Skip to contentSkip to conversation

hwmon: constify struct regmap_config

PATCH Applied Javier Carrasco 2 participants 7 messages Jul 2, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover hwmon: constify struct regmap_config

This series adds the const modifier to the remaining regmap_config structs within the hwmon subsystem that are effectively used as const (i.e., only read after their declaration), but kept ad writtable data.

---
Javier Carrasco (3):
hwmon: (ina238) Constify struct regmap_config
hwmon: (tmp513) Constify struct regmap_config
hwmon: (tps23861) Constify struct regmap_config

 drivers/hwmon/ina238.c   | 2 +-
 drivers/hwmon/tmp513.c   | 2 +-
 drivers/hwmon/tps23861.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

---
base-commit: 39b24cced70fdc336dbc0070f8b3bde61d8513a8
change-id: 20240702-hwmon-const-regmap-4d4e3c097d9e

Best regards,

Signature · 1 line
Javier Carrasco <[email protected]>
#1 lore raw

PATCH 1/3 hwmon: (ina238) Constify struct regmap_config

ina238_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/hwmon/ina238.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/ina238.c +1 -1
index 855626f1bc01..2d9f12f68d50 100644
@@ -96,7 +96,7 @@
 #define INA238_BUS_VOLTAGE_LSB		3125 /* 3.125 mV/lsb */
 #define INA238_DIE_TEMP_LSB		125 /* 125 mC/lsb */
 
-static struct regmap_config ina238_regmap_config = {
+static const struct regmap_config ina238_regmap_config = {
 	.max_register = INA238_REGISTERS,
 	.reg_bits = 8,
 	.val_bits = 16,
Signature · 1 line
2.40.1
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] hwmon: (ina238) Constify struct regmap_config

Quoted 4 lines · Javier Carrasco

ina238_regmap_config is not modified and can be declared as const to move its data to a read-only section.

Applied.

Thanks,
Guenter

#3 lore raw

PATCH 2/3 hwmon: (tmp513) Constify struct regmap_config

In reply to Javier Carrasco

tmp51x_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/hwmon/tmp513.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tmp513.c +1 -1
index ea6f4416c124..926d28cd3fab 100644
@@ -159,7 +159,7 @@ static const u8 TMP51X_CURR_INPUT[2] = {
 	TMP51X_BUS_CURRENT_RESULT
 };
 
-static struct regmap_config tmp51x_regmap_config = {
+static const struct regmap_config tmp51x_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 16,
 	.max_register = TMP51X_MAX_REGISTER_ADDR,
Signature · 1 line
2.40.1
maintainer Applied
#4 lore raw

Re: [PATCH 2/3] hwmon: (tmp513) Constify struct regmap_config

Quoted 4 lines · Javier Carrasco

tmp51x_regmap_config is not modified and can be declared as const to move its data to a read-only section.

Applied.

Thanks,
Guenter

#5 lore raw

PATCH 3/3 hwmon: (tps23861) Constify struct regmap_config

In reply to Javier Carrasco

tps23861_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/hwmon/tps23861.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tps23861.c +1 -1
index d33ecbac00d6..dfcfb09d9f3c 100644
@@ -117,7 +117,7 @@ struct tps23861_data {
 	struct dentry *debugfs_dir;
 };
 
-static struct regmap_config tps23861_regmap_config = {
+static const struct regmap_config tps23861_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 	.max_register = 0x6f,
Signature · 1 line
2.40.1
maintainer Applied
#6 lore raw

Re: [PATCH 3/3] hwmon: (tps23861) Constify struct regmap_config

Quoted 4 lines · Javier Carrasco

tps23861_regmap_config is not modified and can be declared as const to move its data to a read-only section.

Applied.

Thanks,
Guenter