* [PATCH v3 2/7] adv7180: add of match table
@ 2014-04-14 10:36 Ben Dooks
2014-04-15 11:24 ` Sergei Shtylyov
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Ben Dooks @ 2014-04-14 10:36 UTC (permalink / raw)
To: linux-sh
Add a proper of match id for use when the device is being bound via
device tree, to avoid having to use the i2c old-style binding of the
device.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/media/i2c/adv7180.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 215afa0..687d97b 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -25,6 +25,7 @@
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/slab.h>
+#include <linux/of.h>
#include <media/v4l2-ioctl.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
@@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
MODULE_DEVICE_TABLE(i2c, adv7180_id);
+#ifdef CONFIG_OF
+static const struct of_device_id adv7180_of_id[] = {
+ { .compatible = "adi,adv7180", },
+ { },
+};
+
+MODULE_DEVICE_TABLE(of, adv7180_of_id)
+#endif
+
static struct i2c_driver adv7180_driver = {
.driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
.pm = ADV7180_PM_OPS,
+ .of_match = of_match_ptr(adv7180_of_id),
},
.probe = adv7180_probe,
.remove = adv7180_remove,
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
@ 2014-04-15 11:24 ` Sergei Shtylyov
2014-05-08 23:23 ` Sergei Shtylyov
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2014-04-15 11:24 UTC (permalink / raw)
To: linux-sh
Hello.
On 14-04-2014 14:36, Ben Dooks wrote:
> Add a proper of match id for use when the device is being bound via
> device tree, to avoid having to use the i2c old-style binding of the
> device.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> drivers/media/i2c/adv7180.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index 215afa0..687d97b 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
[...]
> @@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
>
> MODULE_DEVICE_TABLE(i2c, adv7180_id);
>
> +#ifdef CONFIG_OF
Don't think it's worth using #ifdef.
> +static const struct of_device_id adv7180_of_id[] = {
> + { .compatible = "adi,adv7180", },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, adv7180_of_id)
> +#endif
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
2014-04-15 11:24 ` Sergei Shtylyov
@ 2014-05-08 23:23 ` Sergei Shtylyov
2014-05-08 23:47 ` Sergei Shtylyov
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2014-05-08 23:23 UTC (permalink / raw)
To: linux-sh
Hello.
On 04/14/2014 02:36 PM, Ben Dooks wrote:
> Add a proper of match id for use when the device is being bound via
> device tree, to avoid having to use the i2c old-style binding of the
> device.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
From looking at of_i2c_register_devices() in drivers/i2c/i2c-core.c, I got
an impression we don't need this patch. This function builds the I2C device
name by calling of_modalias_node() which just strips the vendor prefix (if
any) from the "compatible" prop.
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
2014-04-15 11:24 ` Sergei Shtylyov
2014-05-08 23:23 ` Sergei Shtylyov
@ 2014-05-08 23:47 ` Sergei Shtylyov
2014-05-09 7:01 ` Geert Uytterhoeven
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2014-05-08 23:47 UTC (permalink / raw)
To: linux-sh
On 05/09/2014 03:23 AM, Sergei Shtylyov wrote:
>> Add a proper of match id for use when the device is being bound via
>> device tree, to avoid having to use the i2c old-style binding of the
>> device.
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> From looking at of_i2c_register_devices() in drivers/i2c/i2c-core.c, I got
> an impression we don't need this patch. This function builds the I2C device
> name by calling of_modalias_node() which just strips the vendor prefix (if
> any) from the "compatible" prop.
Yeah, I was able to get the ADV7180 device from DT probed without this
patch. So, no, we don't need the patch.
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
` (2 preceding siblings ...)
2014-05-08 23:47 ` Sergei Shtylyov
@ 2014-05-09 7:01 ` Geert Uytterhoeven
2014-05-09 22:57 ` Sergei Shtylyov
2014-06-05 23:03 ` Sergei Shtylyov
5 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2014-05-09 7:01 UTC (permalink / raw)
To: linux-sh
On Fri, May 9, 2014 at 1:47 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 05/09/2014 03:23 AM, Sergei Shtylyov wrote:
>
>>> Add a proper of match id for use when the device is being bound via
>>> device tree, to avoid having to use the i2c old-style binding of the
"to avoid having to use the i2c old-style binding"
>>> device.
>
>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>
>> From looking at of_i2c_register_devices() in drivers/i2c/i2c-core.c, I
>> got
>> an impression we don't need this patch. This function builds the I2C
>> device
>> name by calling of_modalias_node() which just strips the vendor prefix (if
>> any) from the "compatible" prop.
>
> Yeah, I was able to get the ADV7180 device from DT probed without this
> patch. So, no, we don't need the patch.
So it works without, but it's better to use the full name.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
` (3 preceding siblings ...)
2014-05-09 7:01 ` Geert Uytterhoeven
@ 2014-05-09 22:57 ` Sergei Shtylyov
2014-06-05 23:03 ` Sergei Shtylyov
5 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2014-05-09 22:57 UTC (permalink / raw)
To: linux-sh
Hello.
On 05/09/2014 11:01 AM, Geert Uytterhoeven wrote:
>>>> Add a proper of match id for use when the device is being bound via
>>>> device tree, to avoid having to use the i2c old-style binding of the
> "to avoid having to use the i2c old-style binding"
Ah, I'd probably missed these words.
>>>> device.
>>>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>>> From looking at of_i2c_register_devices() in drivers/i2c/i2c-core.c, I
>>> got
>>> an impression we don't need this patch. This function builds the I2C
>>> device
>>> name by calling of_modalias_node() which just strips the vendor prefix (if
>>> any) from the "compatible" prop.
>> Yeah, I was able to get the ADV7180 device from DT probed without this
>> patch. So, no, we don't need the patch.
> So it works without, but it's better to use the full name.
OK, I'll see how it binds to the driver with this patch applied...
> Gr{oetje,eeting}s,
> Geert
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/7] adv7180: add of match table
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
` (4 preceding siblings ...)
2014-05-09 22:57 ` Sergei Shtylyov
@ 2014-06-05 23:03 ` Sergei Shtylyov
5 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2014-06-05 23:03 UTC (permalink / raw)
To: linux-sh
Hello.
On 04/14/2014 02:36 PM, Ben Dooks wrote:
> Add a proper of match id for use when the device is being bound via
> device tree, to avoid having to use the i2c old-style binding of the
> device.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> drivers/media/i2c/adv7180.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index 215afa0..687d97b 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
[...]
> @@ -695,11 +696,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
>
> MODULE_DEVICE_TABLE(i2c, adv7180_id);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id adv7180_of_id[] = {
> + { .compatible = "adi,adv7180", },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, adv7180_of_id)
> +#endif
> +
> static struct i2c_driver adv7180_driver = {
> .driver = {
> .owner = THIS_MODULE,
> .name = KBUILD_MODNAME,
> .pm = ADV7180_PM_OPS,
> + .of_match = of_match_ptr(adv7180_of_id),
Duh, this doesn't even compile: the field is called 'of_match_table' actually.
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-05 23:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-14 10:36 [PATCH v3 2/7] adv7180: add of match table Ben Dooks
2014-04-15 11:24 ` Sergei Shtylyov
2014-05-08 23:23 ` Sergei Shtylyov
2014-05-08 23:47 ` Sergei Shtylyov
2014-05-09 7:01 ` Geert Uytterhoeven
2014-05-09 22:57 ` Sergei Shtylyov
2014-06-05 23:03 ` Sergei Shtylyov
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).