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

video: xilinxfb: 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>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Cc: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

authored by

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

+2 -2
+2 -2
drivers/video/fbdev/xilinxfb.c
··· 110 110 /* 111 111 * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures 112 112 */ 113 - static struct fb_fix_screeninfo xilinx_fb_fix = { 113 + static const struct fb_fix_screeninfo xilinx_fb_fix = { 114 114 .id = "Xilinx", 115 115 .type = FB_TYPE_PACKED_PIXELS, 116 116 .visual = FB_VISUAL_TRUECOLOR, 117 117 .accel = FB_ACCEL_NONE 118 118 }; 119 119 120 - static struct fb_var_screeninfo xilinx_fb_var = { 120 + static const struct fb_var_screeninfo xilinx_fb_var = { 121 121 .bits_per_pixel = BITS_PER_PIXEL, 122 122 123 123 .red = { RED_SHIFT, 8, 0 },