[PATCH] sbrmi_i2c_regmap_config: Constify struct regmap_config

Christophe JAILLET <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.janitors
Message-ID <4b1f177cf2967ed27dd0159b3fcefeb96d2bde0f.1786367419.git.christophe.jaillet@wanadoo.fr>
'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 <[email protected]>
---
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.