From nobody Thu Dec 18 16:54:56 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04192C83F12 for ; Mon, 28 Aug 2023 15:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230478AbjH1PcL (ORCPT ); Mon, 28 Aug 2023 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230047AbjH1Pby (ORCPT ); Mon, 28 Aug 2023 11:31:54 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8826E125; Mon, 28 Aug 2023 08:31:51 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,207,1688396400"; d="scan'208";a="174228506" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 29 Aug 2023 00:31:51 +0900 Received: from localhost.localdomain (unknown [10.226.92.234]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 4435C40065DD; Tue, 29 Aug 2023 00:31:49 +0900 (JST) From: Biju Das To: Tony Lindgren , Lee Jones Cc: Biju Das , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Date: Mon, 28 Aug 2023 16:31:43 +0100 Message-Id: <20230828153144.75479-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> References: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Constify .data in OF table and {palmas,tps65917}_irq_chip and replace the variable *features->features in struct palmas_driver_data and drop the {palmas,tps659038}_features variables and use their values directly in the named initialization. While at it, drop the inner leading commas for OF match table. Signed-off-by: Biju Das --- v1->v2: * Moved the OF table just above its user. * Removed trailing comma from the terminator entry for the OF table. --- drivers/mfd/palmas.c | 52 ++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 6e562bab62e4..3ac9dec2b117 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -296,7 +296,7 @@ static const struct regmap_irq palmas_irqs[] =3D { }, }; =20 -static struct regmap_irq_chip palmas_irq_chip =3D { +static const struct regmap_irq_chip palmas_irq_chip =3D { .name =3D "palmas", .irqs =3D palmas_irqs, .num_irqs =3D ARRAY_SIZE(palmas_irqs), @@ -309,7 +309,7 @@ static struct regmap_irq_chip palmas_irq_chip =3D { PALMAS_INT1_MASK), }; =20 -static struct regmap_irq_chip tps65917_irq_chip =3D { +static const struct regmap_irq_chip tps65917_irq_chip =3D { .name =3D "tps65917", .irqs =3D tps65917_irqs, .num_irqs =3D ARRAY_SIZE(tps65917_irqs), @@ -463,51 +463,29 @@ static void palmas_power_off(void) __func__, ret); } =20 -static unsigned int palmas_features =3D PALMAS_PMIC_FEATURE_SMPS10_BOOST; -static unsigned int tps659038_features; - struct palmas_driver_data { - unsigned int *features; - struct regmap_irq_chip *irq_chip; + unsigned int features; + const struct regmap_irq_chip *irq_chip; }; =20 -static struct palmas_driver_data palmas_data =3D { - .features =3D &palmas_features, +static const struct palmas_driver_data palmas_data =3D { + .features =3D PALMAS_PMIC_FEATURE_SMPS10_BOOST, .irq_chip =3D &palmas_irq_chip, }; =20 -static struct palmas_driver_data tps659038_data =3D { - .features =3D &tps659038_features, +static const struct palmas_driver_data tps659038_data =3D { .irq_chip =3D &palmas_irq_chip, }; =20 -static struct palmas_driver_data tps65917_data =3D { - .features =3D &tps659038_features, +static const struct palmas_driver_data tps65917_data =3D { .irq_chip =3D &tps65917_irq_chip, }; =20 -static const struct of_device_id of_palmas_match_tbl[] =3D { - { - .compatible =3D "ti,palmas", - .data =3D &palmas_data, - }, - { - .compatible =3D "ti,tps659038", - .data =3D &tps659038_data, - }, - { - .compatible =3D "ti,tps65917", - .data =3D &tps65917_data, - }, - { }, -}; -MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); - static int palmas_i2c_probe(struct i2c_client *i2c) { struct palmas *palmas; struct palmas_platform_data *pdata; - struct palmas_driver_data *driver_data; + const struct palmas_driver_data *driver_data; struct device_node *node =3D i2c->dev.of_node; int ret =3D 0, i; unsigned int reg, addr; @@ -535,8 +513,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c) palmas->dev =3D &i2c->dev; palmas->irq =3D i2c->irq; =20 - driver_data =3D (struct palmas_driver_data *) device_get_match_data(&i2c-= >dev); - palmas->features =3D *driver_data->features; + driver_data =3D device_get_match_data(&i2c->dev); + palmas->features =3D driver_data->features; =20 for (i =3D 0; i < PALMAS_NUM_CLIENTS; i++) { if (i =3D=3D 0) @@ -712,6 +690,14 @@ static void palmas_i2c_remove(struct i2c_client *i2c) } } =20 +static const struct of_device_id of_palmas_match_tbl[] =3D { + { .compatible =3D "ti,palmas", .data =3D &palmas_data }, + { .compatible =3D "ti,tps659038", .data =3D &tps659038_data }, + { .compatible =3D "ti,tps65917", .data =3D &tps65917_data }, + { } +}; +MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); + static const struct i2c_device_id palmas_i2c_id[] =3D { { "palmas", }, { "twl6035", }, --=20 2.25.1 From nobody Thu Dec 18 16:54:56 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C19AC83F1A for ; Mon, 28 Aug 2023 15:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbjH1PcO (ORCPT ); Mon, 28 Aug 2023 11:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjH1Pb4 (ORCPT ); Mon, 28 Aug 2023 11:31:56 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 38DECA8; Mon, 28 Aug 2023 08:31:54 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,207,1688396400"; d="scan'208";a="174228511" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 29 Aug 2023 00:31:53 +0900 Received: from localhost.localdomain (unknown [10.226.92.234]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id EC83C40065DD; Tue, 29 Aug 2023 00:31:51 +0900 (JST) From: Biju Das To: Tony Lindgren , Lee Jones Cc: Biju Das , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Date: Mon, 28 Aug 2023 16:31:44 +0100 Message-Id: <20230828153144.75479-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> References: <20230828153144.75479-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the driver_data is wrong for ID match. While at it, drop the inner leading commas for ID table. Signed-off-by: Biju Das --- v1->v2: * Removed trailing comma in the terminator entry for ID table --- drivers/mfd/palmas.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 3ac9dec2b117..7fc886f4f80e 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c @@ -513,7 +513,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c) palmas->dev =3D &i2c->dev; palmas->irq =3D i2c->irq; =20 - driver_data =3D device_get_match_data(&i2c->dev); + driver_data =3D i2c_get_match_data(i2c); palmas->features =3D driver_data->features; =20 for (i =3D 0; i < PALMAS_NUM_CLIENTS; i++) { @@ -699,10 +699,10 @@ static const struct of_device_id of_palmas_match_tbl[= ] =3D { MODULE_DEVICE_TABLE(of, of_palmas_match_tbl); =20 static const struct i2c_device_id palmas_i2c_id[] =3D { - { "palmas", }, - { "twl6035", }, - { "twl6037", }, - { "tps65913", }, + { "palmas", (kernel_ulong_t)&palmas_data }, + { "twl6035", (kernel_ulong_t)&palmas_data }, + { "twl6037", (kernel_ulong_t)&palmas_data }, + { "tps65913", (kernel_ulong_t)&palmas_data }, { /* end */ } }; MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); --=20 2.25.1