From nobody Mon Feb 9 03:23:04 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 8BB60C83F3F for ; Sun, 3 Sep 2023 15:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243250AbjICPnI (ORCPT ); Sun, 3 Sep 2023 11:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjICPnH (ORCPT ); Sun, 3 Sep 2023 11:43:07 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BFC798 for ; Sun, 3 Sep 2023 08:43:03 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.02,224,1688396400"; d="scan'208";a="178557873" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 04 Sep 2023 00:43:02 +0900 Received: from localhost.localdomain (unknown [10.226.92.30]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A1B02400C0EB; Mon, 4 Sep 2023 00:43:00 +0900 (JST) From: Biju Das To: Laurent Pinchart Cc: Biju Das , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Biju Das , Andy Shevchenko Subject: [PATCH v2] regulator: max20086: Make similar OF and ID table Date: Sun, 3 Sep 2023 16:42:57 +0100 Message-Id: <20230903154257.70800-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 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 blank lines before MODULE_DEVICE_TABLE* and remove trailing comma in the terminator entry for OF/ID table. Signed-off-by: Biju Das --- Note: This patch is only compile tested. v1->v2: * Removed trailing comma in the terminator entry for OF/ID table. --- drivers/regulator/max20086-regulator.c | 65 ++++++++++++-------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max= 20086-regulator.c index 32f47b896fd1..59eb23d467ec 100644 --- a/drivers/regulator/max20086-regulator.c +++ b/drivers/regulator/max20086-regulator.c @@ -223,7 +223,7 @@ static int max20086_i2c_probe(struct i2c_client *i2c) return -ENOMEM; =20 chip->dev =3D &i2c->dev; - chip->info =3D device_get_match_data(chip->dev); + chip->info =3D i2c_get_match_data(i2c); =20 i2c_set_clientdata(i2c, chip); =20 @@ -275,45 +275,42 @@ static int max20086_i2c_probe(struct i2c_client *i2c) return 0; } =20 -static const struct i2c_device_id max20086_i2c_id[] =3D { - { "max20086" }, - { "max20087" }, - { "max20088" }, - { "max20089" }, - { /* Sentinel */ }, +static const struct max20086_chip_info max20086_chip_info =3D { + .id =3D MAX20086_DEVICE_ID_MAX20086, + .num_outputs =3D 4, +}; + +static const struct max20086_chip_info max20087_chip_info =3D { + .id =3D MAX20086_DEVICE_ID_MAX20087, + .num_outputs =3D 4, +}; + +static const struct max20086_chip_info max20088_chip_info =3D { + .id =3D MAX20086_DEVICE_ID_MAX20088, + .num_outputs =3D 2, +}; + +static const struct max20086_chip_info max20089_chip_info =3D { + .id =3D MAX20086_DEVICE_ID_MAX20089, + .num_outputs =3D 2, }; =20 +static const struct i2c_device_id max20086_i2c_id[] =3D { + { "max20086", (kernel_ulong_t)&max20086_chip_info }, + { "max20087", (kernel_ulong_t)&max20087_chip_info }, + { "max20088", (kernel_ulong_t)&max20088_chip_info }, + { "max20089", (kernel_ulong_t)&max20089_chip_info }, + { /* Sentinel */ } +}; MODULE_DEVICE_TABLE(i2c, max20086_i2c_id); =20 static const struct of_device_id max20086_dt_ids[] __maybe_unused =3D { - { - .compatible =3D "maxim,max20086", - .data =3D &(const struct max20086_chip_info) { - .id =3D MAX20086_DEVICE_ID_MAX20086, - .num_outputs =3D 4, - } - }, { - .compatible =3D "maxim,max20087", - .data =3D &(const struct max20086_chip_info) { - .id =3D MAX20086_DEVICE_ID_MAX20087, - .num_outputs =3D 4, - } - }, { - .compatible =3D "maxim,max20088", - .data =3D &(const struct max20086_chip_info) { - .id =3D MAX20086_DEVICE_ID_MAX20088, - .num_outputs =3D 2, - } - }, { - .compatible =3D "maxim,max20089", - .data =3D &(const struct max20086_chip_info) { - .id =3D MAX20086_DEVICE_ID_MAX20089, - .num_outputs =3D 2, - } - }, - { /* Sentinel */ }, + { .compatible =3D "maxim,max20086", .data =3D &max20086_chip_info }, + { .compatible =3D "maxim,max20087", .data =3D &max20087_chip_info }, + { .compatible =3D "maxim,max20088", .data =3D &max20088_chip_info }, + { .compatible =3D "maxim,max20089", .data =3D &max20089_chip_info }, + { /* Sentinel */ } }; - MODULE_DEVICE_TABLE(of, max20086_dt_ids); =20 static struct i2c_driver max20086_regulator_driver =3D { --=20 2.25.1