mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.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 20:13:08 +0300	[thread overview]
Message-ID: <atjypFBUGPzWv083@ashevche-desk.local> (raw)
In-Reply-To: <20261021015004.1537738-3-dmitry.torokhov@gmail.com>

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.

> +	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?

>  	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.

> +
> +		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;

?

> +			fwnode = dev_fwnode(&pd->dev);
> +			platform_device_unregister(pd);
> +			soc_button_remove_swnodes(fwnode);
> +		}
> +	}
>  }

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2026-10-21 17:13 UTC|newest]

Thread overview: 15+ 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 [this message]
2026-10-21 17:23     ` 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=atjypFBUGPzWv083@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=arnd@arndb.de \
    --cc=brgl@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --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

all inboxes | Powered by JetHome®