diff options
author | Tzung-Bi Shih <tzungbi@kernel.org> | 2024-04-01 11:00:48 +0800 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-04-02 10:58:21 +0200 |
commit | 782f4e47ffc19622bf80b3c0cf9cadd2b0b9a644 (patch) | |
tree | 382ebf707d2e05c8d6418b0106b9a4d6539823cd /drivers/gpio/gpio-cros-ec.c | |
parent | a261e208e137f3ae4cd44dffd4aab011457420e7 (diff) |
gpio: cros-ec: provide ID table for avoiding fallback match
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
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-cros-ec.c')
-rw-r--r-- | drivers/gpio/gpio-cros-ec.c | 8 |
1 files changed, 8 insertions, 0 deletions
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); |