[PATCH] sbrmi_i2c_regmap_config: Constify struct regmap_config

Christophe JAILLET posted 1 patch 1 month, 2 weeks ago
drivers/misc/amd-sbi/rmi-i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] sbrmi_i2c_regmap_config: Constify struct regmap_config
Posted by Christophe JAILLET 1 month, 2 weeks ago
'struct regmap_config' are not modified in this driver.

Constifying these structures moves some data to a read-only section, so
increases overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   5776	   3472	    320	   9568	   2560	drivers/misc/amd-sbi/rmi-i2c.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   6544	   2704	    320	   9568	   2560	drivers/misc/amd-sbi/rmi-i2c.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/misc/amd-sbi/rmi-i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/amd-sbi/rmi-i2c.c b/drivers/misc/amd-sbi/rmi-i2c.c
index 463a9a757464..3ed0a4244be7 100644
--- a/drivers/misc/amd-sbi/rmi-i2c.c
+++ b/drivers/misc/amd-sbi/rmi-i2c.c
@@ -86,12 +86,12 @@ static int sbrmi_common_probe(struct device *dev, struct regmap *regmap, uint8_t
 	return create_misc_rmi_device(data, dev);
 }
 
-static struct regmap_config sbrmi_regmap_config = {
+static const struct regmap_config sbrmi_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
 };
 
-static struct regmap_config sbrmi_regmap_config_ext = {
+static const struct regmap_config sbrmi_regmap_config_ext = {
 	.reg_bits = 16,
 	.val_bits = 8,
 	.reg_format_endian = REGMAP_ENDIAN_LITTLE,
-- 
2.55.0