[PATCH RFC 2/4] i2c: mux: ltc4306: convert to using a pointer in i2c_device_id

From: Dmitry Torokhov
Date: Mon Aug 14 2023 - 17:54:20 EST


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@xxxxxxxxx>
---
drivers/i2c/muxes/i2c-mux-ltc4306.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-ltc4306.c b/drivers/i2c/muxes/i2c-mux-ltc4306.c
index 637e25506490..17b9ed9ceef3 100644
--- a/drivers/i2c/muxes/i2c-mux-ltc4306.c
+++ b/drivers/i2c/muxes/i2c-mux-ltc4306.c
@@ -192,8 +192,8 @@ static int ltc4306_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
}

static const struct i2c_device_id ltc4306_id[] = {
- { "ltc4305", ltc_4305 },
- { "ltc4306", ltc_4306 },
+ { "ltc4305", .data = &chips[ltc_4305] },
+ { "ltc4306", .data = &chips[ltc_4306] },
{ }
};
MODULE_DEVICE_TABLE(i2c, ltc4306_id);
@@ -217,9 +217,8 @@ static int ltc4306_probe(struct i2c_client *client)
int num, ret;

chip = of_device_get_match_data(&client->dev);
-
if (!chip)
- chip = &chips[i2c_match_id(ltc4306_id, client)->driver_data];
+ chip = i2c_match_id(ltc4306_id, client)->data;

idle_disc = device_property_read_bool(&client->dev,
"i2c-mux-idle-disconnect");

--
2.41.0.694.ge786442a9b-goog