From nobody Thu May 16 07:41:25 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vg28k0lr6z5KmwC; Thu, 16 May 2024 07:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vg28j6JH2z4LwG; Thu, 16 May 2024 07:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715845285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=71fDqDx/InEZ/FcI3+7baLb0rBXHFHQaYi1lCYQoMlo=; b=WqHkLF3+doGLwGEDPVHcCsGD98wnKMPwTVy/G2A3Kn1VOm5FeJfR5hKl3JyQEQDtNuMnYH AsOVeFXOyub/Tbk50HiQ+SBcAOIXkJ6RvkckYfNsO3atyF5niig04NbXqpjK9ITg7wjSLc 1PhPwoCKZ/O2c8W7Lx6XU2YlrzcMAzak8fNREH8JwQEd+NFXQsq2xdvF9Xo9fiNuH9ouf5 rWaXerpPBn2qLPo5JAhEhYwJiTlOoAMuPwXU6LePHW/z4O6BqihxwJ8p9VHF42/Z65U9nR MooxW+TEoUSiL5rU2zCskpdg8LayPgIdj8gEEo8vcfJxDl13jI9vxRtFR5Trpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715845285; a=rsa-sha256; cv=none; b=B2tDYiTP1pq/za2rFMfb6Szd7deHfMqU3jcJZmkEKVqFeGNjw0oXKSPxIUzhqN6+EYlERk dBHF9aisJT3gMOXI+wV4kNm4VTGr2sOQsBnkK3Jmvl77YOU/TBhFEodBya2xeNY5BMynjg aEivZqEepRPWegIKXM6a1Q3YfjXxFTyH+qOMPHgMo713p9NtVqARlEHXClPMT32qaoWNC5 XvD5z00ypeDPUz2fcxNQ2P+fyvLT7lQ8hqTCHRNF+5GZNwFG0ZidRgQTEJiqxj51L3duu0 87q44jOcO3VteBDMcHWvAmsXlpQ8aGtlYIX+F8Fn2IzBInpN7o3/fLPC2CrZPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715845285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=71fDqDx/InEZ/FcI3+7baLb0rBXHFHQaYi1lCYQoMlo=; b=S/H7u2WSc+IlHSWI1mryjguLk+WwgdU7ojKALUDhpnyygV8crRyO2YEmYgo5eYcNWCN9T0 RDElQOlvQRMK7lBIfn9iVL5C3Lc67F+VkOAB+CtVIsQuJH2F3wQvo8ZkKNHSw/1daF4yY8 WipyEkZOqsOU7xHEO+YdtPS88ZlTrBS1AilSEsfMiREvlAQ/6jF1i1xs0x/ExfRBUeRycd 9mYfDYvCl3RvqF3J5OsVHR8oLaxEn4hpNyBQ8heYwAu8L3HU5P4O7erw3tUAwZMAvNcnp3 lfTyE7IcSMiuRQxl2mzJU8lU6CoO8vBXIJOya8JdZqapswpQaZ7azr7zU2DViQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vg28j5vfGzqY0; Thu, 16 May 2024 07:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44G7fPx9068071; Thu, 16 May 2024 07:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44G7fPF0068067; Thu, 16 May 2024 07:41:25 GMT (envelope-from git) Date: Thu, 16 May 2024 07:41:25 GMT Message-Id: <202405160741.44G7fPF0068067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5c0a1923486e - main - linuxkpi: rwlock: Simplify code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c0a1923486e65cd47398e52c03cb289d6120a78 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5c0a1923486e65cd47398e52c03cb289d6120a78 commit 5c0a1923486e65cd47398e52c03cb289d6120a78 Author: Emmanuel Vadot AuthorDate: 2024-05-15 09:05:29 +0000 Commit: Emmanuel Vadot CommitDate: 2024-05-16 07:40:03 +0000 linuxkpi: rwlock: Simplify code Just use a typedef for rwlock_t, no need to create a useless structure. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45206 --- sys/compat/linuxkpi/common/include/linux/rwlock.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/rwlock.h b/sys/compat/linuxkpi/common/include/linux/rwlock.h index 8c1ee36ac4de..126b70c875c0 100644 --- a/sys/compat/linuxkpi/common/include/linux/rwlock.h +++ b/sys/compat/linuxkpi/common/include/linux/rwlock.h @@ -34,14 +34,12 @@ #include #include -typedef struct { - struct rwlock rw; -} rwlock_t; +typedef struct rwlock rwlock_t; -#define read_lock(_l) rw_rlock(&(_l)->rw) -#define write_lock(_l) rw_wlock(&(_l)->rw) -#define read_unlock(_l) rw_runlock(&(_l)->rw) -#define write_unlock(_l) rw_wunlock(&(_l)->rw) +#define read_lock(_l) rw_rlock(_l) +#define write_lock(_l) rw_wlock(_l) +#define read_unlock(_l) rw_runlock(_l) +#define write_unlock(_l) rw_wunlock(_l) #define read_lock_irq(lock) read_lock((lock)) #define read_unlock_irq(lock) read_unlock((lock)) #define write_lock_irq(lock) write_lock((lock)) @@ -54,13 +52,6 @@ typedef struct { do { read_unlock(lock); } while (0) #define write_unlock_irqrestore(lock, flags) \ do { write_unlock(lock); } while (0) - -static inline void -rwlock_init(rwlock_t *lock) -{ - - memset(&lock->rw, 0, sizeof(lock->rw)); - rw_init_flags(&lock->rw, "lnxrw", RW_NOWITNESS); -} +#define rwlock_init(_l) rw_init_flags(_l, "lnxrw", RW_NOWITNESS) #endif /* _LINUXKPI_LINUX_RWLOCK_H_ */