provide ID table for avoiding fallback match
Subsystems (6)
Tzung-Bi Shih
maintainerv2 cover provide ID table for avoiding fallback match
Inspired by [1]. Turn all MODULE_ALIAS() in ChromeOS EC platform drivers into proper platform_device_id table and MODULE_DEVICE_TABLE().
The series is basically looking for drivers from:
- struct mfd_cell in drivers/mfd/cros_ec_dev.c.
- grep -R MODULE_ALIAS drivers/platform/chrome/.
Changes from v1 (https://patchwork.kernel.org/project/chrome-platform/cover/[email protected]/):
- Split "platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding
fallback match" into 2 commits.
- Remove patches that have been applied.
Tzung-Bi Shih (6):
media: platform: cros-ec: provide ID table for avoiding fallback match
gpio: cros-ec: provide ID table for avoiding fallback match
power: supply: cros_usbpd: provide ID table for avoiding fallback
match
power: supply: cros_pchg: provide ID table for avoiding fallback match platform/chrome: cros_kbd_led_backlight: shrink the driver name platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding
fallback match
drivers/gpio/gpio-cros-ec.c | 8 ++++++++ drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 9 ++++++++- drivers/platform/chrome/cros_kbd_led_backlight.c | 11 +++++++++-- drivers/power/supply/cros_peripheral_charger.c | 11 +++++++++-- drivers/power/supply/cros_usbpd-charger.c | 11 +++++++++-- 5 files changed, 43 insertions(+), 7 deletions(-)
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Tzung-Bi Shih
maintainerPATCH v2 1/6 media: platform: cros-ec: provide ID table for avoiding fallback match
Instead of using fallback driver name match, provide ID table[1] for the primary match.
[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353
---
Changes from v1:
- No code changes.
- Add R-b tags.
drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +8 -1
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/dmi.h> #include <linux/pci.h>
@@ -573,6 +574,12 @@ static void cros_ec_cec_remove(struct platform_device *pdev) } } +static const struct platform_device_id cros_ec_cec_id[] = { + {DRV_NAME ,0 }, + {} +}; +MODULE_DEVICE_TABLE (platform, cros_ec_cec_id); +static struct platform_driver cros_ec_cec_driver = { .probe = cros_ec_cec_probe, .remove_new = cros_ec_cec_remove,
@@ -580,6 +587,7 @@ static struct platform_driver cros_ec_cec_driver = { .name = DRV_NAME, .pm = &cros_ec_cec_pm_ops, }, + .id_table = cros_ec_cec_id, };module_platform_driver (cros_ec_cec_driver);
@@ -587,4 +595,3 @@ module_platform_driver(cros_ec_cec_driver);MODULE_DESCRIPTION ("CEC driver for ChromeOS ECs" );MODULE_AUTHOR ("Neil Armstrong <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Re: [PATCH v2 1/6] media: platform: cros-ec: provide ID table for avoiding fallback match
Quoted 8 lines · Tzung-Bi Shih
Instead of using fallback driver name match, provide ID table[1] for the primary match.
[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]>
Looks OK, I'll queue this patch up for v6.10.
Regards,
Hans
Quoted 46 lines
---
Changes from v1:
- No code changes.
- Add R-b tags.drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/media/cec/platform/cros-ec/cros-ec-cec.c +8
-1@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/dmi.h> #include <linux/pci.h> @@ -573,6 +574,12 @@ static void cros_ec_cec_remove(struct platform_device *pdev) } } +static const struct platform_device_id cros_ec_cec_id[] = { + {DRV_NAME ,0 }, + {} +}; +MODULE_DEVICE_TABLE (platform, cros_ec_cec_id); +static struct platform_driver cros_ec_cec_driver = { .probe = cros_ec_cec_probe, .remove_new = cros_ec_cec_remove,@@ -580,6 +587,7 @@ static struct platform_driver cros_ec_cec_driver = { .name = DRV_NAME, .pm = &cros_ec_cec_pm_ops, }, + .id_table = cros_ec_cec_id, };module_platform_driver (cros_ec_cec_driver);@@ -587,4 +595,3 @@ module_platform_driver(cros_ec_cec_driver);MODULE_DESCRIPTION ("CEC driver for ChromeOS ECs" );MODULE_AUTHOR ("Neil Armstrong <[email protected]>" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:" DRV_NAME );
Tzung-Bi Shih
maintainerPATCH v2 2/6 gpio: cros-ec: provide ID table for avoiding fallback match
In reply to Tzung-Bi ShihInstead 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
---
Changes from v1:
- No code changes.
- Add R-b tags.
drivers/gpio/gpio-cros-ec.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpio/gpio-cros-ec.c +8 -0
@@ -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);
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Bartosz Golaszewski
AppliedRe: [PATCH v2 2/6] gpio: cros-ec: provide ID table for avoiding fallback match
Quoted 50 lines · Tzung-Bi Shih
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]>---
Changes from v1:
- No code changes.
- Add R-b tags.drivers/gpio/gpio-cros-ec.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpio/gpio-cros-ec.c +8
-1@@ -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); --
Quoted 2 lines
2.44.0.478.gd926399ef9-goog
Applied, thanks!
Bart
Tzung-Bi Shih
maintainerPATCH v2 3/6 power: supply: cros_usbpd: provide ID table for avoiding fallback match
In reply to Tzung-Bi ShihInstead of using fallback driver name match, provide ID table[1] for the primary match.
[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353
---
Changes from v1:
- No code changes.
- Add R-b tags.
drivers/power/supply/cros_usbpd-charger.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/power/supply/cros_usbpd-charger.c +9 -2
@@ -5,6 +5,7 @@* Copyright (c) 2014 - 2018 Google, Inc */ +#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>
@@ -711,16 +712,22 @@ static int cros_usbpd_charger_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(cros_usbpd_charger_pm_ops, NULL, cros_usbpd_charger_resume); +static const struct platform_device_id cros_usbpd_charger_id[] = { + {DRV_NAME ,0 }, + {} +}; +MODULE_DEVICE_TABLE (platform, cros_usbpd_charger_id); +static struct platform_driver cros_usbpd_charger_driver = { .driver = { .name =DRV_NAME , .pm = &cros_usbpd_charger_pm_ops, }, - .probe = cros_usbpd_charger_probe + .probe = cros_usbpd_charger_probe, + .id_table = cros_usbpd_charger_id, };module_platform_driver (cros_usbpd_charger_driver);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("ChromeOS EC USBPD charger" ); -MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Tzung-Bi Shih
maintainerPATCH v2 4/6 power: supply: cros_pchg: provide ID table for avoiding fallback match
In reply to Tzung-Bi ShihInstead of using fallback driver name match, provide ID table[1] for the primary match.
[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353
---
Changes from v1:
- No code changes.
- Add R-b tags.
drivers/power/supply/cros_peripheral_charger.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/power/supply/cros_peripheral_charger.c +9 -2
@@ -5,6 +5,7 @@* Copyright 2020 Google LLC. */ +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/notifier.h> #include <linux/platform_data/cros_ec_commands.h>
@@ -367,16 +368,22 @@ static int __maybe_unused cros_pchg_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(cros_pchg_pm_ops, NULL, cros_pchg_resume); +static const struct platform_device_id cros_pchg_id[] = { + {DRV_NAME ,0 }, + {} +}; +MODULE_DEVICE_TABLE (platform, cros_pchg_id); +static struct platform_driver cros_pchg_driver = { .driver = { .name =DRV_NAME , .pm = &cros_pchg_pm_ops, }, - .probe = cros_pchg_probe + .probe = cros_pchg_probe, + .id_table = cros_pchg_id, };module_platform_driver (cros_pchg_driver);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("ChromeOS EC peripheral device charger" ); -MODULE_ALIAS ("platform:" DRV_NAME );
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Tzung-Bi Shih
maintainerPATCH v2 5/6 platform/chrome: cros_kbd_led_backlight: shrink the driver name
In reply to Tzung-Bi ShihPrepare to provide platform_device_id table. Shrink the driver name for fitting to [1].
[1]: https://elixir.bootlin.com/linux/v6.8/source/include/linux/mod_devicetable.h#L608
---
Changes from v1 (https://patchwork.kernel.org/project/chrome-platform/patch/[email protected]/):
- Split from "platform/chrome: cros_kbd_led_backlight: provide ID table for
avoiding fallback match".
- Add R-b tags.
drivers/platform/chrome/cros_kbd_led_backlight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/chrome/cros_kbd_led_backlight.c +2 -2
@@ -249,7 +249,7 @@ MODULE_DEVICE_TABLE(of, keyboard_led_of_match);static struct platform_driver keyboard_led_driver = { .driver = { - .name ="chromeos-keyboard-leds" , + .name ="cros-keyboard-leds" , .acpi_match_table =ACPI_PTR (keyboard_led_acpi_match), .of_match_table =of_match_ptr (keyboard_led_of_match), },
@@ -260,4 +260,4 @@ module_platform_driver(keyboard_led_driver);MODULE_AUTHOR ("Simon Que <[email protected]>" );MODULE_DESCRIPTION ("ChromeOS Keyboard backlight LED Driver" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:chromeos-keyboard-leds" ); +MODULE_ALIAS ("platform:cros-keyboard-leds" );
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Re: [PATCH v2 5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name
Quoted 2 lines · Tzung-Bi Shih
Prepare to provide
platform_device_idtable. Shrink the driver name for fitting to [1].
Instead of linking to external resources, please describe the problem and the bug you are fixing here.
Quoted 5 lines
[1]: https://elixir.bootlin.com/linux/v6.8/source/include/linux/mod_devicetable.h#L608
Reviewed-by Benson Leung <[email protected]>Signed-off-by Tzung-Bi Shih <[email protected]>
Missing fixes tag and Cc-stable.
Best regards,
Krzysztof
Re: [PATCH v2 5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name
Quoted 8 lines · Krzysztof Kozlowski
Quoted 2 lines · Tzung-Bi Shih
Prepare to provide
platform_device_idtable. Shrink the driver name for fitting to [1].Instead of linking to external resources, please describe the problem and the bug you are fixing here.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
[1]: https://elixir.bootlin.com/linux/v6.8/source/include/linux/mod_devicetable.h#L608
Reviewed-by Benson Leung <[email protected]>Signed-off-by Tzung-Bi Shih <[email protected]>Missing fixes tag and Cc-stable.
Ah, now I read your answer to v1 discussion. So this was not a bug in the first place? Hm, then probably my comment was not really correct and we should not split it.
Best regards,
Krzysztof
Tzung-Bi Shih
maintainerRe: [PATCH v2 5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski
Quoted 2 lines · Tzung-Bi Shih
Prepare to provide
platform_device_idtable. Shrink the driver name for fitting to [1].Instead of linking to external resources, please describe the problem and the bug you are fixing here.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Benson Leung <[email protected]>Signed-off-by Tzung-Bi Shih <[email protected]>Missing fixes tag and Cc-stable.
Ah, now I read your answer to v1 discussion. So this was not a bug in the first place? Hm, then probably my comment was not really correct and we should not split it.
Correct, this wasn't a bug in the first place. Only if moving the string into struct platform_device_id, the compiler emits errors about the oversize.
I'm fine with both versions. But let's go back to adopt v1 (no split) if no strong objections.
Thanks a lot for your review again.
Tzung-Bi Shih
maintainerPATCH v2 6/6 platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match
In reply to Tzung-Bi ShihInstead of using fallback driver name match, provide ID table[1] for the primary match.
[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353
---
Changes from v1 (https://patchwork.kernel.org/project/chrome-platform/patch/[email protected]/):
- Split from "platform/chrome: cros_kbd_led_backlight: provide ID table for
avoiding fallback match".
- Add R-b tags.
drivers/platform/chrome/cros_kbd_led_backlight.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_kbd_led_backlight.c +8 -1
@@ -9,6 +9,7 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/leds.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/of.h> #include <linux/platform_data/cros_ec_commands.h>
@@ -247,6 +248,12 @@ static const struct of_device_id keyboard_led_of_match[] = {MODULE_DEVICE_TABLE (of, keyboard_led_of_match);#endif +static const struct platform_device_id keyboard_led_id[] = { + {"cros-keyboard-leds" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (platform, keyboard_led_id); +static struct platform_driver keyboard_led_driver = { .driver = { .name ="cros-keyboard-leds" ,
@@ -254,10 +261,10 @@ static struct platform_driver keyboard_led_driver = { .of_match_table = of_match_ptr(keyboard_led_of_match), }, .probe = keyboard_led_probe, + .id_table = keyboard_led_id, };module_platform_driver (keyboard_led_driver);MODULE_AUTHOR ("Simon Que <[email protected]>" );MODULE_DESCRIPTION ("ChromeOS Keyboard backlight LED Driver" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("platform:cros-keyboard-leds" );
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Re: [PATCH v2 6/6] platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match
Quoted 8 lines · Tzung-Bi Shih
Instead of using fallback driver name match, provide ID table[1] for the primary match.
[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353
Reviewed-by Benson Leung <[email protected]>Signed-off-by Tzung-Bi Shih <[email protected]>---
Best regards,
Krzysztof
Sebastian Reichel
AppliedRe: (subset) [PATCH v2 0/6] provide ID table for avoiding fallback match
In reply to Tzung-Bi ShihQuoted 8 lines · Tzung-Bi Shih
Inspired by [1]. Turn all
MODULE_ALIAS()in ChromeOS EC platform drivers into properplatform_device_idtable andMODULE_DEVICE_TABLE().The series is basically looking for drivers from:
-struct mfd_cellindrivers/mfd/cros_ec_dev.c.
- grep -RMODULE_ALIASdrivers/platform/chrome/.[...]
Applied, thanks!
[3/6] power: supply: cros_usbpd: provide ID table for avoiding fallback match
commit: 0f8678c34cbfdc63569a9b0ede1fe235ec6ec693
[4/6] power: supply: cros_pchg: provide ID table for avoiding fallback match
commit: d6486a13665e9df5b503a375e18226e1824f21d3Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>
This series was applied to chrome-platform/linux.git (for-kernelci) by Sebastian Reichel <[email protected]>:
Hello:
This series was applied to chrome-platform/linux.git (for-kernelci) by Sebastian Reichel <[email protected]>:
Quoted 8 lines · On Mon, 1 Apr 2024 11:00:46 +0800 you wrote:
Inspired by [1]. Turn all
MODULE_ALIAS()in ChromeOS EC platform drivers into properplatform_device_idtable andMODULE_DEVICE_TABLE().The series is basically looking for drivers from:
-struct mfd_cellindrivers/mfd/cros_ec_dev.c.
- grep -RMODULE_ALIASdrivers/platform/chrome/.[...]
Here is the summary with links:
- [v2,1/6] media: platform: cros-ec: provide ID table for avoiding fallback match (no matching commit)
- [v2,2/6] gpio: cros-ec: provide ID table for avoiding fallback match (no matching commit)
- [v2,3/6] power: supply: cros_usbpd: provide ID table for avoiding fallback match
https://git.kernel.org/chrome-platform/c/0f8678c34cbf - [v2,4/6] power: supply: cros_pchg: provide ID table for avoiding fallback match https://git.kernel.org/chrome-platform/c/d6486a13665e
- [v2,5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name
(no matching commit)
- [v2,6/6] platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This series was applied to chrome-platform/linux.git (for-next) by Sebastian Reichel <[email protected]>:
Hello:
This series was applied to chrome-platform/linux.git (for-next) by Sebastian Reichel <[email protected]>:
Quoted 8 lines · On Mon, 1 Apr 2024 11:00:46 +0800 you wrote:
Inspired by [1]. Turn all
MODULE_ALIAS()in ChromeOS EC platform drivers into properplatform_device_idtable andMODULE_DEVICE_TABLE().The series is basically looking for drivers from:
-struct mfd_cellindrivers/mfd/cros_ec_dev.c.
- grep -RMODULE_ALIASdrivers/platform/chrome/.[...]
Here is the summary with links:
- [v2,1/6] media: platform: cros-ec: provide ID table for avoiding fallback match (no matching commit)
- [v2,2/6] gpio: cros-ec: provide ID table for avoiding fallback match (no matching commit)
- [v2,3/6] power: supply: cros_usbpd: provide ID table for avoiding fallback match
https://git.kernel.org/chrome-platform/c/0f8678c34cbf - [v2,4/6] power: supply: cros_pchg: provide ID table for avoiding fallback match https://git.kernel.org/chrome-platform/c/d6486a13665e
- [v2,5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name
(no matching commit)
- [v2,6/6] platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match (no matching commit)
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html