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

video/mbx: 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
1ccca3fe 5bbee78a

+2 -2
+2 -2
drivers/video/fbdev/mbx/mbxfb.c
··· 79 79 80 80 }; 81 81 82 - static struct fb_var_screeninfo mbxfb_default = { 82 + static const struct fb_var_screeninfo mbxfb_default = { 83 83 .xres = 640, 84 84 .yres = 480, 85 85 .xres_virtual = 640, ··· 102 102 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 103 103 }; 104 104 105 - static struct fb_fix_screeninfo mbxfb_fix = { 105 + static const struct fb_fix_screeninfo mbxfb_fix = { 106 106 .id = "MBX", 107 107 .type = FB_TYPE_PACKED_PIXELS, 108 108 .visual = FB_VISUAL_TRUECOLOR,