mfd: Constify struct regmap_config
Subsystems (5)
cover mfd: Constify struct regmap_config
This series adds the const modifier to the remaining regmap_config structs within mfd that are effectively used as const (i.e., only read after their declaration), but kept as writtable data.
---
Javier Carrasco (7):
mfd: da9062-core: Constify struct regmap_config
mfd: fsl-imx25-tsadc: Constify struct regmap_config
mfd: hi655x-pmic: Constify struct regmap_config
mfd: wcd934x: Constify struct regmap_config
mfd: tps6105x: Constify struct regmap_config
mfd: rohm-bd9576: Constify struct regmap_config
mfd: intel-m10-bmc: Constify struct regmap_config
drivers/mfd/da9062-core.c | 4 ++-- drivers/mfd/fsl-imx25-tsadc.c | 2 +- drivers/mfd/hi655x-pmic.c | 2 +- drivers/mfd/intel-m10-bmc-pmci.c | 2 +- drivers/mfd/intel-m10-bmc-spi.c | 2 +- drivers/mfd/rohm-bd9576.c | 2 +- drivers/mfd/tps6105x.c | 2 +- drivers/mfd/wcd934x.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-)
---
base-commit: 0b58e108042b0ed28a71cd7edf5175999955b233
change-id: 20240703-mfd-const-regmap_config-96da5e18a85f
Best regards,
Signature · 1 line
Javier Carrasco <[email protected]>
PATCH 1/7 mfd: da9062-core: Constify struct regmap_config
da9061_regmap_config and da9062_regmap_config are not modified and can be declared as const to move their data to a read-only section.
--- drivers/mfd/da9062-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/da9062-core.c +2 -2
@@ -470,7 +470,7 @@ static const struct regmap_range_cfg da9061_range_cfg[] = { } }; -static struct regmap_config da9061_regmap_config = { +static const struct regmap_config da9061_regmap_config = { .reg_bits =8 , .val_bits =8 , .ranges = da9061_range_cfg,
@@ -576,7 +576,7 @@ static const struct regmap_range_cfg da9062_range_cfg[] = { } }; -static struct regmap_config da9062_regmap_config = { +static const struct regmap_config da9062_regmap_config = { .reg_bits =8 , .val_bits =8 , .ranges = da9062_range_cfg,
Signature · 1 line
2.40.1
PATCH 2/7 mfd: fsl-imx25-tsadc: Constify struct regmap_config
In reply to Javier Carrascomx25_tsadc_regmap_config is not modified and can be declared as const to move its data to a read-only section.
--- drivers/mfd/fsl-imx25-tsadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/fsl-imx25-tsadc.c +1 -1
@@ -16,7 +16,7 @@#include <linux/platform_device.h> #include <linux/regmap.h> -static struct regmap_config mx25_tsadc_regmap_config = { +static const struct regmap_config mx25_tsadc_regmap_config = { .fast_io = true, .max_register =8 , .reg_bits =32 ,
Signature · 1 line
2.40.1
PATCH 3/7 mfd: hi655x-pmic: Constify struct regmap_config
In reply to Javier Carrascohi655x_regmap_config is not modified and can be declared as const to move its data to a read-only section.
--- drivers/mfd/hi655x-pmic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/hi655x-pmic.c +1 -1
@@ -41,7 +41,7 @@ static const struct regmap_irq_chip hi655x_irq_chip = { .mask_base = HI655X_IRQ_MASK_BASE, }; -static struct regmap_config hi655x_regmap_config = { +static const struct regmap_config hi655x_regmap_config = { .reg_bits =32 , .reg_stride =HI655X_STRIDE , .val_bits =8 ,
Signature · 1 line
2.40.1
PATCH 4/7 mfd: wcd934x: Constify struct regmap_config
In reply to Javier Carrascowcd934x_regmap_config is not modified and can be declared as const to move its data to a read-only section.
--- drivers/mfd/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/wcd934x.c +1 -1
@@ -109,7 +109,7 @@ static const struct regmap_range_cfg wcd934x_ranges[] = { }, }; -static struct regmap_config wcd934x_regmap_config = { +static const struct regmap_config wcd934x_regmap_config = { .reg_bits =16 , .val_bits =8 , .cache_type =REGCACHE_MAPLE ,
Signature · 1 line
2.40.1
PATCH 5/7 mfd: tps6105x: Constify struct regmap_config
In reply to Javier Carrascotps6105x_regmap_config is not modified and can be declared as const to move its data to a read-only section.
--- drivers/mfd/tps6105x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/tps6105x.c +1 -1
@@ -23,7 +23,7 @@#include <linux/mfd/core.h> #include <linux/mfd/tps6105x.h> -static struct regmap_config tps6105x_regmap_config = { +static const struct regmap_config tps6105x_regmap_config = { .reg_bits =8 , .val_bits =8 , .max_register =TPS6105X_REG_3 ,
Signature · 1 line
2.40.1
PATCH 6/7 mfd: rohm-bd9576: Constify struct regmap_config
In reply to Javier Carrascobd957x_regmap is not modified and can be declared as const to move its data to a read-only section.
--- drivers/mfd/rohm-bd9576.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rohm-bd9576.c +1 -1
@@ -57,7 +57,7 @@ static const struct regmap_access_table volatile_regs = { .n_yes_ranges = ARRAY_SIZE(volatile_ranges), }; -static struct regmap_config bd957x_regmap = { +static const struct regmap_config bd957x_regmap = { .reg_bits =8 , .val_bits =8 , .volatile_table = &volatile_regs,
Signature · 1 line
2.40.1
Matti Vaittinen
maintainerRe: [PATCH 6/7] mfd: rohm-bd9576: Constify struct regmap_config
Quoted 14 lines · Javier Carrasco
bd957x_regmapis not modified and can be declared as const to move its data to a read-only section.Signed-off-by Javier Carrasco <[email protected]>--- drivers/mfd/rohm-bd9576.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/rohm-bd9576.c +0
-0
drivers/mfd/rohm-bd9576.c static const struct regmap_access_table volatile_regs = { · line 63
Quoted 8 lines
drivers/mfd/rohm-bd9576.c +1
-1@@ -57,7 +57,7 @@ static const struct regmap_access_table volatile_regs = { .n_yes_ranges = ARRAY_SIZE(volatile_ranges), }; -static struct regmap_config bd957x_regmap = { +static const struct regmap_config bd957x_regmap = { .reg_bits =8 , .val_bits =8 , .volatile_table = &volatile_regs,
Thanks a ton Javier. This looks good to me but if you feel like going an extra mile while you are at it... Do you think this could be extended to:
drivers/mfd/rohm-bd9576.c +3 -3
@@ -57,7 +57,7 @@ static const struct regmap_access_table volatile_regs = { .n_yes_ranges = ARRAY_SIZE(volatile_ranges), }; -static struct regmap_config bd957x_regmap = { +static const struct regmap_config bd957x_regmap = { .reg_bits =8 , .val_bits =8 , .volatile_table = &volatile_regs,
@@ -65,7 +65,7 @@ static struct regmap_config bd957x_regmap = { .cache_type = REGCACHE_MAPLE, }; -static struct regmap_irq bd9576_irqs[] = { +static const struct regmap_irq bd9576_irqs[] = {REGMAP_IRQ_REG (BD9576_INT_THERM ,0 ,BD957X_MASK_INT_MAIN_THERM ),REGMAP_IRQ_REG (BD9576_INT_OVP ,0 ,BD957X_MASK_INT_MAIN_OVP ),REGMAP_IRQ_REG (BD9576_INT_SCP ,0 ,BD957X_MASK_INT_MAIN_SCP ),
@@ -76,7 +76,7 @@ static struct regmap_irq bd9576_irqs[] = { REGMAP_IRQ_REG(BD9576_INT_SYS, 0, BD957X_MASK_INT_MAIN_SYS), }; -static struct regmap_irq_chip bd9576_irq_chip = { +static const struct regmap_irq_chip bd9576_irq_chip = { .name ="bd9576_irq" , .irqs = &bd9576_irqs[0 ], .num_irqs =ARRAY_SIZE (bd9576_irqs),
Yours,
-- Matti
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
Re: [PATCH 6/7] mfd: rohm-bd9576: Constify struct regmap_config
Quoted 61 lines · Matti Vaittinen
Quoted 20 lines · Javier Carrasco
bd957x_regmapis not modified and can be declared as const to move its data to a read-only section.Signed-off-by Javier Carrasco <[email protected]>---
drivers/mfd/rohm-bd9576.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/rohm-bd9576.c +1
-0@@ -57,7 +57,7 @@ static const struct regmap_access_table volatile_regs = { .n_yes_ranges = ARRAY_SIZE(volatile_ranges), }; -static struct regmap_config bd957x_regmap = { +static const struct regmap_config bd957x_regmap = { .reg_bits = 8, .val_bits = 8,Quoted 2 lines
.volatile_table =
&volatile_regs,Thanks a ton Javier. This looks good to me but if you feel like going an extra mile while you are at it... Do you think this could be extended to:
drivers/mfd/rohm-bd9576.c +3
-3@@ -57,7 +57,7 @@ static const struct regmap_access_table volatile_regs = { .n_yes_ranges = ARRAY_SIZE(volatile_ranges), }; -static struct regmap_config bd957x_regmap = { +static const struct regmap_config bd957x_regmap = { .reg_bits = 8, .val_bits = 8, .volatile_table = &volatile_regs,@@ -65,7 +65,7 @@ static struct regmap_config bd957x_regmap = { .cache_type = REGCACHE_MAPLE, }; -static struct regmap_irq bd9576_irqs[] = { +static const struct regmap_irq bd9576_irqs[] = { REGMAP_IRQ_REG(BD9576_INT_THERM, 0, BD957X_MASK_INT_MAIN_THERM), REGMAP_IRQ_REG(BD9576_INT_OVP, 0, BD957X_MASK_INT_MAIN_OVP), REGMAP_IRQ_REG(BD9576_INT_SCP, 0, BD957X_MASK_INT_MAIN_SCP),@@ -76,7 +76,7 @@ static struct regmap_irq bd9576_irqs[] = { REGMAP_IRQ_REG(BD9576_INT_SYS, 0, BD957X_MASK_INT_MAIN_SYS), }; -static struct regmap_irq_chip bd9576_irq_chip = { +static const struct regmap_irq_chip bd9576_irq_chip = { .name = "bd9576_irq", .irqs = &bd9576_irqs[0], .num_irqs = ARRAY_SIZE(bd9576_irqs),
Quoted 3 lines
Yours,
-- Matti
Sure, I will generalize it and update the series to cover regmap_irq and regmap_irq_chip as well, of course including these two cases too.
Best regards,
Javier Carrasco
PATCH 7/7 mfd: intel-m10-bmc: Constify struct regmap_config
In reply to Javier Carrascom10bmc_pmci_regmap_config and intel_m10bmc_regmap_config are not modified and can be declared as const to move their data to a read-only section.
--- drivers/mfd/intel-m10-bmc-pmci.c | 2 +- drivers/mfd/intel-m10-bmc-spi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/intel-m10-bmc-pmci.c +1 -1
@@ -336,7 +336,7 @@ static const struct regmap_access_table m10bmc_pmci_access_table = { .n_yes_ranges = ARRAY_SIZE(m10bmc_pmci_regmap_range), }; -static struct regmap_config m10bmc_pmci_regmap_config = { +static const struct regmap_config m10bmc_pmci_regmap_config = { .reg_bits =32 , .reg_stride =4 , .val_bits =32 ,
drivers/mfd/intel-m10-bmc-spi.c +1 -1
@@ -24,7 +24,7 @@ static const struct regmap_access_table m10bmc_access_table = { .n_yes_ranges = ARRAY_SIZE(m10bmc_regmap_range), }; -static struct regmap_config intel_m10bmc_regmap_config = { +static const struct regmap_config intel_m10bmc_regmap_config = { .reg_bits =32 , .val_bits =32 , .reg_stride =4 ,
Signature · 1 line
2.40.1