From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: [PATCH 4/6] input: gpio_keys_polled: use device_for_each_child_node_scoped()
Date: Fri, 12 Apr 2024 22:57:33 +0200 [thread overview]
Message-ID: <20240412-input_device_for_each_child_node_scoped-v1-4-dbad1bc7ea84@gmail.com> (raw)
In-Reply-To: <20240412-input_device_for_each_child_node_scoped-v1-0-dbad1bc7ea84@gmail.com>
Switch to the _scoped() version introduced in commit 365130fd47af
("device property: Introduce device_for_each_child_node_scoped()")
to remove the need for manual calling of fwnode_handle_put() in the
paths where the code exits the loop early.
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/input/keyboard/gpio_keys_polled.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index b41fd1240f43..41ca0d3c9098 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -144,7 +144,6 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
{
struct gpio_keys_platform_data *pdata;
struct gpio_keys_button *button;
- struct fwnode_handle *child;
int nbuttons;
nbuttons = device_get_child_node_count(dev);
@@ -166,11 +165,10 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev)
device_property_read_string(dev, "label", &pdata->name);
- device_for_each_child_node(dev, child) {
+ device_for_each_child_node_scoped(dev, child) {
if (fwnode_property_read_u32(child, "linux,code",
&button->code)) {
dev_err(dev, "button without keycode\n");
- fwnode_handle_put(child);
return ERR_PTR(-EINVAL);
}
--
2.40.1
next prev parent reply other threads:[~2024-04-12 20:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 20:57 [PATCH 0/6] input: use device_for_each_child_node_scoped() Javier Carrasco
2024-04-12 20:57 ` [PATCH 1/6] input: iqs269a: " Javier Carrasco
2024-04-12 20:57 ` [PATCH 2/6] input: qt1050: " Javier Carrasco
2024-07-16 1:03 ` Dmitry Torokhov
2024-07-16 4:17 ` Javier Carrasco
2024-07-16 4:23 ` Dmitry Torokhov
2024-04-12 20:57 ` [PATCH 3/6] input: gpio_keys: " Javier Carrasco
2024-04-12 20:57 ` Javier Carrasco [this message]
2024-04-12 20:57 ` [PATCH 5/6] input: adc-keys: " Javier Carrasco
2024-04-12 20:57 ` [PATCH 6/6] input: adc-joystick: " Javier Carrasco
2024-07-16 1:05 ` [PATCH 0/6] input: " Dmitry Torokhov
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=20240412-input_device_for_each_child_node_scoped-v1-4-dbad1bc7ea84@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).