diff mbox series

Input: cypress-sf - Constify struct i2c_device_id

Message ID 4bc3e3b4d10223d9df850fe4ba48f1cefd197082.1731689418.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Mainlined
Commit 34e77144308ff1efe2e865e68a033ce166f6411e
Headers show
Series Input: cypress-sf - Constify struct i2c_device_id | expand

Commit Message

Christophe JAILLET Nov. 15, 2024, 4:50 p.m. UTC
'struct i2c_device_id' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   6438	    618	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   6502	    554	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
 drivers/input/keyboard/cypress-sf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Torokhov Nov. 19, 2024, 3:35 a.m. UTC | #1
On Fri, Nov 15, 2024 at 05:50:37PM +0100, Christophe JAILLET wrote:
> 'struct i2c_device_id' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increase overall security.
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>    6438	    618	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>    6502	    554	      0	   7056	   1b90	drivers/input/keyboard/cypress-sf.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied, thank you.
diff mbox series

Patch

diff --git a/drivers/input/keyboard/cypress-sf.c b/drivers/input/keyboard/cypress-sf.c
index eb1d0720784d..335b72efc5aa 100644
--- a/drivers/input/keyboard/cypress-sf.c
+++ b/drivers/input/keyboard/cypress-sf.c
@@ -208,7 +208,7 @@  static int cypress_sf_resume(struct device *dev)
 static DEFINE_SIMPLE_DEV_PM_OPS(cypress_sf_pm_ops,
 				cypress_sf_suspend, cypress_sf_resume);
 
-static struct i2c_device_id cypress_sf_id_table[] = {
+static const struct i2c_device_id cypress_sf_id_table[] = {
 	{ CYPRESS_SF_DEV_NAME },
 	{ }
 };