From d8aba9d5d6c0d9809798967b9aac293690233b6d Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 9 May 2011 10:46:24 -0700 Subject: [PATCH] staging/keucr: fix sparse statics and non-ANSI function warnings 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 Signed-off-by: Greg Kroah-Hartman --- 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(-) diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c index 8af7c84daee2..b5a89375df22 100644 --- a/drivers/staging/keucr/init.c +++ b/drivers/staging/keucr/init.c @@ -11,9 +11,6 @@ #include "transport.h" #include "init.h" -BYTE IsSSFDCCompliance; -BYTE IsXDCompliance; - /* * ENE_InitMedia(): */ diff --git a/drivers/staging/keucr/init.h b/drivers/staging/keucr/init.h index 953a31e9d5f0..f709055ae146 100644 --- a/drivers/staging/keucr/init.h +++ b/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, diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h index 4226813ba588..24506058c58c 100644 --- a/drivers/staging/keucr/smil.h +++ b/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 (struct us_data *,BYTE *); 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); diff --git a/drivers/staging/keucr/smilecc.c b/drivers/staging/keucr/smilecc.c index 5659dea7b701..ba25f158a1bc 100644 --- a/drivers/staging/keucr/smilecc.c +++ b/drivers/staging/keucr/smilecc.c @@ -48,11 +48,13 @@ static void trans_result (BYTE, BYTE, BYTE *, BYTE *); #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); } diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index 566dac0ed426..1ca99b4f62e2 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -48,31 +48,27 @@ int MarkFail_D_PhyOneBlock (struct us_data *); 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; // diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index 4fe47422eb79..3c1c0d46da73 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/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; diff --git a/drivers/staging/keucr/smscsi.c b/drivers/staging/keucr/smscsi.c index 62116869b38a..a6fa77f9c48e 100644 --- a/drivers/staging/keucr/smscsi.c +++ b/drivers/staging/keucr/smscsi.c @@ -20,8 +20,6 @@ int SM_SCSI_Read_Capacity (struct us_data *us, struct scsi_cmnd *srb); 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; diff --git a/drivers/staging/keucr/transport.h b/drivers/staging/keucr/transport.h index 565d98c98454..ddfec53bf85a 100644 --- a/drivers/staging/keucr/transport.h +++ b/drivers/staging/keucr/transport.h @@ -135,7 +135,4 @@ extern int MS_CountFreeBlock(struct us_data *us, WORD PhyBlock); 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 diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index b0d16700a5d7..d8c5c626be5c 100644 --- a/drivers/staging/keucr/usb.c +++ b/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 *iface, pm_message_t message) } //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 *iface) 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); -- 2.30.2