linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/7] iio: srf08: add device tree table
@ 2017-08-02 23:25 Andreas Klinger
  2017-08-12 11:54 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Klinger @ 2017-08-02 23:25 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: wsa-z923LK4zBo2bacvFa/9K2g, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Added MODULE_DEVICE_TABLE for device tree bindings.

It used to work without it by using the i2c_device_id table, but adding the
table makes everything clear and documented.

Signed-off-by: Andreas Klinger <ak-n176/SwNRljddJNmlsFzeA@public.gmane.org>
---
 drivers/iio/proximity/srf08.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
index 92e1799c430c..a2913a5bf68e 100644
--- a/drivers/iio/proximity/srf08.c
+++ b/drivers/iio/proximity/srf08.c
@@ -455,6 +455,14 @@ static int srf08_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
+static const struct of_device_id of_srf08_match[] = {
+	{ .compatible = "devantech,srf08", (void *)SRF08},
+	{ .compatible = "devantech,srf10", (void *)SRF10},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, of_srf08_match);
+
 static const struct i2c_device_id srf08_id[] = {
 	{ "srf08", SRF08 },
 	{ "srf10", SRF10 },
@@ -465,6 +473,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);
 static struct i2c_driver srf08_driver = {
 	.driver = {
 		.name	= "srf08",
+		.of_match_table	= of_srf08_match,
 	},
 	.probe = srf08_probe,
 	.id_table = srf08_id,
-- 
2.1.4


-- 

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

* Re: [PATCH 4/7] iio: srf08: add device tree table
  2017-08-02 23:25 [PATCH 4/7] iio: srf08: add device tree table Andreas Klinger
@ 2017-08-12 11:54 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-08-12 11:54 UTC (permalink / raw)
  To: Andreas Klinger
  Cc: knaack.h, lars, pmeerw, linux-iio, wsa, robh+dt, mark.rutland,
	linux-i2c, devicetree, linux-kernel

On Thu, 3 Aug 2017 01:25:04 +0200
Andreas Klinger <ak@it-klinger.de> wrote:

> Added MODULE_DEVICE_TABLE for device tree bindings.
> 
> It used to work without it by using the i2c_device_id table, but adding the
> table makes everything clear and documented.
> 
> Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Looks fine.  Will pick up once the rest are sorted.

Jonathan
> ---
>  drivers/iio/proximity/srf08.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iio/proximity/srf08.c b/drivers/iio/proximity/srf08.c
> index 92e1799c430c..a2913a5bf68e 100644
> --- a/drivers/iio/proximity/srf08.c
> +++ b/drivers/iio/proximity/srf08.c
> @@ -455,6 +455,14 @@ static int srf08_probe(struct i2c_client *client,
>  	return devm_iio_device_register(&client->dev, indio_dev);
>  }
>  
> +static const struct of_device_id of_srf08_match[] = {
> +	{ .compatible = "devantech,srf08", (void *)SRF08},
> +	{ .compatible = "devantech,srf10", (void *)SRF10},
> +	{},
> +};
> +
> +MODULE_DEVICE_TABLE(of, of_srf08_match);
> +
>  static const struct i2c_device_id srf08_id[] = {
>  	{ "srf08", SRF08 },
>  	{ "srf10", SRF10 },
> @@ -465,6 +473,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);
>  static struct i2c_driver srf08_driver = {
>  	.driver = {
>  		.name	= "srf08",
> +		.of_match_table	= of_srf08_match,
>  	},
>  	.probe = srf08_probe,
>  	.id_table = srf08_id,

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

end of thread, other threads:[~2017-08-12 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02 23:25 [PATCH 4/7] iio: srf08: add device tree table Andreas Klinger
2017-08-12 11:54 ` 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).