public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Wolfram Sang <wsa@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Michael Hennerich <michael.hennerich@analog.com>,
	Peter Rosin <peda@axentia.se>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RFC 3/4] i2c: mux: pca954x: convert to using a pointer in i2c_device_id
Date: Mon, 14 Aug 2023 14:52:51 -0700	[thread overview]
Message-ID: <20230814-i2c-id-rework-v1-3-3e5bc71c49ee@gmail.com> (raw)
In-Reply-To: <20230814-i2c-id-rework-v1-0-3e5bc71c49ee@gmail.com>

Switch the driver to use newly added "data" pointer in i2c_device_id to
streamline DT and legacy flows.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 6965bf4c2348..c8540e4ca660 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -177,18 +177,18 @@ static const struct chip_desc chips[] = {
 };
 
 static const struct i2c_device_id pca954x_id[] = {
-	{ "pca9540", pca_9540 },
-	{ "pca9542", pca_9542 },
-	{ "pca9543", pca_9543 },
-	{ "pca9544", pca_9544 },
-	{ "pca9545", pca_9545 },
-	{ "pca9546", pca_9546 },
-	{ "pca9547", pca_9547 },
-	{ "pca9548", pca_9548 },
-	{ "pca9846", pca_9846 },
-	{ "pca9847", pca_9847 },
-	{ "pca9848", pca_9848 },
-	{ "pca9849", pca_9849 },
+	{ "pca9540", .data = &chips[pca_9540] },
+	{ "pca9542", .data = &chips[pca_9542] },
+	{ "pca9543", .data = &chips[pca_9543] },
+	{ "pca9544", .data = &chips[pca_9544] },
+	{ "pca9545", .data = &chips[pca_9545] },
+	{ "pca9546", .data = &chips[pca_9546] },
+	{ "pca9547", .data = &chips[pca_9547] },
+	{ "pca9548", .data = &chips[pca_9548] },
+	{ "pca9846", .data = &chips[pca_9846] },
+	{ "pca9847", .data = &chips[pca_9847] },
+	{ "pca9848", .data = &chips[pca_9848] },
+	{ "pca9849", .data = &chips[pca_9849] },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, pca954x_id);
@@ -206,7 +206,7 @@ static const struct of_device_id pca954x_of_match[] = {
 	{ .compatible = "nxp,pca9847", .data = &chips[pca_9847] },
 	{ .compatible = "nxp,pca9848", .data = &chips[pca_9848] },
 	{ .compatible = "nxp,pca9849", .data = &chips[pca_9849] },
-	{}
+	{ }
 };
 MODULE_DEVICE_TABLE(of, pca954x_of_match);
 
@@ -447,7 +447,7 @@ static int pca954x_probe(struct i2c_client *client)
 
 	data->chip = device_get_match_data(dev);
 	if (!data->chip)
-		data->chip = &chips[id->driver_data];
+		data->chip = id->data;
 
 	if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) {
 		struct i2c_device_identity id;

-- 
2.41.0.694.ge786442a9b-goog


  parent reply	other threads:[~2023-08-14 21:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-14 21:52 [PATCH RFC 0/4] Start unification of of_device_id and i2c_device_id Dmitry Torokhov
2023-08-14 21:52 ` [PATCH RFC 1/4] i2c: start migrating to a pointer in i2c_device_id Dmitry Torokhov
2023-08-15 15:55   ` Andy Shevchenko
2023-08-14 21:52 ` [PATCH RFC 2/4] i2c: mux: ltc4306: convert to using " Dmitry Torokhov
2023-08-15 15:50   ` Andy Shevchenko
2023-08-14 21:52 ` Dmitry Torokhov [this message]
2023-08-15 15:51   ` [PATCH RFC 3/4] i2c: mux: pca954x: " Andy Shevchenko
2023-08-14 21:52 ` [PATCH RFC 4/4] i2c: slave-eeprom: " Dmitry Torokhov
2023-08-15 15:53   ` Andy Shevchenko

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=20230814-i2c-id-rework-v1-3-3e5bc71c49ee@gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=jic23@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=peda@axentia.se \
    --cc=wsa@kernel.org \
    /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