diff mbox series

[4/4] iio: potentiometer: mcp4018: Use i2c_get_match_data

Message ID 20230716175218.130557-5-biju.das.jz@bp.renesas.com (mailing list archive)
State Changes Requested
Headers show
Series Use i2c_get_match_data() | expand

Commit Message

Biju Das July 16, 2023, 5:52 p.m. UTC
Replace of_device_get_match_data() and i2c_match_id() by i2c_get_match
_data() as we have similar I2C and DT-based matching table.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/iio/potentiometer/mcp4018.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Biju Das July 16, 2023, 6:10 p.m. UTC | #1
Hi All,

I would like to drop this patch, as this driver does not have similar
I2C and DT-based matching table.

Cheers,
Biju

> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: Sunday, July 16, 2023 6:52 PM
> To: Peter Rosin <peda@axentia.se>; Jonathan Cameron <jic23@kernel.org>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lars-Peter Clausen
> <lars@metafoo.de>; linux-iio@vger.kernel.org; Geert Uytterhoeven
> <geert+renesas@glider.be>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> lad.rj@bp.renesas.com>; linux-renesas-soc@vger.kernel.org
> Subject: [PATCH 4/4] iio: potentiometer: mcp4018: Use i2c_get_match_data
> 
> Replace of_device_get_match_data() and i2c_match_id() by i2c_get_match
> _data() as we have similar I2C and DT-based matching table.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/iio/potentiometer/mcp4018.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/potentiometer/mcp4018.c
> b/drivers/iio/potentiometer/mcp4018.c
> index 89daecc90305..a5d902845a1c 100644
> --- a/drivers/iio/potentiometer/mcp4018.c
> +++ b/drivers/iio/potentiometer/mcp4018.c
> @@ -157,9 +157,9 @@ static int mcp4018_probe(struct i2c_client *client)
>  	i2c_set_clientdata(client, indio_dev);
>  	data->client = client;
> 
> -	data->cfg = device_get_match_data(dev);
> +	data->cfg = i2c_get_match_data(dev);
>  	if (!data->cfg)
> -		data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)-
> >driver_data];
> +		return -ENODEV;
> 
>  	indio_dev->info = &mcp4018_info;
>  	indio_dev->channels = &mcp4018_channel;
> --
> 2.25.1
Jonathan Cameron July 20, 2023, 7:17 p.m. UTC | #2
On Sun, 16 Jul 2023 18:10:13 +0000
Biju Das <biju.das.jz@bp.renesas.com> wrote:

> Hi All,
> 
> I would like to drop this patch, as this driver does not have similar
> I2C and DT-based matching table.

Could make it so they do ;)

Jonathan

> 
> Cheers,
> Biju
> 
> > -----Original Message-----
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> > Sent: Sunday, July 16, 2023 6:52 PM
> > To: Peter Rosin <peda@axentia.se>; Jonathan Cameron <jic23@kernel.org>
> > Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lars-Peter Clausen
> > <lars@metafoo.de>; linux-iio@vger.kernel.org; Geert Uytterhoeven
> > <geert+renesas@glider.be>; Prabhakar Mahadev Lad <prabhakar.mahadev-  
> > lad.rj@bp.renesas.com>; linux-renesas-soc@vger.kernel.org  
> > Subject: [PATCH 4/4] iio: potentiometer: mcp4018: Use i2c_get_match_data
> > 
> > Replace of_device_get_match_data() and i2c_match_id() by i2c_get_match
> > _data() as we have similar I2C and DT-based matching table.
> > 
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/iio/potentiometer/mcp4018.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/potentiometer/mcp4018.c
> > b/drivers/iio/potentiometer/mcp4018.c
> > index 89daecc90305..a5d902845a1c 100644
> > --- a/drivers/iio/potentiometer/mcp4018.c
> > +++ b/drivers/iio/potentiometer/mcp4018.c
> > @@ -157,9 +157,9 @@ static int mcp4018_probe(struct i2c_client *client)
> >  	i2c_set_clientdata(client, indio_dev);
> >  	data->client = client;
> > 
> > -	data->cfg = device_get_match_data(dev);
> > +	data->cfg = i2c_get_match_data(dev);
> >  	if (!data->cfg)
> > -		data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)-  
> > >driver_data];  
> > +		return -ENODEV;
> > 
> >  	indio_dev->info = &mcp4018_info;
> >  	indio_dev->channels = &mcp4018_channel;
> > --
> > 2.25.1  
>
Biju Das July 20, 2023, 7:31 p.m. UTC | #3
Hi Jonathan Cameron,

