Re: [PATCH 1/3] Adding Skyworks SKY81452 MFD driver

From: Thierry Reding
Date: Thu Aug 21 2014 - 05:59:57 EST


On Thu, Aug 21, 2014 at 10:45:02AM +0100, Lee Jones wrote:
[...]
> > diff --git a/drivers/mfd/sky81452.c b/drivers/mfd/sky81452.c
[...]
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the
> > + * Free Software Foundation; either version 2, or (at your option) any
> > + * later version.
[...]
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(i2c, sky81452_ids);
> > +
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id sky81452_of_match[] = {
> > + { .compatible = "skyworks,sky81452", },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, sky81452_of_match);
> > +#endif
>
> You can drop the #differy the compiler should sort that out on the
> back of of_match_ptr().

It won't, unfortunately. If !OF, then of_match_ptr(x) will evaluate to
NULL, therefore sky81452_of_match will become unreferenced and cause the
compiler to output a warning. I guess it could be made __maybe_unused,
but I don't see that as much of an advantage over the #ifdef.

> > +static struct i2c_driver sky81452_driver = {
> > + .driver = {
> > + .name = "sky81452",
> > + .of_match_table = of_match_ptr(sky81452_of_match),
> > + },
> > + .probe = sky81452_probe,
> > + .remove = sky81452_remove,
> > + .id_table = sky81452_ids,
> > +};
> > +
> > +module_i2c_driver(sky81452_driver);
> > +
> > +MODULE_DESCRIPTION("Skyworks SKY81452 MFD driver");
> > +MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@xxxxxxxxxxxxxxx>");
> > +MODULE_LICENSE("GPL");
>
> I think you want v2.

The header comment says "... version 2, or (at your option) any later
version.", so I think "GPL" is the right one here.

Thierry

Attachment: pgp7ER1JKoVQr.pgp
Description: PGP signature