linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: ad9832: Add device tree support
@ 2019-05-18 20:48 João Seckler
  2019-05-19 11:19 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: João Seckler @ 2019-05-18 20:48 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman
  Cc: linux-iio, devel, linux-kernel

Add a of_device_id struct variable and subsequent call to
MODULE_DEVICE_TABLE macro to support device tree.

Signed-off-by: João Seckler <joaoseckler@gmail.com>
Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
Co-developed-by: Anderson Reis  <andersonreisrosa@gmail.com>
Signed-off-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
Co-developed-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
---
 drivers/staging/iio/frequency/ad9832.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 74308a2e72db..51e97c74c6b2 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)
 	return 0;
 }
 
+static const struct of_device_id ad9832_of_match[] = {
+	{ .compatible = "adi,ad9832", },
+	{ .compatible = "adi,ad9835", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, ad9832_of_match);
+
 static const struct spi_device_id ad9832_id[] = {
 	{"ad9832", 0},
 	{"ad9835", 0},
-- 
2.11.0


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

* Re: [PATCH] staging: iio: ad9832: Add device tree support
  2019-05-18 20:48 [PATCH] staging: iio: ad9832: Add device tree support João Seckler
@ 2019-05-19 11:19 ` Jonathan Cameron
  2019-05-20  8:49   ` Alexandru Ardelean
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2019-05-19 11:19 UTC (permalink / raw)
  To: João Seckler
  Cc: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
	Hartmut Knaack, Peter Meerwald-Stadler, Greg Kroah-Hartman,
	linux-iio, devel, linux-kernel

On Sat, 18 May 2019 17:48:25 -0300
João Seckler <joaoseckler@gmail.com> wrote:

> Add a of_device_id struct variable and subsequent call to
> MODULE_DEVICE_TABLE macro to support device tree.
> 
> Signed-off-by: João Seckler <joaoseckler@gmail.com>
> Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
> Co-developed-by: Anderson Reis  <andersonreisrosa@gmail.com>
> Signed-off-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
> Co-developed-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
Hi All,

Missing the setting of the relevant entry in the spi_driver structure.
Otherwise looks fine,

Thanks,

Jonathan
> ---
>  drivers/staging/iio/frequency/ad9832.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> index 74308a2e72db..51e97c74c6b2 100644
> --- a/drivers/staging/iio/frequency/ad9832.c
> +++ b/drivers/staging/iio/frequency/ad9832.c
> @@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)
>  	return 0;
>  }
>  
> +static const struct of_device_id ad9832_of_match[] = {
> +	{ .compatible = "adi,ad9832", },
> +	{ .compatible = "adi,ad9835", },
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, ad9832_of_match);
> +
>  static const struct spi_device_id ad9832_id[] = {
>  	{"ad9832", 0},
>  	{"ad9835", 0},


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

* Re: [PATCH] staging: iio: ad9832: Add device tree support
  2019-05-19 11:19 ` Jonathan Cameron
@ 2019-05-20  8:49   ` Alexandru Ardelean
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandru Ardelean @ 2019-05-20  8:49 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: João Seckler, Lars-Peter Clausen, Michael Hennerich,
	Stefan Popa, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman, linux-iio, devel, LKML, Alexandru Ardelean

On Sun, May 19, 2019 at 8:17 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sat, 18 May 2019 17:48:25 -0300
> João Seckler <joaoseckler@gmail.com> wrote:
>
> > Add a of_device_id struct variable and subsequent call to
> > MODULE_DEVICE_TABLE macro to support device tree.
> >
> > Signed-off-by: João Seckler <joaoseckler@gmail.com>
> > Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
> > Co-developed-by: Anderson Reis  <andersonreisrosa@gmail.com>
> > Signed-off-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
> > Co-developed-by: Andre Tadeu de Carvalho <andre.tadeu.de.carvalho@gmail.com>
> Hi All,
>
> Missing the setting of the relevant entry in the spi_driver structure.
> Otherwise looks fine,
>
> Thanks,
>
> Jonathan
> > ---
> >  drivers/staging/iio/frequency/ad9832.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> > index 74308a2e72db..51e97c74c6b2 100644
> > --- a/drivers/staging/iio/frequency/ad9832.c
> > +++ b/drivers/staging/iio/frequency/ad9832.c
> > @@ -451,6 +451,13 @@ static int ad9832_remove(struct spi_device *spi)
> >       return 0;
> >  }
> >
> > +static const struct of_device_id ad9832_of_match[] = {
> > +     { .compatible = "adi,ad9832", },
> > +     { .compatible = "adi,ad9835", },
> > +     { /* sentinel */ },
> > +};
> > +MODULE_DEVICE_TABLE(of, ad9832_of_match);
> > +


Yep.
To clarify what Jonathan said (see line below with plus + ) :

static struct spi_driver ad9832_driver = {
        .driver = {
                .name   = "ad9832",
+              .of_match_table = ad9832_of_match,
        },
        .probe          = ad9832_probe,
        .remove         = ad9832_remove,
        .id_table       = ad9832_id,
};



> >  static const struct spi_device_id ad9832_id[] = {
> >       {"ad9832", 0},
> >       {"ad9835", 0},
>

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

end of thread, other threads:[~2019-05-20  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18 20:48 [PATCH] staging: iio: ad9832: Add device tree support João Seckler
2019-05-19 11:19 ` Jonathan Cameron
2019-05-20  8:49   ` Alexandru Ardelean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).