staging: sm750fb: Fix checkpatch warnings in sm750.c
Subsystems (2)
v2 cover staging: sm750fb: Fix checkpatch warnings in sm750.c
This patch series addresses the checkpatch.pl warnings identified by Dan Carpenter's review. The changes have been split into three separate patches as requested:
1. Fix const declaration for g_fbmode array
2. Fix function parameter alignment
3. Fix CamelCase variable naming
Each patch addresses a specific type of checkpatch warning and can be applied independently. The changes are purely stylistic and do not affect functionality.
Ignacio Peña (3):
staging: sm750fb: Fix const declaration for g_fbmode array
staging: sm750fb: Fix function parameter alignment
staging: sm750fb: Fix CamelCase variable naming
drivers/staging/sm750fb/sm750.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH v2 1/3 staging: sm750fb: Fix const declaration for g_fbmode array
The g_fbmode array should be declared as const pointer to const string as its contents never change.
--- drivers/staging/sm750fb/sm750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/sm750fb/sm750.c +1 -1
@@ -33,7 +33,7 @@static int g_hwcursor =1 ;static int g_noaccel;static int g_nomtrr; -static const char *g_fbmode[] = {NULL ,NULL }; +static const char *const g_fbmode[] = {NULL ,NULL };static const char *g_def_fbmode ="1024x768-32@60" ;static char *g_settings;static int g_dualview;
Signature · 1 line
2.39.5 (Apple Git-154)
Re: [PATCH 1/3] staging: sm750fb: Fix const declaration for g_fbmode array
Quoted 2 lines · Ignacio Peña
The
g_fbmodearray should be declared as const pointer to const string as its contents never change.
Try compiling this code. The contents do change.
There are a few other issues as well. Try running checkpatch on your patch. Also there is a specific format for v2 patches
https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/
regards,
dan carpenter
PATCH v2 2/3 staging: sm750fb: Fix function parameter alignment
In reply to Ignacio PeñaAlign function parameters properly to fix checkpatch.pl warnings about misaligned function arguments.
--- drivers/staging/sm750fb/sm750.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/sm750fb/sm750.c +4 -4
@@ -121,13 +121,13 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct fb_cursor *fbcursor)sm750_hw_cursor_disable (cursor);if (fbcursor->set &FB_CUR_SETSIZE )sm750_hw_cursor_set_size (cursor, - fbcursor->image.width, - fbcursor->image.height); + fbcursor->image.width, + fbcursor->image.height);if (fbcursor->set &FB_CUR_SETPOS )sm750_hw_cursor_set_pos (cursor, - fbcursor->image.dx - info->var.xoffset, - fbcursor->image.dy - info->var.yoffset); + fbcursor->image.dx - info->var.xoffset, + fbcursor->image.dy - info->var.yoffset);if (fbcursor->set &FB_CUR_SETCMAP ) {/* get the 16bit color of kernel means */
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH v2 3/3 staging: sm750fb: Fix CamelCase variable naming
In reply to Ignacio PeñaRename variable 'Bpp' to 'bpp' to fix checkpatch.pl warnings about CamelCase variable names. Use lowercase naming convention for local variables.
--- drivers/staging/sm750fb/sm750.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/sm750fb/sm750.c +10 -10
@@ -160,7 +160,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info, {struct lynxfb_par *par;struct sm750_dev *sm750_dev; -unsigned int base, pitch, Bpp, rop; +unsigned int base, pitch, bpp, rop;u32 color;if (info->state !=FBINFO_STATE_RUNNING )
@@ -175,9 +175,9 @@ static void lynxfb_ops_fillrect(struct fb_info *info,*/ base = par->crtc.o_screen; pitch = info->fix.line_length; - Bpp = info->var.bits_per_pixel >>3 ; + bpp = info->var.bits_per_pixel >>3 ; - color = (Bpp ==1 ) ? region->color : + color = (bpp ==1 ) ? region->color : ((u32 *)info->pseudo_palette)[region->color]; rop = (region->rop !=ROP_COPY ) ?HW_ROP2_XOR :HW_ROP2_COPY ;
@@ -190,7 +190,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,spin_lock (&sm750_dev->slock); sm750_dev->accel.de_fillrect (&sm750_dev->accel, - base, pitch, Bpp, + base, pitch, bpp, region->dx, region->dy, region->width, region->height, color, rop);
@@ -202,7 +202,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info, {struct lynxfb_par *par;struct sm750_dev *sm750_dev; -unsigned int base, pitch, Bpp; +unsigned int base, pitch, bpp; par = info->par; sm750_dev = par->dev;
@@ -213,7 +213,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,*/ base = par->crtc.o_screen; pitch = info->fix.line_length; - Bpp = info->var.bits_per_pixel >>3 ; + bpp = info->var.bits_per_pixel >>3 ;/* * If not use spin_lock, system will die if user load driver
@@ -225,7 +225,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info, sm750_dev->accel.de_copyarea (&sm750_dev->accel, base, pitch, region->sx, region->sy, - base, pitch, Bpp, region->dx, region->dy, + base, pitch, bpp, region->dx, region->dy, region->width, region->height,HW_ROP2_COPY );spin_unlock (&sm750_dev->slock);
@@ -234,7 +234,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,static void lynxfb_ops_imageblit (struct fb_info *info,const struct fb_image *image) { -unsigned int base, pitch, Bpp; +unsigned int base, pitch, bpp;unsigned int fgcol, bgcol;struct lynxfb_par *par;struct sm750_dev *sm750_dev;
@@ -247,7 +247,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,*/ base = par->crtc.o_screen; pitch = info->fix.line_length; - Bpp = info->var.bits_per_pixel >>3 ; + bpp = info->var.bits_per_pixel >>3 ;/* TODO: Implement hardware acceleration for image->depth > 1 */ if (image->depth !=1 ) {
@@ -274,7 +274,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, sm750_dev->accel.de_imageblit (&sm750_dev->accel, image->data, image->width >>3 ,0 , - base, pitch, Bpp, + base, pitch, bpp, image->dx, image->dy, image->width, image->height, fgcol, bgcol,HW_ROP2_COPY );
Signature · 1 line
2.39.5 (Apple Git-154)