[PATCH 2/3] staging/keucr: fix sparse statics and non-ANSI function warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Make lots of functions and data static (fixes sparse warnings).
Fix 5 functions to use ANSI format for function parameters (fixes
sparse warnings).

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
 drivers/staging/keucr/init.c      |    3 -
 drivers/staging/keucr/init.h      |   10 ++---
 drivers/staging/keucr/smil.h      |   14 ++++++++
 drivers/staging/keucr/smilecc.c   |   49 ++++++++++++++--------------
 drivers/staging/keucr/smilmain.c  |   24 +++++--------
 drivers/staging/keucr/smilsub.c   |    4 --
 drivers/staging/keucr/smscsi.c    |    2 -
 drivers/staging/keucr/transport.h |    3 -
 drivers/staging/keucr/usb.c       |    7 ++--
 9 files changed, 59 insertions(+), 57 deletions(-)

--- linux-next-20110506.orig/drivers/staging/keucr/usb.c
+++ linux-next-20110506/drivers/staging/keucr/usb.c
@@ -14,6 +14,7 @@
 
 #include "usb.h"
 #include "scsiglue.h"
+#include "smil.h"
 #include "transport.h"
 
 /* Some informational data */
@@ -34,7 +35,7 @@ MODULE_DEVICE_TABLE (usb, eucr_usb_ids);
 
 #ifdef CONFIG_PM
 
