Commit 782f4e47 authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Bartosz Golaszewski

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#L1353Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent a261e208
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/gpio/driver.h> #include <linux/gpio/driver.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev) ...@@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev)
return devm_gpiochip_add_data(dev, gc, cros_ec); 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 = { static struct platform_driver cros_ec_gpio_driver = {
.probe = cros_ec_gpio_probe, .probe = cros_ec_gpio_probe,
.driver = { .driver = {
.name = "cros-ec-gpio", .name = "cros-ec-gpio",
}, },
.id_table = cros_ec_gpio_id,
}; };
module_platform_driver(cros_ec_gpio_driver); module_platform_driver(cros_ec_gpio_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment