Message ID | 1390474715-6587-2-git-send-email-sachin.kamat@linaro.org |
---|---|
State | Rejected |
Headers | show |
On Thu, Jan 23, 2014 at 04:28:35PM +0530, Sachin Kamat wrote: > Use the helper instead of defining NULL for CONFIG_OF > disabled case. > > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > --- > drivers/pwm/pwm-pxa.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c > index 8d995731cef8..685ae2c96b77 100644 > --- a/drivers/pwm/pwm-pxa.c > +++ b/drivers/pwm/pwm-pxa.c > @@ -19,6 +19,7 @@ > #include <linux/clk.h> > #include <linux/io.h> > #include <linux/pwm.h> > +#include <linux/of.h> > #include <linux/of_device.h> > > #include <asm/div64.h> > @@ -140,13 +141,12 @@ static struct of_device_id pwm_of_match[] = { > { } > }; > MODULE_DEVICE_TABLE(of, pwm_of_match); > -#else > -#define pwm_of_match NULL > #endif > > static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev) > { > - const struct of_device_id *id = of_match_device(pwm_of_match, dev); > + const struct of_device_id *id; > + id = of_match_device(of_match_ptr(pwm_of_match), dev); Because of this, I find it actually more elegant to define pwm_of_match to NULL for non-DT. Thierry
On 23 January 2014 18:18, Thierry Reding <thierry.reding@gmail.com> wrote: > On Thu, Jan 23, 2014 at 04:28:35PM +0530, Sachin Kamat wrote: >> Use the helper instead of defining NULL for CONFIG_OF >> disabled case. >> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> >> --- >> drivers/pwm/pwm-pxa.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c >> index 8d995731cef8..685ae2c96b77 100644 >> --- a/drivers/pwm/pwm-pxa.c >> +++ b/drivers/pwm/pwm-pxa.c >> @@ -19,6 +19,7 @@ >> #include <linux/clk.h> >> #include <linux/io.h> >> #include <linux/pwm.h> >> +#include <linux/of.h> >> #include <linux/of_device.h> >> >> #include <asm/div64.h> >> @@ -140,13 +141,12 @@ static struct of_device_id pwm_of_match[] = { >> { } >> }; >> MODULE_DEVICE_TABLE(of, pwm_of_match); >> -#else >> -#define pwm_of_match NULL >> #endif >> >> static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev) >> { >> - const struct of_device_id *id = of_match_device(pwm_of_match, dev); >> + const struct of_device_id *id; >> + id = of_match_device(of_match_ptr(pwm_of_match), dev); > > Because of this, I find it actually more elegant to define pwm_of_match > to NULL for non-DT. OK. If you prefer so, will drop this patch then.
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c index 8d995731cef8..685ae2c96b77 100644 --- a/drivers/pwm/pwm-pxa.c +++ b/drivers/pwm/pwm-pxa.c @@ -19,6 +19,7 @@ #include <linux/clk.h> #include <linux/io.h> #include <linux/pwm.h> +#include <linux/of.h> #include <linux/of_device.h> #include <asm/div64.h> @@ -140,13 +141,12 @@ static struct of_device_id pwm_of_match[] = { { } }; MODULE_DEVICE_TABLE(of, pwm_of_match); -#else -#define pwm_of_match NULL #endif static const struct platform_device_id *pxa_pwm_get_id_dt(struct device *dev) { - const struct of_device_id *id = of_match_device(pwm_of_match, dev); + const struct of_device_id *id; + id = of_match_device(of_match_ptr(pwm_of_match), dev); return id ? id->data : NULL; } @@ -228,7 +228,7 @@ static struct platform_driver pwm_driver = { .driver = { .name = "pxa25x-pwm", .owner = THIS_MODULE, - .of_match_table = pwm_of_match, + .of_match_table = of_match_ptr(pwm_of_match), }, .probe = pwm_probe, .remove = pwm_remove,
Use the helper instead of defining NULL for CONFIG_OF disabled case. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/pwm/pwm-pxa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)