lkml.org 
[lkml]   [2013]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv6 1/3] Input: twl4030-pwrbutton - add device tree support
Hi Péter,

On Fri, Oct 25, 2013 at 03:46:02PM +0300, Peter Ujfalusi wrote:
> > [...]
> > +#if IS_ENABLED(CONFIG_OF)
>
> You don't need to do this.

It's done like this in all the other drivers.

> > +static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
> > + { .compatible = "ti,twl4030-pwrbutton" },
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> > +#endif
> > +
> > static struct platform_driver twl4030_pwrbutton_driver = {
> > + .probe = twl4030_pwrbutton_probe,
> > .remove = __exit_p(twl4030_pwrbutton_remove),
> > .driver = {
> > .name = "twl4030_pwrbutton",
> > .owner = THIS_MODULE,
> > + .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
>
> If you try to compile this driver with config !CONFIG_OF it will not work in
> this way.

For !CONFIG_OF of_match_ptr is defined as follows (in "include/linux/of.h"):

#define of_match_ptr(_ptr) NULL

So the preprocessor will remove the undefined symbol.

-- Sebastian
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-10-25 17:01    [W:0.084 / U:0.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site