From nobody Sun Feb 8 22:31:50 2026 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 B7780C83F2C for ; Sun, 3 Sep 2023 16:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343695AbjICQsv (ORCPT ); Sun, 3 Sep 2023 12:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343527AbjICQsu (ORCPT ); Sun, 3 Sep 2023 12:48:50 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C4F210D for ; Sun, 3 Sep 2023 09:48:46 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,224,1688396400"; d="scan'208";a="174853015" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 04 Sep 2023 01:48:40 +0900 Received: from localhost.localdomain (unknown [10.226.92.30]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 08C714023AAB; Mon, 4 Sep 2023 01:48:37 +0900 (JST) From: Biju Das To: Liam Girdwood , Mark Brown Cc: Biju Das , linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v3 1/2] regulator: pv880x0: Drop ifdeffery Date: Sun, 3 Sep 2023 17:48:31 +0100 Message-Id: <20230903164832.83077-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230903164832.83077-1-biju.das.jz@bp.renesas.com> References: <20230903164832.83077-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" Drop of_match_ptr() from pv88080_regulator_driver and get rid of ugly CONFIG_OF ifdeffery. This slightly increases the size of pv88080_dt_ids on non-OF system and shouldn't be an issue. Add mod_devicetable.h include. While at it, remove trailing comma in the terminator entry for OF/ID table. Suggested-by: Andy Shevchenko Signed-off-by: Biju Das --- v2->v3: * Swapped the patch. * Removed trailing comma in the terminator entry for OF/ID table. * Restored OF table position. * Updated commit description. v2: * New patch. --- drivers/regulator/pv88080-regulator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88= 080-regulator.c index 7ab3e4a9bd28..1b2a8385e2e8 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include #include #include @@ -196,15 +197,13 @@ static const struct pv88080_compatible_regmap pv88080= _ba_regs =3D { .hvbuck_vsel_mask =3D PV88080_VHVBUCK_MASK, }; =20 -#ifdef CONFIG_OF static const struct of_device_id pv88080_dt_ids[] =3D { { .compatible =3D "pvs,pv88080", .data =3D (void *)TYPE_PV88080_AA }, { .compatible =3D "pvs,pv88080-aa", .data =3D (void *)TYPE_PV88080_AA }, { .compatible =3D "pvs,pv88080-ba", .data =3D (void *)TYPE_PV88080_BA }, - {}, + {} }; MODULE_DEVICE_TABLE(of, pv88080_dt_ids); -#endif =20 static unsigned int pv88080_buck_get_mode(struct regulator_dev *rdev) { @@ -550,7 +549,7 @@ static const struct i2c_device_id pv88080_i2c_id[] =3D { { "pv88080", TYPE_PV88080_AA }, { "pv88080-aa", TYPE_PV88080_AA }, { "pv88080-ba", TYPE_PV88080_BA }, - {}, + {} }; MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id); =20 @@ -558,7 +557,7 @@ static struct i2c_driver pv88080_regulator_driver =3D { .driver =3D { .name =3D "pv88080", .probe_type =3D PROBE_PREFER_ASYNCHRONOUS, - .of_match_table =3D of_match_ptr(pv88080_dt_ids), + .of_match_table =3D pv88080_dt_ids, }, .probe =3D pv88080_i2c_probe, .id_table =3D pv88080_i2c_id, --=20 2.25.1 From nobody Sun Feb 8 22:31:50 2026 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 E3273C83F2C for ; Sun, 3 Sep 2023 16:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245750AbjICQsr (ORCPT ); Sun, 3 Sep 2023 12:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbjICQsq (ORCPT ); Sun, 3 Sep 2023 12:48:46 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BA07294 for ; Sun, 3 Sep 2023 09:48:42 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,224,1688396400"; d="scan'208";a="178560459" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 04 Sep 2023 01:48:42 +0900 Received: from localhost.localdomain (unknown [10.226.92.30]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 89471402309A; Mon, 4 Sep 2023 01:48:40 +0900 (JST) From: Biju Das To: Liam Girdwood , Mark Brown Cc: Biju Das , linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v3 2/2] regulator: pv880x0: Simplify probe() Date: Sun, 3 Sep 2023 17:48:32 +0100 Message-Id: <20230903164832.83077-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230903164832.83077-1-biju.das.jz@bp.renesas.com> References: <20230903164832.83077-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" Replace pv88080_types->pv88080_compatible_regmap in OF/ID tables and simplify the probe() by replacing of_match_node() and ID lookup for retrieving match data by i2c_get_match_data(). After this there is no user of enum pv88080_types. So drop it. While at it, move OF table near to the user. Signed-off-by: Biju Das --- v2->v3: * Moved OF tables close to the user as patch#1 restored OF table position. * Dropped extra space from OF table entry. v1->v2: * Moved OF/ID tables close to the user * Removed trailing comma in the terminator entry for OF/ID tables. --- drivers/regulator/pv88080-regulator.c | 51 ++++++++------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88= 080-regulator.c index 1b2a8385e2e8..9fe539a34786 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c @@ -29,11 +29,6 @@ enum { PV88080_ID_HVBUCK, }; =20 -enum pv88080_types { - TYPE_PV88080_AA, - TYPE_PV88080_BA, -}; - struct pv88080_regulator { struct regulator_desc desc; unsigned int mode_reg; @@ -197,14 +192,6 @@ static const struct pv88080_compatible_regmap pv88080_= ba_regs =3D { .hvbuck_vsel_mask =3D PV88080_VHVBUCK_MASK, }; =20 -static const struct of_device_id pv88080_dt_ids[] =3D { - { .compatible =3D "pvs,pv88080", .data =3D (void *)TYPE_PV88080_AA }, - { .compatible =3D "pvs,pv88080-aa", .data =3D (void *)TYPE_PV88080_AA }, - { .compatible =3D "pvs,pv88080-ba", .data =3D (void *)TYPE_PV88080_BA }, - {} -}; -MODULE_DEVICE_TABLE(of, pv88080_dt_ids); - static unsigned int pv88080_buck_get_mode(struct regulator_dev *rdev) { struct pv88080_regulator *info =3D rdev_get_drvdata(rdev); @@ -375,11 +362,9 @@ static irqreturn_t pv88080_irq_handler(int irq, void *= data) */ static int pv88080_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id =3D i2c_client_get_device_id(i2c); struct regulator_init_data *init_data =3D dev_get_platdata(&i2c->dev); struct pv88080 *chip; const struct pv88080_compatible_regmap *regmap_config; - const struct of_device_id *match; struct regulator_config config =3D { }; int i, error, ret; unsigned int conf2, conf5; @@ -397,16 +382,9 @@ static int pv88080_i2c_probe(struct i2c_client *i2c) return error; } =20 - if (i2c->dev.of_node) { - match =3D of_match_node(pv88080_dt_ids, i2c->dev.of_node); - if (!match) { - dev_err(chip->dev, "Failed to get of_match_node\n"); - return -EINVAL; - } - chip->type =3D (unsigned long)match->data; - } else { - chip->type =3D id->driver_data; - } + chip->regmap_config =3D i2c_get_match_data(i2c); + if (!chip->regmap_config) + return -ENODEV; =20 i2c_set_clientdata(i2c, chip); =20 @@ -451,15 +429,6 @@ static int pv88080_i2c_probe(struct i2c_client *i2c) dev_warn(chip->dev, "No IRQ configured\n"); } =20 - switch (chip->type) { - case TYPE_PV88080_AA: - chip->regmap_config =3D &pv88080_aa_regs; - break; - case TYPE_PV88080_BA: - chip->regmap_config =3D &pv88080_ba_regs; - break; - } - regmap_config =3D chip->regmap_config; config.dev =3D chip->dev; config.regmap =3D chip->regmap; @@ -545,10 +514,18 @@ static int pv88080_i2c_probe(struct i2c_client *i2c) return 0; } =20 +static const struct of_device_id pv88080_dt_ids[] =3D { + { .compatible =3D "pvs,pv88080", .data =3D &pv88080_aa_regs }, + { .compatible =3D "pvs,pv88080-aa", .data =3D &pv88080_aa_regs }, + { .compatible =3D "pvs,pv88080-ba", .data =3D &pv88080_ba_regs }, + {} +}; +MODULE_DEVICE_TABLE(of, pv88080_dt_ids); + static const struct i2c_device_id pv88080_i2c_id[] =3D { - { "pv88080", TYPE_PV88080_AA }, - { "pv88080-aa", TYPE_PV88080_AA }, - { "pv88080-ba", TYPE_PV88080_BA }, + { "pv88080", (kernel_ulong_t)&pv88080_aa_regs }, + { "pv88080-aa", (kernel_ulong_t)&pv88080_aa_regs }, + { "pv88080-ba", (kernel_ulong_t)&pv88080_ba_regs }, {} }; MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id); --=20 2.25.1