linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: accel: adxl372: Add OF device ID table
@ 2020-07-20 13:49 Alexandru Ardelean
  2020-07-21 18:37 ` Andy Shevchenko
  2020-07-22  7:30 ` [PATCH v2] iio: adxl372_i2c: " Alexandru Ardelean
  0 siblings, 2 replies; 5+ messages in thread
From: Alexandru Ardelean @ 2020-07-20 13:49 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, Stefan Popa, Alexandru Ardelean

From: Stefan Popa <stefan.popa@analog.com>

The driver does not have a struct of_device_id table, but supported
devices are registered via Device Trees. This patch adds OF device ID
table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/accel/adxl372_i2c.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iio/accel/adxl372_i2c.c b/drivers/iio/accel/adxl372_i2c.c
index e1affe480c77..5197d1eb6803 100644
--- a/drivers/iio/accel/adxl372_i2c.c
+++ b/drivers/iio/accel/adxl372_i2c.c
@@ -8,6 +8,8 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #include "adxl372.h"
 
@@ -46,9 +48,16 @@ static const struct i2c_device_id adxl372_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adxl372_i2c_id);
 
+static const struct of_device_id adxl372_of_match[] = {
+	{ .compatible = "adi,adxl372" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, adxl372_of_match);
+
 static struct i2c_driver adxl372_i2c_driver = {
 	.driver = {
 		.name = "adxl372_i2c",
+		.of_match_table = adxl372_of_match,
 	},
 	.probe = adxl372_i2c_probe,
 	.id_table = adxl372_i2c_id,
-- 
2.17.1


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

* Re: [PATCH] iio: accel: adxl372: Add OF device ID table
  2020-07-20 13:49 [PATCH] iio: accel: adxl372: Add OF device ID table Alexandru Ardelean
@ 2020-07-21 18:37 ` Andy Shevchenko
  2020-07-22  7:08   ` Alexandru Ardelean
  2020-07-22  7:30 ` [PATCH v2] iio: adxl372_i2c: " Alexandru Ardelean
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2020-07-21 18:37 UTC (permalink / raw)
  To: Alexandru Ardelean
  Cc: linux-iio, Linux Kernel Mailing List, Jonathan Cameron, Stefan Popa

On Mon, Jul 20, 2020 at 4:48 PM Alexandru Ardelean
<alexandru.ardelean@analog.com> wrote:
>
> From: Stefan Popa <stefan.popa@analog.com>
>
> The driver does not have a struct of_device_id table, but supported
> devices are registered via Device Trees. This patch adds OF device ID
> table.
>
> Signed-off-by: Stefan Popa <stefan.popa@analog.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/accel/adxl372_i2c.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/iio/accel/adxl372_i2c.c b/drivers/iio/accel/adxl372_i2c.c
> index e1affe480c77..5197d1eb6803 100644
> --- a/drivers/iio/accel/adxl372_i2c.c
> +++ b/drivers/iio/accel/adxl372_i2c.c
> @@ -8,6 +8,8 @@
>  #include <linux/i2c.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>


> +#include <linux/of.h>
> +#include <linux/of_device.h>

With the huge patch series from Jonathan I think you may learn that
proper header here is

mod_devicetable.h.


>
>  #include "adxl372.h"
>
> @@ -46,9 +48,16 @@ static const struct i2c_device_id adxl372_i2c_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, adxl372_i2c_id);
>
> +static const struct of_device_id adxl372_of_match[] = {
> +       { .compatible = "adi,adxl372" },

> +       { },

No comma, please!

> +};
> +MODULE_DEVICE_TABLE(of, adxl372_of_match);
> +
>  static struct i2c_driver adxl372_i2c_driver = {
>         .driver = {
>                 .name = "adxl372_i2c",
> +               .of_match_table = adxl372_of_match,
>         },
>         .probe = adxl372_i2c_probe,
>         .id_table = adxl372_i2c_id,
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] iio: accel: adxl372: Add OF device ID table
  2020-07-21 18:37 ` Andy Shevchenko
@ 2020-07-22  7:08   ` Alexandru Ardelean
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandru Ardelean @ 2020-07-22  7:08 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Alexandru Ardelean, linux-iio, Linux Kernel Mailing List,
	Jonathan Cameron, Stefan Popa

On Tue, Jul 21, 2020 at 9:39 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Jul 20, 2020 at 4:48 PM Alexandru Ardelean
> <alexandru.ardelean@analog.com> wrote:
> >
> > From: Stefan Popa <stefan.popa@analog.com>
> >
> > The driver does not have a struct of_device_id table, but supported
> > devices are registered via Device Trees. This patch adds OF device ID
> > table.
> >
> > Signed-off-by: Stefan Popa <stefan.popa@analog.com>
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/accel/adxl372_i2c.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/iio/accel/adxl372_i2c.c b/drivers/iio/accel/adxl372_i2c.c
> > index e1affe480c77..5197d1eb6803 100644
> > --- a/drivers/iio/accel/adxl372_i2c.c
> > +++ b/drivers/iio/accel/adxl372_i2c.c
> > @@ -8,6 +8,8 @@
> >  #include <linux/i2c.h>
> >  #include <linux/module.h>
> >  #include <linux/regmap.h>
>
>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
>
> With the huge patch series from Jonathan I think you may learn that
> proper header here is
>
> mod_devicetable.h.

yep;
thanks for pointing that out;

>
>
> >
> >  #include "adxl372.h"
> >
> > @@ -46,9 +48,16 @@ static const struct i2c_device_id adxl372_i2c_id[] = {
> >  };
> >  MODULE_DEVICE_TABLE(i2c, adxl372_i2c_id);
> >
> > +static const struct of_device_id adxl372_of_match[] = {
> > +       { .compatible = "adi,adxl372" },
>
> > +       { },
>
> No comma, please!
>
> > +};
> > +MODULE_DEVICE_TABLE(of, adxl372_of_match);
> > +
> >  static struct i2c_driver adxl372_i2c_driver = {
> >         .driver = {
> >                 .name = "adxl372_i2c",
> > +               .of_match_table = adxl372_of_match,
> >         },
> >         .probe = adxl372_i2c_probe,
> >         .id_table = adxl372_i2c_id,
> > --
> > 2.17.1
> >
>
>
> --
> With Best Regards,
> Andy Shevchenko

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

* [PATCH v2] iio: adxl372_i2c: Add OF device ID table
  2020-07-20 13:49 [PATCH] iio: accel: adxl372: Add OF device ID table Alexandru Ardelean
  2020-07-21 18:37 ` Andy Shevchenko
@ 2020-07-22  7:30 ` Alexandru Ardelean
  2020-07-26 12:30   ` Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Alexandru Ardelean @ 2020-07-22  7:30 UTC (permalink / raw)
  To: linux-iio, linux-kernel; +Cc: jic23, Stefan Popa, Alexandru Ardelean

From: Stefan Popa <stefan.popa@analog.com>

The driver does not have a struct of_device_id table, but supported
devices are registered via Device Trees. This patch adds OF device ID
table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---

Changelog v1 -> v2:
* use linux/mod_devicetable.h include instead for the OF table
* remove comma from null terminator

 drivers/iio/accel/adxl372_i2c.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/iio/accel/adxl372_i2c.c b/drivers/iio/accel/adxl372_i2c.c
index e1affe480c77..9a07ab3d151a 100644
--- a/drivers/iio/accel/adxl372_i2c.c
+++ b/drivers/iio/accel/adxl372_i2c.c
@@ -6,6 +6,7 @@
  */
 
 #include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
 
@@ -46,9 +47,16 @@ static const struct i2c_device_id adxl372_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adxl372_i2c_id);
 
+static const struct of_device_id adxl372_of_match[] = {
+	{ .compatible = "adi,adxl372" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, adxl372_of_match);
+
 static struct i2c_driver adxl372_i2c_driver = {
 	.driver = {
 		.name = "adxl372_i2c",
+		.of_match_table = adxl372_of_match,
 	},
 	.probe = adxl372_i2c_probe,
 	.id_table = adxl372_i2c_id,
-- 
2.17.1


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

* Re: [PATCH v2] iio: adxl372_i2c: Add OF device ID table
  2020-07-22  7:30 ` [PATCH v2] iio: adxl372_i2c: " Alexandru Ardelean
@ 2020-07-26 12:30   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2020-07-26 12:30 UTC (permalink / raw)
  To: Alexandru Ardelean; +Cc: linux-iio, linux-kernel, Stefan Popa

On Wed, 22 Jul 2020 10:30:03 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> From: Stefan Popa <stefan.popa@analog.com>
> 
> The driver does not have a struct of_device_id table, but supported
> devices are registered via Device Trees. This patch adds OF device ID
> table.
> 
> Signed-off-by: Stefan Popa <stefan.popa@analog.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied.

Thanks,

Jonathan

> ---
> 
> Changelog v1 -> v2:
> * use linux/mod_devicetable.h include instead for the OF table
> * remove comma from null terminator
> 
>  drivers/iio/accel/adxl372_i2c.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/iio/accel/adxl372_i2c.c b/drivers/iio/accel/adxl372_i2c.c
> index e1affe480c77..9a07ab3d151a 100644
> --- a/drivers/iio/accel/adxl372_i2c.c
> +++ b/drivers/iio/accel/adxl372_i2c.c
> @@ -6,6 +6,7 @@
>   */
>  
>  #include <linux/i2c.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  
> @@ -46,9 +47,16 @@ static const struct i2c_device_id adxl372_i2c_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, adxl372_i2c_id);
>  
> +static const struct of_device_id adxl372_of_match[] = {
> +	{ .compatible = "adi,adxl372" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, adxl372_of_match);
> +
>  static struct i2c_driver adxl372_i2c_driver = {
>  	.driver = {
>  		.name = "adxl372_i2c",
> +		.of_match_table = adxl372_of_match,
>  	},
>  	.probe = adxl372_i2c_probe,
>  	.id_table = adxl372_i2c_id,


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

end of thread, other threads:[~2020-07-26 12:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 13:49 [PATCH] iio: accel: adxl372: Add OF device ID table Alexandru Ardelean
2020-07-21 18:37 ` Andy Shevchenko
2020-07-22  7:08   ` Alexandru Ardelean
2020-07-22  7:30 ` [PATCH v2] iio: adxl372_i2c: " Alexandru Ardelean
2020-07-26 12:30   ` Jonathan Cameron

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).