Skip to contentSkip to conversation

Input - constify read-only struct regmap_config

PATCH In review Javier Carrasco 2 participants 4 messages Jul 5, 2024 – Jul 8, 2024

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

cover Input - constify read-only struct regmap_config

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

---
Javier Carrasco (2):
Input: qt1050 - constify struct regmap_config
Input: fsl-imx25-tcq - constify struct regmap_config

 drivers/input/keyboard/qt1050.c           | 2 +-
 drivers/input/touchscreen/fsl-imx25-tcq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
base-commit: 0b58e108042b0ed28a71cd7edf5175999955b233
change-id: 20240705-input-const-regmap_config-46d2fb3110bd

Best regards,

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

PATCH 1/2 Input: qt1050 - constify struct regmap_config

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

---
 drivers/input/keyboard/qt1050.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/qt1050.c +1 -1
index 056e9bc26026..5a2592e6293d 100644
@@ -208,7 +208,7 @@ static const struct regmap_access_table qt1050_writeable_table = {
 	.n_yes_ranges = ARRAY_SIZE(qt1050_writeable_ranges),
 };
 
-static struct regmap_config qt1050_regmap_config = {
+static const struct regmap_config qt1050_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 	.max_register = QT1050_RES_CAL,
Signature · 1 line
2.40.1
#2 lore raw

PATCH 2/2 Input: fsl-imx25-tcq - constify struct regmap_config

In reply to Javier Carrasco

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

---
 drivers/input/touchscreen/fsl-imx25-tcq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/fsl-imx25-tcq.c +1 -1
index 60a7246c5157..a32708652d10 100644
@@ -38,7 +38,7 @@ struct mx25_tcq_priv {
 	struct device *dev;
 };
 
-static struct regmap_config mx25_tcq_regconfig = {
+static const struct regmap_config mx25_tcq_regconfig = {
 	.fast_io = true,
 	.max_register = 0x5c,
 	.reg_bits = 32,
Signature · 1 line
2.40.1
maintainer
#3 lore raw
In reply to Javier Carrasco
Quoted 5 lines · Javier Carrasco

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

Quoted 8 lines

---
Javier Carrasco (2):
Input: qt1050 - constify struct regmap_config
Input: fsl-imx25-tcq - constify struct regmap_config

 drivers/input/keyboard/qt1050.c           | 2 +-
 drivers/input/touchscreen/fsl-imx25-tcq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied the lot, thank you.

Signature · 1 line
Dmitry