video: xilinxfb: constify fb_fix_screeninfo and fb_var_screeninfo structures
Subsystems (2)
PATCH 1/1 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 at p = { ... };
@ok@
identifier r.i;
expression e;
position p;
@@
e = i at p
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct fb_fix_screeninfo e;
@@
e at 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.
--- drivers/video/fbdev/xilinxfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/xilinxfb.c +2 -2
@@ -110,14 +110,14 @@ static struct xilinxfb_platform_data xilinx_fb_default_pdata = {/* * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures */ -static struct fb_fix_screeninfo xilinx_fb_fix = { +static const struct fb_fix_screeninfo xilinx_fb_fix = { .id ="Xilinx" , .type =FB_TYPE_PACKED_PIXELS , .visual =FB_VISUAL_TRUECOLOR , .accel =FB_ACCEL_NONE }; -static struct fb_var_screeninfo xilinx_fb_var = { +static const struct fb_var_screeninfo xilinx_fb_var = { .bits_per_pixel =BITS_PER_PIXEL , .red = {RED_SHIFT ,8 ,0 },
Signature · 1 line
2.5.0
Quoted 51 lines · Gustavo A. R. Silva
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 structfb_fix_screeninfoi at p = { ... };@ok@
identifier r.i;
expression e;
position p;
@@
e = i at p@bad@
position p != {r.p,ok.p};
identifier r.i;
structfb_fix_screeninfoe;
@@
e at i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
structfb_fix_screeninfoi = { ... };The semantic patch for
fb_var_screeninfois analogous.Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/video/fbdev/xilinxfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/video/fbdev/xilinxfb.c +1
-1@@ -110,14 +110,14 @@ static struct xilinxfb_platform_data xilinx_fb_default_pdata = {/* * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures */ -static struct fb_fix_screeninfo xilinx_fb_fix = { +static const struct fb_fix_screeninfo xilinx_fb_fix = { .id ="Xilinx" ,
drivers/video/fbdev/xilinxfb.c static struct xilinxfb_platform_data xilinx_fb_default_pdata = { · line 123
Quoted 10 lines
drivers/video/fbdev/xilinxfb.c +1
-1.type = FB_TYPE_PACKED_PIXELS, .visual = FB_VISUAL_TRUECOLOR, .accel = FB_ACCEL_NONE }; -static struct fb_var_screeninfo xilinx_fb_var = { +static const struct fb_var_screeninfo xilinx_fb_var = { .bits_per_pixel =BITS_PER_PIXEL , .red = {RED_SHIFT ,8 ,0 },
Thanks,
Michal
Quoted 56 lines · Michal Simek
Quoted 55 lines · Gustavo A. R. Silva
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 structfb_fix_screeninfoi at p = { ... };@ok@
identifier r.i;
expression e;
position p;
@@
e = i at p@bad@
position p != {r.p,ok.p};
identifier r.i;
structfb_fix_screeninfoe;
@@
e at i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
structfb_fix_screeninfoi = { ... };The semantic patch for
fb_var_screeninfois analogous.Signed-off-by Gustavo A. R. Silva <[email protected]>--- drivers/video/fbdev/xilinxfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/video/fbdev/xilinxfb.c +1
-1@@ -110,14 +110,14 @@ static struct xilinxfb_platform_data xilinx_fb_default_pdata = {/* * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures */ -static struct fb_fix_screeninfo xilinx_fb_fix = { +static const struct fb_fix_screeninfo xilinx_fb_fix = { .id ="Xilinx" , .type =FB_TYPE_PACKED_PIXELS , .visual =FB_VISUAL_TRUECOLOR , .accel =FB_ACCEL_NONE };
Quoted 7 lines
drivers/video/fbdev/xilinxfb.c static struct xilinxfb_platform_data xilinx_fb_default_pdata = { · line 123
Quoted 6 lines
drivers/video/fbdev/xilinxfb.c +1
-1-static struct fb_var_screeninfo xilinx_fb_var = { +static const struct fb_var_screeninfo xilinx_fb_var = { .bits_per_pixel =BITS_PER_PIXEL , .red = {RED_SHIFT ,8 ,0 },Acked-by Michal Simek <[email protected]>
Thank you, Michal.
Signature · 1 line
Gustavo A. R. Silva
Quoted 32 lines · Gustavo A. R. Silva
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 structfb_fix_screeninfoi at p = { ... };@ok@
identifier r.i;
expression e;
position p;
@@
e = i at p@bad@
position p != {r.p,ok.p};
identifier r.i;
structfb_fix_screeninfoe;
@@
e at i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
structfb_fix_screeninfoi = { ... };
Quoted 3 lines
The semantic patch for
fb_var_screeninfois analogous.Signed-off-by Gustavo A. R. Silva <[email protected]>
Patch queued for 4.14, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics