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

video/chips: constify fb_fix_screeninfo and fb_var_screeninfo structures

These structures are only used to copy into other structures,
so declare them as const.

This issue was detected using Coccinelle and the following semantic patch:

@r disable optional_qualifier@
identifier i;
position p;
@@
static struct fb_fix_screeninfo i@p = { ... };

@ok@
identifier r.i;
expression e;
position p;
@@
e = i@p

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct fb_fix_screeninfo e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct fb_fix_screeninfo i = { ... };

The semantic patch for fb_var_screeninfo is analogous.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

authored by

Gustavo A. R. Silva and committed by
Bartlomiej Zolnierkiewicz
2d9e4e2b 1ccca3fe

+2 -2
+2 -2
drivers/video/fbdev/chipsfb.c
··· 292 292 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); 293 293 } 294 294 295 - static struct fb_fix_screeninfo chipsfb_fix = { 295 + static const struct fb_fix_screeninfo chipsfb_fix = { 296 296 .id = "C&T 65550", 297 297 .type = FB_TYPE_PACKED_PIXELS, 298 298 .visual = FB_VISUAL_PSEUDOCOLOR, ··· 309 309 .smem_len = 0x100000, /* 1MB */ 310 310 }; 311 311 312 - static struct fb_var_screeninfo chipsfb_var = { 312 + static const struct fb_var_screeninfo chipsfb_var = { 313 313 .xres = 800, 314 314 .yres = 600, 315 315 .xres_virtual = 800,