Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fbdev: mmp: Constify struct mmp_overlay_ops

'struct mmp_overlay_ops' 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, as an example:
Before:
======
text data bss dec hex filename
11798 555 16 12369 3051 drivers/video/fbdev/mmp/hw/mmp_ctrl.o

After:
=====
text data bss dec hex filename
11834 507 16 12357 3045 drivers/video/fbdev/mmp/hw/mmp_ctrl.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Christophe JAILLET and committed by
Helge Deller
b65bd787 c260bda6

+3 -3
+1 -1
drivers/video/fbdev/mmp/hw/mmp_ctrl.c
··· 313 313 mutex_unlock(&path->access_ok); 314 314 } 315 315 316 - static struct mmp_overlay_ops mmphw_overlay_ops = { 316 + static const struct mmp_overlay_ops mmphw_overlay_ops = { 317 317 .set_fetch = overlay_set_fetch, 318 318 .set_onoff = overlay_set_onoff, 319 319 .set_win = overlay_set_win,
+2 -2
include/video/mmp_disp.h
··· 156 156 int status; 157 157 struct mutex access_ok; 158 158 159 - struct mmp_overlay_ops *ops; 159 + const struct mmp_overlay_ops *ops; 160 160 }; 161 161 162 162 /* panel type */ ··· 299 299 int overlay_num; 300 300 void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode); 301 301 void (*set_onoff)(struct mmp_path *path, int status); 302 - struct mmp_overlay_ops *overlay_ops; 302 + const struct mmp_overlay_ops *overlay_ops; 303 303 void *plat_data; 304 304 }; 305 305