Message ID | 20240329075630.2069474-3-tzungbi@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | platform/chrome: provide ID table for avoiding fallback match | expand |
On 29/03/2024 08:56, Tzung-Bi Shih wrote: > Instead of using fallback driver name match, provide ID table[1] for the > primary match. Also allow automatic module loading by adding > MODULE_DEVICE_TABLE(). > > [1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353 > > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> > --- Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On Fri, Mar 29, 2024 at 03:56:14PM +0800, Tzung-Bi Shih wrote: > Instead of using fallback driver name match, provide ID table[1] for the > primary match. Also allow automatic module loading by adding > MODULE_DEVICE_TABLE(). > > [1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353 > > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Reviewed-by: Benson Leung <bleung@chromium.org> > --- > drivers/gpio/gpio-cros-ec.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpio/gpio-cros-ec.c b/drivers/gpio/gpio-cros-ec.c > index 842e1c060414..0c09bb54dc0c 100644 > --- a/drivers/gpio/gpio-cros-ec.c > +++ b/drivers/gpio/gpio-cros-ec.c > @@ -12,6 +12,7 @@ > #include <linux/errno.h> > #include <linux/gpio/driver.h> > #include <linux/kernel.h> > +#include <linux/mod_devicetable.h> > #include <linux/module.h> > #include <linux/platform_data/cros_ec_commands.h> > #include <linux/platform_data/cros_ec_proto.h> > @@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev) > return devm_gpiochip_add_data(dev, gc, cros_ec); > } > > +static const struct platform_device_id cros_ec_gpio_id[] = { > + { "cros-ec-gpio", 0 }, > + {} > +}; > +MODULE_DEVICE_TABLE(platform, cros_ec_gpio_id); > + > static struct platform_driver cros_ec_gpio_driver = { > .probe = cros_ec_gpio_probe, > .driver = { > .name = "cros-ec-gpio", > }, > + .id_table = cros_ec_gpio_id, > }; > module_platform_driver(cros_ec_gpio_driver); > > -- > 2.44.0.478.gd926399ef9-goog >
On Fri, Mar 29, 2024 at 8:57 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote: > Instead of using fallback driver name match, provide ID table[1] for the > primary match. Also allow automatic module loading by adding > MODULE_DEVICE_TABLE(). > > [1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353 > > Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
diff --git a/drivers/gpio/gpio-cros-ec.c b/drivers/gpio/gpio-cros-ec.c index 842e1c060414..0c09bb54dc0c 100644 --- a/drivers/gpio/gpio-cros-ec.c +++ b/drivers/gpio/gpio-cros-ec.c @@ -12,6 +12,7 @@ #include <linux/errno.h> #include <linux/gpio/driver.h> #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_proto.h> @@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev) return devm_gpiochip_add_data(dev, gc, cros_ec); } +static const struct platform_device_id cros_ec_gpio_id[] = { + { "cros-ec-gpio", 0 }, + {} +}; +MODULE_DEVICE_TABLE(platform, cros_ec_gpio_id); + static struct platform_driver cros_ec_gpio_driver = { .probe = cros_ec_gpio_probe, .driver = { .name = "cros-ec-gpio", }, + .id_table = cros_ec_gpio_id, }; module_platform_driver(cros_ec_gpio_driver);
Instead of using fallback driver name match, provide ID table[1] for the primary match. Also allow automatic module loading by adding MODULE_DEVICE_TABLE(). [1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353 Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> --- drivers/gpio/gpio-cros-ec.c | 8 ++++++++ 1 file changed, 8 insertions(+)