mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Angel Iglesias <ang.iglesiasg@gmail.com>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data
Date: Mon, 14 Aug 2023 18:43:49 +0200	[thread overview]
Message-ID: <a83bde5079b769950220c0f1f3b8d374db39cfc7.camel@gmail.com> (raw)
In-Reply-To: <OS0PR01MB5922EDF7759069CD4993FA468617A@OS0PR01MB5922.jpnprd01.prod.outlook.com>

On Mon, 2023-08-14 at 06:57 +0000, Biju Das wrote:
> 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 <ang.iglesiasg@gmail.com>
> > > 
> > > 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.

I have around a BMP390 with the SPI pins available to test it out. In the case
of the bmp280 we could unify the of_match table as they're almost the same. In
the case of the spi_device_id and i2c_device_id tables, as they're different
structs I'm not sure if they can be unified.

Regarding Andy's comment, I think he's referring to the duplicated chip infos.
In the case of the bmp280, the chip_infos are defined on the common driver code
and used for both SPI and I2C match tables.

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

Kind regards,
Angel


  reply	other threads:[~2023-08-14 16:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 19:03 [PATCH v2 0/3] iio: pressure: bmp280: Small driver cleanup Angel Iglesias
2023-08-13 19:03 ` [PATCH v2 1/3] iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order Angel Iglesias
2023-08-13 19:03 ` [PATCH v2 2/3] iio: pressure: bmp280: Use i2c_get_match_data Angel Iglesias
2023-08-13 19:09   ` Angel Iglesias
2023-08-14  6:57     ` Biju Das
2023-08-14 16:43       ` Angel Iglesias [this message]
2023-08-28 11:39         ` Jonathan Cameron
2023-09-07  7:09           ` Angel Iglesias
2023-09-07  7:11             ` Biju Das
2023-08-13 19:03 ` [PATCH v2 3/3] iio: pressure: bmp280: Use spi_get_device_match_data() Angel Iglesias

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=a83bde5079b769950220c0f1f3b8d374db39cfc7.camel@gmail.com \
    --to=ang.iglesiasg@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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

all inboxes | Powered by JetHome®