From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:29:07
This patch uses memset_io instead of memset when using memset on __iomem
qualified pointers. This fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750.c:489:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:490:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:501:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:502:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:833:5: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:1154:9: warning: incorrect type in argument 1 (different address spaces)
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/sm750.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:29:12
Fixes Function declarations which expect no parameters to have a parameter list consisting of void. This fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750_hw.c:584:23: warning: non-ANSI function declaration of function 'hw_sm750le_deWait'
drivers/staging/sm750fb/sm750_hw.c:601:21: warning: non-ANSI function declaration of function 'hw_sm750_deWait'
9,13d7
drivers/staging/sm750fb/ddk750_chip.c:14:33: warning: non-ANSI function declaration of function 'getChipType'
drivers/staging/sm750fb/ddk750_chip.c:94:27: warning: non-ANSI function declaration of function 'getChipClock'
drivers/staging/sm750fb/ddk750_chip.c:235:31: warning: non-ANSI function declaration of function 'ddk750_getVMSize'
drivers/staging/sm750fb/ddk750_power.c:18:27: warning: non-ANSI function declaration of function 'getPowerMode'
drivers/staging/sm750fb/ddk750_display.c:276:24: warning: non-ANSI function declaration of function 'ddk750_initDVIDisp'
19,22d12
drivers/staging/sm750fb/ddk750_sii164.c:37:34: warning: non-ANSI function declaration of function 'sii164GetVendorID'
drivers/staging/sm750fb/ddk750_sii164.c:54:34: warning: non-ANSI function declaration of function 'sii164GetDeviceID'
drivers/staging/sm750fb/ddk750_dvi.c:65:31: warning: non-ANSI function declaration of function 'dviGetVendorID'
drivers/staging/sm750fb/ddk750_dvi.c:85:31: warning: non-ANSI function declaration of function 'dviGetDeviceID'
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/ddk750_chip.c | 6 +++---
drivers/staging/sm750fb/ddk750_display.c | 2 +-
drivers/staging/sm750fb/ddk750_dvi.c | 4 ++--
drivers/staging/sm750fb/ddk750_power.c | 2 +-
drivers/staging/sm750fb/ddk750_sii164.c | 4 ++--
drivers/staging/sm750fb/sm750_hw.c | 4 ++--
6 files changed, 11 insertions(+), 11 deletions(-)
@@ -273,7 +273,7 @@ void ddk750_setLogicalDispOut(disp_output_t output)}-intddk750_initDVIDisp()+intddk750_initDVIDisp(void){/* Initialize DVI. If the dviInit fail and the VendorID or the DeviceID arenotzeroed,thensetthefailureflag.Ifitiszeroe,itmightmean
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:29:16
This patch declares externally unavailable functions static. This fixes the
following sparse warnings:-
drivers/staging/sm750fb/ddk750_swi2c.c:223:6: warning: symbol 'swI2CStart' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_swi2c.c:234:6: warning: symbol 'swI2CStop' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_swi2c.c:252:6: warning: symbol 'swI2CWriteByte' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_swi2c.c:320:15: warning: symbol 'swI2CReadByte' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_swi2c.c:361:6: warning: symbol 'swI2CInit_SM750LE' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:63:6: warning: symbol 'hwI2CWaitTXDone' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:93:14: warning: symbol 'hwI2CWriteData' was not declared. Should it be static?
drivers/staging/sm750fb/ddk750_hwi2c.c:160:14: warning: symbol 'hwI2CReadData' was not declared. Should it be static?
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 6 +++---
drivers/staging/sm750fb/ddk750_swi2c.c | 10 +++++-----
drivers/staging/sm750fb/sm750_accel.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:29:21
This patch combines spinlock locks and unlocks together in the same block rather
than occurring in separate blocks preventing a possible deadlock. This fixes the
following sparse warnings:-
drivers/staging/sm750fb/sm750.c:218:22: warning: context imbalance in 'lynxfb_ops_fillrect' - different lock contexts for basic block
drivers/staging/sm750fb/sm750.c:241:22: warning: context imbalance in 'lynxfb_ops_copyarea' - different lock contexts for basic block
drivers/staging/sm750fb/sm750.c:282:22: warning: context imbalance in 'lynxfb_ops_imageblit' - different lock contexts for basic block
Unfortunately this change involves code (and comment) duplication.
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/sm750.c | 76 +++++++++++++++++++++++------------------
1 file changed, 43 insertions(+), 33 deletions(-)
@@ -56,23 +56,6 @@ static char * g_settings = NULL;staticintg_dualview=0;staticchar*g_option=NULL;-/* if not use spin_lock,system will die if user load driver-*andimmediatlyunloaddriverfrequently(dual)*/-staticinlinevoidmyspin_lock(spinlock_t*sl){-structlynx_share*share;-share=container_of(sl,structlynx_share,slock);-if(share->dual){-spin_lock(sl);-}-}--staticinlinevoidmyspin_unlock(spinlock_t*sl){-structlynx_share*share;-share=container_of(sl,structlynx_share,slock);-if(share->dual){-spin_unlock(sl);-}-}staticconststructfb_videomodelynx750_ext[]={/* 1024x600-60 VESA [1.71:1] */{NULL,60,1024,600,20423,144,40,18,1,104,3,
@@ -209,13 +192,22 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* rcolor=(Bpp=1)?region->color:((u32*)info->pseudo_palette)[region->color];rop=(region->rop!=ROP_COPY)?HW_ROP2_XOR:HW_ROP2_COPY;-myspin_lock(&share->slock);-share->accel.de_fillrect(&share->accel,-base,pitch,Bpp,-region->dx,region->dy,-region->width,region->height,-color,rop);-myspin_unlock(&share->slock);+/* if not use spin_lock,system will die if user load driver+*andimmediatlyunloaddriverfrequently(dual)*/+if(share->dual){+spin_lock(&share->slock);+share->accel.de_fillrect(&share->accel,+base,pitch,Bpp,+region->dx,region->dy,+region->width,region->height,+color,rop);+spin_unlock(&share->slock);+}else+share->accel.de_fillrect(&share->accel,+base,pitch,Bpp,+region->dx,region->dy,+region->width,region->height,+color,rop);}staticvoidlynxfb_ops_copyarea(structfb_info*info,conststructfb_copyarea*region)
@@ -233,12 +225,20 @@ static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea *pitch=info->fix.line_length;Bpp=info->var.bits_per_pixel>>3;-myspin_lock(&share->slock);-share->accel.de_copyarea(&share->accel,-base,pitch,region->sx,region->sy,-base,pitch,Bpp,region->dx,region->dy,-region->width,region->height,HW_ROP2_COPY);-myspin_unlock(&share->slock);+/* if not use spin_lock,system will die if user load driver+*andimmediatlyunloaddriverfrequently(dual)*/+if(share->dual){+spin_lock(&share->slock);+share->accel.de_copyarea(&share->accel,+base,pitch,region->sx,region->sy,+base,pitch,Bpp,region->dx,region->dy,+region->width,region->height,HW_ROP2_COPY);+spin_unlock(&share->slock);+}else+share->accel.de_copyarea(&share->accel,+base,pitch,region->sx,region->sy,+base,pitch,Bpp,region->dx,region->dy,+region->width,region->height,HW_ROP2_COPY);}staticvoidlynxfb_ops_imageblit(structfb_info*info,conststructfb_image*image)
@@ -272,14 +272,24 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag}return;_do_work:-myspin_lock(&share->slock);-share->accel.de_imageblit(&share->accel,+/* if not use spin_lock,system will die if user load driver+*andimmediatlyunloaddriverfrequently(dual)*/+if(share->dual){+spin_lock(&share->slock);+share->accel.de_imageblit(&share->accel,+image->data,image->width>>3,0,+base,pitch,Bpp,+image->dx,image->dy,+image->width,image->height,+fgcol,bgcol,HW_ROP2_COPY);+spin_unlock(&share->slock);+}else+share->accel.de_imageblit(&share->accel,image->data,image->width>>3,0,base,pitch,Bpp,image->dx,image->dy,image->width,image->height,fgcol,bgcol,HW_ROP2_COPY);-myspin_unlock(&share->slock);}staticintlynxfb_ops_pan_display(structfb_var_screeninfo*var,
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:29:54
This patch annotates pointers as referring to I/O mapped memory where they ought
to be, removes now unnecessary ugly casts, eliminates an incorrect deref on I/O
mapped memory by using iowrite16 instead, and updates the pointer arithmetic
accordingly to take into account that the pointers are now byte-sized. This
fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750_cursor.c:113:19: warning: cast removes address space of expression
drivers/staging/sm750fb/sm750_cursor.c:204:19: warning: cast removes address space of expression
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/sm750_cursor.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 01:30:21
This patch adds a reference to hw712_fillrect which is not used elsewhere in the driver,
but appears to be an alternative to the hw_fillrect method. This patch fixes the following sparse warning:-
drivers/staging/sm750fb/sm750_accel.c:95:5: warning: symbol 'hw712_fillrect' was not declared. Should it be static?
Signed-off-by: Lorenzo Stoakes <redacted>
---
drivers/staging/sm750fb/sm750_accel.c | 2 +-
drivers/staging/sm750fb/sm750_accel.h | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
From: Dan Carpenter <hidden> Date: 2015-03-11 08:54:53
On Wed, Mar 11, 2015 at 01:28:40AM +0000, Lorenzo Stoakes wrote:
This patch uses memset_io instead of memset when using memset on __iomem
qualified pointers. This fixes the following sparse warnings:-
drivers/staging/sm750fb/sm750.c:489:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:490:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:501:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:502:17: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:833:5: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/sm750fb/sm750.c:1154:9: warning: incorrect type in argument 1 (different address spaces)
Signed-off-by: Lorenzo Stoakes <redacted>
When I see a patch like this, then I worry, "What if the Sparse
annotations are wrong? The patch description doesn't say anything about
that." After review then I think the annotations are correct so that's
fine.
Btw, do you have this hardware? Are you able to test these changes?
regards,
dan carpenter
From: Dan Carpenter <hidden> Date: 2015-03-11 08:56:25
On Wed, Mar 11, 2015 at 01:28:43AM +0000, Lorenzo Stoakes wrote:
This patch adds a reference to hw712_fillrect which is not used elsewhere in the driver,
but appears to be an alternative to the hw_fillrect method. This patch fixes the following sparse warning:-
drivers/staging/sm750fb/sm750_accel.c:95:5: warning: symbol 'hw712_fillrect' was not declared. Should it be static?
Yes, good. We all hate locking wrappers but these are worse than
normal.
+ /* if not use spin_lock,system will die if user load driver
+ * and immediatly unload driver frequently (dual)*/
+ if (share->dual) {
+ spin_lock(&share->slock);
+ share->accel.de_fillrect(&share->accel,
+ base,pitch,Bpp,
+ region->dx,region->dy,
+ region->width,region->height,
+ color,rop);
+ spin_unlock(&share->slock);
+ } else
+ share->accel.de_fillrect(&share->accel,
+ base,pitch,Bpp,
+ region->dx,region->dy,
+ region->width,region->height,
+ color,rop);
}
No. You've made the code uglier to work around Sparse stupidness. Also
the braces are not according to kernel style.
if (share->dual)
spin_lock(&share->slock);
share->accel.de_fillrect(&share->accel,
base,pitch,Bpp,
region->dx,region->dy,
region->width,region->height,
color,rop);
if (share->dual)
spin_unlock(&share->slock);
Sparse will still complain but no one cares.
regards,
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 09:11:57
On 11 March 2015 at 08:54, Dan Carpenter [off-list ref] wrote:
When I see a patch like this, then I worry, "What if the Sparse
annotations are wrong? The patch description doesn't say anything about
that." After review then I think the annotations are correct so that's
fine.
How do you mean? I was careful to check what sparse was referring to,
then investigate how memset should be used with pointers with a
__iomem qualifier. I'd like to be able to improve my patch
descriptions going forward as best I can :)
Btw, do you have this hardware? Are you able to test these changes?
Unfortunately not, I am trying to keep these changes as simple code
fixes that ought not to affect actual hardware behaviour as I can
(though of course you can never be entirely sure that's the case!)
I suspect that Sudip must have some real hardware, is this the case
Sudip? If it isn't too presumptuous of me to ask, perhaps you might be
able to check patches that are successfully merged into
staging-testing?
Best,
--
Lorenzo Stoakes
https:/ljs.io
From: Dan Carpenter <hidden> Date: 2015-03-11 09:23:52
On Wed, Mar 11, 2015 at 09:11:52AM +0000, Lorenzo Stoakes wrote:
On 11 March 2015 at 08:54, Dan Carpenter [off-list ref] wrote:
quoted
When I see a patch like this, then I worry, "What if the Sparse
annotations are wrong? The patch description doesn't say anything about
that." After review then I think the annotations are correct so that's
fine.
How do you mean? I was careful to check what sparse was referring to,
then investigate how memset should be used with pointers with a
__iomem qualifier. I'd like to be able to improve my patch
descriptions going forward as best I can :)
Yes. The patch is correct. I wasn't asking you to redo it. From later
patches it's actually clear that you know that this change is a bugfix
and a behavior change. But we get a lot of patches where people just
randomly change things to please Sparse and it maybe silences a warning
but it's not correct. I can think of a few recentish examples where
people used standard struct types which hold __iomem or __user pointers
but they used them in non-standard ways so the pointers were actually
normal kernel pointers.
I guess the rule here is that the patch should explain the effect of the
bugfix for the user. Often you won't know the effect, but it's a
helpful thing to think about.
quoted
Btw, do you have this hardware? Are you able to test these changes?
Unfortunately not, I am trying to keep these changes as simple code
fixes that ought not to affect actual hardware behaviour as I can
(though of course you can never be entirely sure that's the case!)
That's fine. I was just wondering. It affects how paranoid I am when I
review the code.
regards,
dan carpenter
@@ -92,7 +92,7 @@ void hw_set2dformat(struct lynx_accel * accel,int fmt)/* seems sm712 RectFill command is broken,so need use BitBlt to*replaceit.*/-inthw712_fillrect(structlynx_accel*accel,+staticinthw712_fillrect(structlynx_accel*accel,u32base,u32pitch,u32Bpp,u32x,u32y,u32width,u32height,u32color,u32rop)
this is introducing a build warning, better remove this from your patch
and send a separate patch to remove the function as this function is
not used anywhere.
regards
sudip
@@ -92,7 +92,7 @@ void hw_set2dformat(struct lynx_accel * accel,int fmt)/* seems sm712 RectFill command is broken,so need use BitBlt to*replaceit.*/-staticinthw712_fillrect(structlynx_accel*accel,+inthw712_fillrect(structlynx_accel*accel,u32base,u32pitch,u32Bpp,u32x,u32y,u32width,u32height,u32color,u32rop)
in your previous patch 3/6 you made it static now you are again
removing the static keyword. may i ask why you changed it in 3/6 if you
again change it back to original in this patch?
anyways, like Dan said, delete this function, its not used anywhere.
it will not be used also, i missed removing this function from the
vendor crude drver.
regards
sudip
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 09:38:13
On 11 March 2015 at 09:30, Sudip Mukherjee
this is introducing a build warning, better remove this from your patch
and send a separate patch to remove the function as this function is
not used anywhere.
Hi Sudip,
I didn't realise I'd included the move to static in this patch. In a
later patch I expose this function in the header file. I'll update
this patch not to touch hw712_fillrect then remove it in a later patch
altogether.
Best,
--
Lorenzo Stoakes
https:/ljs.io
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 09:39:14
On 11 March 2015 at 09:37, Sudip Mukherjee [off-list ref] wrote:
in your previous patch 3/6 you made it static now you are again
removing the static keyword. may i ask why you changed it in 3/6 if you
again change it back to original in this patch?
There's no good reason, it's just a mistake :) I'll fix it shortly.
anyways, like Dan said, delete this function, its not used anywhere.
it will not be used also, i missed removing this function from the
vendor crude drver.
On Wed, Mar 11, 2015 at 09:11:52AM +0000, Lorenzo Stoakes wrote:
On 11 March 2015 at 08:54, Dan Carpenter [off-list ref] wrote:
quoted
Btw, do you have this hardware? Are you able to test these changes?
Unfortunately not, I am trying to keep these changes as simple code
fixes that ought not to affect actual hardware behaviour as I can
(though of course you can never be entirely sure that's the case!)
I suspect that Sudip must have some real hardware, is this the case
Sudip? If it isn't too presumptuous of me to ask, perhaps you might be
able to check patches that are successfully merged into
staging-testing?
yes, i have the hardware and will test on it. but your patch 5/6 and
6/6 is scaring me :)
regards
sudip
On Wed, Mar 11, 2015 at 03:18:06PM +0530, Sudip Mukherjee wrote:
On Wed, Mar 11, 2015 at 09:11:52AM +0000, Lorenzo Stoakes wrote:
quoted
On 11 March 2015 at 08:54, Dan Carpenter [off-list ref] wrote:
quoted
Btw, do you have this hardware? Are you able to test these changes?
Unfortunately not, I am trying to keep these changes as simple code
fixes that ought not to affect actual hardware behaviour as I can
(though of course you can never be entirely sure that's the case!)
I suspect that Sudip must have some real hardware, is this the case
Sudip? If it isn't too presumptuous of me to ask, perhaps you might be
able to check patches that are successfully merged into
staging-testing?
yes, i have the hardware and will test on it. but your patch 5/6 and
6/6 is scaring me :)
i think i will better check v2 of your series on hardware, and while
you are preparing that v2 keep in mind the changelog should not exceed
72 characters. in your this series for all patches it was more than
that.
regards
sudip
From: Lorenzo Stoakes <hidden> Date: 2015-03-11 10:41:50
On 11 March 2015 at 10:35, Sudip Mukherjee
i think i will better check v2 of your series on hardware
This is incoming in just a moment (though I only v2 patches in the
series I've changed which I think is the right way to make
modifications with a patch series.)
, and while
you are preparing that v2 keep in mind the changelog should not exceed
72 characters. in your this series for all patches it was more than
that.
I will update the messages in the changed patches accordingly, I'm not
sure this is worth a resend of all previous patches for however? I do
see quite a few patches in the log that exceed this.
Additionally, I suspect it would make the patches less readable to
wrap sparse warning lines so I think those ought to sit outside of
this limit.
I am more than happy to change these though if these ought to be kept
*strictly* to a 72 character limit throughout?
Best,
--
Lorenzo Stoakes
https:/ljs.io