LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read
@ 2020-10-18  3:25 Vaishnav M A
  2020-10-18 11:24 ` Jonathan Cameron
  2020-10-18 11:35 ` Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Vaishnav M A @ 2020-10-18  3:25 UTC (permalink / raw)
  To: jic23, knaack.h, lars, alexandru.ardelean, nish.malpani25,
	matt.ranostay, linux-iio, linux-kernel
  Cc: jkridner, drew, robertcnelson, rajkovic, vaishnav

replace the of_property_read_u32 for reading the amstaos,cover-comp-gain
property with device_property_read_u32,allows the driver to
get the properties information using the more generic device_property_*
helpers and opens the possibility of passing the properties during
platform instantiation of the device by a suitably populated
struct property_entry.

Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
---
 v2:
	- fix commit message
 drivers/iio/light/tsl2563.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index abc8d7db8dc1..1f1b8b7cefa4 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
 	struct iio_dev *indio_dev;
 	struct tsl2563_chip *chip;
 	struct tsl2563_platform_data *pdata = client->dev.platform_data;
-	struct device_node *np = client->dev.of_node;
 	int err = 0;
 	u8 id = 0;
 
@@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
 	chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
 	chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
 
-	if (pdata)
+	if (pdata) {
 		chip->cover_comp_gain = pdata->cover_comp_gain;
-	else if (np)
-		of_property_read_u32(np, "amstaos,cover-comp-gain",
-				     &chip->cover_comp_gain);
-	else
-		chip->cover_comp_gain = 1;
+	} else {
+		err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
+					       &chip->cover_comp_gain);
+		if (err)
+			chip->cover_comp_gain = 1;
+	}
 
 	dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
 	indio_dev->name = client->name;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read
  2020-10-18  3:25 [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read Vaishnav M A
@ 2020-10-18 11:24 ` Jonathan Cameron
  2020-10-18 11:35 ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2020-10-18 11:24 UTC (permalink / raw)
  To: Vaishnav M A
  Cc: knaack.h, lars, alexandru.ardelean, nish.malpani25,
	matt.ranostay, linux-iio, linux-kernel, jkridner, drew,
	robertcnelson, rajkovic

On Sun, 18 Oct 2020 08:55:43 +0530
Vaishnav M A <vaishnav@beagleboard.org> wrote:

> replace the of_property_read_u32 for reading the amstaos,cover-comp-gain
> property with device_property_read_u32,allows the driver to
> get the properties information using the more generic device_property_*
> helpers and opens the possibility of passing the properties during
> platform instantiation of the device by a suitably populated
> struct property_entry.
> 
> Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
See review for v1. Most of it still applies, I just hadn't realised
you'd sent a v2.  As I mentioned on one of your other patches, if
you send a v2 without any comments on v1, please reply yourself to say
you have done so.  Otherwise, people may well review the wrong version.

Thanks,

Jonathan

> ---
>  v2:
> 	- fix commit message
>  drivers/iio/light/tsl2563.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index abc8d7db8dc1..1f1b8b7cefa4 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
>  	struct iio_dev *indio_dev;
>  	struct tsl2563_chip *chip;
>  	struct tsl2563_platform_data *pdata = client->dev.platform_data;
> -	struct device_node *np = client->dev.of_node;
>  	int err = 0;
>  	u8 id = 0;
>  
> @@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
>  	chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
>  	chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
>  
> -	if (pdata)
> +	if (pdata) {
>  		chip->cover_comp_gain = pdata->cover_comp_gain;
> -	else if (np)
> -		of_property_read_u32(np, "amstaos,cover-comp-gain",
> -				     &chip->cover_comp_gain);
> -	else
> -		chip->cover_comp_gain = 1;
> +	} else {
> +		err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
> +					       &chip->cover_comp_gain);
> +		if (err)
> +			chip->cover_comp_gain = 1;
> +	}
>  
>  	dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
>  	indio_dev->name = client->name;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read
  2020-10-18  3:25 [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read Vaishnav M A
  2020-10-18 11:24 ` Jonathan Cameron
@ 2020-10-18 11:35 ` Jonathan Cameron
  2020-10-18 14:44   ` Vaishnav M A
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2020-10-18 11:35 UTC (permalink / raw)
  To: Vaishnav M A
  Cc: knaack.h, lars, alexandru.ardelean, nish.malpani25,
	matt.ranostay, linux-iio, linux-kernel, jkridner, drew,
	robertcnelson, rajkovic

On Sun, 18 Oct 2020 08:55:43 +0530
Vaishnav M A <vaishnav@beagleboard.org> wrote:

> replace the of_property_read_u32 for reading the amstaos,cover-comp-gain
> property with device_property_read_u32,allows the driver to
> get the properties information using the more generic device_property_*
> helpers and opens the possibility of passing the properties during
> platform instantiation of the device by a suitably populated
> struct property_entry.
> 
> Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
Please tidy up that description in a similar fashion to I've suggested in
other reviews.  Code looks fine.

On another day I might have just fixed that description whilst applying but
we have lots of time at this point in the cycle, hence I'm bouncing
them back to you ;)

Thanks,

Jonathan

> ---
>  v2:
> 	- fix commit message
>  drivers/iio/light/tsl2563.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index abc8d7db8dc1..1f1b8b7cefa4 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
>  	struct iio_dev *indio_dev;
>  	struct tsl2563_chip *chip;
>  	struct tsl2563_platform_data *pdata = client->dev.platform_data;
> -	struct device_node *np = client->dev.of_node;
>  	int err = 0;
>  	u8 id = 0;
>  
> @@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
>  	chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
>  	chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
>  
> -	if (pdata)
> +	if (pdata) {
>  		chip->cover_comp_gain = pdata->cover_comp_gain;
> -	else if (np)
> -		of_property_read_u32(np, "amstaos,cover-comp-gain",
> -				     &chip->cover_comp_gain);
> -	else
> -		chip->cover_comp_gain = 1;
> +	} else {
> +		err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
> +					       &chip->cover_comp_gain);
> +		if (err)
> +			chip->cover_comp_gain = 1;
> +	}
>  
>  	dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
>  	indio_dev->name = client->name;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read
  2020-10-18 11:35 ` Jonathan Cameron
@ 2020-10-18 14:44   ` Vaishnav M A
  2020-10-18 20:42     ` Vaishnav M A
  0 siblings, 1 reply; 5+ messages in thread
From: Vaishnav M A @ 2020-10-18 14:44 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Alexandru Ardelean,
	nish.malpani25, Matt Ranostay,
	open list:IIO SUBSYSTEM AND DRIVERS, open list, Jason Kridner,
	Drew Fustini, Robert Nelson, Ivan Rajković

On Sun, Oct 18, 2020 at 5:05 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sun, 18 Oct 2020 08:55:43 +0530
> Vaishnav M A <vaishnav@beagleboard.org> wrote:
>
> > replace the of_property_read_u32 for reading the amstaos,cover-comp-gain
> > property with device_property_read_u32,allows the driver to
> > get the properties information using the more generic device_property_*
> > helpers and opens the possibility of passing the properties during
> > platform instantiation of the device by a suitably populated
> > struct property_entry.
> >
> > Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
> Please tidy up that description in a similar fashion to I've suggested in
> other reviews.  Code looks fine.
>
> On another day I might have just fixed that description whilst applying but
> we have lots of time at this point in the cycle, hence I'm bouncing
> them back to you ;)
>
> Thanks,
>
> Jonathan
>
Thank you Jonathan for the review, sorry about missing to notify after
sending the v2 patch(and repeating the same mistake a few times), will
make sure that it won't happen again. I have sent a v3 patch updated with
all the suggested changes : https://lore.kernel.org/patchwork/patch/1322194/

Thanks and Regards,
Vaishnav
> > ---
> >  v2:
> >       - fix commit message
> >  drivers/iio/light/tsl2563.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> > index abc8d7db8dc1..1f1b8b7cefa4 100644
> > --- a/drivers/iio/light/tsl2563.c
> > +++ b/drivers/iio/light/tsl2563.c
> > @@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
> >       struct iio_dev *indio_dev;
> >       struct tsl2563_chip *chip;
> >       struct tsl2563_platform_data *pdata = client->dev.platform_data;
> > -     struct device_node *np = client->dev.of_node;
> >       int err = 0;
> >       u8 id = 0;
> >
> > @@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
> >       chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
> >       chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
> >
> > -     if (pdata)
> > +     if (pdata) {
> >               chip->cover_comp_gain = pdata->cover_comp_gain;
> > -     else if (np)
> > -             of_property_read_u32(np, "amstaos,cover-comp-gain",
> > -                                  &chip->cover_comp_gain);
> > -     else
> > -             chip->cover_comp_gain = 1;
> > +     } else {
> > +             err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
> > +                                            &chip->cover_comp_gain);
> > +             if (err)
> > +                     chip->cover_comp_gain = 1;
> > +     }
> >
> >       dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
> >       indio_dev->name = client->name;
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read
  2020-10-18 14:44   ` Vaishnav M A
@ 2020-10-18 20:42     ` Vaishnav M A
  0 siblings, 0 replies; 5+ messages in thread
From: Vaishnav M A @ 2020-10-18 20:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Alexandru Ardelean,
	nish.malpani25, Matt Ranostay,
	open list:IIO SUBSYSTEM AND DRIVERS, open list, Jason Kridner,
	Drew Fustini, Robert Nelson, Ivan Rajković

On Sun, Oct 18, 2020 at 8:14 PM Vaishnav M A <vaishnav@beagleboard.org> wrote:
>
> On Sun, Oct 18, 2020 at 5:05 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Sun, 18 Oct 2020 08:55:43 +0530
> > Vaishnav M A <vaishnav@beagleboard.org> wrote:
> >
> > > replace the of_property_read_u32 for reading the amstaos,cover-comp-gain
> > > property with device_property_read_u32,allows the driver to
> > > get the properties information using the more generic device_property_*
> > > helpers and opens the possibility of passing the properties during
> > > platform instantiation of the device by a suitably populated
> > > struct property_entry.
> > >
> > > Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
> > Please tidy up that description in a similar fashion to I've suggested in
> > other reviews.  Code looks fine.
> >
> > On another day I might have just fixed that description whilst applying but
> > we have lots of time at this point in the cycle, hence I'm bouncing
> > them back to you ;)
> >
> > Thanks,
> >
> > Jonathan
> >
> Thank you Jonathan for the review, sorry about missing to notify after
> sending the v2 patch(and repeating the same mistake a few times), will
> make sure that it won't happen again. I have sent a v3 patch updated with
> all the suggested changes : https://lore.kernel.org/patchwork/patch/1322194/
>
> Thanks and Regards,
> Vaishnav
Updated v4 patch submitted considering comments from Andy Shevchenko
on a different patch to refer to the functions like function() and updated the
commit title to a shorter one, similar to one used for similar changes
within the subsystem, like in 00fa493b9989
("iio:proximity:as3935: Drop of_match_ptr and use generic fw accessors")
https://lore.kernel.org/patchwork/patch/1322221/
> > > ---
> > >  v2:
> > >       - fix commit message
> > >  drivers/iio/light/tsl2563.c | 14 +++++++-------
> > >  1 file changed, 7 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> > > index abc8d7db8dc1..1f1b8b7cefa4 100644
> > > --- a/drivers/iio/light/tsl2563.c
> > > +++ b/drivers/iio/light/tsl2563.c
> > > @@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
> > >       struct iio_dev *indio_dev;
> > >       struct tsl2563_chip *chip;
> > >       struct tsl2563_platform_data *pdata = client->dev.platform_data;
> > > -     struct device_node *np = client->dev.of_node;
> > >       int err = 0;
> > >       u8 id = 0;
> > >
> > > @@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
> > >       chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
> > >       chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
> > >
> > > -     if (pdata)
> > > +     if (pdata) {
> > >               chip->cover_comp_gain = pdata->cover_comp_gain;
> > > -     else if (np)
> > > -             of_property_read_u32(np, "amstaos,cover-comp-gain",
> > > -                                  &chip->cover_comp_gain);
> > > -     else
> > > -             chip->cover_comp_gain = 1;
> > > +     } else {
> > > +             err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
> > > +                                            &chip->cover_comp_gain);
> > > +             if (err)
> > > +                     chip->cover_comp_gain = 1;
> > > +     }
> > >
> > >       dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
> > >       indio_dev->name = client->name;
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18  3:25 [PATCH v2] iio: light: tsl2563 change of_property_read to device_property_read Vaishnav M A
2020-10-18 11:24 ` Jonathan Cameron
2020-10-18 11:35 ` Jonathan Cameron
2020-10-18 14:44   ` Vaishnav M A
2020-10-18 20:42     ` Vaishnav M A

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git