From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Hans de Goede <hansg@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Andy Shevchenko <andy@kernel.org>,
Linus Walleij <linusw@kernel.org>,
linux-input@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] Input: soc_button_array - convert to software nodes
Date: Wed, 21 Oct 2026 10:23:45 -0700 [thread overview]
Message-ID: <atjzqdtaduFV6B7M@google.com> (raw)
In-Reply-To: <atjypFBUGPzWv083@ashevche-desk.local>
On Wed, Oct 21, 2026 at 08:13:08PM +0300, Andy Shevchenko wrote:
> On Tue, Oct 20, 2026 at 06:50:01PM -0700, Dmitry Torokhov wrote:
> > Convert the driver from using legacy platform data to using software
> > nodes for registering 'gpio-keys' devices. This allows us to
> > transition away from platform data and use generic device properties.
>
> ...
>
> > +static void soc_button_remove_swnodes(struct fwnode_handle *parent)
> > +{
> > + struct fwnode_handle *child;
>
> > + if (IS_ERR_OR_NULL(parent))
> > + return;
>
> Isn't this redundant? Because the following has it inside already.
Maybe but it really is not obvious whether the latest flavor of some API
handles error pointers or NULLs transparently or not and whether it will
continue doing this.
This is not a hot path so I can think we can spare an extra check.
>
> > + fwnode_for_each_child_node(parent, child)
> > + fwnode_remove_software_node(child);
> > +
> > + fwnode_remove_software_node(parent);
> > +}
>
> ...
>
> > const struct soc_button_info *info;
> > struct platform_device *pd;
> > - struct gpio_keys_button *gpio_keys;
> > - struct gpio_keys_platform_data *gpio_keys_pdata;
> > + struct fwnode_handle *parent_node;
>
> Can it be one line down, so we keep reversed xmas tree order?
Sure.
>
> > const struct dmi_system_id *dmi_id;
> > int invalid_acpi_index = -1;
> > - int error, gpio, irq = 0;
> > + int error, irq = 0;
> > int n_buttons = 0;
>
> ...
>
> > + child_props[prop_idx++] = PROPERTY_ENTRY_U32("linux,code", info->event_code);
> > + child_props[prop_idx++] = PROPERTY_ENTRY_STRING("label", info->name);
> > +
> > + if (info->event_type != EV_KEY)
> > + child_props[prop_idx++] =
>
> > + PROPERTY_ENTRY_U32("linux,input-type",
> > + info->event_type);
>
> Make it a single line, you seem use 100 limit anyway.
OK.
>
> > +
> > + if (info->wakeup)
> > + child_props[prop_idx++] = PROPERTY_ENTRY_BOOL("wakeup-source");
> > +
> > + /* These devices often use cheap buttons, use 50 ms debounce */
> > + child_props[prop_idx++] = PROPERTY_ENTRY_U32("debounce-interval", 50);
>
> ...
>
> > static void soc_button_remove(struct platform_device *pdev)
> > {
> > struct soc_button_data *priv = platform_get_drvdata(pdev);
> > -
> > + struct platform_device *pd;
> > + struct fwnode_handle *fwnode;
> > int i;
> >
> > - for (i = 0; i < BUTTON_TYPES; i++)
> > - if (priv->children[i])
> > - platform_device_unregister(priv->children[i]);
> > + for (i = 0; i < BUTTON_TYPES; i++) {
>
> At the same time this can be transformed to
>
> for (int i = 0; i < BUTTON_TYPES; i++) {
>
> > + pd = priv->children[i];
> > + if (pd) {
>
> if (!pd)
> continue;
>
> ?
Sure, why not...
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-10-21 17:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 1:49 [PATCH 1/3] Input: soc_button_array - use resources to set up IRQ info for gpio-keys Dmitry Torokhov
2026-10-21 1:50 ` [PATCH 2/3] Input: soc_button_array - use __free() cleanup facilities to free memory Dmitry Torokhov
2026-10-21 10:06 ` Bartosz Golaszewski
2026-10-21 17:05 ` Andy Shevchenko
2026-10-21 17:15 ` Dmitry Torokhov
2026-10-21 17:43 ` Andy Shevchenko
2026-10-21 17:53 ` Dmitry Torokhov
2026-10-21 18:21 ` Andy Shevchenko
2026-10-21 1:50 ` [PATCH 3/3] Input: soc_button_array - convert to software nodes Dmitry Torokhov
2026-10-21 10:11 ` Bartosz Golaszewski
2026-10-21 16:56 ` Dmitry Torokhov
2026-10-21 17:02 ` Arnd Bergmann
2026-10-21 17:16 ` Dmitry Torokhov
2026-10-21 17:13 ` Andy Shevchenko
2026-10-21 17:23 ` Dmitry Torokhov [this message]
2026-10-21 1:59 ` [PATCH 1/3] Input: soc_button_array - use resources to set up IRQ info for gpio-keys sashiko-bot
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=atjzqdtaduFV6B7M@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=arnd@arndb.de \
--cc=brgl@kernel.org \
--cc=hansg@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--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