-int eucr_suspend(struct usb_interface *iface, pm_message_t message)
+static int eucr_suspend(struct usb_interface *iface, pm_message_t message)
 {
 	struct us_data *us = usb_get_intfdata(iface);
 	pr_info("--- eucr_suspend ---\n");
@@ -55,7 +56,7 @@ int eucr_suspend(struct usb_interface *i
 }
 //EXPORT_SYMBOL_GPL(eucr_suspend);
 
-int eucr_resume(struct usb_interface *iface)
+static int eucr_resume(struct usb_interface *iface)
 {
 	BYTE    tmp = 0;
 
@@ -80,7 +81,7 @@ int eucr_resume(struct usb_interface *if
 	return 0;
 }
 //EXPORT_SYMBOL_GPL(eucr_resume);
-int eucr_reset_resume(struct usb_interface *iface)
+static int eucr_reset_resume(struct usb_interface *iface)
 {
 	BYTE    tmp = 0;
 	struct us_data *us = usb_get_intfdata(iface);
--- linux-next-20110506.orig/drivers/staging/keucr/init.h
+++ linux-next-20110506/drivers/staging/keucr/init.h
@@ -4,7 +4,7 @@ extern DWORD MediaChange;
 extern int Check_D_MediaFmt(struct us_data *);
 
 
-BYTE MS_Init[] = {
+static BYTE MS_Init[] = {
 0x90, 0xF0, 0x15, 0xE0, 0xF5, 0x1C, 0x11, 0x2C,
 0x90, 0xFF, 0x09, 0xE0, 0x30, 0xE1, 0x06, 0x90,
 0xFF, 0x23, 0x74, 0x80, 0xF0, 0x90, 0xFF, 0x09,
@@ -262,7 +262,7 @@ BYTE MS_Init[] = {
 0x4D, 0x53, 0x2D, 0x49, 0x6E, 0x69, 0x74, 0x20,
 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30 };
 
-BYTE MSP_Rdwr[] = {
+static BYTE MSP_Rdwr[] = {
 0x90, 0xF0, 0x10, 0xE0, 0x90, 0xEA, 0x46, 0xF0,
 0xB4, 0x04, 0x03, 0x02, 0xE1, 0x1E, 0x90, 0xFF,
 0x09, 0xE0, 0x30, 0xE1, 0x06, 0x90, 0xFF, 0x23,
@@ -520,7 +520,7 @@ BYTE MSP_Rdwr[] = {
 0x4D, 0x53, 0x50, 0x2D, 0x52, 0x57, 0x20, 0x20,
 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30 };
 
-BYTE MS_Rdwr[] = {
+static BYTE MS_Rdwr[] = {
 0x90, 0xF0, 0x10, 0xE0, 0x90, 0xEA, 0x46, 0xF0,
 0xB4, 0x02, 0x02, 0x80, 0x36, 0x90, 0xF0, 0x11,
 0xE0, 0xF5, 0x17, 0x90, 0xF0, 0x12, 0xE0, 0xF5,
@@ -778,7 +778,7 @@ BYTE MS_Rdwr[] = {
 0x4D, 0x53, 0x2D, 0x52, 0x57, 0x20, 0x20, 0x20,
 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x30 };
 
-BYTE SM_Init[] = {
+static BYTE SM_Init[] = {
 0x7B, 0x09, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9,
 0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xCC,
 0xE0, 0xB4, 0x07, 0x12, 0x90, 0xFF, 0x09, 0xE0,
@@ -1036,7 +1036,7 @@ BYTE SM_Init[] = {
 0x58, 0x44, 0x2D, 0x49, 0x6E, 0x69, 0x74, 0x20,
 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x31 };
 
-BYTE SM_Rdwr[] = {
+static BYTE SM_Rdwr[] = {
 0x7B, 0x0C, 0x7C, 0xF0, 0x7D, 0x10, 0x7E, 0xE9,
 0x7F, 0xCC, 0x12, 0x2F, 0x71, 0x90, 0xE9, 0xC3,
 0xE0, 0xB4, 0x73, 0x04, 0x74, 0x40, 0x80, 0x09,
--- linux-next-20110506.orig/drivers/staging/keucr/smilmain.c
+++ linux-next-20110506/drivers/staging/keucr/smilmain.c
@@ -48,31 +48,27 @@ int  MarkFail_D_PhyOneBlock      (struct
 DWORD ErrXDCode;
 DWORD ErrCode;
 //BYTE  SectBuf[SECTSIZE];
-BYTE  WorkBuf[SECTSIZE];
-BYTE  Redundant[REDTSIZE];
-BYTE  WorkRedund[REDTSIZE];
+static BYTE  WorkBuf[SECTSIZE];
+static BYTE  Redundant[REDTSIZE];
+static BYTE  WorkRedund[REDTSIZE];
 //WORD  Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK];
-WORD  *Log2Phy[MAX_ZONENUM];                 // 128 x 1000,   Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK];
-BYTE  Assign[MAX_ZONENUM][MAX_BLOCKNUM/8];
-WORD  AssignStart[MAX_ZONENUM];
+static WORD  *Log2Phy[MAX_ZONENUM];                 // 128 x 1000,   Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK];
+static BYTE  Assign[MAX_ZONENUM][MAX_BLOCKNUM/8];
+static WORD  AssignStart[MAX_ZONENUM];
 WORD  ReadBlock;
 WORD  WriteBlock;
 DWORD MediaChange;
-DWORD SectCopyMode;
-
-extern struct SSFDCTYPE  Ssfdc;
-extern struct ADDRESS    Media;
-extern struct CIS_AREA   CisArea;
+static DWORD SectCopyMode;
 
 //BIT Control Macro
-BYTE BitData[] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 } ;
+static BYTE BitData[] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 } ;
 #define Set_D_Bit(a,b)    (a[(BYTE)((b)/8)]|= BitData[(b)%8])
 #define Clr_D_Bit(a,b)    (a[(BYTE)((b)/8)]&=~BitData[(b)%8])
 #define Chk_D_Bit(a,b)    (a[(BYTE)((b)/8)] & BitData[(b)%8])
 
 //extern PBYTE    SMHostAddr;
-extern BYTE     IsSSFDCCompliance;
-extern BYTE     IsXDCompliance;
+BYTE     IsSSFDCCompliance;
+BYTE     IsXDCompliance;
 
 
 //
--- linux-next-20110506.orig/drivers/staging/keucr/smilsub.c
+++ linux-next-20110506/drivers/staging/keucr/smilsub.c
@@ -42,10 +42,8 @@ struct SSFDCTYPE                Ssfdc;
 struct ADDRESS                  Media;
 struct CIS_AREA                 CisArea;
 
-BYTE                            EccBuf[6];
+static BYTE                            EccBuf[6];
 extern PBYTE                    SMHostAddr;
-extern BYTE                     IsSSFDCCompliance;
-extern BYTE                     IsXDCompliance;
 extern DWORD                    ErrXDCode;
 
 extern WORD  ReadBlock;
--- linux-next-20110506.orig/drivers/staging/keucr/smilecc.c
+++ linux-next-20110506/drivers/staging/keucr/smilecc.c
@@ -48,11 +48,13 @@ static void   trans_result  (BYTE,   BYT
 #define MASK_CPS    0x3f
 #define CORRECTABLE 0x00555554L
 
-static void trans_result(reg2,reg3,ecc1,ecc2)
-BYTE reg2; // LP14,LP12,LP10,...
-BYTE reg3; // LP15,LP13,LP11,...
-BYTE *ecc1; // LP15,LP14,LP13,...
-BYTE *ecc2; // LP07,LP06,LP05,...
+/*
+ * reg2; // LP14,LP12,LP10,...
+ * reg3; // LP15,LP13,LP11,...
+ * *ecc1; // LP15,LP14,LP13,...
+ * *ecc2; // LP07,LP06,LP05,...
+ */
+static void trans_result(BYTE reg2, BYTE reg3, BYTE *ecc1, BYTE *ecc2)
 {
     BYTE a; // Working for reg2,reg3
     BYTE b; // Working for ecc1,ecc2
@@ -83,12 +85,14 @@ BYTE *ecc2; // LP07,LP06,LP05,...
 }
 
 //static void calculate_ecc(table,data,ecc1,ecc2,ecc3)
-void calculate_ecc(table,data,ecc1,ecc2,ecc3)
-BYTE *table; // CP0-CP5 code table
-BYTE *data; // DATA
-BYTE *ecc1; // LP15,LP14,LP13,...
-BYTE *ecc2; // LP07,LP06,LP05,...
-BYTE *ecc3; // CP5,CP4,CP3,...,"1","1"
+/*
+ * *table; // CP0-CP5 code table
+ * *data; // DATA
+ * *ecc1; // LP15,LP14,LP13,...
+ * *ecc2; // LP07,LP06,LP05,...
+ * *ecc3; // CP5,CP4,CP3,...,"1","1"
+ */
+void calculate_ecc(BYTE *table, BYTE *data, BYTE *ecc1, BYTE *ecc2, BYTE *ecc3)
 {
     DWORD  i;    // For counting
     BYTE a;    // Working for table
@@ -113,12 +117,14 @@ BYTE *ecc3; // CP5,CP4,CP3,...,"1","1"
     *ecc3=((~reg1)<<2)|BIT1BIT0; // Make TEL format
 }
 
-BYTE correct_data(data,eccdata,ecc1,ecc2,ecc3)
-BYTE *data; // DATA
-BYTE *eccdata; // ECC DATA
-BYTE ecc1; // LP15,LP14,LP13,...
-BYTE ecc2; // LP07,LP06,LP05,...
-BYTE ecc3; // CP5,CP4,CP3,...,"1","1"
+/*
+ * *data; // DATA
+ * *eccdata; // ECC DATA
+ * ecc1; // LP15,LP14,LP13,...
+ * ecc2; // LP07,LP06,LP05,...
+ * ecc3; // CP5,CP4,CP3,...,"1","1"
+ */
+BYTE correct_data(BYTE *data, BYTE *eccdata, BYTE ecc1, BYTE ecc2, BYTE ecc3)
 {
     DWORD l; // Working to check d
     DWORD d; // Result of comparison
@@ -177,10 +183,7 @@ BYTE ecc3; // CP5,CP4,CP3,...,"1","1"
     return(3); // Uncorrectable error
 }
 
-int _Correct_D_SwECC(buf,redundant_ecc,calculate_ecc)
-BYTE *buf;
-BYTE *redundant_ecc;
-BYTE *calculate_ecc;
+int _Correct_D_SwECC(BYTE *buf, BYTE *redundant_ecc, BYTE *calculate_ecc)
 {
 	DWORD err;
 
@@ -195,9 +198,7 @@ BYTE *calculate_ecc;
 	return -1;
 }
 
-void _Calculate_D_SwECC(buf,ecc)
-BYTE *buf;
-BYTE *ecc;
+void _Calculate_D_SwECC(BYTE *buf, BYTE *ecc)
 {
     calculate_ecc(ecctable,buf,ecc+1,ecc+0,ecc+2);
 }
--- linux-next-20110506.orig/drivers/staging/keucr/init.c
+++ linux-next-20110506/drivers/staging/keucr/init.c
@@ -11,9 +11,6 @@
 #include "transport.h"
 #include "init.h"
 
-BYTE IsSSFDCCompliance;
-BYTE IsXDCompliance;
-
 /*
  * ENE_InitMedia():
  */
--- linux-next-20110506.orig/drivers/staging/keucr/smil.h
+++ linux-next-20110506/drivers/staging/keucr/smil.h
@@ -206,6 +206,19 @@ struct CIS_AREA
 };
 
 
+extern BYTE IsSSFDCCompliance;
+extern BYTE IsXDCompliance;
+
+extern DWORD	ErrXDCode;
+extern DWORD	ErrCode;
+extern WORD	ReadBlock;
+extern WORD	WriteBlock;
+extern DWORD	MediaChange;
+
+extern struct SSFDCTYPE  Ssfdc;
+extern struct ADDRESS    Media;
+extern struct CIS_AREA   CisArea;
+
 //----- SMILMain.c ---------------------------------------------------
 /******************************************/
 int         Init_D_SmartMedia           (void);
@@ -223,6 +236,7 @@ int         Media_D_OneSectWriteNext    
 int         Media_D_OneSectWriteFlush   (struct us_data *);
 
 /******************************************/
+extern int	SM_FreeMem(void);	/* ENE SM function */
 void        SM_EnableLED                (struct us_data *,BOOLEAN);
 void        Led_D_TernOn                (void);
 void        Led_D_TernOff               (void);
--- linux-next-20110506.orig/drivers/staging/keucr/smscsi.c
+++ linux-next-20110506/drivers/staging/keucr/smscsi.c
@@ -20,8 +20,6 @@ int SM_SCSI_Read_Capacity   (struct us_d
 int SM_SCSI_Read            (struct us_data *us, struct scsi_cmnd *srb);
 int SM_SCSI_Write           (struct us_data *us, struct scsi_cmnd *srb);
 
-extern struct SSFDCTYPE     Ssfdc;
-extern struct ADDRESS       Media;
 extern PBYTE                SMHostAddr;
 extern DWORD                ErrXDCode;
 
--- linux-next-20110506.orig/drivers/staging/keucr/transport.h
+++ linux-next-20110506/drivers/staging/keucr/transport.h
@@ -135,7 +135,4 @@ extern int	MS_CountFreeBlock(struct us_d
 extern int	MS_LibSearchBlockFromLogical(struct us_data *us, WORD logblk);
 extern int	MS_LibSearchBlockFromPhysical(struct us_data *us, WORD phyblk);
 
-// ENE SM function
-extern int	SM_FreeMem(void);
-
 #endif
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux