Skip to content

Commit 782f4e4

Browse files
Tzung-Bi ShihBartosz Golaszewski
authored andcommitted
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 <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent a261e20 commit 782f4e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/gpio/gpio-cros-ec.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/errno.h>
1313
#include <linux/gpio/driver.h>
1414
#include <linux/kernel.h>
15+
#include <linux/mod_devicetable.h>
1516
#include <linux/module.h>
1617
#include <linux/platform_data/cros_ec_commands.h>
1718
#include <linux/platform_data/cros_ec_proto.h>
@@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev)
197198
return devm_gpiochip_add_data(dev, gc, cros_ec);
198199
}
199200

201+
static const struct platform_device_id cros_ec_gpio_id[] = {
202+
{ "cros-ec-gpio", 0 },
203+
{}
204+
};
205+
MODULE_DEVICE_TABLE(platform, cros_ec_gpio_id);
206+
200207
static struct platform_driver cros_ec_gpio_driver = {
201208
.probe = cros_ec_gpio_probe,
202209
.driver = {
203210
.name = "cros-ec-gpio",
204211
},
212+
.id_table = cros_ec_gpio_id,
205213
};
206214
module_platform_driver(cros_ec_gpio_driver);
207215

0 commit comments

Comments
 (0)