* [PATCH 0/2] iio: pressure: bmp280: Use i2c_get_match_data()
@ 2023-08-05 23:15 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-05 23:15 ` [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data Angel Iglesias
0 siblings, 2 replies; 7+ messages in thread
From: Angel Iglesias @ 2023-08-05 23:15 UTC (permalink / raw)
To: linux-iio
Cc: Angel Iglesias, Jonathan Cameron, Lars-Peter Clausen,
Andy Shevchenko, Uwe Kleine-König, linux-kernel
Minor cleanup of BMP280 i2c code and migration to the new helper function
i2c_get_match_data() instead of device_get_match_data().
Patch 1 reorders local variable declarations on probe function following
the reverse xmas tree to unify styles with other parts of the driver.
Patch 2 ports adtops the i2c_get_match_data() helper on the i2c probe.
Angel Iglesias (2):
iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order
iio: pressure: bmp280: Use i2c_get_match_data
drivers/iio/pressure/bmp280-i2c.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
base-commit: 6d9c5ae6a70c9e1017a7a252bc730d9168e219ce
--
2.41.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order
2023-08-05 23:15 [PATCH 0/2] iio: pressure: bmp280: Use i2c_get_match_data() Angel Iglesias
@ 2023-08-05 23:15 ` Angel Iglesias
2023-08-07 15:43 ` Andy Shevchenko
2023-08-05 23:15 ` [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data Angel Iglesias
1 sibling, 1 reply; 7+ messages in thread
From: Angel Iglesias @ 2023-08-05 23:15 UTC (permalink / raw)
To: linux-iio
Cc: Angel Iglesias, Jonathan Cameron, Lars-Peter Clausen,
Andy Shevchenko, Uwe Kleine-König, linux-kernel
Minor cleanup reordering local variable declarations following reverse
christmas tree convention.
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 dbe630ad05b5..693eb1975fdc 100644
--- a/drivers/iio/pressure/bmp280-i2c.c
+++ b/drivers/iio/pressure/bmp280-i2c.c
@@ -7,9 +7,9 @@
static int bmp280_i2c_probe(struct i2c_client *client)
{
- struct regmap *regmap;
- const struct bmp280_chip_info *chip_info;
const struct i2c_device_id *id = i2c_client_get_device_id(client);
+ const struct bmp280_chip_info *chip_info;
+ struct regmap *regmap;
chip_info = device_get_match_data(&client->dev);
if (!chip_info)
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data
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-05 23:15 ` Angel Iglesias
2023-08-06 11:30 ` Uwe Kleine-König
1 sibling, 1 reply; 7+ messages in thread
From: Angel Iglesias @ 2023-08-05 23:15 UTC (permalink / raw)
To: linux-iio
Cc: Angel Iglesias, Jonathan Cameron, Lars-Peter Clausen,
Andy Shevchenko, Uwe Kleine-König, linux-kernel
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;
regmap = devm_regmap_init_i2c(client, chip_info->regmap_config);
if (IS_ERR(regmap)) {
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data
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
0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2023-08-06 11:30 UTC (permalink / raw)
To: Angel Iglesias
Cc: linux-iio, Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]
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.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order
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
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-07 15:43 UTC (permalink / raw)
To: Angel Iglesias
Cc: linux-iio, Jonathan Cameron, Lars-Peter Clausen,
Uwe Kleine-König, linux-kernel
On Sun, Aug 06, 2023 at 01:15:02AM +0200, Angel Iglesias wrote:
> Minor cleanup reordering local variable declarations following reverse
> christmas tree convention.
What about other functions there? Are all of them ordered correctly?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] iio: pressure: bmp280: Use i2c_get_match_data
2023-08-06 11:30 ` Uwe Kleine-König
@ 2023-08-12 15:47 ` Angel Iglesias
0 siblings, 0 replies; 7+ messages in thread
From: Angel Iglesias @ 2023-08-12 15:47 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: linux-iio, Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko,
linux-kernel
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] iio: pressure: bmp280: i2c: Rearrange vars in reverse xmas tree order
2023-08-07 15:43 ` Andy Shevchenko
@ 2023-08-12 15:50 ` Angel Iglesias
0 siblings, 0 replies; 7+ messages in thread
From: Angel Iglesias @ 2023-08-12 15:50 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-iio, Jonathan Cameron, Lars-Peter Clausen,
Uwe Kleine-König, linux-kernel
On Mon, 2023-08-07 at 18:43 +0300, Andy Shevchenko wrote:
> On Sun, Aug 06, 2023 at 01:15:02AM +0200, Angel Iglesias wrote:
> > Minor cleanup reordering local variable declarations following reverse
> > christmas tree convention.
>
> What about other functions there? Are all of them ordered correctly?
>
This one was a leftover from previous work I did on this driver. I will check
the rest of the drive and update it to follow the same convention if required.
Thank you for your time.
Kind regards
Angel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-12 15:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.