From nobody Sat Oct 4 14:13:13 2025 Received: from vs81.iboxed.net (vs10.datenmanufaktur-hosting.net [213.160.73.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0E4B23D298; Sun, 17 Aug 2025 10:23:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.160.73.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755426183; cv=none; b=jY+9okbXVlWfZEb5ciPNjZfTHgDCfz/7a88ghLp9okjEqmIEP1es7CcQ0qvKcm/Asr3Y1v+e3JH8v4Z7ira6/AymsFZNuK/3vm3smScV6t8/Jzzc6pN6Rmowx5Uf/H3Owz6VJPywx71qo/FnSCGK3fUA+MqKtSsnne001DyZhvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755426183; c=relaxed/simple; bh=q8/DbBKbrBgEINTYssy1UUKBdYsb7f2nRa/oHEffnS8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cP5X9ye7PuDTRKv57Ma0Ru89jFiHxnIssZbgbU1ETEADi3rY0MKqpJvf0vXS1mocI16ygQK6vcip/9FY0vFrcuKkNsrRs6mcquciFAkXEP+BZvm1WGoDwzCyYWzGBPq5Zhl/7fXgpBh1DF0V44CEZSfXlOY2621X3U+zkHaMT6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blala.de; spf=pass smtp.mailfrom=blala.de; arc=none smtp.client-ip=213.160.73.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blala.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=blala.de Received: from blala.de (localhost [127.0.0.1]) by vs81.iboxed.net (8.15.2/8.15.2/Debian-14~deb10u1) with ESMTP id 57HARr82029784; Sun, 17 Aug 2025 10:27:53 GMT Received: (from akurz@localhost) by blala.de (8.15.2/8.15.2/Submit) id 57HARrHB029779; Sun, 17 Aug 2025 10:27:53 GMT From: Alexander Kurz To: Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Dmitry Torokhov , Dzmitry Sankouski , "Dr. David Alan Gilbert" , Heiko Stuebner , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , devicetree@vger.kernel.org, linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Alexander Kurz Subject: [PATCH 4/6] Input: mc13783-pwrbutton: convert members to array Date: Sun, 17 Aug 2025 10:27:48 +0000 Message-Id: <20250817102751.29709-5-akurz@blala.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20250817102751.29709-1-akurz@blala.de> References: <20250817102751.29709-1-akurz@blala.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/input/misc/mc13783-pwrbutton.c | 56 +++++++++++++------------- include/linux/mfd/mc13xxx.h | 8 +--- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc= 13783-pwrbutton.c index cb2f25a1a757..49bc5d25f098 100644 --- a/drivers/input/misc/mc13783-pwrbutton.c +++ b/drivers/input/misc/mc13783-pwrbutton.c @@ -130,28 +130,28 @@ static int mc13783_pwrbutton_probe(struct platform_de= vice *pdev) return -ENOMEM; =20 /* ONOFD3 is only supported for MC13783. */ - if (pdata->b3on_flags & MC13783_BUTTON_ENABLE && + if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE && chip !=3D MC13XXX_CHIP_TYPE_MC13783) return -ENODEV; =20 - reg |=3D (pdata->b1on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC; - reg |=3D (pdata->b2on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC; - reg |=3D (pdata->b3on_flags & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC; + reg |=3D (pdata->b_on_flags[0] & 0x3) << MC13783_POWER_CONTROL_2_ON1BDBNC; + reg |=3D (pdata->b_on_flags[1] & 0x3) << MC13783_POWER_CONTROL_2_ON2BDBNC; + reg |=3D (pdata->b_on_flags[2] & 0x3) << MC13783_POWER_CONTROL_2_ON3BDBNC; =20 priv->pwr =3D pwr; priv->mc13783 =3D mc13783; =20 mc13xxx_lock(mc13783); =20 - if (pdata->b1on_flags & MC13783_BUTTON_ENABLE) { - priv->keymap[0] =3D pdata->b1on_key; - if (pdata->b1on_key !=3D KEY_RESERVED) - __set_bit(pdata->b1on_key, pwr->keybit); + if (pdata->b_on_flags[0] & MC13783_BUTTON_ENABLE) { + priv->keymap[0] =3D pdata->b_on_key[0]; + if (pdata->b_on_key[0] !=3D KEY_RESERVED) + __set_bit(pdata->b_on_key[0], pwr->keybit); =20 - if (pdata->b1on_flags & MC13783_BUTTON_POL_INVERT) + if (pdata->b_on_flags[0] & MC13783_BUTTON_POL_INVERT) priv->flags |=3D MC13783_PWRB_B1_POL_INVERT; =20 - if (pdata->b1on_flags & MC13783_BUTTON_RESET_EN) + if (pdata->b_on_flags[0] & MC13783_BUTTON_RESET_EN) reg |=3D MC13783_POWER_CONTROL_2_ON1BRSTEN; =20 err =3D mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD1, @@ -162,15 +162,15 @@ static int mc13783_pwrbutton_probe(struct platform_de= vice *pdev) } } =20 - if (pdata->b2on_flags & MC13783_BUTTON_ENABLE) { - priv->keymap[1] =3D pdata->b2on_key; - if (pdata->b2on_key !=3D KEY_RESERVED) - __set_bit(pdata->b2on_key, pwr->keybit); + if (pdata->b_on_flags[1] & MC13783_BUTTON_ENABLE) { + priv->keymap[1] =3D pdata->b_on_key[1]; + if (pdata->b_on_key[1] !=3D KEY_RESERVED) + __set_bit(pdata->b_on_key[1], pwr->keybit); =20 - if (pdata->b2on_flags & MC13783_BUTTON_POL_INVERT) + if (pdata->b_on_flags[1] & MC13783_BUTTON_POL_INVERT) priv->flags |=3D MC13783_PWRB_B2_POL_INVERT; =20 - if (pdata->b2on_flags & MC13783_BUTTON_RESET_EN) + if (pdata->b_on_flags[1] & MC13783_BUTTON_RESET_EN) reg |=3D MC13783_POWER_CONTROL_2_ON2BRSTEN; =20 err =3D mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD2, @@ -181,15 +181,15 @@ static int mc13783_pwrbutton_probe(struct platform_de= vice *pdev) } } =20 - if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) { - priv->keymap[2] =3D pdata->b3on_key; - if (pdata->b3on_key !=3D KEY_RESERVED) - __set_bit(pdata->b3on_key, pwr->keybit); + if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE) { + priv->keymap[2] =3D pdata->b_on_key[3]; + if (pdata->b_on_key[3] !=3D KEY_RESERVED) + __set_bit(pdata->b_on_key[3], pwr->keybit); =20 - if (pdata->b3on_flags & MC13783_BUTTON_POL_INVERT) + if (pdata->b_on_flags[2] & MC13783_BUTTON_POL_INVERT) priv->flags |=3D MC13783_PWRB_B3_POL_INVERT; =20 - if (pdata->b3on_flags & MC13783_BUTTON_RESET_EN) + if (pdata->b_on_flags[2] & MC13783_BUTTON_RESET_EN) reg |=3D MC13783_POWER_CONTROL_2_ON3BRSTEN; =20 err =3D mc13xxx_irq_request(mc13783, MC13783_IRQ_ONOFD3, @@ -225,15 +225,15 @@ static int mc13783_pwrbutton_probe(struct platform_de= vice *pdev) free_irq: mc13xxx_lock(mc13783); =20 - if (pdata->b3on_flags & MC13783_BUTTON_ENABLE) + if (pdata->b_on_flags[2] & MC13783_BUTTON_ENABLE) mc13xxx_irq_free(mc13783, MC13783_IRQ_ONOFD3, priv); =20 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); =20 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); =20 free_mc13xxx_lock: @@ -251,11 +251,11 @@ static void mc13783_pwrbutton_remove(struct platform_= device *pdev) =20 mc13xxx_lock(priv->mc13783); =20 - 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); =20 mc13xxx_unlock(priv->mc13783); diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index 6984ea69db3e..8bd25b0532ba 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h @@ -196,12 +196,8 @@ struct mc13xxx_leds_platform_data { #define MC13783_BUTTON_RESET_EN (1 << 4) =20 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]; }; =20 #define MC13783_TS_ATO_FIRST false --=20 2.39.5