* [PATCH] iio: potentiometer: ad5110: Use i2c_get_match_data()
@ 2023-08-12 15:08 Biju Das
2023-08-28 16:21 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Biju Das @ 2023-08-12 15:08 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Biju Das, Mugilraj Dhavachelvan, Lars-Peter Clausen,
Andy Shevchenko, Michael Hennerich, linux-iio, Geert Uytterhoeven,
linux-renesas-soc
Replace device_get_match_data()->i2c_get_match_data by making similar I2C
and DT-based matching table to extend matching support for ID table.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/iio/potentiometer/ad5110.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/potentiometer/ad5110.c b/drivers/iio/potentiometer/ad5110.c
index 991e745c4f93..aaf02cc7aeba 100644
--- a/drivers/iio/potentiometer/ad5110.c
+++ b/drivers/iio/potentiometer/ad5110.c
@@ -278,14 +278,19 @@ static const struct of_device_id ad5110_of_match[] = {
};
MODULE_DEVICE_TABLE(of, ad5110_of_match);
+#define AD5110_ID_TABLE(_name, cfg) { \
+ .name = _name, \
+ .driver_data = (kernel_ulong_t)&ad5110_cfg[cfg], \
+}
+
static const struct i2c_device_id ad5110_id[] = {
- { "ad5110-10", AD5110_10 },
- { "ad5110-80", AD5110_80 },
- { "ad5112-05", AD5112_05 },
- { "ad5112-10", AD5112_10 },
- { "ad5112-80", AD5112_80 },
- { "ad5114-10", AD5114_10 },
- { "ad5114-80", AD5114_80 },
+ AD5110_ID_TABLE("ad5110-10", AD5110_10),
+ AD5110_ID_TABLE("ad5110-80", AD5110_80),
+ AD5110_ID_TABLE("ad5112-05", AD5112_05),
+ AD5110_ID_TABLE("ad5112-10", AD5112_10),
+ AD5110_ID_TABLE("ad5112-80", AD5112_80),
+ AD5110_ID_TABLE("ad5114-10", AD5114_10),
+ AD5110_ID_TABLE("ad5114-80", AD5114_80),
{ }
};
MODULE_DEVICE_TABLE(i2c, ad5110_id);
@@ -305,7 +310,7 @@ static int ad5110_probe(struct i2c_client *client)
data->client = client;
mutex_init(&data->lock);
data->enable = 1;
- data->cfg = device_get_match_data(dev);
+ data->cfg = i2c_get_match_data(client);
/* refresh RDAC register with EEPROM */
ret = ad5110_write(data, AD5110_RESET, 0);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: potentiometer: ad5110: Use i2c_get_match_data()
2023-08-12 15:08 [PATCH] iio: potentiometer: ad5110: Use i2c_get_match_data() Biju Das
@ 2023-08-28 16:21 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2023-08-28 16:21 UTC (permalink / raw)
To: Biju Das
Cc: Mugilraj Dhavachelvan, Lars-Peter Clausen, Andy Shevchenko,
Michael Hennerich, linux-iio, Geert Uytterhoeven,
linux-renesas-soc
On Sat, 12 Aug 2023 16:08:38 +0100
Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Replace device_get_match_data()->i2c_get_match_data by making similar I2C
> and DT-based matching table to extend matching support for ID table.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Could have been a little clearer on the reasoning for doign this, but meh there
are a lot of them and this is moving things forwards.
Applied.
Thanks,
Jonathan
> ---
> drivers/iio/potentiometer/ad5110.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/potentiometer/ad5110.c b/drivers/iio/potentiometer/ad5110.c
> index 991e745c4f93..aaf02cc7aeba 100644
> --- a/drivers/iio/potentiometer/ad5110.c
> +++ b/drivers/iio/potentiometer/ad5110.c
> @@ -278,14 +278,19 @@ static const struct of_device_id ad5110_of_match[] = {
> };
> MODULE_DEVICE_TABLE(of, ad5110_of_match);
>
> +#define AD5110_ID_TABLE(_name, cfg) { \
> + .name = _name, \
> + .driver_data = (kernel_ulong_t)&ad5110_cfg[cfg], \
> +}
> +
> static const struct i2c_device_id ad5110_id[] = {
> - { "ad5110-10", AD5110_10 },
> - { "ad5110-80", AD5110_80 },
> - { "ad5112-05", AD5112_05 },
> - { "ad5112-10", AD5112_10 },
> - { "ad5112-80", AD5112_80 },
> - { "ad5114-10", AD5114_10 },
> - { "ad5114-80", AD5114_80 },
> + AD5110_ID_TABLE("ad5110-10", AD5110_10),
> + AD5110_ID_TABLE("ad5110-80", AD5110_80),
> + AD5110_ID_TABLE("ad5112-05", AD5112_05),
> + AD5110_ID_TABLE("ad5112-10", AD5112_10),
> + AD5110_ID_TABLE("ad5112-80", AD5112_80),
> + AD5110_ID_TABLE("ad5114-10", AD5114_10),
> + AD5110_ID_TABLE("ad5114-80", AD5114_80),
> { }
> };
> MODULE_DEVICE_TABLE(i2c, ad5110_id);
> @@ -305,7 +310,7 @@ static int ad5110_probe(struct i2c_client *client)
> data->client = client;
> mutex_init(&data->lock);
> data->enable = 1;
> - data->cfg = device_get_match_data(dev);
> + data->cfg = i2c_get_match_data(client);
>
> /* refresh RDAC register with EEPROM */
> ret = ad5110_write(data, AD5110_RESET, 0);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-28 16:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-12 15:08 [PATCH] iio: potentiometer: ad5110: Use i2c_get_match_data() Biju Das
2023-08-28 16:21 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox