From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: Michael Hennerich <michael.hennerich@analog.com>,
Ville Syrjala <syrjala@sci.fi>,
Support Opensource <support.opensource@diasemi.com>,
Eddie James <eajames@linux.ibm.com>,
Andrey Moiseev <o2g.org.ru@gmail.com>,
Hans de Goede <hdegoede@redhat.com>,
Jeff LaBundy <jeff@labundy.com>,
linux-kernel@vger.kernel.org,
Javier Carrasco Cruz <javier.carrasco.cruz@gmail.com>
Subject: Re: [PATCH 14/22] Input: iqs626a - use cleanup facility for fwnodes
Date: Wed, 4 Sep 2024 13:10:58 +0200 [thread overview]
Message-ID: <e491af84-db7c-4a32-87f9-c89fc7e2c576@gmail.com> (raw)
In-Reply-To: <20240904044814.1048062-1-dmitry.torokhov@gmail.com>
On 04/09/2024 06:48, Dmitry Torokhov wrote:
> Use __free(fwnode_handle) cleanup facility to ensure that references to
> acquired fwnodes are dropped at appropriate times automatically.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/input/misc/iqs626a.c | 22 ++++++----------------
> 1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/input/misc/iqs626a.c b/drivers/input/misc/iqs626a.c
> index 0dab54d3a060..7a6e6927f331 100644
> --- a/drivers/input/misc/iqs626a.c
> +++ b/drivers/input/misc/iqs626a.c
> @@ -462,7 +462,6 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> {
> struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg;
> struct i2c_client *client = iqs626->client;
> - struct fwnode_handle *ev_node;
> const char *ev_name;
> u8 *thresh, *hyst;
> unsigned int val;
> @@ -501,6 +500,7 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> if (!iqs626_channels[ch_id].events[i])
> continue;
>
> + struct fwnode_handle *ev_node __free(fwnode_handle) = NULL;
> if (ch_id == IQS626_CH_TP_2 || ch_id == IQS626_CH_TP_3) {
> /*
> * Trackpad touch events are simply described under the
> @@ -530,7 +530,6 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> dev_err(&client->dev,
> "Invalid input type: %u\n",
> val);
> - fwnode_handle_put(ev_node);
> return -EINVAL;
> }
>
> @@ -545,7 +544,6 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> dev_err(&client->dev,
> "Invalid %s channel hysteresis: %u\n",
> fwnode_get_name(ch_node), val);
> - fwnode_handle_put(ev_node);
> return -EINVAL;
> }
>
> @@ -566,7 +564,6 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> dev_err(&client->dev,
> "Invalid %s channel threshold: %u\n",
> fwnode_get_name(ch_node), val);
> - fwnode_handle_put(ev_node);
> return -EINVAL;
> }
>
> @@ -575,8 +572,6 @@ iqs626_parse_events(struct iqs626_private *iqs626,
> else
> *(thresh + iqs626_events[i].th_offs) = val;
> }
> -
> - fwnode_handle_put(ev_node);
> }
>
> return 0;
> @@ -774,12 +769,12 @@ static int iqs626_parse_trackpad(struct iqs626_private *iqs626,
> for (i = 0; i < iqs626_channels[ch_id].num_ch; i++) {
> u8 *ati_base = &sys_reg->tp_grp_reg.ch_reg_tp[i].ati_base;
> u8 *thresh = &sys_reg->tp_grp_reg.ch_reg_tp[i].thresh;
> - struct fwnode_handle *tc_node;
> char tc_name[10];
>
> snprintf(tc_name, sizeof(tc_name), "channel-%d", i);
>
> - tc_node = fwnode_get_named_child_node(ch_node, tc_name);
> + struct fwnode_handle *tc_node __free(fwnode_handle) =
> + fwnode_get_named_child_node(ch_node, tc_name);
> if (!tc_node)
> continue;
>
> @@ -790,7 +785,6 @@ static int iqs626_parse_trackpad(struct iqs626_private *iqs626,
> dev_err(&client->dev,
> "Invalid %s %s ATI base: %u\n",
> fwnode_get_name(ch_node), tc_name, val);
> - fwnode_handle_put(tc_node);
> return -EINVAL;
> }
>
> @@ -803,14 +797,11 @@ static int iqs626_parse_trackpad(struct iqs626_private *iqs626,
> dev_err(&client->dev,
> "Invalid %s %s threshold: %u\n",
> fwnode_get_name(ch_node), tc_name, val);
> - fwnode_handle_put(tc_node);
> return -EINVAL;
> }
>
> *thresh = val;
> }
> -
> - fwnode_handle_put(tc_node);
> }
>
> if (!fwnode_property_present(ch_node, "linux,keycodes"))
> @@ -1233,7 +1224,6 @@ static int iqs626_parse_prop(struct iqs626_private *iqs626)
> {
> struct iqs626_sys_reg *sys_reg = &iqs626->sys_reg;
> struct i2c_client *client = iqs626->client;
> - struct fwnode_handle *ch_node;
> unsigned int val;
> int error, i;
> u16 general;
> @@ -1375,13 +1365,13 @@ static int iqs626_parse_prop(struct iqs626_private *iqs626)
> sys_reg->active = 0;
>
> for (i = 0; i < ARRAY_SIZE(iqs626_channels); i++) {
> - ch_node = device_get_named_child_node(&client->dev,
> - iqs626_channels[i].name);
> + struct fwnode_handle *ch_node __free(fwnode_handle) =
> + device_get_named_child_node(&client->dev,
> + iqs626_channels[i].name);
> if (!ch_node)
> continue;
>
> error = iqs626_parse_channel(iqs626, ch_node, i);
> - fwnode_handle_put(ch_node);
> if (error)
> return error;
>
Reviewed-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
next prev parent reply other threads:[~2024-09-04 11:11 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 4:42 [PATCH 00/22] Convert misc input drivers to use new cleanup facilities Dmitry Torokhov
2024-09-04 4:42 ` [PATCH 01/22] Input: ad714x - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 18:47 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 02/22] Input: ati_remote2 " Dmitry Torokhov
2024-09-04 18:49 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 03/22] Input: cm109 - use guard notation when acquiring mutex and spinlock Dmitry Torokhov
2024-09-04 19:44 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 04/22] Input: cma3000_d0x - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 18:51 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 05/22] Input: da7280 - use guard notation when acquiring mutex and spinlock Dmitry Torokhov
2024-09-04 19:02 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 06/22] Input: kxtj9 - use guard notation when acquiring mutex/disabling irq Dmitry Torokhov
2024-09-04 19:03 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 07/22] Input: drv260x - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 19:05 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 08/22] Input: drv2665 " Dmitry Torokhov
2024-09-04 19:07 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 09/22] Input: drv2667 " Dmitry Torokhov
2024-09-04 19:08 ` Javier Carrasco
2024-09-04 4:42 ` [PATCH 10/22] Input: ideapad_slidebar - use guard notation when acquiring spinlock Dmitry Torokhov
2024-09-04 19:09 ` Javier Carrasco
2024-09-04 4:47 ` [PATCH 11/22] Input: ibm-panel " Dmitry Torokhov
2024-09-04 19:11 ` Javier Carrasco
2024-09-04 21:56 ` Eddie James
2024-09-04 4:47 ` [PATCH 12/22] Input: iqs269a - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 13:53 ` Javier Carrasco
2024-09-04 18:21 ` Dmitry Torokhov
2024-09-04 18:41 ` Javier Carrasco
2024-09-04 18:53 ` Dmitry Torokhov
2024-09-08 22:05 ` Jeff LaBundy
2024-09-04 4:48 ` [PATCH 13/22] Input: iqs269a - use cleanup facility for fwnodes Dmitry Torokhov
2024-09-04 11:13 ` Javier Carrasco
2024-09-08 22:08 ` Jeff LaBundy
2024-09-04 4:48 ` [PATCH 14/22] Input: iqs626a " Dmitry Torokhov
2024-09-04 11:10 ` Javier Carrasco [this message]
2024-09-09 0:02 ` Jeff LaBundy
2024-09-09 1:31 ` Dmitry Torokhov
2024-09-10 15:12 ` Jeff LaBundy
2024-09-04 4:48 ` [PATCH 15/22] Input: iqs7222 " Dmitry Torokhov
2024-09-04 10:50 ` Javier Carrasco
2024-09-04 18:26 ` Dmitry Torokhov
2024-09-04 18:46 ` Javier Carrasco
2024-09-09 0:12 ` Jeff LaBundy
2024-09-09 1:34 ` Dmitry Torokhov
2024-09-10 15:14 ` Jeff LaBundy
2024-09-04 4:48 ` [PATCH 16/22] Input: max8997_haptic - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 19:12 ` Javier Carrasco
2024-09-04 4:48 ` [PATCH 17/22] Input: pegasus_notetaker " Dmitry Torokhov
2024-09-04 19:52 ` Javier Carrasco
2024-09-04 20:59 ` [PATCH v2 " Dmitry Torokhov
2024-09-04 4:49 ` [PATCH 18/22] Input: powermate - use guard notation when acquiring spinlock Dmitry Torokhov
2024-09-04 19:16 ` Javier Carrasco
2024-09-04 4:49 ` [PATCH 19/22] Input: pwm-beeper " Dmitry Torokhov
2024-09-04 19:22 ` Javier Carrasco
2024-09-04 4:49 ` [PATCH 20/22] Input: regulator-haptic - use guard notation when acquiring mutex Dmitry Torokhov
2024-09-04 19:27 ` Javier Carrasco
2024-09-04 20:55 ` [PATCH v2 " Dmitry Torokhov
2024-09-04 21:41 ` Javier Carrasco
2024-09-07 3:40 ` [PATCH " kernel test robot
2024-09-04 4:49 ` [PATCH 21/22] Input: rotary_encoder " Dmitry Torokhov
2024-09-04 19:32 ` Javier Carrasco
2024-09-04 4:49 ` [PATCH 22/22] Input: sparcspkr - use guard notation when acquiring spinlock Dmitry Torokhov
2024-09-04 19:33 ` Javier Carrasco
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=e491af84-db7c-4a32-87f9-c89fc7e2c576@gmail.com \
--to=javier.carrasco.cruz@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=eajames@linux.ibm.com \
--cc=hdegoede@redhat.com \
--cc=jeff@labundy.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=o2g.org.ru@gmail.com \
--cc=support.opensource@diasemi.com \
--cc=syrjala@sci.fi \
/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).