Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays
@ 2026-05-29 10:18 Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 1/6] power: Drop unused assignment of platform_device_id driver data Uwe Kleine-König (The Capable Hub)
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Kuan-Wei Chiu, Benson Leung, Guenter Roeck, Thomas Weißschuh,
	Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-pm, linux-kernel, chrome-platform, linux-arm-kernel,
	linux-mediatek, Hans de Goede, Marek Szyprowski,
	Sebastian Krzyszkowiak, Purism Kernel Team, Yixun Lan,
	Andreas Kemnade, Matti Vaittinen, Sven Peter, Janne Grunau,
	Neal Gompa, Amit Sunil Dhamne, Samuel Kayode, linux-riscv,
	spacemit, asahi, imx, Chen-Yu Tsai

Hello,

this series targets to use named initializers for platform_device_id
arrays. In general these are better readable for humans and more robust
to changes in the respective struct definition.

This robustness is needed as I want to do

	diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
	--- a/include/linux/mod_devicetable.h
	+++ b/include/linux/mod_devicetable.h
	@@ -610,4 +610,7 @@ struct dmi_system_id {
	 struct platform_device_id {
		char name[PLATFORM_NAME_SIZE];
	-	kernel_ulong_t driver_data;
	+	union {
	+		kernel_ulong_t driver_data;
	+		const void *driver_data_ptr;
	+	};
	 };

which allows dropping several casts and eases porting CHERI to mainline
linux. A possible follow-up change is the following example:

	diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
	index 5d61053e0596..03bc8e859d73 100644
	--- a/drivers/gpio/gpio-pxa.c
	+++ b/drivers/gpio/gpio-pxa.c
	@@ -534,7 +534,7 @@ static struct irq_chip pxa_muxed_gpio_chip = {
	 static int pxa_gpio_nums(struct platform_device *pdev)
	 {
		const struct platform_device_id *id = platform_get_device_id(pdev);
	-	struct pxa_gpio_id *pxa_id = (struct pxa_gpio_id *)id->driver_data;
	+	struct pxa_gpio_id *pxa_id = id->driver_data_ptr;
		int count = 0;
	 
		switch (pxa_id->type) {
	@@ -708,14 +708,14 @@ static int pxa_gpio_probe(struct platform_device *pdev)
	 }
	 
	 static const struct platform_device_id gpio_id_table[] = {
	-	{ .name = "pxa25x-gpio",	.driver_data = (unsigned long)&pxa25x_id },
	-	{ .name = "pxa26x-gpio",	.driver_data = (unsigned long)&pxa26x_id },
	-	{ .name = "pxa27x-gpio",	.driver_data = (unsigned long)&pxa27x_id },
	-	{ .name = "pxa3xx-gpio",	.driver_data = (unsigned long)&pxa3xx_id },
	-	{ .name = "pxa93x-gpio",	.driver_data = (unsigned long)&pxa93x_id },
	-	{ .name = "mmp-gpio",		.driver_data = (unsigned long)&mmp_id },
	-	{ .name = "mmp2-gpio",		.driver_data = (unsigned long)&mmp2_id },
	-	{ .name = "pxa1928-gpio",	.driver_data = (unsigned long)&pxa1928_id },
	+	{ .name = "pxa25x-gpio",	.driver_data_ptr = &pxa25x_id },
	+	{ .name = "pxa26x-gpio",	.driver_data_ptr = &pxa26x_id },
	+	{ .name = "pxa27x-gpio",	.driver_data_ptr = &pxa27x_id },
	+	{ .name = "pxa3xx-gpio",	.driver_data_ptr = &pxa3xx_id },
	+	{ .name = "pxa93x-gpio",	.driver_data_ptr = &pxa93x_id },
	+	{ .name = "mmp-gpio",		.driver_data_ptr = &mmp_id },
	+	{ .name = "mmp2-gpio",		.driver_data_ptr = &mmp2_id },
	+	{ .name = "pxa1928-gpio",	.driver_data_ptr = &pxa1928_id },
		{ }
	 };
 
increasing readability due to less casting. Also this results in the
compiler warning:

	drivers/gpio/gpio-pxa.c: In function ‘pxa_gpio_nums’:
	drivers/gpio/gpio-pxa.c:537:38: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
	  537 |         struct pxa_gpio_id *pxa_id = id->driver_data_ptr;
	      |                                      ^~

which is a good thing as adding the needed const to fix this warning
improves type safety. (Sorry, no driver below drivers/power benefits
here, so the example is from a different subsystem.)

Patch #5 is just an unrelated change where I spotted the patch
opportunity while preparing this series. It's included here just for my
convenience and could be applied independently.

If you consider the last patch mostly churn, just drop it.

There are no dependencies between the patches, the only file that is
touched in more than one patch is drivers/power/supply/mt6360_charger.c
and even if these (i.e. patches #1 and #5) are reordered, git should be
able to cope with that without conflicts.

Note that this series is only build tested, and there is the possibility
that I failed to spot driver data usage that render patches #2 and/or #3
wrong. So a deeper look on at least those two won't hurt.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (6):
  power: Drop unused assignment of platform_device_id driver data
  power: supply: max14577: Drop driver data in of and platform device id
    arrays
  power: supply: max17042: Drop driver data in of and platform device id
    arrays
  power: Use named initializers for platform_device_id arrays
  power: supply: mt6360_charger: Use of match table unconditionally
  power: Unify code style for platform_device_id arrays

 drivers/power/reset/qemu-virt-ctrl.c           |  2 +-
 drivers/power/reset/spacemit-p1-reboot.c       |  4 ++--
 drivers/power/reset/tps65086-restart.c         |  2 +-
 drivers/power/supply/axp288_charger.c          |  2 +-
 drivers/power/supply/axp288_fuel_gauge.c       |  2 +-
 drivers/power/supply/bd71828-power.c           |  8 ++++----
 drivers/power/supply/charger-manager.c         |  4 ++--
 drivers/power/supply/cros_charge-control.c     |  4 ++--
 drivers/power/supply/cros_peripheral_charger.c |  4 ++--
 drivers/power/supply/cros_usbpd-charger.c      |  4 ++--
 drivers/power/supply/macsmc-power.c            |  2 +-
 drivers/power/supply/max14577_charger.c        | 12 +++++-------
 drivers/power/supply/max17042_battery.c        | 14 +++++++-------
 drivers/power/supply/max77693_charger.c        |  2 +-
 drivers/power/supply/max77759_charger.c        |  2 +-
 drivers/power/supply/max8997_charger.c         |  2 +-
 drivers/power/supply/max8998_charger.c         |  2 +-
 drivers/power/supply/mt6360_charger.c          |  6 +++---
 drivers/power/supply/pf1550-charger.c          |  2 +-
 drivers/power/supply/rt5033_charger.c          |  2 +-
 20 files changed, 40 insertions(+), 42 deletions(-)


base-commit: f7af91adc230aa99e23330ecf85bc9badd9780ad
-- 
2.47.3


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v1 1/6] power: Drop unused assignment of platform_device_id driver data
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays Uwe Kleine-König (The Capable Hub)
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Kuan-Wei Chiu, Benson Leung, Guenter Roeck, Thomas Weißschuh,
	Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-pm, linux-kernel, chrome-platform, linux-arm-kernel,
	linux-mediatek

The driver explicitly set the .driver_data member of struct
platform_device_id to zero without relying on that value. Drop this
unused assignments.

While touching this array unify spacing, use a named initializer for
.name and drop trailing commas after the list terminators.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/reset/qemu-virt-ctrl.c           | 2 +-
 drivers/power/supply/charger-manager.c         | 4 ++--
 drivers/power/supply/cros_charge-control.c     | 4 ++--
 drivers/power/supply/cros_peripheral_charger.c | 4 ++--
 drivers/power/supply/cros_usbpd-charger.c      | 4 ++--
 drivers/power/supply/max77693_charger.c        | 2 +-
 drivers/power/supply/max8997_charger.c         | 2 +-
 drivers/power/supply/mt6360_charger.c          | 4 ++--
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/power/reset/qemu-virt-ctrl.c b/drivers/power/reset/qemu-virt-ctrl.c
index 01409dfe2265..aa8355270b2c 100644
--- a/drivers/power/reset/qemu-virt-ctrl.c
+++ b/drivers/power/reset/qemu-virt-ctrl.c
@@ -103,7 +103,7 @@ static int qemu_virt_ctrl_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id qemu_virt_ctrl_id[] = {
-	{ "qemu-virt-ctrl", 0 },
+	{ .name = "qemu-virt-ctrl" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, qemu_virt_ctrl_id);
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
index 1b0239c59114..fa7518e9d72f 100644
--- a/drivers/power/supply/charger-manager.c
+++ b/drivers/power/supply/charger-manager.c
@@ -1649,8 +1649,8 @@ static void charger_manager_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id charger_manager_id[] = {
-	{ "charger-manager", 0 },
-	{ },
+	{ .name = "charger-manager" },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, charger_manager_id);
 
diff --git a/drivers/power/supply/cros_charge-control.c b/drivers/power/supply/cros_charge-control.c
index 53e6a77e03fc..b489325be816 100644
--- a/drivers/power/supply/cros_charge-control.c
+++ b/drivers/power/supply/cros_charge-control.c
@@ -320,8 +320,8 @@ static int cros_chctl_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id cros_chctl_id[] = {
-	{ "cros-charge-control", 0 },
-	{}
+	{ .name = "cros-charge-control" },
+	{ }
 };
 
 static struct platform_driver cros_chctl_driver = {
diff --git a/drivers/power/supply/cros_peripheral_charger.c b/drivers/power/supply/cros_peripheral_charger.c
index f132fad288cb..9f67a6dbd94e 100644
--- a/drivers/power/supply/cros_peripheral_charger.c
+++ b/drivers/power/supply/cros_peripheral_charger.c
@@ -369,8 +369,8 @@ 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 },
-	{}
+	{ .name = DRV_NAME },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, cros_pchg_id);
 
diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c
index 7d3e676a951c..308e1d4e6dd8 100644
--- a/drivers/power/supply/cros_usbpd-charger.c
+++ b/drivers/power/supply/cros_usbpd-charger.c
@@ -707,8 +707,8 @@ 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 },
-	{}
+	{ .name = DRV_NAME },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, cros_usbpd_charger_id);
 
diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c
index 027d6a539b65..76c58b32a374 100644
--- a/drivers/power/supply/max77693_charger.c
+++ b/drivers/power/supply/max77693_charger.c
@@ -788,7 +788,7 @@ static void max77693_charger_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max77693_charger_id[] = {
-	{ "max77693-charger", 0, },
+	{ .name = "max77693-charger" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max77693_charger_id);
diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c
index 1ec3535a257d..19da9eff0372 100644
--- a/drivers/power/supply/max8997_charger.c
+++ b/drivers/power/supply/max8997_charger.c
@@ -268,7 +268,7 @@ static int max8997_battery_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max8997_battery_id[] = {
-	{ "max8997-battery", 0 },
+	{ .name = "max8997-battery" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max8997_battery_id);
diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
index 77747eb51667..69955f255091 100644
--- a/drivers/power/supply/mt6360_charger.c
+++ b/drivers/power/supply/mt6360_charger.c
@@ -841,8 +841,8 @@ static const struct of_device_id __maybe_unused mt6360_charger_of_id[] = {
 MODULE_DEVICE_TABLE(of, mt6360_charger_of_id);
 
 static const struct platform_device_id mt6360_charger_id[] = {
-	{ "mt6360-chg", 0 },
-	{},
+	{ .name = "mt6360-chg" },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, mt6360_charger_id);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 1/6] power: Drop unused assignment of platform_device_id driver data Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 14:20   ` Krzysztof Kozlowski
  2026-05-29 10:18 ` [PATCH v1 3/6] power: supply: max17042: " Uwe Kleine-König (The Capable Hub)
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: Krzysztof Kozlowski, linux-pm, linux-kernel

These values are not used, the relevant distinction happens in the mfd
parent driver. So they can be dropped.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/supply/max14577_charger.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/power/supply/max14577_charger.c b/drivers/power/supply/max14577_charger.c
index 63077d38ea30..a15d94942184 100644
--- a/drivers/power/supply/max14577_charger.c
+++ b/drivers/power/supply/max14577_charger.c
@@ -613,18 +613,16 @@ static void max14577_charger_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max14577_charger_id[] = {
-	{ "max14577-charger", MAXIM_DEVICE_TYPE_MAX14577, },
-	{ "max77836-charger", MAXIM_DEVICE_TYPE_MAX77836, },
+	{ .name = "max14577-charger" },
+	{ .name = "max77836-charger" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max14577_charger_id);
 
 static const struct of_device_id of_max14577_charger_dt_match[] = {
-	{ .compatible = "maxim,max14577-charger",
-	  .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
-	{ .compatible = "maxim,max77836-charger",
-	  .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
-	{ },
+	{ .compatible = "maxim,max14577-charger" },
+	{ .compatible = "maxim,max77836-charger" },
+	{ }
 };
 MODULE_DEVICE_TABLE(of, of_max14577_charger_dt_match);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 3/6] power: supply: max17042: Drop driver data in of and platform device id arrays
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 1/6] power: Drop unused assignment of platform_device_id driver data Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 14:17   ` Krzysztof Kozlowski
  2026-05-29 14:21   ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Hans de Goede, Krzysztof Kozlowski, Marek Szyprowski,
	Sebastian Krzyszkowiak, Purism Kernel Team, linux-pm,
	linux-kernel

These values are not used, the relevant distinction happens in the mfd
parent driver. So they can be dropped.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/supply/max17042_battery.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 167fb3fb3732..3c50f5ba0591 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -1298,7 +1298,7 @@ static SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend,
 
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id max17042_acpi_match[] = {
-	{ "MAX17047", MAXIM_DEVICE_TYPE_MAX17047 },
+	{ "MAX17047" },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, max17042_acpi_match);
@@ -1346,12 +1346,12 @@ static const struct i2c_device_id max17042_id[] = {
 MODULE_DEVICE_TABLE(i2c, max17042_id);
 
 static const struct platform_device_id max17042_platform_id[] = {
-	{ "max17042", MAXIM_DEVICE_TYPE_MAX17042 },
-	{ "max17047", MAXIM_DEVICE_TYPE_MAX17047 },
-	{ "max17050", MAXIM_DEVICE_TYPE_MAX17050 },
-	{ "max17055", MAXIM_DEVICE_TYPE_MAX17055 },
-	{ "max77705-battery", MAXIM_DEVICE_TYPE_MAX17047 },
-	{ "max77849-battery", MAXIM_DEVICE_TYPE_MAX17047 },
+	{ .name = "max17042" },
+	{ .name = "max17047" },
+	{ .name = "max17050" },
+	{ .name = "max17055" },
+	{ .name = "max77705-battery" },
+	{ .name = "max77849-battery" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max17042_platform_id);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
                   ` (2 preceding siblings ...)
  2026-05-29 10:18 ` [PATCH v1 3/6] power: supply: max17042: " Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 11:29   ` Joshua Peisach
  2026-05-29 10:18 ` [PATCH v1 5/6] power: supply: mt6360_charger: Use of match table unconditionally Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 6/6] power: Unify code style for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  5 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Yixun Lan, Andreas Kemnade, Matti Vaittinen, Sven Peter,
	Janne Grunau, Neal Gompa, Amit Sunil Dhamne, Samuel Kayode,
	linux-pm, linux-riscv, spacemit, linux-kernel, asahi,
	linux-arm-kernel, imx

Named initializers are better readable and more robust to changes of the
struct definition. This robustness is relevant for a planned change to
struct platform_device_id replacing .driver_data by an anonymous union.

While touching these arrays unify spacing and usage of commas.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/reset/spacemit-p1-reboot.c | 4 ++--
 drivers/power/reset/tps65086-restart.c   | 2 +-
 drivers/power/supply/bd71828-power.c     | 8 ++++----
 drivers/power/supply/macsmc-power.c      | 2 +-
 drivers/power/supply/max77759_charger.c  | 2 +-
 drivers/power/supply/max8998_charger.c   | 2 +-
 drivers/power/supply/pf1550-charger.c    | 2 +-
 drivers/power/supply/rt5033_charger.c    | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/power/reset/spacemit-p1-reboot.c b/drivers/power/reset/spacemit-p1-reboot.c
index 9ec3d1fff8f3..84026b042ea2 100644
--- a/drivers/power/reset/spacemit-p1-reboot.c
+++ b/drivers/power/reset/spacemit-p1-reboot.c
@@ -70,8 +70,8 @@ static int spacemit_p1_reboot_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id spacemit_p1_reboot_id_table[] = {
-	{ "spacemit-p1-reboot", },
-	{ /* sentinel */ },
+	{ .name = "spacemit-p1-reboot" },
+	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(platform, spacemit_p1_reboot_id_table);
 
diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c
index 6976dbcac74f..37d248a9df17 100644
--- a/drivers/power/reset/tps65086-restart.c
+++ b/drivers/power/reset/tps65086-restart.c
@@ -41,7 +41,7 @@ static int tps65086_restart_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id tps65086_restart_id_table[] = {
-	{ "tps65086-reset", },
+	{ .name = "tps65086-reset" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(platform, tps65086_restart_id_table);
diff --git a/drivers/power/supply/bd71828-power.c b/drivers/power/supply/bd71828-power.c
index 5e78faa0a4aa..5ab514ff5c65 100644
--- a/drivers/power/supply/bd71828-power.c
+++ b/drivers/power/supply/bd71828-power.c
@@ -1184,10 +1184,10 @@ static int bd71828_power_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id bd71828_charger_id[] = {
-	{ "bd71815-power", ROHM_CHIP_TYPE_BD71815 },
-	{ "bd71828-power", ROHM_CHIP_TYPE_BD71828 },
-	{ "bd72720-power", ROHM_CHIP_TYPE_BD72720 },
-	{ },
+	{ .name = "bd71815-power", .driver_data = ROHM_CHIP_TYPE_BD71815 },
+	{ .name = "bd71828-power", .driver_data = ROHM_CHIP_TYPE_BD71828 },
+	{ .name = "bd72720-power", .driver_data = ROHM_CHIP_TYPE_BD72720 },
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, bd71828_charger_id);
 
diff --git a/drivers/power/supply/macsmc-power.c b/drivers/power/supply/macsmc-power.c
index 33ca07460f3a..ced07f71e0a8 100644
--- a/drivers/power/supply/macsmc-power.c
+++ b/drivers/power/supply/macsmc-power.c
@@ -834,7 +834,7 @@ static void macsmc_power_remove(struct platform_device *pdev)
 }
 
 static const struct platform_device_id macsmc_power_id[] = {
-	{ "macsmc-power" },
+	{ .name = "macsmc-power" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(platform, macsmc_power_id);
diff --git a/drivers/power/supply/max77759_charger.c b/drivers/power/supply/max77759_charger.c
index 9bb414599f16..c606d7bafcb8 100644
--- a/drivers/power/supply/max77759_charger.c
+++ b/drivers/power/supply/max77759_charger.c
@@ -754,7 +754,7 @@ static int max77759_charger_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max77759_charger_id[] = {
-	{ .name = "max77759-charger", },
+	{ .name = "max77759-charger" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max77759_charger_id);
diff --git a/drivers/power/supply/max8998_charger.c b/drivers/power/supply/max8998_charger.c
index 418b882b163d..b0eda2b51e7f 100644
--- a/drivers/power/supply/max8998_charger.c
+++ b/drivers/power/supply/max8998_charger.c
@@ -188,7 +188,7 @@ static int max8998_battery_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max8998_battery_id[] = {
-	{ "max8998-battery", TYPE_MAX8998 },
+	{ .name = "max8998-battery" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, max8998_battery_id);
diff --git a/drivers/power/supply/pf1550-charger.c b/drivers/power/supply/pf1550-charger.c
index a457862ef461..41036f4cb64a 100644
--- a/drivers/power/supply/pf1550-charger.c
+++ b/drivers/power/supply/pf1550-charger.c
@@ -622,7 +622,7 @@ static int pf1550_charger_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id pf1550_charger_id[] = {
-	{ "pf1550-charger", },
+	{ .name = "pf1550-charger" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(platform, pf1550_charger_id);
diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c
index de724f23e453..536ab29b657d 100644
--- a/drivers/power/supply/rt5033_charger.c
+++ b/drivers/power/supply/rt5033_charger.c
@@ -727,7 +727,7 @@ static int rt5033_charger_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id rt5033_charger_id[] = {
-	{ "rt5033-charger", },
+	{ .name = "rt5033-charger" },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, rt5033_charger_id);
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 5/6] power: supply: mt6360_charger: Use of match table unconditionally
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
                   ` (3 preceding siblings ...)
  2026-05-29 10:18 ` [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  2026-05-29 10:18 ` [PATCH v1 6/6] power: Unify code style for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
  5 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-pm,
	linux-kernel, linux-arm-kernel, linux-mediatek

mt6360_charger_of_id is defined unconditionally, so it doesn't make sense
to not use it for the driver's .of_match_table member.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/supply/mt6360_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/mt6360_charger.c b/drivers/power/supply/mt6360_charger.c
index 69955f255091..d3b0731f6562 100644
--- a/drivers/power/supply/mt6360_charger.c
+++ b/drivers/power/supply/mt6360_charger.c
@@ -849,7 +849,7 @@ MODULE_DEVICE_TABLE(platform, mt6360_charger_id);
 static struct platform_driver mt6360_charger_driver = {
 	.driver = {
 		.name = "mt6360-chg",
-		.of_match_table = of_match_ptr(mt6360_charger_of_id),
+		.of_match_table = mt6360_charger_of_id,
 	},
 	.probe = mt6360_charger_probe,
 	.id_table = mt6360_charger_id,
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v1 6/6] power: Unify code style for platform_device_id arrays
  2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
                   ` (4 preceding siblings ...)
  2026-05-29 10:18 ` [PATCH v1 5/6] power: supply: mt6360_charger: Use of match table unconditionally Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 10:18 ` Uwe Kleine-König (The Capable Hub)
  5 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 10:18 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: Hans de Goede, Chen-Yu Tsai, linux-pm, linux-kernel

Use a single space in the list terminator and remove the trailing comma.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/power/supply/axp288_charger.c    | 2 +-
 drivers/power/supply/axp288_fuel_gauge.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index ea0f5caee8f0..24a8b1ee2fec 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -955,7 +955,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 
 static const struct platform_device_id axp288_charger_id_table[] = {
 	{ .name = "axp288_charger" },
-	{},
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, axp288_charger_id_table);
 
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index a3d71fc72064..5af334c0a980 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -799,7 +799,7 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
 
 static const struct platform_device_id axp288_fg_id_table[] = {
 	{ .name = DEV_NAME },
-	{},
+	{ }
 };
 MODULE_DEVICE_TABLE(platform, axp288_fg_id_table);
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays
  2026-05-29 10:18 ` [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 11:29   ` Joshua Peisach
  2026-05-29 18:49     ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 1 reply; 12+ messages in thread
From: Joshua Peisach @ 2026-05-29 11:29 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Sebastian Reichel
  Cc: Yixun Lan, Andreas Kemnade, Matti Vaittinen, Sven Peter,
	Janne Grunau, Neal Gompa, Amit Sunil Dhamne, Samuel Kayode,
	linux-pm, linux-riscv, spacemit, linux-kernel, asahi,
	linux-arm-kernel, imx

On Fri May 29, 2026 at 6:18 AM EDT, Uwe Kleine-König (The Capable Hub) wrote:
> Named initializers are better readable and more robust to changes of the
> struct definition. This robustness is relevant for a planned change to
> struct platform_device_id replacing .driver_data by an anonymous union.
>
> While touching these arrays unify spacing and usage of commas.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
>  drivers/power/reset/spacemit-p1-reboot.c | 4 ++--
>  drivers/power/reset/tps65086-restart.c   | 2 +-
>  drivers/power/supply/bd71828-power.c     | 8 ++++----
>  drivers/power/supply/macsmc-power.c      | 2 +-
>  drivers/power/supply/max77759_charger.c  | 2 +-
>  drivers/power/supply/max8998_charger.c   | 2 +-
>  drivers/power/supply/pf1550-charger.c    | 2 +-
>  drivers/power/supply/rt5033_charger.c    | 2 +-
>  8 files changed, 12 insertions(+), 12 deletions(-)

[snip]

> diff --git a/drivers/power/supply/macsmc-power.c b/drivers/power/supply/macsmc-power.c
> index 33ca07460f3a..ced07f71e0a8 100644
> --- a/drivers/power/supply/macsmc-power.c
> +++ b/drivers/power/supply/macsmc-power.c
> @@ -834,7 +834,7 @@ static void macsmc_power_remove(struct platform_device *pdev)
>  }
>  
>  static const struct platform_device_id macsmc_power_id[] = {
> -	{ "macsmc-power" },
> +	{ .name = "macsmc-power" },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(platform, macsmc_power_id);

For macsmc-power,

Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>

(I'm not sure if one can "Review-by" a specific section of a singular
patch, but also the other changes in the patch look fine to me, so
consider it reviewed as well.)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 3/6] power: supply: max17042: Drop driver data in of and platform device id arrays
  2026-05-29 10:18 ` [PATCH v1 3/6] power: supply: max17042: " Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 14:17   ` Krzysztof Kozlowski
  2026-05-29 14:21   ` Uwe Kleine-König (The Capable Hub)
  1 sibling, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-29 14:17 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Sebastian Reichel
  Cc: Hans de Goede, Marek Szyprowski, Sebastian Krzyszkowiak,
	Purism Kernel Team, linux-pm, linux-kernel

On 29/05/2026 12:18, Uwe Kleine-König (The Capable Hub) wrote:
> These values are not used, the relevant distinction happens in the mfd
> parent driver. So they can be dropped.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>


I clearly see in this driver probe function 'chip_type =
id->driver_data' which later is being used ('chip->chip_type =
chip_type'), so I think it is used.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays
  2026-05-29 10:18 ` [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays Uwe Kleine-König (The Capable Hub)
@ 2026-05-29 14:20   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-29 14:20 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Sebastian Reichel
  Cc: linux-pm, linux-kernel

On 29/05/2026 12:18, Uwe Kleine-König (The Capable Hub) wrote:
> These values are not used, the relevant distinction happens in the mfd
> parent driver. So they can be dropped.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
>  drivers/power/supply/max14577_charger.c | 12 +++++-------


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 3/6] power: supply: max17042: Drop driver data in of and platform device id arrays
  2026-05-29 10:18 ` [PATCH v1 3/6] power: supply: max17042: " Uwe Kleine-König (The Capable Hub)
  2026-05-29 14:17   ` Krzysztof Kozlowski
@ 2026-05-29 14:21   ` Uwe Kleine-König (The Capable Hub)
  1 sibling, 0 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 14:21 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Hans de Goede, Krzysztof Kozlowski, Marek Szyprowski,
	Sebastian Krzyszkowiak, Purism Kernel Team, linux-pm,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

On Fri, May 29, 2026 at 12:18:18PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> These values are not used, the relevant distinction happens in the mfd
> parent driver. So they can be dropped.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
>  drivers/power/supply/max17042_battery.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
> index 167fb3fb3732..3c50f5ba0591 100644
> --- a/drivers/power/supply/max17042_battery.c
> +++ b/drivers/power/supply/max17042_battery.c
> @@ -1298,7 +1298,7 @@ static SIMPLE_DEV_PM_OPS(max17042_pm_ops, max17042_suspend,
>  
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id max17042_acpi_match[] = {
> -	{ "MAX17047", MAXIM_DEVICE_TYPE_MAX17047 },
> +	{ "MAX17047" },

This part is wrong. I missed that max17042_acpi_match is also used for
the i2c driver where the data is queried. Thanks to sashiko[1] for
noticing.

So please don't apply this patch.

As of now I assume the other patches are fine. I will check which parts
of the series didn't make it into next and/or the mainline later,
probably around the next merge window and resend accordingly.

Thanks
Uwe

[1] https://sashiko.dev/#/patchset/cover.1780048925.git.u.kleine-koenig%40baylibre.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays
  2026-05-29 11:29   ` Joshua Peisach
@ 2026-05-29 18:49     ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 0 replies; 12+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-29 18:49 UTC (permalink / raw)
  To: Joshua Peisach
  Cc: Sebastian Reichel, Yixun Lan, Andreas Kemnade, Matti Vaittinen,
	Sven Peter, Janne Grunau, Neal Gompa, Amit Sunil Dhamne,
	Samuel Kayode, linux-pm, linux-riscv, spacemit, linux-kernel,
	asahi, linux-arm-kernel, imx

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

Hello Joshua,

On Fri, May 29, 2026 at 07:29:08AM -0400, Joshua Peisach wrote:
> For macsmc-power,
> 
> Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>

Thanks!

> (I'm not sure if one can "Review-by" a specific section of a singular
> patch, but also the other changes in the patch look fine to me, so
> consider it reviewed as well.)

I think what you did is quite usual. The restriction doesn't make it
into git history this way though. Another usual idiom that can be found
often in git-log is:

Reviewed-by_ Joshua Peisach <jpeisach@ubuntu.com> # macsmc-power

(intentionally added did s/:/_/ to not make tools pick up this line).

Best regards
Uwe


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-05-29 18:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 10:18 [PATCH v1 0/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-05-29 10:18 ` [PATCH v1 1/6] power: Drop unused assignment of platform_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-05-29 10:18 ` [PATCH v1 2/6] power: supply: max14577: Drop driver data in of and platform device id arrays Uwe Kleine-König (The Capable Hub)
2026-05-29 14:20   ` Krzysztof Kozlowski
2026-05-29 10:18 ` [PATCH v1 3/6] power: supply: max17042: " Uwe Kleine-König (The Capable Hub)
2026-05-29 14:17   ` Krzysztof Kozlowski
2026-05-29 14:21   ` Uwe Kleine-König (The Capable Hub)
2026-05-29 10:18 ` [PATCH v1 4/6] power: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-05-29 11:29   ` Joshua Peisach
2026-05-29 18:49     ` Uwe Kleine-König (The Capable Hub)
2026-05-29 10:18 ` [PATCH v1 5/6] power: supply: mt6360_charger: Use of match table unconditionally Uwe Kleine-König (The Capable Hub)
2026-05-29 10:18 ` [PATCH v1 6/6] power: Unify code style for platform_device_id arrays Uwe Kleine-König (The Capable Hub)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox