Re: [PATCHv6 1/3] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel
Date: Fri Oct 25 2013 - 10:44:59 EST
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
Attachment:
signature.asc
Description: Digital signature