Linux Input/HID development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Alexander Kurz <akurz@blala.de>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Dzmitry Sankouski" <dsankouski@gmail.com>,
	"Dr. David Alan Gilbert" <linux@treblig.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	devicetree@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/7] Input: mc13783-pwrbutton: convert pdata members to array
Date: Wed, 3 Sep 2025 14:35:18 +0100	[thread overview]
Message-ID: <20250903133518.GA2764654@google.com> (raw)
In-Reply-To: <20250829201517.15374-4-akurz@blala.de>

On Fri, 29 Aug 2025, Alexander Kurz wrote:

> As preparation for mc13783-pwrbutton OF support, convert the members of
> mc13xxx_buttons_platform_data to arrays to allow index access within
> the next commit.
> 
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
>  drivers/input/misc/mc13783-pwrbutton.c | 54 +++++++++++++-------------

>  include/linux/mfd/mc13xxx.h            |  8 +---

Acked-by: Lee Jones <lee@kernel.org>

>  2 files changed, 29 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
> index 9fd84b8d163d..ace9f286fd24 100644
> --- a/drivers/input/misc/mc13783-pwrbutton.c
> +++ b/drivers/input/misc/mc13783-pwrbutton.c
> @@ -127,24 +127,24 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	reg |= (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
> -	reg |= (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
> -	reg |= (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
> +	reg |= (pdata->b_on_flags[0] & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC;
> +	reg |= (pdata->b_on_flags[1] & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC;
> +	reg |= (pdata->b_on_flags[2] & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC;
>  
>  	priv->pwr = pwr;
>  	priv->mc13783 = mc13783;
>  
>  	mc13xxx_lock(mc13783);
>  
> -	if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) {
> -		priv->keymap[0] = pdata->b1on_key;
> -		if (pdata->b1on_key != KEY_RESERVED)
> -			__set_bit(pdata->b1on_key, pwr->keybit);
> +	if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE) {
> +		priv->keymap[0] = pdata->b_on_key[0];
> +		if (pdata->b_on_key[0] != KEY_RESERVED)
> +			__set_bit(pdata->b_on_key[0], pwr->keybit);
>  
> -		if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT)
> +		if (pdata->b_on_flags[0] & MC13783_BUTTON_POL_INVERT)
>  			priv->flags |= MC13783_PWRB_B1_POL_INVERT;
>  
> -		if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN)
> +		if (pdata->b_on_flags[0] & MC13783_BUTTON_RESET_EN)
>  			reg |= MC13783_POWER_CONTROL_2_ON1BRSTEN;
>  
>  		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1,
> @@ -155,15 +155,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) {
> -		priv->keymap[1] = pdata->b2on_key;
> -		if (pdata->b2on_key != KEY_RESERVED)
> -			__set_bit(pdata->b2on_key, pwr->keybit);
> +	if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE) {
> +		priv->keymap[1] = pdata->b_on_key[1];
> +		if (pdata->b_on_key[1] != KEY_RESERVED)
> +			__set_bit(pdata->b_on_key[1], pwr->keybit);
>  
> -		if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT)
> +		if (pdata->b_on_flags[1] & MC13783_BUTTON_POL_INVERT)
>  			priv->flags |= MC13783_PWRB_B2_POL_INVERT;
>  
> -		if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN)
> +		if (pdata->b_on_flags[1] & MC13783_BUTTON_RESET_EN)
>  			reg |= MC13783_POWER_CONTROL_2_ON2BRSTEN;
>  
>  		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2,
> @@ -174,15 +174,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) {
> -		priv->keymap[2] = pdata->b3on_key;
> -		if (pdata->b3on_key != KEY_RESERVED)
> -			__set_bit(pdata->b3on_key, pwr->keybit);
> +	if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE) {
> +		priv->keymap[2] = pdata->b_on_key[2];
> +		if (pdata->b_on_key[2] != KEY_RESERVED)
> +			__set_bit(pdata->b_on_key[2], pwr->keybit);
>  
> -		if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT)
> +		if (pdata->b_on_flags[2] & MC13783_BUTTON_POL_INVERT)
>  			priv->flags |= MC13783_PWRB_B3_POL_INVERT;
>  
> -		if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN)
> +		if (pdata->b_on_flags[2] & MC13783_BUTTON_RESET_EN)
>  			reg |= MC13783_POWER_CONTROL_2_ON3BRSTEN;
>  
>  		err = mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3,
> @@ -218,15 +218,15 @@ static int mc13783_pwrbutton_probe(struct platform_device *pdev)
>  free_irq:
>  	mc13xxx_lock(mc13783);
>  
> -	if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv);
>  
>  free_irq_b2:
> -	if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD2, priv);
>  
>  free_irq_b1:
> -	if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD1, priv);
>  
>  free_mc13xxx_lock:
> @@ -244,11 +244,11 @@ static void mc13783_pwrbutton_remove(struct platform_device *pdev)
>  
>  	mc13xxx_lock(priv->mc13783);
>  
> -	if (pdata->b3on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD3, priv);
> -	if (pdata->b2on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD2, priv);
> -	if (pdata->b1on_flags & MC13783_BUTTON_ENABLE)
> +	if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE)
>  		mc13xxx_irq_free(priv->mc13783, MC13783_IRQ_ONOFD1, priv);
>  
>  	mc13xxx_unlock(priv->mc13783);
> diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
> index f372926d5894..0393083af28a 100644
> --- a/include/linux/mfd/mc13xxx.h
> +++ b/include/linux/mfd/mc13xxx.h
> @@ -187,12 +187,8 @@ struct mc13xxx_leds_platform_data {
>  #define MC13783_BUTTON_RESET_EN		(1 << 4)
>  
>  struct mc13xxx_buttons_platform_data {
> -	int b1on_flags;
> -	unsigned short b1on_key;
> -	int b2on_flags;
> -	unsigned short b2on_key;
> -	int b3on_flags;
> -	unsigned short b3on_key;
> +	int b_on_flags[3];
> +	unsigned int b_on_key[3];
>  };
>  
>  #define MC13783_TS_ATO_FIRST	false
> -- 
> 2.39.5
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2025-09-03 13:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29 20:15 [PATCH v3 0/7] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
2025-08-29 20:15 ` [PATCH v3 1/7] Input: mc13783-pwrbutton: fix irq mixup Alexander Kurz
2025-09-04 14:10   ` Dmitry Torokhov
2025-08-29 20:15 ` [PATCH v3 2/7] Input: mc13783-pwrbutton: use managed resources Alexander Kurz
2025-09-04 14:12   ` Dmitry Torokhov
2025-08-29 20:15 ` [PATCH v3 3/7] Input: mc13783-pwrbutton: convert pdata members to array Alexander Kurz
2025-09-03 13:35   ` Lee Jones [this message]
2025-08-29 20:15 ` [PATCH v3 4/7] Input: mc13783-pwrbutton: enable other mc13xxx PMIC Alexander Kurz
2025-09-03 13:35   ` Lee Jones
2025-08-29 20:15 ` [PATCH v3 5/7] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
2025-09-02 20:48   ` Rob Herring (Arm)
2025-08-29 20:15 ` [PATCH v3 6/7] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
2025-09-02 20:49   ` Rob Herring (Arm)
2025-08-29 20:15 ` [PATCH v3 7/7] Input: mc13783-pwrbutton: add OF support Alexander Kurz
2025-09-04 14:16   ` Dmitry Torokhov
2025-09-03 13:37 ` (subset) [PATCH v3 0/7] Fix, extend and support OF to mc13xxx pwrbutton Lee Jones

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=20250903133518.GA2764654@google.com \
    --to=lee@kernel.org \
    --cc=akurz@blala.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dsankouski@gmail.com \
    --cc=heiko@sntech.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /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