From: Angel Iglesias <ang.iglesiasg@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data
Date: Sat, 12 Aug 2023 17:47:59 +0200 [thread overview]
Message-ID: <6d923240417c3e679cfec6c79767b80e4ea9605b.camel@gmail.com> (raw)
In-Reply-To: <20230806113001.26neek3slt3w77zt@pengutronix.de>
On Sun, 2023-08-06 at 13:30 +0200, Uwe Kleine-König wrote:
> On Sun, Aug 06, 2023 at 01:15:03AM +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..4ebaa4edc4fc 100644
> > --- a/drivers/iio/pressure/bmp280-i2c.c
> > +++ b/drivers/iio/pressure/bmp280-i2c.c
> > @@ -11,9 +11,9 @@ 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);
> > + chip_info = i2c_get_match_data(client);
> > if (!chip_info)
> > - chip_info = (const struct bmp280_chip_info *) id-
> > >driver_data;
> > + return -ENODEV;
>
> the old code assumed that chip_info isn't NULL (implicitly by
> dereferencing that pointer in the line below). I wouldn't change
> semantics in a patch converting to a helper and so just do:
>
> - chip_info = device_get_match_data(&client->dev);
> + chip_info = i2c_get_match_data(client);
> - if (!chip_info)
> - chip_info = (const struct bmp280_chip_info *) id->driver_data;
>
> or alternatively, if you think adding a check is a good idea, add an
> error message in the error path and mention the semantic change in the
> commit log.
>
Oh I see. I didn't take into account all this. Thanks for your time
> Best regards
> Uwe
>
Kind regards
Angel
prev parent reply other threads:[~2023-08-12 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-05 23:15 [PATCH 0/2] iio: pressure: bmp280: Use i2c_get_match_data() Angel Iglesias
2023-08-05 23:15 ` [PATCH 1/2] iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order Angel Iglesias
2023-08-07 15:43 ` Andy Shevchenko
2023-08-12 15:50 ` Angel Iglesias
2023-08-05 23:15 ` [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data Angel Iglesias
2023-08-06 11:30 ` Uwe Kleine-König
2023-08-12 15:47 ` Angel Iglesias [this message]
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=6d923240417c3e679cfec6c79767b80e4ea9605b.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=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®