Message ID | 20161128070644.8386-1-pbrobinson@gmail.com |
---|---|
State | Rejected |
Headers | show |
Hi, On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote : > Set the of_match_table for this driver so that devices can be described in > the device tree. This device is used in a number of NXP devices as well as > the CryptoCap and is already defined in the various device trees. > This is useless (as you mention it is already used in various device trees) as it will already be probed properly using the "dallas,ds3232" compatible string. > Signed-off-by: Peter Robinson <pbrobinson@gmail.com> > --- > drivers/rtc/rtc-ds3232.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c > index b1f20d8..711cc5b 100644 > --- a/drivers/rtc/rtc-ds3232.c > +++ b/drivers/rtc/rtc-ds3232.c > @@ -15,6 +15,7 @@ > > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/of.h> > #include <linux/interrupt.h> > #include <linux/i2c.h> > #include <linux/spi/spi.h> > @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = { > }; > MODULE_DEVICE_TABLE(i2c, ds3232_id); > > +#ifdef CONFIG_OF > +static const struct of_device_id ds3232_of_match[] = { > + { .compatible = "dallas,ds3232", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, ds3232_of_match); > +#endif > + > static struct i2c_driver ds3232_driver = { > .driver = { > .name = "rtc-ds3232", > + .of_match_table = of_match_ptr(ds3232_of_match), > .pm = &ds3232_pm_ops, > }, > .probe = ds3232_i2c_probe, > -- > 2.9.3 >
On Mon, Nov 28, 2016 at 8:24 AM, Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote: > Hi, > > On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote : >> Set the of_match_table for this driver so that devices can be described in >> the device tree. This device is used in a number of NXP devices as well as >> the CryptoCap and is already defined in the various device trees. >> > > This is useless (as you mention it is already used in various device > trees) as it will already be probed properly using the "dallas,ds3232" > compatible string. Why? The driver doesn't currently set the compatible string. >> Signed-off-by: Peter Robinson <pbrobinson@gmail.com> >> --- >> drivers/rtc/rtc-ds3232.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c >> index b1f20d8..711cc5b 100644 >> --- a/drivers/rtc/rtc-ds3232.c >> +++ b/drivers/rtc/rtc-ds3232.c >> @@ -15,6 +15,7 @@ >> >> #include <linux/kernel.h> >> #include <linux/module.h> >> +#include <linux/of.h> >> #include <linux/interrupt.h> >> #include <linux/i2c.h> >> #include <linux/spi/spi.h> >> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = { >> }; >> MODULE_DEVICE_TABLE(i2c, ds3232_id); >> >> +#ifdef CONFIG_OF >> +static const struct of_device_id ds3232_of_match[] = { >> + { .compatible = "dallas,ds3232", }, >> + { } >> +}; >> +MODULE_DEVICE_TABLE(of, ds3232_of_match); >> +#endif >> + >> static struct i2c_driver ds3232_driver = { >> .driver = { >> .name = "rtc-ds3232", >> + .of_match_table = of_match_ptr(ds3232_of_match), >> .pm = &ds3232_pm_ops, >> }, >> .probe = ds3232_i2c_probe, >> -- >> 2.9.3 >> > > -- > Alexandre Belloni, Free Electrons > Embedded Linux and Kernel engineering > http://free-electrons.com
On 28/11/2016 at 08:31:20 +0000, Peter Robinson wrote : > On Mon, Nov 28, 2016 at 8:24 AM, Alexandre Belloni > <alexandre.belloni@free-electrons.com> wrote: > > Hi, > > > > On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote : > >> Set the of_match_table for this driver so that devices can be described in > >> the device tree. This device is used in a number of NXP devices as well as > >> the CryptoCap and is already defined in the various device trees. > >> > > > > This is useless (as you mention it is already used in various device > > trees) as it will already be probed properly using the "dallas,ds3232" > > compatible string. > > Why? The driver doesn't currently set the compatible string. > The i2c core does that for you using the i2c_device_id array. > >> Signed-off-by: Peter Robinson <pbrobinson@gmail.com> > >> --- > >> drivers/rtc/rtc-ds3232.c | 10 ++++++++++ > >> 1 file changed, 10 insertions(+) > >> > >> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c > >> index b1f20d8..711cc5b 100644 > >> --- a/drivers/rtc/rtc-ds3232.c > >> +++ b/drivers/rtc/rtc-ds3232.c > >> @@ -15,6 +15,7 @@ > >> > >> #include <linux/kernel.h> > >> #include <linux/module.h> > >> +#include <linux/of.h> > >> #include <linux/interrupt.h> > >> #include <linux/i2c.h> > >> #include <linux/spi/spi.h> > >> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = { > >> }; > >> MODULE_DEVICE_TABLE(i2c, ds3232_id); > >> > >> +#ifdef CONFIG_OF > >> +static const struct of_device_id ds3232_of_match[] = { > >> + { .compatible = "dallas,ds3232", }, > >> + { } > >> +}; > >> +MODULE_DEVICE_TABLE(of, ds3232_of_match); > >> +#endif > >> + > >> static struct i2c_driver ds3232_driver = { > >> .driver = { > >> .name = "rtc-ds3232", > >> + .of_match_table = of_match_ptr(ds3232_of_match), > >> .pm = &ds3232_pm_ops, > >> }, > >> .probe = ds3232_i2c_probe, > >> -- > >> 2.9.3 > >> > > > > -- > > Alexandre Belloni, Free Electrons > > Embedded Linux and Kernel engineering > > http://free-electrons.com
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index b1f20d8..711cc5b 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c @@ -15,6 +15,7 @@ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/spi/spi.h> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = { }; MODULE_DEVICE_TABLE(i2c, ds3232_id); +#ifdef CONFIG_OF +static const struct of_device_id ds3232_of_match[] = { + { .compatible = "dallas,ds3232", }, + { } +}; +MODULE_DEVICE_TABLE(of, ds3232_of_match); +#endif + static struct i2c_driver ds3232_driver = { .driver = { .name = "rtc-ds3232", + .of_match_table = of_match_ptr(ds3232_of_match), .pm = &ds3232_pm_ops, }, .probe = ds3232_i2c_probe,
Set the of_match_table for this driver so that devices can be described in the device tree. This device is used in a number of NXP devices as well as the CryptoCap and is already defined in the various device trees. Signed-off-by: Peter Robinson <pbrobinson@gmail.com> --- drivers/rtc/rtc-ds3232.c | 10 ++++++++++ 1 file changed, 10 insertions(+)