Skip to contentSkip to conversation

staging: sm750fb: Make internal functions static

PATCH In review Lorenzo Stoakes 2 participants 10 messages Mar 11, 2015 – Mar 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 3/6 staging: sm750fb: Make internal functions static

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?

---
 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(-)
drivers/staging/sm750fb/ddk750_hwi2c.c +3 -3
index 84dfb6f..7826376 100644
@@ -60,7 +60,7 @@ void hwI2CClose(void)
 }
 
 
-long hwI2CWaitTXDone(void)
+static long hwI2CWaitTXDone(void)
 {
     unsigned int timeout;
 
@@ -90,7 +90,7 @@ long hwI2CWaitTXDone(void)
  *  Return Value:
  *      Total number of bytes those are actually written.
  */
-unsigned int hwI2CWriteData(
+static unsigned int hwI2CWriteData(
     unsigned char deviceAddress,
     unsigned int length,
     unsigned char *pBuffer
@@ -157,7 +157,7 @@ unsigned int hwI2CWriteData(
  *  Return Value:
  *      Total number of actual bytes read from the slave device
  */
-unsigned int hwI2CReadData(
+static unsigned int hwI2CReadData(
     unsigned char deviceAddress,
     unsigned int length,
     unsigned char *pBuffer
drivers/staging/sm750fb/ddk750_swi2c.c +5 -5
index 1249759..516f5bb 100644
@@ -220,7 +220,7 @@ static void swI2CAck(void)
 /*
  *  This function sends the start command to the slave device
  */
-void swI2CStart(void)
+static void swI2CStart(void)
 {
     /* Start I2C */
     swI2CSDA(1);
@@ -231,7 +231,7 @@ void swI2CStart(void)
 /*
  *  This function sends the stop command to the slave device
  */
-void swI2CStop(void)
+static void swI2CStop(void)
 {
     /* Stop the I2C */
     swI2CSCL(1);
@@ -249,7 +249,7 @@ void swI2CStop(void)
  *       0   - Success
  *      -1   - Fail to write byte
  */
-long swI2CWriteByte(unsigned char data)
+static long swI2CWriteByte(unsigned char data)
 {
     unsigned char value = data;
     int i;
@@ -317,7 +317,7 @@ long swI2CWriteByte(unsigned char data)
  *  Return Value:
  *      One byte data read from the Slave device
  */
-unsigned char swI2CReadByte(unsigned char ack)
+static unsigned char swI2CReadByte(unsigned char ack)
 {
     int i;
     unsigned char data = 0;
@@ -358,7 +358,7 @@ unsigned char swI2CReadByte(unsigned char ack)
  *      -1   - Fail to initialize the i2c
  *       0   - Success
  */
-long swI2CInit_SM750LE(
+static long swI2CInit_SM750LE(
     unsigned char i2cClkGPIO,
     unsigned char i2cDataGPIO
 )
Signature · 1 line
2.3.2
#1 lore raw

PATCH v2 4/6 staging: sm750fb: Remove unused function

This patch removes the unused hw712_fillrect function. 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?

---
 drivers/staging/sm750fb/sm750_accel.c | 78 -----------------------------------
 1 file changed, 78 deletions(-)
drivers/staging/sm750fb/sm750_accel.c +0 -77
index 6521c3b..c5a3726 100644
@@ -89,84 +89,6 @@ void hw_set2dformat(struct lynx_accel * accel,int fmt)
 	write_dpr(accel,DE_STRETCH_FORMAT,reg);
 }
 
-/* seems sm712 RectFill command is broken,so need use BitBlt to
- * replace it. */
-
-int hw712_fillrect(struct lynx_accel * accel,
-				u32 base,u32 pitch,u32 Bpp,
-				u32 x,u32 y,u32 width,u32 height,
-				u32 color,u32 rop)
-{
-	u32 deCtrl;
-	if(accel->de_wait() != 0)
-	{
-		/* int time wait and always busy,seems hardware
-		 * got something error */
-		pr_debug("%s:De engine always bussy\n",__func__);
-		return -1;
-	}
-	/* 24bpp 2d acceleration still not work,we already support 2d on
-	 * both 8/16/32 bpp now, so there is no harm if we disable 2d on
-	 * 24bpp for current stage. */
-#if 0
-	if(Bpp = 3){
-		width *= 3;
-		x *= 3;
-		write_dpr(accel,DE_PITCH,
-			FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch)|
-			FIELD_VALUE(0,DE_PITCH,SOURCE,pitch));//dpr10
-	}
-	else
-#endif
-	{
-		write_dpr(accel,DE_PITCH,
-			FIELD_VALUE(0,DE_PITCH,DESTINATION,pitch/Bpp)|
-			FIELD_VALUE(0,DE_PITCH,SOURCE,pitch/Bpp));//dpr10
-
-	}
-
-	write_dpr(accel,DE_FOREGROUND,color);//DPR14
-	write_dpr(accel,DE_MONO_PATTERN_HIGH,~0);//DPR34
-	write_dpr(accel,DE_MONO_PATTERN_LOW,~0);//DPR38
-
-	write_dpr(accel,DE_WINDOW_SOURCE_BASE,base);//dpr44
-	write_dpr(accel,DE_WINDOW_DESTINATION_BASE,base);//dpr40
-
-
-	write_dpr(accel,DE_WINDOW_WIDTH,
-			FIELD_VALUE(0,DE_WINDOW_WIDTH,DESTINATION,pitch/Bpp)|
-			FIELD_VALUE(0,DE_WINDOW_WIDTH,SOURCE,pitch/Bpp));//dpr3c
-
-
-	write_dpr(accel,DE_DESTINATION,
-			FIELD_SET(0,DE_DESTINATION,WRAP,DISABLE)|
-			FIELD_VALUE(0,DE_DESTINATION,X,x)|
-			FIELD_VALUE(0,DE_DESTINATION,Y,y));//dpr4
-
-	write_dpr(accel,DE_DIMENSION,
-			FIELD_VALUE(0,DE_DIMENSION,X,width)|
-			FIELD_VALUE(0,DE_DIMENSION,Y_ET,height));//dpr8
-
-	deCtrl -		FIELD_SET(0,DE_CONTROL,STATUS,START)|
-		FIELD_SET(0,DE_CONTROL,COMMAND,BITBLT)|
-		FIELD_SET(0,DE_CONTROL,ROP2_SOURCE,PATTERN)|
-		FIELD_SET(0,DE_CONTROL,ROP_SELECT,ROP2)|
-		FIELD_VALUE(0,DE_CONTROL,ROP,rop);//dpr0xc
-#if 0
-		/* dump registers */
-		int i;
-		inf_msg("x,y,w,h = %d,%d,%d,%d\n",x,y,width,height);
-		for(i=0x04;i<=0x44;i+=4){
-			inf_msg("dpr%02x = %08x\n",i,read_dpr(accel,i));
-		}
-		inf_msg("deCtrl = %08x\n",deCtrl);
-#endif
-
-	write_dpr(accel,DE_CONTROL,deCtrl);
-	return 0;
-}
-
 int hw_fillrect(struct lynx_accel * accel,
 				u32 base,u32 pitch,u32 Bpp,
 				u32 x,u32 y,u32 width,u32 height,
Signature · 1 line
2.3.2
#5 lore raw

PATCH v2 6/6 staging: sm750fb: Remove spinlock helper function

In reply to Lorenzo Stoakes

This patch removes the unnecessary spinlock helper function and instead calls spin_lock and spin_unlock directly.

This does *not* resolve sparse warnings about context imbalances but these are spurious.

---
 drivers/staging/sm750fb/sm750.c | 47 +++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 23 deletions(-)
drivers/staging/sm750fb/sm750.c +24 -23
index 3e36b6a..217795e 100644
@@ -56,23 +56,6 @@ static char * g_settings = NULL;
 static int g_dualview = 0;
 static char * g_option = NULL;
 
-/* if not use spin_lock,system will die if user load driver
- * and immediatly unload driver frequently (dual)*/
-static inline void myspin_lock(spinlock_t * sl){
-	struct lynx_share * share;
-	share = container_of(sl,struct lynx_share,slock);
-	if(share->dual){
-		spin_lock(sl);
-	}
-}
-
-static inline void myspin_unlock(spinlock_t * sl){
-	struct lynx_share * share;
-	share = container_of(sl,struct lynx_share,slock);
-	if(share->dual){
-		spin_unlock(sl);
-	}
-}
 static const struct fb_videomode lynx750_ext[] = {
 	/*  	1024x600-60 VESA 	[1.71:1]	*/
 	{NULL,  60, 1024, 600, 20423, 144,  40, 18, 1, 104, 3,
@@ -209,13 +192,19 @@ static void lynxfb_ops_fillrect(struct fb_info* info,const struct fb_fillrect* r
 	color = (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);
+	/* 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);
-	myspin_unlock(&share->slock);
+
+	if (share->dual)
+		spin_unlock(&share->slock);
 }
 
 static void lynxfb_ops_copyarea(struct fb_info * info,const struct fb_copyarea * region)
@@ -233,12 +222,18 @@ 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);
+	/* 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_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 (share->dual)
+		spin_unlock(&share->slock);
 }
 
 static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* image)
@@ -272,14 +267,20 @@ static void lynxfb_ops_imageblit(struct fb_info*info,const struct fb_image* imag
 	}
 	return;
 _do_work:
-	myspin_lock(&share->slock);
+	/* 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_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);
+
+	if (share->dual)
+		spin_unlock(&share->slock);
 }
 
 static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var,
Signature · 1 line
2.3.2
maintainer
#2 lore raw

Re: [PATCH v2 4/6] staging: sm750fb: Remove unused function

In reply to Lorenzo Stoakes

drivers/staging/sm750fb/sm750_accel.c

Quoted 14 lines · Lorenzo Stoakes

This patch removes the unused hw712_fillrect function. 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?

---
 drivers/staging/sm750fb/sm750_accel.c | 78 -----------------------------------
 1 file changed, 78 deletions(-)
drivers/staging/sm750fb/sm750_accel.c +0 -0
index 6521c3b..c5a3726 100644

but function prototype still remains in sm750_accel.h

regards
sudip

#3 lore raw

Re: [PATCH v2 4/6] staging: sm750fb: Remove unused function

Quoted 1 line · Sudip Mukherjee

but function prototype still remains in sm750_accel.h

No it doesn't, v2 of patch 3 in the series no longer puts it there :)

Signature · 2 lines
Lorenzo Stoakes
https:/ljs.io
maintainer
#4 lore raw

Re: [PATCH v2 4/6] staging: sm750fb: Remove unused function

Quoted 4 lines · Lorenzo Stoakes
Quoted 1 line · Sudip Mukherjee

but function prototype still remains in sm750_accel.h

No it doesn't, v2 of patch 3 in the series no longer puts it there :)

oops.. i am sorry.. i still had your previous patches applied thatiswhy i got the prototype in sm750_accel.h

regards
sudip

Quoted 4 lines
Signature · 3 lines
-- 
Lorenzo Stoakes
https:/ljs.io
maintainer
#6 lore raw

Re: [PATCH v2 6/6] staging: sm750fb: Remove spinlock helper function

In reply to Lorenzo Stoakes
Quoted 5 lines · Lorenzo Stoakes

This patch removes the unnecessary spinlock helper function and instead calls spin_lock and spin_unlock directly.

This does *not* resolve sparse warnings about context imbalances but these are spurious.

tested the whole series on hardware, looks ok.

now it depends on Greg if he wants to accept patches with such big commit logs, and another problem he will face is to get some patches from this thread and some from the old thread.
(while testing i faced this problem to maintain the sequence of
patches)

regards
sudip

#7 lore raw

Re: [PATCH v2 6/6] staging: sm750fb: Remove spinlock helper function

Quoted 3 lines · Sudip Mukherjee

tested the whole series on hardware, looks ok.

Great!

Quoted 5 lines

now it depends on Greg if he wants to accept patches with such big commit logs, and another problem he will face is to get some patches from this thread and some from the old thread.
(while testing i faced this problem to maintain the sequence of
patches)

I am more than happy to resend the whole series as necessary if that makes it easier for Greg or anyone else :) I have previously resubmitted an entire patch series only for people to find the v2 resubmits of unchanged code to be confusing. I am absolutely happy to do whatever works for Greg of course!

Best,

Signature · 2 lines
Lorenzo Stoakes
https:/ljs.io
maintainer
#8 lore raw

Re: [PATCH v2 6/6] staging: sm750fb: Remove spinlock helper function

Quoted 7 lines · Lorenzo Stoakes

On 11 March 2015 at 14:58, Sudip Mukherjee <[email protected]> wrote:

I am more than happy to resend the whole series as necessary if that makes it easier for Greg or anyone else :) I have previously resubmitted an entire patch series only for people to find the v2 resubmits of unchanged code to be confusing. I am absolutely happy to do whatever works for Greg of course!

your series is not applying anymore to linux-next. looks like some patches came from the Outreachy and were already applied.
please redo it against staging-testing.

regards
sudip

Quoted 6 lines

Best,

Signature · 2 lines
Lorenzo Stoakes
https:/ljs.io
#9 lore raw

Re: [PATCH v2 6/6] staging: sm750fb: Remove spinlock helper function

Quoted 4 lines · Sudip Mukherjee

your series is not applying anymore to linux-next. looks like some patches came from the Outreachy and were already applied.
please redo it against staging-testing.

Will do that now! I think at this point it'll be easier for me to resend the whole series to make it clear which is applicable right now.

Best,

Signature · 2 lines
Lorenzo Stoakes
https:/ljs.io