Thanks for the feedback.

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Thursday, July 20, 2023 8:17 PM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Peter Rosin <peda@axentia.se>; Lars-Peter Clausen <lars@metafoo.de>;
> linux-iio@vger.kernel.org; Geert Uytterhoeven <geert+renesas@glider.be>;
> Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; linux-
> renesas-soc@vger.kernel.org
> Subject: Re: [PATCH 4/4] iio: potentiometer: mcp4018: Use
> i2c_get_match_data
> 
> On Sun, 16 Jul 2023 18:10:13 +0000
> Biju Das <biju.das.jz@bp.renesas.com> wrote:
> 
> > Hi All,
> >
> > I would like to drop this patch, as this driver does not have similar
> > I2C and DT-based matching table.
> 
> Could make it so they do ;)

OK, will create separate patch for similar I2C and DT-based matching table
and will send V2 for this driver.

Cheers,
Biju

> 
> >
> > Cheers,
> > Biju
> >
> > > -----Original Message-----
> > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > Sent: Sunday, July 16, 2023 6:52 PM
> > > To: Peter Rosin <peda@axentia.se>; Jonathan Cameron
> > > <jic23@kernel.org>
> > > Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lars-Peter Clausen
> > > <lars@metafoo.de>; linux-iio@vger.kernel.org; Geert Uytterhoeven
> > > <geert+renesas@glider.be>; Prabhakar Mahadev Lad <prabhakar.mahadev-
> > > lad.rj@bp.renesas.com>; linux-renesas-soc@vger.kernel.org
> > > Subject: [PATCH 4/4] iio: potentiometer: mcp4018: Use
> > > i2c_get_match_data
> > >
> > > Replace of_device_get_match_data() and i2c_match_id() by
> > > i2c_get_match
> > > _data() as we have similar I2C and DT-based matching table.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > >  drivers/iio/potentiometer/mcp4018.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/iio/potentiometer/mcp4018.c
> > > b/drivers/iio/potentiometer/mcp4018.c
> > > index 89daecc90305..a5d902845a1c 100644
> > > --- a/drivers/iio/potentiometer/mcp4018.c
> > > +++ b/drivers/iio/potentiometer/mcp4018.c
> > > @@ -157,9 +157,9 @@ static int mcp4018_probe(struct i2c_client
> *client)
> > >  	i2c_set_clientdata(client, indio_dev);
> > >  	data->client = client;
> > >
> > > -	data->cfg = device_get_match_data(dev);
> > > +	data->cfg = i2c_get_match_data(dev);
> > >  	if (!data->cfg)
> > > -		data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)-
> > > >driver_data];
> > > +		return -ENODEV;
> > >
> > >  	indio_dev->info = &mcp4018_info;
> > >  	indio_dev->channels = &mcp4018_channel;
> > > --
> > > 2.25.1
> >
diff mbox series

Patch

diff --git a/drivers/iio/potentiometer/mcp4018.c b/drivers/iio/potentiometer/mcp4018.c
index 89daecc90305..a5d902845a1c 100644
--- a/drivers/iio/potentiometer/mcp4018.c
+++ b/drivers/iio/potentiometer/mcp4018.c
@@ -157,9 +157,9 @@  static int mcp4018_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, indio_dev);
 	data->client = client;
 
-	data->cfg = device_get_match_data(dev);
+	data->cfg = i2c_get_match_data(dev);
 	if (!data->cfg)
-		data->cfg = &mcp4018_cfg[i2c_match_id(mcp4018_id, client)->driver_data];
+		return -ENODEV;
 
 	indio_dev->info = &mcp4018_info;
 	indio_dev->channels = &mcp4018_channel;