public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Angel Iglesias <ang.iglesiasg@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-iio@vger.kernel.org,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Nuno Sá" <noname.nuno@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] iio: pressure: bmp280: convert to i2c's .probe_new()
Date: Wed, 02 Nov 2022 01:16:44 +0100	[thread overview]
Message-ID: <ae43aa9c3a9f29d0ecef69756a539ebf00a84ab1.camel@gmail.com> (raw)
In-Reply-To: <20221101215236.ihoqkx2xckilom67@pengutronix.de>

On Tue, 2022-11-01 at 22:52 +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Sun, Oct 30, 2022 at 06:53:11PM +0100, Angel Iglesias wrote:
> > Use i2c_client_get_device_id() to get the i2c_device_id* parameter in the
> > .new_probe() callback.
> > 
> > Signed-off-by: Angel Iglesias <ang.iglesiasg@gmail.com>
> > ---
> >  drivers/iio/pressure/bmp280-i2c.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/bmp280-i2c.c
> > b/drivers/iio/pressure/bmp280-i2c.c
> > index 0c27211f3ea0..20073b09b3e3 100644
> > --- a/drivers/iio/pressure/bmp280-i2c.c
> > +++ b/drivers/iio/pressure/bmp280-i2c.c
> > @@ -5,11 +5,11 @@
> >  
> >  #include "bmp280.h"
> >  
> > -static int bmp280_i2c_probe(struct i2c_client *client,
> > -                           const struct i2c_device_id *id)
> > +static int bmp280_i2c_probe(struct i2c_client *client)
> >  {
> > -       struct regmap *regmap;
> > +       const struct i2c_device_id *id = i2c_client_get_device_id(client);
> >         const struct regmap_config *regmap_config;
> > +       struct regmap *regmap;
> >  
> >         switch (id->driver_data) {
> >         case BMP180_CHIP_ID:
> 
> What is the motivation for moving regmap? I thought reverse christmas
> tree is only a thing in network code? I would have left the regmap
> declaration where it is.

Long story short, I worked previously on a small refactor of this driver to add
support for a new family of sensors. During the different iterations of the
patchset, one thing that was agreed was unifying the driver coding style to
reverse xmas tree. For some extra context, here's the thread:
https://lore.kernel.org/all/20220814145249.701f1261@jic23-huawei/

> > @@ -65,7 +65,7 @@ static struct i2c_driver bmp280_i2c_driver = {
> >                 .of_match_table = bmp280_of_i2c_match,
> >                 .pm = pm_ptr(&bmp280_dev_pm_ops),
> >         },
> > -       .probe          = bmp280_i2c_probe,
> > +       .probe_new      = bmp280_i2c_probe,
> >         .id_table       = bmp280_i2c_id,
> >  };
> >  module_i2c_driver(bmp280_i2c_driver);
> 
> Best regards
> Uwe
> 
Kind regards
Angel

  reply	other threads:[~2022-11-02  0:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30 17:51 [RFC PATCH 0/2] i2c: core: Introduce i2c_client_get_device_id helper Angel Iglesias
2022-10-30 17:52 ` [RFC PATCH 1/2] i2c: core: Introduce i2c_client_get_device_id helper function Angel Iglesias
2022-11-01 13:09   ` Wolfram Sang
2022-11-01 14:54   ` Uwe Kleine-König
2022-11-01 23:53     ` Angel Iglesias
2022-10-30 17:53 ` [RFC PATCH 2/2] iio: pressure: bmp280: convert to i2c's .probe_new() Angel Iglesias
2022-11-01 21:52   ` Uwe Kleine-König
2022-11-02  0:16     ` Angel Iglesias [this message]
2022-11-05 14:54       ` Jonathan Cameron
2022-11-01 14:58 ` [RFC PATCH 0/2] i2c: core: Introduce i2c_client_get_device_id helper Andy Shevchenko
2022-11-05 14:56   ` Jonathan Cameron
2022-11-05 21:29     ` Wolfram Sang
2022-11-06 12:09       ` Jonathan Cameron

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=ae43aa9c3a9f29d0ecef69756a539ebf00a84ab1.camel@gmail.com \
    --to=ang.iglesiasg@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=paul@crapouillou.net \
    --cc=rafael.j.wysocki@intel.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=ulf.hansson@linaro.org \
    /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