From: Zqiang <qiang.zhang@linux.dev>
To: linusw@kernel.org, brgl@kernel.org, paulmck@kernel.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
qiang.zhang@linux.dev
Subject: [PATCH] gpiolib: Use srcu_dereference() in gpiod_get_label()
Date: Thu, 26 Nov 2026 16:42:33 +0800 [thread overview]
Message-ID: <20261126084233.17381-2-qiang.zhang@linux.dev> (raw)
In-Reply-To: <20261126084233.17381-1-qiang.zhang@linux.dev>
The srcu_dereference_check() already evaluates 'srcu_read_lock_held(ssp)'
internally, so passing srcu_read_lock_held() as the extra condition is
redundant. all callers of gpiod_get_label() hold the desc_srcu read lock,
so replace it with srcu_dereference(), which provides identical lockdep
coverage.
No functional changes.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
drivers/gpio/gpiolib.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 5dd4d142cf52..47ce89bfb578 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -124,8 +124,7 @@ const char *gpiod_get_label(struct gpio_desc *desc)
flags = READ_ONCE(desc->flags);
- label = srcu_dereference_check(desc->label, &desc->gdev->desc_srcu,
- srcu_read_lock_held(&desc->gdev->desc_srcu));
+ label = srcu_dereference(desc->label, &desc->gdev->desc_srcu);
if (test_bit(GPIOD_FLAG_USED_AS_IRQ, &flags))
return label ? label->str : "interrupt";
--
2.17.1
prev parent reply other threads:[~2026-11-26 8:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 8:42 [PATCH] gpiolib: Use srcu_barrier() instead of synchronize_srcu() in gpiodev_release() Zqiang
2026-11-26 8:42 ` Zqiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126084233.17381-2-qiang.zhang@linux.dev \
--to=qiang.zhang@linux.dev \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®