[PATCH v2 1/2] mfd: Constify mfd_cell arrays
Liviu Dudau
liviu.dudau at arm.com
Fri Oct 30 07:50:35 PDT 2026
On Fri, Oct 30, 2026 at 03:02:41PM +0100, Krzysztof Kozlowski wrote:
> mfd_add_devices() takes pointer to const, so 'struct mfd_cell' arrays
> can be constified whenever driver does not modify it in the probe.
>
> Acked-by: Chen-Yu Tsai <wens at kernel.org> # ac100 & axp20x
> Acked-by: Charles Keepax <ckeepax at opensource.cirrus.com>
> Acked-by: Thomas Richard (congatec GmbH) <thomas.richard at bootlin.com> # cgbc-core
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at oss.qualcomm.com>
>
> ---
>
> Changes in v2:
> 1. Add tags
> 2. Drop wm97xx-core.c, it was not intended to be committed
> ---
> drivers/mfd/ac100.c | 2 +-
> drivers/mfd/axp20x.c | 4 ++--
> drivers/mfd/cgbc-core.c | 2 +-
> drivers/mfd/cs5535-mfd.c | 2 +-
> drivers/mfd/intel_soc_pmic_bxtwc.c | 2 +-
> drivers/mfd/intel_soc_pmic_chtdc_ti.c | 2 +-
> drivers/mfd/intel_soc_pmic_chtwc.c | 2 +-
> drivers/mfd/intel_soc_pmic_crc.c | 6 +++---
> drivers/mfd/max77705.c | 2 +-
> drivers/mfd/menf21bmc.c | 2 +-
> drivers/mfd/mxs-lradc.c | 6 +++---
> drivers/mfd/rohm-bd718x7.c | 6 +++---
> drivers/mfd/rsmu_core.c | 8 ++++----
> drivers/mfd/stmfx.c | 2 +-
> drivers/mfd/vexpress-sysreg.c | 2 +-
For the vexpress-sysreg.c:
Reviewed-by: Liviu Dudau <liviu.dudau at arm.com>
Best regards,
Liviu
> 15 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/mfd/ac100.c b/drivers/mfd/ac100.c
> index 8f47c392cbd1..51b4d468c51d 100644
> --- a/drivers/mfd/ac100.c
> +++ b/drivers/mfd/ac100.c
> @@ -75,7 +75,7 @@ static const struct regmap_config ac100_regmap_config = {
> .cache_type = REGCACHE_MAPLE,
> };
>
> -static struct mfd_cell ac100_cells[] = {
> +static const struct mfd_cell ac100_cells[] = {
> {
> .name = "ac100-codec",
> .of_compatible = "x-powers,ac100-codec",
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 50df66de24e0..4d770e718716 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1055,13 +1055,13 @@ static const struct mfd_cell axp152_cells[] = {
> },
> };
>
> -static struct mfd_cell axp313a_cells[] = {
> +static const struct mfd_cell axp313a_cells[] = {
> /* AXP323 is sometimes paired with AXP717 as sub-PMIC */
> MFD_CELL_BASIC("axp20x-regulator", NULL, NULL, 0, 1),
> MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
> };
>
> -static struct mfd_cell axp717_cells[] = {
> +static const struct mfd_cell axp717_cells[] = {
> MFD_CELL_NAME("axp20x-regulator"),
> MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
> MFD_CELL_OF("axp717-adc",
> diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
> index 2becaf797646..3460c50047ea 100644
> --- a/drivers/mfd/cgbc-core.c
> +++ b/drivers/mfd/cgbc-core.c
> @@ -231,7 +231,7 @@ int cgbc_command(struct cgbc_device_data *cgbc, void *cmd, unsigned int cmd_size
> }
> EXPORT_SYMBOL_GPL(cgbc_command);
>
> -static struct mfd_cell cgbc_devs[] = {
> +static const struct mfd_cell cgbc_devs[] = {
> { .name = "cgbc-wdt" },
> { .name = "cgbc-gpio" },
> { .name = "cgbc-i2c", .id = 1 },
> diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c
> index f3becbef19f5..d91d60dc5416 100644
> --- a/drivers/mfd/cs5535-mfd.c
> +++ b/drivers/mfd/cs5535-mfd.c
> @@ -37,7 +37,7 @@ const struct software_node cs5535_gpio_swnode = {
> };
> EXPORT_SYMBOL_NS(cs5535_gpio_swnode, "CS5535");
>
> -static struct mfd_cell cs5535_mfd_cells[] = {
> +static const struct mfd_cell cs5535_mfd_cells[] = {
> {
> .name = "cs5535-smb",
> .num_resources = 1,
> diff --git a/drivers/mfd/intel_soc_pmic_bxtwc.c b/drivers/mfd/intel_soc_pmic_bxtwc.c
> index 117517c171b5..5aa9e52401f0 100644
> --- a/drivers/mfd/intel_soc_pmic_bxtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_bxtwc.c
> @@ -245,7 +245,7 @@ static const struct resource tmu_resources[] = {
> DEFINE_RES_IRQ_NAMED(BXTWC_TMU_IRQ, "TMU"),
> };
>
> -static struct mfd_cell bxt_wc_dev[] = {
> +static const struct mfd_cell bxt_wc_dev[] = {
> {
> .name = "bxt_wcove_thermal",
> .num_resources = ARRAY_SIZE(thermal_resources),
> diff --git a/drivers/mfd/intel_soc_pmic_chtdc_ti.c b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> index 6daf33e07ea0..8412a25d37ff 100644
> --- a/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> +++ b/drivers/mfd/intel_soc_pmic_chtdc_ti.c
> @@ -53,7 +53,7 @@ static const struct resource battery_resources[] = {
> DEFINE_RES_IRQ(CHTDC_TI_CCEOCAL),
> };
>
> -static struct mfd_cell chtdc_ti_dev[] = {
> +static const struct mfd_cell chtdc_ti_dev[] = {
> {
> .name = "chtdc_ti_pwrbtn",
> .num_resources = ARRAY_SIZE(power_button_resources),
> diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
> index aa71a7d83fcd..f27985a58c87 100644
> --- a/drivers/mfd/intel_soc_pmic_chtwc.c
> +++ b/drivers/mfd/intel_soc_pmic_chtwc.c
> @@ -50,7 +50,7 @@ static const struct resource cht_wc_ext_charger_resources[] = {
> DEFINE_RES_IRQ(CHT_WC_EXT_CHGR_IRQ),
> };
>
> -static struct mfd_cell cht_wc_dev[] = {
> +static const struct mfd_cell cht_wc_dev[] = {
> {
> .name = "cht_wcove_pwrsrc",
> .num_resources = ARRAY_SIZE(cht_wc_pwrsrc_resources),
> diff --git a/drivers/mfd/intel_soc_pmic_crc.c b/drivers/mfd/intel_soc_pmic_crc.c
> index 627a89334908..ce4c9ef59198 100644
> --- a/drivers/mfd/intel_soc_pmic_crc.c
> +++ b/drivers/mfd/intel_soc_pmic_crc.c
> @@ -54,7 +54,7 @@ static const struct resource gpio_resources[] = {
> DEFINE_RES_IRQ_NAMED(CRYSTAL_COVE_IRQ_GPIO, "GPIO"),
> };
>
> -static struct mfd_cell crystal_cove_byt_dev[] = {
> +static const struct mfd_cell crystal_cove_byt_dev[] = {
> {
> .name = "crystal_cove_pwrsrc",
> .num_resources = ARRAY_SIZE(pwrsrc_resources),
> @@ -93,7 +93,7 @@ static struct mfd_cell crystal_cove_byt_dev[] = {
> },
> };
>
> -static struct mfd_cell crystal_cove_cht_dev[] = {
> +static const struct mfd_cell crystal_cove_cht_dev[] = {
> {
> .name = "crystal_cove_gpio",
> .num_resources = ARRAY_SIZE(gpio_resources),
> @@ -142,7 +142,7 @@ static struct pwm_lookup crc_pwm_lookup[] = {
>
> struct crystal_cove_config {
> unsigned long irq_flags;
> - struct mfd_cell *cell_dev;
> + const struct mfd_cell *cell_dev;
> int n_cell_devs;
> const struct regmap_config *regmap_config;
> const struct regmap_irq_chip *irq_chip;
> diff --git a/drivers/mfd/max77705.c b/drivers/mfd/max77705.c
> index 2e9b81f26414..771015c229c8 100644
> --- a/drivers/mfd/max77705.c
> +++ b/drivers/mfd/max77705.c
> @@ -15,7 +15,7 @@
> #include <linux/regmap.h>
> #include <linux/of.h>
>
> -static struct mfd_cell max77705_devs[] = {
> +static const struct mfd_cell max77705_devs[] = {
> MFD_CELL_OF("max77705-rgb", NULL, NULL, 0, 0, "maxim,max77705-rgb"),
> MFD_CELL_OF("max77705-charger", NULL, NULL, 0, 0, "maxim,max77705-charger"),
> MFD_CELL_OF("max77705-haptic", NULL, NULL, 0, 0, "maxim,max77705-haptic"),
> diff --git a/drivers/mfd/menf21bmc.c b/drivers/mfd/menf21bmc.c
> index 0f24de516d72..252d5c81db6b 100644
> --- a/drivers/mfd/menf21bmc.c
> +++ b/drivers/mfd/menf21bmc.c
> @@ -17,7 +17,7 @@
> #define BMC_CMD_REV_MINOR 0x81
> #define BMC_CMD_REV_MAIN 0x82
>
> -static struct mfd_cell menf21bmc_cell[] = {
> +static const struct mfd_cell menf21bmc_cell[] = {
> { .name = "menf21bmc_wdt", },
> { .name = "menf21bmc_led", },
> { .name = "menf21bmc_hwmon", }
> diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
> index 64afc7631790..71ad5184f7e0 100644
> --- a/drivers/mfd/mxs-lradc.c
> +++ b/drivers/mfd/mxs-lradc.c
> @@ -90,7 +90,7 @@ static struct resource mx28_touchscreen_resources[] = {
> DEFINE_RES_IRQ_NAMED(MX28_LRADC_CH7_IRQ, "mxs-lradc-channel7"),
> };
>
> -static struct mfd_cell mx23_cells[] = {
> +static const struct mfd_cell mx23_cells[] = {
> {
> .name = "mxs-lradc-adc",
> .resources = mx23_adc_resources,
> @@ -103,7 +103,7 @@ static struct mfd_cell mx23_cells[] = {
> },
> };
>
> -static struct mfd_cell mx28_cells[] = {
> +static const struct mfd_cell mx28_cells[] = {
> {
> .name = "mxs-lradc-adc",
> .resources = mx28_adc_resources,
> @@ -128,7 +128,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct device_node *node = dev->of_node;
> struct mxs_lradc *lradc;
> - struct mfd_cell *cells = NULL;
> + const struct mfd_cell *cells = NULL;
> struct resource *res;
> int ret = 0;
> u32 ts_wires = 0;
> diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
> index 0b0f8e27e329..bd087004dde8 100644
> --- a/drivers/mfd/rohm-bd718x7.c
> +++ b/drivers/mfd/rohm-bd718x7.c
> @@ -19,12 +19,12 @@
>
> #include "rohm-pwrbutton.h"
>
> -static struct mfd_cell bd71837_mfd_cells[] = {
> +static const struct mfd_cell bd71837_mfd_cells[] = {
> { .name = "bd71837-clk", },
> { .name = "bd71837-pmic", },
> };
>
> -static struct mfd_cell bd71847_mfd_cells[] = {
> +static const struct mfd_cell bd71847_mfd_cells[] = {
> { .name = "bd71847-clk", },
> { .name = "bd71847-pmic", },
> };
> @@ -113,7 +113,7 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c)
> struct irq_domain *irq_domain;
> int ret;
> unsigned int chip_type;
> - struct mfd_cell *mfd;
> + const struct mfd_cell *mfd;
> int cells;
>
> if (!i2c->irq) {
> diff --git a/drivers/mfd/rsmu_core.c b/drivers/mfd/rsmu_core.c
> index fd04a6e5dfa3..02bfb84653ae 100644
> --- a/drivers/mfd/rsmu_core.c
> +++ b/drivers/mfd/rsmu_core.c
> @@ -22,7 +22,7 @@ enum {
> RSMU_N_DEVS = 2,
> };
>
> -static struct mfd_cell rsmu_cm_devs[] = {
> +static const struct mfd_cell rsmu_cm_devs[] = {
> [RSMU_PHC] = {
> .name = "8a3400x-phc",
> },
> @@ -31,7 +31,7 @@ static struct mfd_cell rsmu_cm_devs[] = {
> },
> };
>
> -static struct mfd_cell rsmu_sabre_devs[] = {
> +static const struct mfd_cell rsmu_sabre_devs[] = {
> [RSMU_PHC] = {
> .name = "82p33x1x-phc",
> },
> @@ -40,7 +40,7 @@ static struct mfd_cell rsmu_sabre_devs[] = {
> },
> };
>
> -static struct mfd_cell rsmu_sl_devs[] = {
> +static const struct mfd_cell rsmu_sl_devs[] = {
> [RSMU_PHC] = {
> .name = "8v19n85x-phc",
> },
> @@ -51,7 +51,7 @@ static struct mfd_cell rsmu_sl_devs[] = {
>
> int rsmu_core_init(struct rsmu_ddata *rsmu)
> {
> - struct mfd_cell *cells;
> + const struct mfd_cell *cells;
> int ret;
>
> switch (rsmu->type) {
> diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c
> index f683fdb6ece6..b0db33c0a7f2 100644
> --- a/drivers/mfd/stmfx.c
> +++ b/drivers/mfd/stmfx.c
> @@ -73,7 +73,7 @@ static const struct resource stmfx_ts_resources[] = {
> DEFINE_RES_IRQ(STMFX_REG_IRQ_SRC_EN_TS_OVF),
> };
>
> -static struct mfd_cell stmfx_cells[] = {
> +static const struct mfd_cell stmfx_cells[] = {
> {
> .of_compatible = "st,stmfx-0300-pinctrl",
> .name = "stmfx-pinctrl",
> diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
> index f49cee91f71c..c5f375cd22ae 100644
> --- a/drivers/mfd/vexpress-sysreg.c
> +++ b/drivers/mfd/vexpress-sysreg.c
> @@ -69,7 +69,7 @@ static const struct software_node vexpress_sysreg_sys_flash_swnode = {
> .properties = vexpress_sysreg_sys_flash_props,
> };
>
> -static struct mfd_cell vexpress_sysreg_cells[] = {
> +static const struct mfd_cell vexpress_sysreg_cells[] = {
> {
> .name = "basic-mmio-gpio",
> .of_compatible = "arm,vexpress-sysreg,sys_led",
> --
> 2.53.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
More information about the linux-arm-kernel
mailing list