LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] iio: proximity: as3935 change of_property_read to device_property_read
@ 2020-10-18  3:17 Vaishnav M A
  2020-10-18 11:17 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Vaishnav M A @ 2020-10-18  3:17 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, alexandru.ardelean, linus.walleij,
	linux-iio, linux-kernel
  Cc: jkridner, drew, robertcnelson, rajkovic

replace the of_property_read_u32 for reading
the ams,tuning-capacitor-pf, ams,nflwdth properties 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/proximity/as3935.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index c339e7339ec8..7e47ddf89a56 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -355,7 +355,6 @@ static int as3935_probe(struct spi_device *spi)
 	struct iio_dev *indio_dev;
 	struct iio_trigger *trig;
 	struct as3935_state *st;
-	struct device_node *np = spi->dev.of_node;
 	int ret;
 
 	/* Be sure lightning event interrupt is specified */
@@ -374,7 +373,7 @@ static int as3935_probe(struct spi_device *spi)
 	spi_set_drvdata(spi, indio_dev);
 	mutex_init(&st->lock);
 
-	ret = of_property_read_u32(np,
+	ret = device_property_read_u32(&spi->dev,
 			"ams,tuning-capacitor-pf", &st->tune_cap);
 	if (ret) {
 		st->tune_cap = 0;
@@ -390,7 +389,7 @@ static int as3935_probe(struct spi_device *spi)
 		return -EINVAL;
 	}
 
-	ret = of_property_read_u32(np,
+	ret = device_property_read_u32(&spi->dev,
 			"ams,nflwdth", &st->nflwdth_reg);
 	if (!ret && st->nflwdth_reg > AS3935_NFLWDTH_MASK) {
 		dev_err(&spi->dev,
-- 
2.25.1


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

* Re: [PATCH v2] iio: proximity: as3935 change of_property_read to device_property_read
  2020-10-18  3:17 [PATCH v2] iio: proximity: as3935 change of_property_read to device_property_read Vaishnav M A
@ 2020-10-18 11:17 ` Jonathan Cameron
  2020-10-18 15:35   ` Vaishnav M A
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2020-10-18 11:17 UTC (permalink / raw)
  To: Vaishnav M A
  Cc: knaack.h, lars, pmeerw, alexandru.ardelean, linus.walleij,
	linux-iio, linux-kernel, jkridner, drew, robertcnelson, rajkovic

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

A very similar change was made recently in
00fa493b9989 ("iio:proximity:as3935: Drop of_match_ptr and use generic fw accessors")
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00fa493b99894b930e431c05a9dba294c5189120

Review follows for reference as I wrote it before remembering the above!

> replace the of_property_read_u32 for reading
> the ams,tuning-capacitor-pf, ams,nflwdth properties 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

Please format this to aid readability.

Replace of_property_read_u32() with device_property_read_u32,
when reading the ams,tuning-capacitor-pf and ams,nflwdth properties.
This opens up the possibility of passing the properties during platform
instantiation of the device by a suitable populated struct property_entry.


As in your other patch, please add the header property.h.

> 
> Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
> ---
>  v2:
> 	- fix commit message
>  drivers/iio/proximity/as3935.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
> index c339e7339ec8..7e47ddf89a56 100644
> --- a/drivers/iio/proximity/as3935.c
> +++ b/drivers/iio/proximity/as3935.c
> @@ -355,7 +355,6 @@ static int as3935_probe(struct spi_device *spi)
>  	struct iio_dev *indio_dev;
>  	struct iio_trigger *trig;
>  	struct as3935_state *st;
> -	struct device_node *np = spi->dev.of_node;
>  	int ret;
>  
>  	/* Be sure lightning event interrupt is specified */
> @@ -374,7 +373,7 @@ static int as3935_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, indio_dev);
>  	mutex_init(&st->lock);
>  
> -	ret = of_property_read_u32(np,
> +	ret = device_property_read_u32(&spi->dev,
>  			"ams,tuning-capacitor-pf", &st->tune_cap);
>  	if (ret) {
>  		st->tune_cap = 0;
> @@ -390,7 +389,7 @@ static int as3935_probe(struct spi_device *spi)
>  		return -EINVAL;
>  	}
>  
> -	ret = of_property_read_u32(np,
> +	ret = device_property_read_u32(&spi->dev,
>  			"ams,nflwdth", &st->nflwdth_reg);
>  	if (!ret && st->nflwdth_reg > AS3935_NFLWDTH_MASK) {
>  		dev_err(&spi->dev,


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

* Re: [PATCH v2] iio: proximity: as3935 change of_property_read to device_property_read
  2020-10-18 11:17 ` Jonathan Cameron
@ 2020-10-18 15:35   ` Vaishnav M A
  0 siblings, 0 replies; 3+ messages in thread
From: Vaishnav M A @ 2020-10-18 15:35 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Alexandru Ardelean, Linus Walleij,
	open list:IIO SUBSYSTEM AND DRIVERS, open list, Jason Kridner,
	Drew Fustini, Robert Nelson, Ivan Rajković

On Sun, Oct 18, 2020 at 4:47 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sun, 18 Oct 2020 08:47:32 +0530
> Vaishnav M A <vaishnav@beagleboard.org> wrote:
>
> A very similar change was made recently in
> 00fa493b9989 ("iio:proximity:as3935: Drop of_match_ptr and use generic fw accessors")
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00fa493b99894b930e431c05a9dba294c5189120
>
Sorry for missing that, happy to see this change.

Thanks,
Vaishnav M A
> Review follows for reference as I wrote it before remembering the above!
>
> > replace the of_property_read_u32 for reading
> > the ams,tuning-capacitor-pf, ams,nflwdth properties 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
>
> Please format this to aid readability.
>
> Replace of_property_read_u32() with device_property_read_u32,
> when reading the ams,tuning-capacitor-pf and ams,nflwdth properties.
> This opens up the possibility of passing the properties during platform
> instantiation of the device by a suitable populated struct property_entry.
>
>
> As in your other patch, please add the header property.h.
>
> >
> > Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
> > ---
> >  v2:
> >       - fix commit message
> >  drivers/iio/proximity/as3935.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
> > index c339e7339ec8..7e47ddf89a56 100644
> > --- a/drivers/iio/proximity/as3935.c
> > +++ b/drivers/iio/proximity/as3935.c
> > @@ -355,7 +355,6 @@ static int as3935_probe(struct spi_device *spi)
> >       struct iio_dev *indio_dev;
> >       struct iio_trigger *trig;
> >       struct as3935_state *st;
> > -     struct device_node *np = spi->dev.of_node;
> >       int ret;
> >
> >       /* Be sure lightning event interrupt is specified */
> > @@ -374,7 +373,7 @@ static int as3935_probe(struct spi_device *spi)
> >       spi_set_drvdata(spi, indio_dev);
> >       mutex_init(&st->lock);
> >
> > -     ret = of_property_read_u32(np,
> > +     ret = device_property_read_u32(&spi->dev,
> >                       "ams,tuning-capacitor-pf", &st->tune_cap);
> >       if (ret) {
> >               st->tune_cap = 0;
> > @@ -390,7 +389,7 @@ static int as3935_probe(struct spi_device *spi)
> >               return -EINVAL;
> >       }
> >
> > -     ret = of_property_read_u32(np,
> > +     ret = device_property_read_u32(&spi->dev,
> >                       "ams,nflwdth", &st->nflwdth_reg);
> >       if (!ret && st->nflwdth_reg > AS3935_NFLWDTH_MASK) {
> >               dev_err(&spi->dev,
>

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18  3:17 [PATCH v2] iio: proximity: as3935 change of_property_read to device_property_read Vaishnav M A
2020-10-18 11:17 ` Jonathan Cameron
2020-10-18 15:35   ` 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