public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre•com>
To: Liam Girdwood <lgirdwood@gmail•com>, Mark Brown <broonie@kernel•org>
Cc: "Chanwoo Choi" <cw00.choi@samsung•com>,
	"Krzysztof Kozlowski" <krzk@kernel•org>,
	"Javier Martinez Canillas" <javier@dowhile0•org>,
	"Matthias Brugger" <matthias.bgg@gmail•com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora•com>,
	"André Draszik" <andre.draszik@linaro•org>,
	linux-kernel@vger•kernel.org,
	linux-arm-kernel@lists•infradead.org,
	linux-mediatek@lists•infradead.org,
	linux-samsung-soc@vger•kernel.org,
	"Karel Balej" <balejk@matfyz•cz>,
	"Matti Vaittinen" <mazziesaccount@gmail•com>,
	"Marek Vasut" <marek.vasut+renesas@gmail•com>,
	"Samuel Kayode" <samkay014@gmail•com>,
	"Aaro Koskinen" <aaro.koskinen@iki•fi>,
	"Andreas Kemnade" <andreas@kemnade•info>,
	"Kevin Hilman" <khilman@baylibre•com>,
	"Roger Quadros" <rogerq@kernel•org>,
	"Tony Lindgren" <tony@atomide•com>,
	linux-renesas-soc@vger•kernel.org, imx@lists•linux.dev,
	linux-arm-msm@vger•kernel.org, linux-omap@vger•kernel.org
Subject: [PATCH v1 0/3] regulator: Use named initializers for platform_device_id arrays
Date: Wed, 27 May 2026 12:47:43 +0200	[thread overview]
Message-ID: <cover.1779878004.git.u.kleine-koenig@baylibre.com> (raw)

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
index 3b0c9a251a2e..b84881f32444 100644
--- 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/regulator/bd96801-regulator.c b/drivers/regulator/bd96801-regulator.c
index 308279b31fd3..6bbad1f1ddd1 100644
--- a/drivers/regulator/bd96801-regulator.c
+++ b/drivers/regulator/bd96801-regulator.c
@@ -1211,7 +1211,7 @@ static int bd96801_probe(struct platform_device *pdev)
 {
 	struct regulator_dev *ldo_errs_rdev_arr[BD96801_NUM_LDOS];
 	struct regulator_dev *all_rdevs[BD96801_NUM_REGULATORS];
-	struct bd96801_pmic_data *pdata_template;
+	const struct bd96801_pmic_data *pdata_template;
 	struct bd96801_regulator_data *rdesc;
 	struct regulator_config config = {};
 	int ldo_errs_arr[BD96801_NUM_LDOS];
@@ -1224,7 +1224,7 @@ static int bd96801_probe(struct platform_device *pdev)
 
 	parent = pdev->dev.parent;
 
-	pdata_template = (struct bd96801_pmic_data *)platform_get_device_id(pdev)->driver_data;
+	pdata_template = platform_get_device_id(pdev)->driver_data_ptr;
 	if (!pdata_template)
 		return -ENODEV;
 
@@ -1329,10 +1329,10 @@ static int bd96801_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id bd96801_pmic_id[] = {
-	{ .name = "bd96801-regulator", .driver_data = (kernel_ulong_t)&bd96801_data },
-	{ .name = "bd96802-regulator", .driver_data = (kernel_ulong_t)&bd96802_data },
-	{ .name = "bd96805-regulator", .driver_data = (kernel_ulong_t)&bd96805_data },
-	{ .name = "bd96806-regulator", .driver_data = (kernel_ulong_t)&bd96806_data },
+	{ .name = "bd96801-regulator", .driver_data_ptr = &bd96801_data },
+	{ .name = "bd96802-regulator", .driver_data_ptr = &bd96802_data },
+	{ .name = "bd96805-regulator", .driver_data_ptr = &bd96805_data },
+	{ .name = "bd96806-regulator", .driver_data_ptr = &bd96806_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(platform, bd96801_pmic_id);

which allows the compiler to notice that driver_data is supposed to
be const and thus requires the first hunk.

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

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (3):
  regulator: Drop unused assignment of platform_device_id driver data
  regulator: Use named initializers for platform_device_id arrays
  regulator: Unify usage of space and comma in platform_device_id arrays

 drivers/regulator/88pm8607.c              |  4 +---
 drivers/regulator/88pm886-regulator.c     |  2 +-
 drivers/regulator/bd71815-regulator.c     |  4 ++--
 drivers/regulator/bd71828-regulator.c     |  6 +++---
 drivers/regulator/bd718x7-regulator.c     |  6 +++---
 drivers/regulator/bd9571mwv-regulator.c   |  4 ++--
 drivers/regulator/bd9576-regulator.c      |  6 +++---
 drivers/regulator/bd96801-regulator.c     | 10 +++++-----
 drivers/regulator/hi6421-regulator.c      |  2 +-
 drivers/regulator/hi6421v530-regulator.c  |  2 +-
 drivers/regulator/hi6421v600-regulator.c  |  2 +-
 drivers/regulator/hi655x-regulator.c      |  2 +-
 drivers/regulator/lp873x-regulator.c      |  2 +-
 drivers/regulator/lp87565-regulator.c     |  4 ++--
 drivers/regulator/max14577-regulator.c    |  4 ++--
 drivers/regulator/max77541-regulator.c    |  4 ++--
 drivers/regulator/max77620-regulator.c    |  8 ++++----
 drivers/regulator/max77686-regulator.c    |  4 ++--
 drivers/regulator/max77693-regulator.c    |  6 +++---
 drivers/regulator/max77802-regulator.c    |  4 ++--
 drivers/regulator/max8997-regulator.c     |  4 ++--
 drivers/regulator/max8998.c               |  4 ++--
 drivers/regulator/mt6323-regulator.c      |  4 ++--
 drivers/regulator/mt6331-regulator.c      |  4 ++--
 drivers/regulator/mt6332-regulator.c      |  4 ++--
 drivers/regulator/mt6357-regulator.c      |  4 ++--
 drivers/regulator/mt6358-regulator.c      |  4 ++--
 drivers/regulator/mt6359-regulator.c      |  4 ++--
 drivers/regulator/mt6360-regulator.c      |  4 ++--
 drivers/regulator/mt6370-regulator.c      |  4 ++--
 drivers/regulator/mt6380-regulator.c      |  4 ++--
 drivers/regulator/mt6397-regulator.c      |  4 ++--
 drivers/regulator/pf1550-regulator.c      |  2 +-
 drivers/regulator/qcom-pm8008-regulator.c |  2 +-
 drivers/regulator/rt4831-regulator.c      |  4 ++--
 drivers/regulator/rt5033-regulator.c      |  2 +-
 drivers/regulator/rt5120-regulator.c      |  4 ++--
 drivers/regulator/s2dos05-regulator.c     |  4 ++--
 drivers/regulator/s2mpa01.c               |  4 ++--
 drivers/regulator/s2mps11.c               | 18 +++++++++---------
 drivers/regulator/s5m8767.c               |  4 ++--
 drivers/regulator/sy7636a-regulator.c     |  2 +-
 drivers/regulator/tps65086-regulator.c    |  2 +-
 drivers/regulator/tps65218-regulator.c    |  2 +-
 drivers/regulator/tps65219-regulator.c    |  6 +++---
 drivers/regulator/tps65912-regulator.c    |  2 +-
 46 files changed, 95 insertions(+), 97 deletions(-)


base-commit: e7e28506af98ce4e1059e5ec59334b335c00a246
-- 
2.47.3



             reply	other threads:[~2026-05-27 10:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 10:47 Uwe Kleine-König (The Capable Hub) [this message]
2026-05-27 10:47 ` [PATCH v1 1/3] regulator: Drop unused assignment of platform_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-05-27 10:47 ` [PATCH v1 2/3] regulator: Use named initializers for platform_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-05-27 18:21   ` Karel Balej
2026-05-29  8:02   ` Matti Vaittinen
2026-06-02 15:09 ` [PATCH v1 0/3] " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1779878004.git.u.kleine-koenig@baylibre.com \
    --to=u.kleine-koenig@baylibre$(echo .)com \
    --cc=aaro.koskinen@iki$(echo .)fi \
    --cc=andre.draszik@linaro$(echo .)org \
    --cc=andreas@kemnade$(echo .)info \
    --cc=angelogioacchino.delregno@collabora$(echo .)com \
    --cc=balejk@matfyz$(echo .)cz \
    --cc=broonie@kernel$(echo .)org \
    --cc=cw00.choi@samsung$(echo .)com \
    --cc=imx@lists$(echo .)linux.dev \
    --cc=javier@dowhile0$(echo .)org \
    --cc=khilman@baylibre$(echo .)com \
    --cc=krzk@kernel$(echo .)org \
    --cc=lgirdwood@gmail$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-arm-msm@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mediatek@lists$(echo .)infradead.org \
    --cc=linux-omap@vger$(echo .)kernel.org \
    --cc=linux-renesas-soc@vger$(echo .)kernel.org \
    --cc=linux-samsung-soc@vger$(echo .)kernel.org \
    --cc=marek.vasut+renesas@gmail$(echo .)com \
    --cc=matthias.bgg@gmail$(echo .)com \
    --cc=mazziesaccount@gmail$(echo .)com \
    --cc=rogerq@kernel$(echo .)org \
    --cc=samkay014@gmail$(echo .)com \
    --cc=tony@atomide$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox