2023-08-13 19:19:40

by Angel Iglesias

[permalink] [raw]
Subject: [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data

Replaces device_get_match_data() and fallback match_id logic by new
unified helper function i2c_get_match_data().

Signed-off-by: Angel Iglesias <[email protected]>

diff --git a/drivers/iio/pressure/bmp280-i2c.c b/drivers/iio/pressure/bmp280-i2c.c
index 693eb1975fdc..34e3bc758493 100644
--- a/drivers/iio/pressure/bmp280-i2c.c
+++ b/drivers/iio/pressure/bmp280-i2c.c
@@ -11,9 +11,7 @@ static int bmp280_i2c_probe(struct i2c_client *client)
const struct bmp280_chip_info *chip_info;
struct regmap *regmap;

- chip_info = device_get_match_data(&client->dev);
- if (!chip_info)
- chip_info = (const struct bmp280_chip_info *) id->driver_data;
+ chip_info = i2c_get_match_data(client);

regmap = devm_regmap_init_i2c(client, chip_info->regmap_config);
if (IS_ERR(regmap)) {
--
2.41.0



2023-08-13 20:23:02

by Angel Iglesias

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data

On Sun, 2023-08-13 at 21:03 +0200, Angel Iglesias wrote:
> Replaces device_get_match_data() and fallback match_id logic by new
> unified helper function i2c_get_match_data().
>
> Signed-off-by: Angel Iglesias <[email protected]>
>
> diff --git a/drivers/iio/pressure/bmp280-i2c.c b/drivers/iio/pressure/bmp280-
> i2c.c
> index 693eb1975fdc..34e3bc758493 100644
> --- a/drivers/iio/pressure/bmp280-i2c.c
> +++ b/drivers/iio/pressure/bmp280-i2c.c
> @@ -11,9 +11,7 @@ static int bmp280_i2c_probe(struct i2c_client *client)
>         const struct bmp280_chip_info *chip_info;
>         struct regmap *regmap;
>  
> -       chip_info = device_get_match_data(&client->dev);
> -       if (!chip_info)
> -               chip_info = (const struct bmp280_chip_info *) id->driver_data;
> +       chip_info = i2c_get_match_data(client);
>  
>         regmap = devm_regmap_init_i2c(client, chip_info->regmap_config);
>         if (IS_ERR(regmap)) {

Hi,

I noticed I submitted this change that was also submitted by Biju Das on another
patch:
https://lore.kernel.org/all/[email protected]/

Should I drop this patch from the series?

Kind regards,
Angel

2023-08-14 07:27:18

by Biju Das

[permalink] [raw]
Subject: RE: [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data

Hi Angel Iglesias,


> Subject: Re: [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data
>
> On Sun, 2023-08-13 at 21:03 +0200, Angel Iglesias wrote:
> > Replaces device_get_match_data() and fallback match_id logic by new
> > unified helper function i2c_get_match_data().
> >
> > Signed-off-by: Angel Iglesias <[email protected]>
> >
> > diff --git a/drivers/iio/pressure/bmp280-i2c.c
> > b/drivers/iio/pressure/bmp280- i2c.c index 693eb1975fdc..34e3bc758493
> > 100644
> > --- a/drivers/iio/pressure/bmp280-i2c.c
> > +++ b/drivers/iio/pressure/bmp280-i2c.c
> > @@ -11,9 +11,7 @@ static int bmp280_i2c_probe(struct i2c_client
> > *client)
> > ????????const struct bmp280_chip_info *chip_info;
> > ????????struct regmap *regmap;
> >
> > -???????chip_info = device_get_match_data(&client->dev);
> > -???????if (!chip_info)
> > -???????????????chip_info = (const struct bmp280_chip_info *)
> > id->driver_data;
> > +???????chip_info = i2c_get_match_data(client);
> >
> > ????????regmap = devm_regmap_init_i2c(client,
> > chip_info->regmap_config);
> > ????????if (IS_ERR(regmap)) {
>
> Hi,
>
> I noticed I submitted this change that was also submitted by Biju Das on
> another
> patch:

> Should I drop this patch from the series?

I think it is ok. Andy is suggesting to use unified table for SPI/I2C

Is it something do able and testable in your environment? see [1],
If yes, please create another patch for using unified table for both i2c and spi.

https://lore.kernel.org/linux-renesas-soc/CAHp75VeX+T=hAN+PgtHTdv4b6UtDVgveUUww1b1kuOngzDinFw@mail.gmail.com/T/#t

Cheers,
Biju