From: Himangi Saraogi Date: Sat, 15 Mar 2014 21:44:57 +0000 (+0530) Subject: staging:keucr: Remove typedefs X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=432f8574a7f5a2e63d00e91d79296440a97faf6f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging:keucr: Remove typedefs As suggested by Pablo, this patch uses a coccinelle script to remove the typedefs: typedef u8 BOOLEAN; <-- use "bool" instead. typedef u8 BYTE; <-- use "u8" typedef u8 *PBYTE; <-- use "u8 *" typedef u16 WORD; <-- use "u16" typedef u16 *PWORD; <-- use "u16 *" typedef u32 DWORD; <-- use "u32" typedef u32 *PDWORD; <-- use "u32 *" in common.h. The coccinelle script is: /* coccinelle script to remove typedefs. */ @remove_typedef@ @@ -typedef bool BOOLEAN; -typedef u8 BYTE; -typedef u8 *PBYTE; -typedef u16 WORD; -typedef u16 *PWORD; -typedef u32 DWORD; -typedef u32 *PDWORD; @fix_usage@ typedef BOOLEAN; @@ -BOOLEAN +bool @fix_usage1@ typedef BYTE; @@ -BYTE +u8 @fix_usage2@ typedef PBYTE; @@ -PBYTE +u8 * @fix_usage3@ typedef WORD; @@ -WORD +u16 @fix_usage4@ typedef PWORD; @@ -PWORD +u16 * @fix_usage5@ typedef DWORD; identifier f; @@ -DWORD +u32 @fix_usage6@ typedef PDWORD; @@ -PDWORD +u32 * Signed-off-by: Himangi Saraogi Signed-off-by: Peter P Waskiewicz Jr --- diff --git a/drivers/staging/keucr/common.h b/drivers/staging/keucr/common.h index cf347ccd6a6e..f0b977616cd5 100644 --- a/drivers/staging/keucr/common.h +++ b/drivers/staging/keucr/common.h @@ -1,14 +1,6 @@ #ifndef COMMON_INCD #define COMMON_INCD -typedef u8 BOOLEAN; -typedef u8 BYTE; -typedef u8 *PBYTE; -typedef u16 WORD; -typedef u16 *PWORD; -typedef u32 DWORD; -typedef u32 *PDWORD; - #define BYTE_MASK 0xff #endif diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c index f5d41e0348ce..e61183906548 100644 --- a/drivers/staging/keucr/init.c +++ b/drivers/staging/keucr/init.c @@ -17,7 +17,7 @@ int ENE_InitMedia(struct us_data *us) { int result; - BYTE MiscReg03 = 0; + u8 MiscReg03 = 0; dev_info(&us->pusb_dev->dev, "--- Init Media ---\n"); result = ene_read_byte(us, REG_CARD_STATUS, &MiscReg03); @@ -41,7 +41,7 @@ int ENE_InitMedia(struct us_data *us) /* * ene_read_byte() : */ -int ene_read_byte(struct us_data *us, WORD index, void *buf) +int ene_read_byte(struct us_data *us, u16 index, void *buf) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; @@ -51,8 +51,8 @@ int ene_read_byte(struct us_data *us, WORD index, void *buf) bcb->DataTransferLength = 0x01; bcb->Flags = 0x80; bcb->CDB[0] = 0xED; - bcb->CDB[2] = (BYTE)(index>>8); - bcb->CDB[3] = (BYTE)index; + bcb->CDB[2] = (u8)(index>>8); + bcb->CDB[3] = (u8)index; result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); return result; @@ -65,7 +65,7 @@ int ENE_SMInit(struct us_data *us) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - BYTE buf[0x200]; + u8 buf[0x200]; dev_dbg(&us->pusb_dev->dev, "transport --- ENE_SMInit\n"); @@ -122,12 +122,12 @@ int ENE_SMInit(struct us_data *us) /* * ENE_LoadBinCode() */ -int ENE_LoadBinCode(struct us_data *us, BYTE flag) +int ENE_LoadBinCode(struct us_data *us, u8 flag) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; /* void *buf; */ - PBYTE buf; + u8 *buf; /* dev_info(&us->pusb_dev->dev, "transport --- ENE_LoadBinCode\n"); */ if (us->BIN_FLAG == flag) @@ -164,7 +164,7 @@ int ENE_LoadBinCode(struct us_data *us, BYTE flag) /* * ENE_SendScsiCmd(): */ -int ENE_SendScsiCmd(struct us_data *us, BYTE fDir, void *buf, int use_sg) +int ENE_SendScsiCmd(struct us_data *us, u8 fDir, void *buf, int use_sg) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf; diff --git a/drivers/staging/keucr/init.h b/drivers/staging/keucr/init.h index c8b2cd604460..98d2e3ba8545 100644 --- a/drivers/staging/keucr/init.h +++ b/drivers/staging/keucr/init.h @@ -1,11 +1,11 @@ #include "common.h" -extern DWORD MediaChange; +extern u32 MediaChange; extern int Check_D_MediaFmt(struct us_data *); -static BYTE SM_Init[] = { +static u8 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, @@ -263,7 +263,7 @@ static BYTE SM_Init[] = { 0x58, 0x44, 0x2D, 0x49, 0x6E, 0x69, 0x74, 0x20, 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x30, 0x31 }; -static BYTE SM_Rdwr[] = { +static u8 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 9136e9447261..39951738d231 100644 --- a/drivers/staging/keucr/smil.h +++ b/drivers/staging/keucr/smil.h @@ -169,29 +169,29 @@ SmartMedia Model & Attribute Struct Definition ***************************************************************************/ struct keucr_media_info { - BYTE Model; - BYTE Attribute; - BYTE MaxZones; - BYTE MaxSectors; - WORD MaxBlocks; - WORD MaxLogBlocks; + u8 Model; + u8 Attribute; + u8 MaxZones; + u8 MaxSectors; + u16 MaxBlocks; + u16 MaxLogBlocks; }; struct keucr_media_address { - BYTE Zone; /* Zone Number */ - BYTE Sector; /* Sector(512byte) Number on Block */ - WORD PhyBlock; /* Physical Block Number on Zone */ - WORD LogBlock; /* Logical Block Number of Zone */ + u8 Zone; /* Zone Number */ + u8 Sector; /* Sector(512byte) Number on Block */ + u16 PhyBlock; /* Physical Block Number on Zone */ + u16 LogBlock; /* Logical Block Number of Zone */ }; struct keucr_media_area { - BYTE Sector; /* Sector(512byte) Number on Block */ - WORD PhyBlock; /* Physical Block Number on Zone 0 */ + u8 Sector; /* Sector(512byte) Number on Block */ + u16 PhyBlock; /* Physical Block Number on Zone 0 */ }; -extern WORD ReadBlock; -extern WORD WriteBlock; -extern DWORD MediaChange; +extern u16 ReadBlock; +extern u16 WriteBlock; +extern u32 MediaChange; extern struct keucr_media_info Ssfdc; extern struct keucr_media_address Media; @@ -204,24 +204,24 @@ extern struct keucr_media_area CisArea; int Init_D_SmartMedia(void); int Pwoff_D_SmartMedia(void); int Check_D_SmartMedia(void); -int Check_D_Parameter(struct us_data *, WORD *, BYTE *, BYTE *); -int Media_D_ReadSector(struct us_data *, DWORD, WORD, BYTE *); -int Media_D_WriteSector(struct us_data *, DWORD, WORD, BYTE *); -int Media_D_CopySector(struct us_data *, DWORD, WORD, BYTE *); -int Media_D_EraseBlock(struct us_data *, DWORD, WORD); +int Check_D_Parameter(struct us_data *, u16 *, u8 *, u8 *); +int Media_D_ReadSector(struct us_data *, u32, u16, u8 *); +int Media_D_WriteSector(struct us_data *, u32, u16, u8 *); +int Media_D_CopySector(struct us_data *, u32, u16, u8 *); +int Media_D_EraseBlock(struct us_data *, u32, u16); int Media_D_EraseAll(struct us_data *); /******************************************/ -int Media_D_OneSectWriteStart(struct us_data *, DWORD, BYTE *); -int Media_D_OneSectWriteNext(struct us_data *, BYTE *); +int Media_D_OneSectWriteStart(struct us_data *, u32, u8 *); +int Media_D_OneSectWriteNext(struct us_data *, u8 *); int Media_D_OneSectWriteFlush(struct us_data *); /******************************************/ extern int SM_FreeMem(void); /* ENE SM function */ -void SM_EnableLED(struct us_data *, BOOLEAN); +void SM_EnableLED(struct us_data *, bool); void Led_D_TernOn(void); void Led_D_TernOff(void); -int Media_D_EraseAllRedtData(DWORD Index, BOOLEAN CheckBlock); +int Media_D_EraseAllRedtData(u32 Index, bool CheckBlock); /*DWORD Media_D_GetMediaInfo(struct us_data * fdoExt, PIOCTL_MEDIA_INFO_IN pParamIn, PIOCTL_MEDIA_INFO_OUT pParamOut); */ @@ -229,31 +229,31 @@ int Media_D_EraseAllRedtData(DWORD Index, BOOLEAN CheckBlock); * SMILSub.c */ /******************************************/ -int Check_D_DataBlank(BYTE *); -int Check_D_FailBlock(BYTE *); -int Check_D_DataStatus(BYTE *); -int Load_D_LogBlockAddr(BYTE *); -void Clr_D_RedundantData(BYTE *); -void Set_D_LogBlockAddr(BYTE *); -void Set_D_FailBlock(BYTE *); -void Set_D_DataStaus(BYTE *); +int Check_D_DataBlank(u8 *); +int Check_D_FailBlock(u8 *); +int Check_D_DataStatus(u8 *); +int Load_D_LogBlockAddr(u8 *); +void Clr_D_RedundantData(u8 *); +void Set_D_LogBlockAddr(u8 *); +void Set_D_FailBlock(u8 *); +void Set_D_DataStaus(u8 *); /******************************************/ void Ssfdc_D_Reset(struct us_data *); -int Ssfdc_D_ReadCisSect(struct us_data *, BYTE *, BYTE *); +int Ssfdc_D_ReadCisSect(struct us_data *, u8 *, u8 *); void Ssfdc_D_WriteRedtMode(void); -void Ssfdc_D_ReadID(BYTE *, BYTE); -int Ssfdc_D_ReadSect(struct us_data *, BYTE *, BYTE *); -int Ssfdc_D_ReadBlock(struct us_data *, WORD, BYTE *, BYTE *); -int Ssfdc_D_WriteSect(struct us_data *, BYTE *, BYTE *); -int Ssfdc_D_WriteBlock(struct us_data *, WORD, BYTE *, BYTE *); -int Ssfdc_D_CopyBlock(struct us_data *, WORD, BYTE *, BYTE *); -int Ssfdc_D_WriteSectForCopy(struct us_data *, BYTE *, BYTE *); +void Ssfdc_D_ReadID(u8 *, u8); +int Ssfdc_D_ReadSect(struct us_data *, u8 *, u8 *); +int Ssfdc_D_ReadBlock(struct us_data *, u16, u8 *, u8 *); +int Ssfdc_D_WriteSect(struct us_data *, u8 *, u8 *); +int Ssfdc_D_WriteBlock(struct us_data *, u16, u8 *, u8 *); +int Ssfdc_D_CopyBlock(struct us_data *, u16, u8 *, u8 *); +int Ssfdc_D_WriteSectForCopy(struct us_data *, u8 *, u8 *); int Ssfdc_D_EraseBlock(struct us_data *); -int Ssfdc_D_ReadRedtData(struct us_data *, BYTE *); -int Ssfdc_D_WriteRedtData(struct us_data *, BYTE *); +int Ssfdc_D_ReadRedtData(struct us_data *, u8 *); +int Ssfdc_D_WriteRedtData(struct us_data *, u8 *); int Ssfdc_D_CheckStatus(void); -int Set_D_SsfdcModel(BYTE); +int Set_D_SsfdcModel(u8); void Cnt_D_Reset(void); int Cnt_D_PowerOn(void); void Cnt_D_PowerOff(void); @@ -263,26 +263,26 @@ int Check_D_CntPower(void); int Check_D_CardExist(void); int Check_D_CardStsChg(void); int Check_D_SsfdcWP(void); -int SM_ReadBlock(struct us_data *, BYTE *, BYTE *); +int SM_ReadBlock(struct us_data *, u8 *, u8 *); -int Ssfdc_D_ReadSect_DMA(struct us_data *, BYTE *, BYTE *); -int Ssfdc_D_ReadSect_PIO(struct us_data *, BYTE *, BYTE *); -int Ssfdc_D_WriteSect_DMA(struct us_data *, BYTE *, BYTE *); -int Ssfdc_D_WriteSect_PIO(struct us_data *, BYTE *, BYTE *); +int Ssfdc_D_ReadSect_DMA(struct us_data *, u8 *, u8 *); +int Ssfdc_D_ReadSect_PIO(struct us_data *, u8 *, u8 *); +int Ssfdc_D_WriteSect_DMA(struct us_data *, u8 *, u8 *); +int Ssfdc_D_WriteSect_PIO(struct us_data *, u8 *, u8 *); /******************************************/ -int Check_D_ReadError(BYTE *); -int Check_D_Correct(BYTE *, BYTE *); -int Check_D_CISdata(BYTE *, BYTE *); -void Set_D_RightECC(BYTE *); +int Check_D_ReadError(u8 *); +int Check_D_Correct(u8 *, u8 *); +int Check_D_CISdata(u8 *, u8 *); +void Set_D_RightECC(u8 *); /* * SMILECC.c */ -void calculate_ecc(BYTE *, BYTE *, BYTE *, BYTE *, BYTE *); -BYTE correct_data(BYTE *, BYTE *, BYTE, BYTE, BYTE); -int _Correct_D_SwECC(BYTE *, BYTE *, BYTE *); -void _Calculate_D_SwECC(BYTE *, BYTE *); +void calculate_ecc(u8 *, u8 *, u8 *, u8 *, u8 *); +u8 correct_data(u8 *, u8 *, u8, u8, u8); +int _Correct_D_SwECC(u8 *, u8 *, u8 *); +void _Calculate_D_SwECC(u8 *, u8 *); void SM_Init(void); diff --git a/drivers/staging/keucr/smilecc.c b/drivers/staging/keucr/smilecc.c index 6b8f7d7a7436..ffe6030f5e4d 100644 --- a/drivers/staging/keucr/smilecc.c +++ b/drivers/staging/keucr/smilecc.c @@ -13,7 +13,7 @@ /* #include "EMCRIOS.h" */ /* CP0-CP5 code table */ -static BYTE ecctable[256] = { +static u8 ecctable[256] = { 0x00, 0x55, 0x56, 0x03, 0x59, 0x0C, 0x0F, 0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03, 0x56, 0x55, 0x00, 0x65, 0x30, 0x33, 0x66, 0x3C, 0x69, 0x6A, 0x3F, 0x3F, 0x6A, 0x69, 0x3C, 0x66, 0x33, 0x30, 0x65, 0x66, 0x33, 0x30, 0x65, 0x3F, 0x6A, 0x69, @@ -36,7 +36,7 @@ static BYTE ecctable[256] = { 0x5A, 0x5A, 0x0F, 0x0C, 0x59, 0x03, 0x56, 0x55, 0x00 }; -static void trans_result(BYTE, BYTE, BYTE *, BYTE *); +static void trans_result(u8, u8, u8 *, u8 *); #define BIT7 0x80 #define BIT6 0x40 @@ -57,11 +57,11 @@ static void trans_result(BYTE, BYTE, BYTE *, BYTE *); * *ecc1; * LP15,LP14,LP13,... * *ecc2; * LP07,LP06,LP05,... */ -static void trans_result(BYTE reg2, BYTE reg3, BYTE *ecc1, BYTE *ecc2) +static void trans_result(u8 reg2, u8 reg3, u8 *ecc1, u8 *ecc2) { - BYTE a; /* Working for reg2,reg3 */ - BYTE b; /* Working for ecc1,ecc2 */ - BYTE i; /* For counting */ + u8 a; /* Working for reg2,reg3 */ + u8 b; /* Working for ecc1,ecc2 */ + u8 i; /* For counting */ a = BIT7; b = BIT7; /* 80h=10000000b */ *ecc1 = *ecc2 = 0; /* Clear ecc1,ecc2 */ @@ -95,21 +95,21 @@ static void trans_result(BYTE reg2, BYTE reg3, BYTE *ecc1, BYTE *ecc2) * *ecc2; * LP07,LP06,LP05,... * *ecc3; * CP5,CP4,CP3,...,"1","1" */ -void calculate_ecc(BYTE *table, BYTE *data, BYTE *ecc1, BYTE *ecc2, BYTE *ecc3) +void calculate_ecc(u8 *table, u8 *data, u8 *ecc1, u8 *ecc2, u8 *ecc3) { - DWORD i; /* For counting */ - BYTE a; /* Working for table */ - BYTE reg1; /* D-all,CP5,CP4,CP3,... */ - BYTE reg2; /* LP14,LP12,L10,... */ - BYTE reg3; /* LP15,LP13,L11,... */ + u32 i; /* For counting */ + u8 a; /* Working for table */ + u8 reg1; /* D-all,CP5,CP4,CP3,... */ + u8 reg2; /* LP14,LP12,L10,... */ + u8 reg3; /* LP15,LP13,L11,... */ reg1 = reg2 = reg3 = 0; /* Clear parameter */ for (i = 0; i < 256; ++i) { a = table[data[i]]; /* Get CP0-CP5 code from table */ reg1 ^= (a&MASK_CPS); /* XOR with a */ if ((a&BIT6) != 0) { /* If D_all(all bit XOR) = 1 */ - reg3 ^= (BYTE)i; /* XOR with counter */ - reg2 ^= ~((BYTE)i); /* XOR with inv. of counter */ + reg3 ^= (u8)i; /* XOR with counter */ + reg2 ^= ~((u8)i); /* XOR with inv. of counter */ } } @@ -127,22 +127,22 @@ void calculate_ecc(BYTE *table, BYTE *data, BYTE *ecc1, BYTE *ecc2, BYTE *ecc3) * ecc2; * LP07,LP06,LP05,... * ecc3; * CP5,CP4,CP3,...,"1","1" */ -BYTE correct_data(BYTE *data, BYTE *eccdata, BYTE ecc1, BYTE ecc2, BYTE ecc3) +u8 correct_data(u8 *data, u8 *eccdata, u8 ecc1, u8 ecc2, u8 ecc3) { - DWORD l; /* Working to check d */ - DWORD d; /* Result of comparison */ - DWORD i; /* For counting */ - BYTE d1, d2, d3; /* Result of comparison */ - BYTE a; /* Working for add */ - BYTE add; /* Byte address of cor. DATA */ - BYTE b; /* Working for bit */ - BYTE bit; /* Bit address of cor. DATA */ + u32 l; /* Working to check d */ + u32 d; /* Result of comparison */ + u32 i; /* For counting */ + u8 d1, d2, d3; /* Result of comparison */ + u8 a; /* Working for add */ + u8 add; /* Byte address of cor. DATA */ + u8 b; /* Working for bit */ + u8 bit; /* Bit address of cor. DATA */ d1 = ecc1^eccdata[1]; d2 = ecc2^eccdata[0]; /* Compare LP's */ d3 = ecc3^eccdata[2]; /* Compare CP's */ - d = ((DWORD)d1<<16) /* Result of comparison */ - +((DWORD)d2<<8) - +(DWORD)d3; + d = ((u32)d1<<16) /* Result of comparison */ + +((u32)d2<<8) + +(u32)d3; if (d == 0) return 0; /* If No error, return */ @@ -188,9 +188,9 @@ BYTE correct_data(BYTE *data, BYTE *eccdata, BYTE ecc1, BYTE ecc2, BYTE ecc3) return 3; /* Uncorrectable error */ } -int _Correct_D_SwECC(BYTE *buf, BYTE *redundant_ecc, BYTE *calculate_ecc) +int _Correct_D_SwECC(u8 *buf, u8 *redundant_ecc, u8 *calculate_ecc) { - DWORD err; + u32 err; err = correct_data(buf, redundant_ecc, *(calculate_ecc + 1), *(calculate_ecc), *(calculate_ecc + 2)); @@ -203,7 +203,7 @@ int _Correct_D_SwECC(BYTE *buf, BYTE *redundant_ecc, BYTE *calculate_ecc) return -1; } -void _Calculate_D_SwECC(BYTE *buf, BYTE *ecc) +void _Calculate_D_SwECC(u8 *buf, u8 *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 09d07e05102f..fc7cbc6f8a45 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -4,11 +4,11 @@ #include "smcommon.h" #include "smil.h" -static int Conv_D_MediaAddr(struct us_data *, DWORD); +static int Conv_D_MediaAddr(struct us_data *, u32); static int Inc_D_MediaAddr(struct us_data *); -static int Media_D_ReadOneSect(struct us_data *, WORD, BYTE *); +static int Media_D_ReadOneSect(struct us_data *, u16, u8 *); -static int Copy_D_BlockAll(struct us_data *, DWORD); +static int Copy_D_BlockAll(struct us_data *, u32); static int Assign_D_WriteBlock(void); static int Release_D_ReadBlock(struct us_data *); @@ -16,7 +16,7 @@ static int Release_D_WriteBlock(struct us_data *); static int Release_D_CopySector(struct us_data *); static int Copy_D_PhyOneSect(struct us_data *); -static int Read_D_PhyOneSect(struct us_data *, WORD, BYTE *); +static int Read_D_PhyOneSect(struct us_data *, u16, u8 *); static int Erase_D_PhyOneBlock(struct us_data *); static int Set_D_PhyFmtValue(struct us_data *); @@ -25,24 +25,24 @@ static int Make_D_LogTable(struct us_data *); static int MarkFail_D_PhyOneBlock(struct us_data *); -static DWORD ErrCode; -static BYTE WorkBuf[SECTSIZE]; -static BYTE Redundant[REDTSIZE]; -static BYTE WorkRedund[REDTSIZE]; +static u32 ErrCode; +static u8 WorkBuf[SECTSIZE]; +static u8 Redundant[REDTSIZE]; +static u8 WorkRedund[REDTSIZE]; /* 128 x 1000, Log2Phy[MAX_ZONENUM][MAX_LOGBLOCK]; */ -static WORD *Log2Phy[MAX_ZONENUM]; -static BYTE Assign[MAX_ZONENUM][MAX_BLOCKNUM / 8]; -static WORD AssignStart[MAX_ZONENUM]; -WORD ReadBlock; -WORD WriteBlock; -DWORD MediaChange; -static DWORD SectCopyMode; +static u16 *Log2Phy[MAX_ZONENUM]; +static u8 Assign[MAX_ZONENUM][MAX_BLOCKNUM / 8]; +static u16 AssignStart[MAX_ZONENUM]; +u16 ReadBlock; +u16 WriteBlock; +u32 MediaChange; +static u32 SectCopyMode; /* BIT Control Macro */ -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]) +static u8 BitData[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; +#define Set_D_Bit(a, b) (a[(u8)((b) / 8)] |= BitData[(b) % 8]) +#define Clr_D_Bit(a, b) (a[(u8)((b) / 8)] &= ~BitData[(b) % 8]) +#define Chk_D_Bit(a, b) (a[(u8)((b) / 8)] & BitData[(b) % 8]) /* ----- SM_FreeMem() ------------------------------------------------- */ int SM_FreeMem(void) @@ -62,9 +62,9 @@ int SM_FreeMem(void) /* SmartMedia Read/Write/Erase Function */ /* ----- Media_D_ReadSector() ------------------------------------------- */ -int Media_D_ReadSector(struct us_data *us, DWORD start, WORD count, BYTE *buf) +int Media_D_ReadSector(struct us_data *us, u32 start, u16 count, u8 *buf) { - WORD len, bn; + u16 len, bn; if (Conv_D_MediaAddr(us, start)) return ErrCode; @@ -97,9 +97,9 @@ int Media_D_ReadSector(struct us_data *us, DWORD start, WORD count, BYTE *buf) } /* here */ /* ----- Media_D_CopySector() ------------------------------------------ */ -int Media_D_CopySector(struct us_data *us, DWORD start, WORD count, BYTE *buf) +int Media_D_CopySector(struct us_data *us, u32 start, u16 count, u8 *buf) { - WORD len, bn; + u16 len, bn; /* pr_info("Media_D_CopySector !!!\n"); */ if (Conv_D_MediaAddr(us, start)) @@ -186,12 +186,12 @@ int Check_D_MediaFmt(struct us_data *us) /* SmartMedia Physical Address Control Subroutine */ /* ----- Conv_D_MediaAddr() --------------------------------------------- */ -static int Conv_D_MediaAddr(struct us_data *us, DWORD addr) +static int Conv_D_MediaAddr(struct us_data *us, u32 addr) { - DWORD temp; + u32 temp; temp = addr / Ssfdc.MaxSectors; - Media.Zone = (BYTE) (temp / Ssfdc.MaxLogBlocks); + Media.Zone = (u8) (temp / Ssfdc.MaxLogBlocks); if (Log2Phy[Media.Zone] == NULL) { if (Make_D_LogTable(us)) { @@ -200,8 +200,8 @@ static int Conv_D_MediaAddr(struct us_data *us, DWORD addr) } } - Media.Sector = (BYTE) (addr % Ssfdc.MaxSectors); - Media.LogBlock = (WORD) (temp % Ssfdc.MaxLogBlocks); + Media.Sector = (u8) (addr % Ssfdc.MaxSectors); + Media.LogBlock = (u16) (temp % Ssfdc.MaxLogBlocks); if (Media.Zone < Ssfdc.MaxZones) { Clr_D_RedundantData(Redundant); @@ -217,7 +217,7 @@ static int Conv_D_MediaAddr(struct us_data *us, DWORD addr) /* ----- Inc_D_MediaAddr() ---------------------------------------------- */ static int Inc_D_MediaAddr(struct us_data *us) { - WORD LogBlock = Media.LogBlock; + u16 LogBlock = Media.LogBlock; if (++Media.Sector < Ssfdc.MaxSectors) return SMSUCCESS; @@ -265,9 +265,9 @@ static int Inc_D_MediaAddr(struct us_data *us) /* SmartMedia Read/Write Subroutine with Retry */ /* ----- Media_D_ReadOneSect() ------------------------------------------ */ -static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) +static int Media_D_ReadOneSect(struct us_data *us, u16 count, u8 *buf) { - DWORD err, retry; + u32 err, retry; if (!Read_D_PhyOneSect(us, count, buf)) return SMSUCCESS; @@ -309,9 +309,9 @@ static int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) /* SmartMedia Physical Sector Data Copy Subroutine */ /* ----- Copy_D_BlockAll() ---------------------------------------------- */ -static int Copy_D_BlockAll(struct us_data *us, DWORD mode) +static int Copy_D_BlockAll(struct us_data *us, u32 mode) { - BYTE sect; + u8 sect; sect = Media.Sector; @@ -381,7 +381,7 @@ static int Assign_D_WriteBlock(void) /* ----- Release_D_ReadBlock() ------------------------------------------ */ static int Release_D_ReadBlock(struct us_data *us) { - DWORD mode; + u32 mode; mode = SectCopyMode; SectCopyMode = COMPLETED; @@ -430,7 +430,7 @@ static int Release_D_WriteBlock(struct us_data *us) static int Copy_D_PhyOneSect(struct us_data *us) { int i; - DWORD err, retry; + u32 err, retry; /* pr_info("Copy_D_PhyOneSect --- Sector = %x\n", Media.Sector); */ if (ReadBlock != NO_ASSIGN) { @@ -504,10 +504,10 @@ static int Copy_D_PhyOneSect(struct us_data *us) /* SmartMedia Physical Sector Read/Write/Erase Subroutine */ /* ----- Read_D_PhyOneSect() -------------------------------------------- */ -static int Read_D_PhyOneSect(struct us_data *us, WORD count, BYTE *buf) +static int Read_D_PhyOneSect(struct us_data *us, u16 count, u8 *buf) { int i; - DWORD retry; + u32 retry; if (Media.PhyBlock == NO_ASSIGN) { for (i = 0; i < SECTSIZE; i++) @@ -637,10 +637,10 @@ static int Search_D_CIS(struct us_data *us) /* ----- Make_D_LogTable() ---------------------------------------------- */ static int Make_D_LogTable(struct us_data *us) { - WORD phyblock, logblock; + u16 phyblock, logblock; if (Log2Phy[Media.Zone] == NULL) { - Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(WORD), + Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(u16), GFP_KERNEL); /* pr_info("ExAllocatePool Zone = %x, Addr = %x\n", Media.Zone, Log2Phy[Media.Zone]); */ @@ -693,7 +693,7 @@ static int Make_D_LogTable(struct us_data *us) phyblock = Media.PhyBlock; logblock = Media.LogBlock; - Media.Sector = (BYTE)(Ssfdc.MaxSectors - 1); + Media.Sector = (u8)(Ssfdc.MaxSectors - 1); if (Ssfdc_D_ReadRedtData(us, Redundant)) { Ssfdc_D_Reset(us); @@ -738,7 +738,7 @@ static int Make_D_LogTable(struct us_data *us) /* ----- MarkFail_D_PhyOneBlock() --------------------------------------- */ static int MarkFail_D_PhyOneBlock(struct us_data *us) { - BYTE sect; + u8 sect; sect = Media.Sector; Set_D_FailBlock(WorkRedund); diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index 2e7e137047ae..44ced8265039 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -6,16 +6,16 @@ #include "smcommon.h" #include "smil.h" -static BYTE _Check_D_DevCode(BYTE); -static DWORD ErrXDCode; -static BYTE IsSSFDCCompliance; -static BYTE IsXDCompliance; +static u8 _Check_D_DevCode(u8); +static u32 ErrXDCode; +static u8 IsSSFDCCompliance; +static u8 IsXDCompliance; struct keucr_media_info Ssfdc; struct keucr_media_address Media; struct keucr_media_area CisArea; -static BYTE EccBuf[6]; +static u8 EccBuf[6]; #define EVEN 0 /* Even Page for 256byte/page */ #define ODD 1 /* Odd Page for 256byte/page */ @@ -24,7 +24,7 @@ static BYTE EccBuf[6]; /* SmartMedia Redundant buffer data Control Subroutine *----- Check_D_DataBlank() -------------------------------------------- */ -int Check_D_DataBlank(BYTE *redundant) +int Check_D_DataBlank(u8 *redundant) { char i; @@ -36,7 +36,7 @@ int Check_D_DataBlank(BYTE *redundant) } /* ----- Check_D_FailBlock() -------------------------------------------- */ -int Check_D_FailBlock(BYTE *redundant) +int Check_D_FailBlock(u8 *redundant) { redundant += REDT_BLOCK; @@ -51,7 +51,7 @@ int Check_D_FailBlock(BYTE *redundant) } /* ----- Check_D_DataStatus() ------------------------------------------- */ -int Check_D_DataStatus(BYTE *redundant) +int Check_D_DataStatus(u8 *redundant) { redundant += REDT_DATA; @@ -70,14 +70,14 @@ int Check_D_DataStatus(BYTE *redundant) } /* ----- Load_D_LogBlockAddr() ------------------------------------------ */ -int Load_D_LogBlockAddr(BYTE *redundant) +int Load_D_LogBlockAddr(u8 *redundant) { - WORD addr1, addr2; + u16 addr1, addr2; - addr1 = (WORD)*(redundant + REDT_ADDR1H)*0x0100 + - (WORD)*(redundant + REDT_ADDR1L); - addr2 = (WORD)*(redundant + REDT_ADDR2H)*0x0100 + - (WORD)*(redundant + REDT_ADDR2L); + addr1 = (u16)*(redundant + REDT_ADDR1H)*0x0100 + + (u16)*(redundant + REDT_ADDR1L); + addr2 = (u16)*(redundant + REDT_ADDR2H)*0x0100 + + (u16)*(redundant + REDT_ADDR2L); if (addr1 == addr2) if ((addr1 & 0xF000) == 0x1000) { @@ -85,7 +85,7 @@ int Load_D_LogBlockAddr(BYTE *redundant) return SMSUCCESS; } - if (hweight16((WORD)(addr1^addr2)) != 0x01) + if (hweight16((u16)(addr1^addr2)) != 0x01) return ERROR; if ((addr1 & 0xF000) == 0x1000) @@ -104,7 +104,7 @@ int Load_D_LogBlockAddr(BYTE *redundant) } /* ----- Clr_D_RedundantData() ------------------------------------------ */ -void Clr_D_RedundantData(BYTE *redundant) +void Clr_D_RedundantData(u8 *redundant) { char i; @@ -113,9 +113,9 @@ void Clr_D_RedundantData(BYTE *redundant) } /* ----- Set_D_LogBlockAddr() ------------------------------------------- */ -void Set_D_LogBlockAddr(BYTE *redundant) +void Set_D_LogBlockAddr(u8 *redundant) { - WORD addr; + u16 addr; *(redundant + REDT_BLOCK) = 0xFF; *(redundant + REDT_DATA) = 0xFF; @@ -125,20 +125,20 @@ void Set_D_LogBlockAddr(BYTE *redundant) addr++; *(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) = - (BYTE)(addr / 0x0100); - *(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (BYTE)addr; + (u8)(addr / 0x0100); + *(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (u8)addr; } /*----- Set_D_FailBlock() ---------------------------------------------- */ -void Set_D_FailBlock(BYTE *redundant) +void Set_D_FailBlock(u8 *redundant) { char i; for (i = 0; i < REDTSIZE; i++) - *redundant++ = (BYTE)((i == REDT_BLOCK) ? 0xF0 : 0xFF); + *redundant++ = (u8)((i == REDT_BLOCK) ? 0xF0 : 0xFF); } /* ----- Set_D_DataStaus() ---------------------------------------------- */ -void Set_D_DataStaus(BYTE *redundant) +void Set_D_DataStaus(u8 *redundant) { redundant += REDT_DATA; *redundant = 0x00; @@ -154,10 +154,10 @@ void Ssfdc_D_Reset(struct us_data *us) } /* ----- Ssfdc_D_ReadCisSect() ------------------------------------------ */ -int Ssfdc_D_ReadCisSect(struct us_data *us, BYTE *buf, BYTE *redundant) +int Ssfdc_D_ReadCisSect(struct us_data *us, u8 *buf, u8 *redundant) { - BYTE zone, sector; - WORD block; + u8 zone, sector; + u16 block; zone = Media.Zone; block = Media.PhyBlock; sector = Media.Sector; Media.Zone = 0; @@ -177,11 +177,11 @@ int Ssfdc_D_ReadCisSect(struct us_data *us, BYTE *buf, BYTE *redundant) /* 6250 CMD 1 */ /* ----- Ssfdc_D_ReadSect() --------------------------------------------- */ -int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) +int Ssfdc_D_ReadSect(struct us_data *us, u8 *buf, u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; + u16 addr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -190,8 +190,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) return USB_STOR_TRANSPORT_ERROR; } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector; /* Read sect data */ memset(bcb, 0, sizeof(struct bulk_cb_wrap)); @@ -200,8 +200,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) bcb->Flags = 0x80; bcb->CDB[0] = 0xF1; bcb->CDB[1] = 0x02; - bcb->CDB[4] = (BYTE)addr; - bcb->CDB[3] = (BYTE)(addr / 0x0100); + bcb->CDB[4] = (u8)addr; + bcb->CDB[3] = (u8)(addr / 0x0100); bcb->CDB[2] = Media.Zone / 2; result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); @@ -215,8 +215,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) bcb->Flags = 0x80; bcb->CDB[0] = 0xF1; bcb->CDB[1] = 0x03; - bcb->CDB[4] = (BYTE)addr; - bcb->CDB[3] = (BYTE)(addr / 0x0100); + bcb->CDB[4] = (u8)addr; + bcb->CDB[3] = (u8)(addr / 0x0100); bcb->CDB[2] = Media.Zone / 2; bcb->CDB[8] = 0; bcb->CDB[9] = 1; @@ -229,12 +229,12 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) } /* ----- Ssfdc_D_ReadBlock() --------------------------------------------- */ -int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, - BYTE *redundant) +int Ssfdc_D_ReadBlock(struct us_data *us, u16 count, u8 *buf, + u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; + u16 addr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -243,8 +243,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, return USB_STOR_TRANSPORT_ERROR; } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector; /* Read sect data */ memset(bcb, 0, sizeof(struct bulk_cb_wrap)); @@ -253,8 +253,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, bcb->Flags = 0x80; bcb->CDB[0] = 0xF1; bcb->CDB[1] = 0x02; - bcb->CDB[4] = (BYTE)addr; - bcb->CDB[3] = (BYTE)(addr / 0x0100); + bcb->CDB[4] = (u8)addr; + bcb->CDB[3] = (u8)(addr / 0x0100); bcb->CDB[2] = Media.Zone / 2; result = ENE_SendScsiCmd(us, FDIR_READ, buf, 0); @@ -268,8 +268,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, bcb->Flags = 0x80; bcb->CDB[0] = 0xF1; bcb->CDB[1] = 0x03; - bcb->CDB[4] = (BYTE)addr; - bcb->CDB[3] = (BYTE)(addr / 0x0100); + bcb->CDB[4] = (u8)addr; + bcb->CDB[3] = (u8)(addr / 0x0100); bcb->CDB[2] = Media.Zone / 2; bcb->CDB[8] = 0; bcb->CDB[9] = 1; @@ -283,12 +283,12 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, /* ----- Ssfdc_D_CopyBlock() -------------------------------------------- */ -int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, - BYTE *redundant) +int Ssfdc_D_CopyBlock(struct us_data *us, u16 count, u8 *buf, + u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD ReadAddr, WriteAddr; + u16 ReadAddr, WriteAddr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -297,10 +297,10 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, return USB_STOR_TRANSPORT_ERROR; } - ReadAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + ReadBlock; - ReadAddr = ReadAddr*(WORD)Ssfdc.MaxSectors; - WriteAddr = (WORD)Media.Zone*Ssfdc.MaxBlocks + WriteBlock; - WriteAddr = WriteAddr*(WORD)Ssfdc.MaxSectors; + ReadAddr = (u16)Media.Zone*Ssfdc.MaxBlocks + ReadBlock; + ReadAddr = ReadAddr*(u16)Ssfdc.MaxSectors; + WriteAddr = (u16)Media.Zone*Ssfdc.MaxBlocks + WriteBlock; + WriteAddr = WriteAddr*(u16)Ssfdc.MaxSectors; /* Write sect data */ memset(bcb, 0, sizeof(struct bulk_cb_wrap)); @@ -309,16 +309,16 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, bcb->Flags = 0x00; bcb->CDB[0] = 0xF0; bcb->CDB[1] = 0x08; - bcb->CDB[7] = (BYTE)WriteAddr; - bcb->CDB[6] = (BYTE)(WriteAddr / 0x0100); + bcb->CDB[7] = (u8)WriteAddr; + bcb->CDB[6] = (u8)(WriteAddr / 0x0100); bcb->CDB[5] = Media.Zone / 2; bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[9] = *(redundant + REDT_ADDR1L); bcb->CDB[10] = Media.Sector; if (ReadBlock != NO_ASSIGN) { - bcb->CDB[4] = (BYTE)ReadAddr; - bcb->CDB[3] = (BYTE)(ReadAddr / 0x0100); + bcb->CDB[4] = (u8)ReadAddr; + bcb->CDB[3] = (u8)(ReadAddr / 0x0100); bcb->CDB[2] = Media.Zone / 2; } else bcb->CDB[11] = 1; @@ -331,11 +331,11 @@ int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, } /* ----- Ssfdc_D_WriteSectForCopy() ------------------------------------- */ -int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) +int Ssfdc_D_WriteSectForCopy(struct us_data *us, u8 *buf, u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; + u16 addr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -345,8 +345,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector; /* Write sect data */ memset(bcb, 0, sizeof(struct bulk_cb_wrap)); @@ -355,8 +355,8 @@ int Ssfdc_D_WriteSectForCopy(struct us_data *us, BYTE *buf, BYTE *redundant) bcb->Flags = 0x00; bcb->CDB[0] = 0xF0; bcb->CDB[1] = 0x04; - bcb->CDB[7] = (BYTE)addr; - bcb->CDB[6] = (BYTE)(addr / 0x0100); + bcb->CDB[7] = (u8)addr; + bcb->CDB[6] = (u8)(addr / 0x0100); bcb->CDB[5] = Media.Zone / 2; bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[9] = *(redundant + REDT_ADDR1L); @@ -374,7 +374,7 @@ int Ssfdc_D_EraseBlock(struct us_data *us) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; + u16 addr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -383,8 +383,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us) return USB_STOR_TRANSPORT_ERROR; } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors; memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); @@ -392,8 +392,8 @@ int Ssfdc_D_EraseBlock(struct us_data *us) bcb->Flags = 0x80; bcb->CDB[0] = 0xF2; bcb->CDB[1] = 0x06; - bcb->CDB[7] = (BYTE)addr; - bcb->CDB[6] = (BYTE)(addr / 0x0100); + bcb->CDB[7] = (u8)addr; + bcb->CDB[6] = (u8)(addr / 0x0100); bcb->CDB[5] = Media.Zone / 2; result = ENE_SendScsiCmd(us, FDIR_READ, NULL, 0); @@ -405,12 +405,12 @@ int Ssfdc_D_EraseBlock(struct us_data *us) /* 6250 CMD 2 */ /*----- Ssfdc_D_ReadRedtData() ----------------------------------------- */ -int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) +int Ssfdc_D_ReadRedtData(struct us_data *us, u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; - BYTE *buf; + u16 addr; + u8 *buf; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -419,8 +419,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) return USB_STOR_TRANSPORT_ERROR; } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector; memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); @@ -428,8 +428,8 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) bcb->Flags = 0x80; bcb->CDB[0] = 0xF1; bcb->CDB[1] = 0x03; - bcb->CDB[4] = (BYTE)addr; - bcb->CDB[3] = (BYTE)(addr / 0x0100); + bcb->CDB[4] = (u8)addr; + bcb->CDB[3] = (u8)(addr / 0x0100); bcb->CDB[2] = Media.Zone / 2; bcb->CDB[8] = 0; bcb->CDB[9] = 1; @@ -446,11 +446,11 @@ int Ssfdc_D_ReadRedtData(struct us_data *us, BYTE *redundant) /* 6250 CMD 4 */ /* ----- Ssfdc_D_WriteRedtData() ---------------------------------------- */ -int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) +int Ssfdc_D_WriteRedtData(struct us_data *us, u8 *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; - WORD addr; + u16 addr; result = ENE_LoadBinCode(us, SM_RW_PATTERN); if (result != USB_STOR_XFER_GOOD) { @@ -459,8 +459,8 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) return USB_STOR_TRANSPORT_ERROR; } - addr = (WORD)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; - addr = addr*(WORD)Ssfdc.MaxSectors + Media.Sector; + addr = (u16)Media.Zone*Ssfdc.MaxBlocks + Media.PhyBlock; + addr = addr*(u16)Ssfdc.MaxSectors + Media.Sector; memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); @@ -468,8 +468,8 @@ int Ssfdc_D_WriteRedtData(struct us_data *us, BYTE *redundant) bcb->Flags = 0x80; bcb->CDB[0] = 0xF2; bcb->CDB[1] = 0x05; - bcb->CDB[7] = (BYTE)addr; - bcb->CDB[6] = (BYTE)(addr / 0x0100); + bcb->CDB[7] = (u8)addr; + bcb->CDB[6] = (u8)(addr / 0x0100); bcb->CDB[5] = Media.Zone / 2; bcb->CDB[8] = *(redundant + REDT_ADDR1H); bcb->CDB[9] = *(redundant + REDT_ADDR1L); @@ -492,7 +492,7 @@ int Ssfdc_D_CheckStatus(void) /* SmartMedia ID Code Check & Mode Set Subroutine * ----- Set_D_SsfdcModel() --------------------------------------------- */ -int Set_D_SsfdcModel(BYTE dcode) +int Set_D_SsfdcModel(u8 dcode) { switch (_Check_D_DevCode(dcode)) { case SSFDC1MB: @@ -600,7 +600,7 @@ int Set_D_SsfdcModel(BYTE dcode) } /* ----- _Check_D_DevCode() --------------------------------------------- */ -static BYTE _Check_D_DevCode(BYTE dcode) +static u8 _Check_D_DevCode(u8 dcode) { switch (dcode) { case 0x6E: @@ -630,21 +630,21 @@ static BYTE _Check_D_DevCode(BYTE dcode) /* SmartMedia ECC Control Subroutine * ----- Check_D_ReadError() ---------------------------------------------- */ -int Check_D_ReadError(BYTE *redundant) +int Check_D_ReadError(u8 *redundant) { return SMSUCCESS; } /* ----- Check_D_Correct() ---------------------------------------------- */ -int Check_D_Correct(BYTE *buf, BYTE *redundant) +int Check_D_Correct(u8 *buf, u8 *redundant) { return SMSUCCESS; } /* ----- Check_D_CISdata() ---------------------------------------------- */ -int Check_D_CISdata(BYTE *buf, BYTE *redundant) +int Check_D_CISdata(u8 *buf, u8 *redundant) { - BYTE cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, + u8 cis[] = {0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20}; int cis_len = sizeof(cis); @@ -669,7 +669,7 @@ int Check_D_CISdata(BYTE *buf, BYTE *redundant) } /* ----- Set_D_RightECC() ---------------------------------------------- */ -void Set_D_RightECC(BYTE *redundant) +void Set_D_RightECC(u8 *redundant) { /* Driver ECC Check */ return; diff --git a/drivers/staging/keucr/smscsi.c b/drivers/staging/keucr/smscsi.c index 5c03eca4dba8..20858f6777c8 100644 --- a/drivers/staging/keucr/smscsi.c +++ b/drivers/staging/keucr/smscsi.c @@ -68,7 +68,7 @@ static int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) /* ----- SM_SCSI_Inquiry() --------------------------------------------- */ static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) { - BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, + u8 data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20, 0x20, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20, @@ -82,9 +82,9 @@ static int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) /* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */ static int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) { - BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, + u8 mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; - BYTE mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, + u8 mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; if (us->SM_Status.WtP) @@ -101,9 +101,9 @@ static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) { unsigned int offset = 0; struct scatterlist *sg = NULL; - DWORD bl_num; - WORD bl_len; - BYTE buf[8]; + u32 bl_num; + u16 bl_len; + u8 buf[8]; dev_dbg(&us->pusb_dev->dev, "SM_SCSI_Read_Capacity\n"); @@ -132,13 +132,13 @@ static int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; - PBYTE Cdb = srb->cmnd; - DWORD bn = ((Cdb[2] << 24) & 0xff000000) | + u8 *Cdb = srb->cmnd; + u32 bn = ((Cdb[2] << 24) & 0xff000000) | ((Cdb[3] << 16) & 0x00ff0000) | ((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[5] << 0) & 0x000000ff); - WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); - DWORD blenByte = blen * 0x200; + u16 blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); + u32 blenByte = blen * 0x200; void *buf; @@ -164,13 +164,13 @@ static int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) static int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; - PBYTE Cdb = srb->cmnd; - DWORD bn = ((Cdb[2] << 24) & 0xff000000) | + u8 *Cdb = srb->cmnd; + u32 bn = ((Cdb[2] << 24) & 0xff000000) | ((Cdb[3] << 16) & 0x00ff0000) | ((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[5] << 0) & 0x000000ff); - WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); - DWORD blenByte = blen * 0x200; + u16 blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); + u32 blenByte = blen * 0x200; void *buf; diff --git a/drivers/staging/keucr/transport.c b/drivers/staging/keucr/transport.c index aeb2186d62ca..ae9414755d2f 100644 --- a/drivers/staging/keucr/transport.c +++ b/drivers/staging/keucr/transport.c @@ -83,8 +83,8 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) */ static void usb_stor_print_cmd(struct us_data *us, struct scsi_cmnd *srb) { - PBYTE Cdb = srb->cmnd; - DWORD cmd = Cdb[0]; + u8 *Cdb = srb->cmnd; + u32 cmd = Cdb[0]; switch (cmd) { case TEST_UNIT_READY: @@ -545,8 +545,8 @@ Handle_Errors: */ void BuildSenseBuffer(struct scsi_cmnd *srb, int SrbStatus) { - BYTE *buf = srb->sense_buffer; - BYTE asc; + u8 *buf = srb->sense_buffer; + u8 asc; pr_info("transport --- BuildSenseBuffer\n"); switch (SrbStatus) { diff --git a/drivers/staging/keucr/transport.h b/drivers/staging/keucr/transport.h index df34474ae568..abd8e5a3dd6e 100644 --- a/drivers/staging/keucr/transport.h +++ b/drivers/staging/keucr/transport.h @@ -58,9 +58,9 @@ extern void usb_stor_set_xfer_buf(struct us_data*, unsigned char *buffer, extern void ENE_stor_invoke_transport(struct scsi_cmnd *, struct us_data *); extern int ENE_InitMedia(struct us_data *); extern int ENE_SMInit(struct us_data *); -extern int ENE_SendScsiCmd(struct us_data*, BYTE, void*, int); -extern int ENE_LoadBinCode(struct us_data*, BYTE); -extern int ene_read_byte(struct us_data*, WORD index, void *buf); +extern int ENE_SendScsiCmd(struct us_data*, u8, void*, int); +extern int ENE_LoadBinCode(struct us_data*, u8); +extern int ene_read_byte(struct us_data*, u16 index, void *buf); extern int ENE_Read_Data(struct us_data*, void *buf, unsigned int length); extern int ENE_Write_Data(struct us_data*, void *buf, unsigned int length); extern void BuildSenseBuffer(struct scsi_cmnd *, int); diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index 3e3ca6365fbc..12ebde7315cd 100644 --- a/drivers/staging/keucr/usb.c +++ b/drivers/staging/keucr/usb.c @@ -50,7 +50,7 @@ static int eucr_suspend(struct usb_interface *iface, pm_message_t message) static int eucr_resume(struct usb_interface *iface) { - BYTE tmp = 0; + u8 tmp = 0; struct us_data *us = usb_get_intfdata(iface); pr_info("--- eucr_resume---\n"); @@ -71,7 +71,7 @@ static int eucr_resume(struct usb_interface *iface) static int eucr_reset_resume(struct usb_interface *iface) { - BYTE tmp = 0; + u8 tmp = 0; struct us_data *us = usb_get_intfdata(iface); pr_info("--- eucr_reset_resume---\n"); @@ -528,7 +528,7 @@ static int eucr_probe(struct usb_interface *intf, struct Scsi_Host *host; struct us_data *us; int result; - BYTE MiscReg03 = 0; + u8 MiscReg03 = 0; struct task_struct *th; pr_info("usb --- eucr_probe\n"); diff --git a/drivers/staging/keucr/usb.h b/drivers/staging/keucr/usb.h index d665af177b96..e894f840c708 100644 --- a/drivers/staging/keucr/usb.h +++ b/drivers/staging/keucr/usb.h @@ -52,34 +52,34 @@ struct us_unusual_dev { #define FDIR_READ 1 struct keucr_sd_status { - BYTE Insert:1; - BYTE Ready:1; - BYTE MediaChange:1; - BYTE IsMMC:1; - BYTE HiCapacity:1; - BYTE HiSpeed:1; - BYTE WtP:1; - BYTE Reserved:1; + u8 Insert:1; + u8 Ready:1; + u8 MediaChange:1; + u8 IsMMC:1; + u8 HiCapacity:1; + u8 HiSpeed:1; + u8 WtP:1; + u8 Reserved:1; }; struct keucr_ms_status { - BYTE Insert:1; - BYTE Ready:1; - BYTE MediaChange:1; - BYTE IsMSPro:1; - BYTE IsMSPHG:1; - BYTE Reserved1:1; - BYTE WtP:1; - BYTE Reserved2:1; + u8 Insert:1; + u8 Ready:1; + u8 MediaChange:1; + u8 IsMSPro:1; + u8 IsMSPHG:1; + u8 Reserved1:1; + u8 WtP:1; + u8 Reserved2:1; }; struct keucr_sm_status { - BYTE Insert:1; - BYTE Ready:1; - BYTE MediaChange:1; - BYTE Reserved:3; - BYTE WtP:1; - BYTE IsMS:1; + u8 Insert:1; + u8 Ready:1; + u8 MediaChange:1; + u8 Reserved:3; + u8 WtP:1; + u8 IsMS:1; }; /* SD Block Length */ @@ -184,38 +184,38 @@ struct us_data { /* ----- SD Control Data ---------------- */ /* SD_REGISTER SD_Regs; */ - WORD SD_Block_Mult; - BYTE SD_READ_BL_LEN; - WORD SD_C_SIZE; - BYTE SD_C_SIZE_MULT; + u16 SD_Block_Mult; + u8 SD_READ_BL_LEN; + u16 SD_C_SIZE; + u8 SD_C_SIZE_MULT; /* SD/MMC New spec. */ - BYTE SD_SPEC_VER; - BYTE SD_CSD_VER; - BYTE SD20_HIGH_CAPACITY; - DWORD HC_C_SIZE; - BYTE MMC_SPEC_VER; - BYTE MMC_BusWidth; - BYTE MMC_HIGH_CAPACITY; + u8 SD_SPEC_VER; + u8 SD_CSD_VER; + u8 SD20_HIGH_CAPACITY; + u32 HC_C_SIZE; + u8 MMC_SPEC_VER; + u8 MMC_BusWidth; + u8 MMC_HIGH_CAPACITY; /* ----- MS Control Data ---------------- */ - BOOLEAN MS_SWWP; - DWORD MSP_TotalBlock; + bool MS_SWWP; + u32 MSP_TotalBlock; /* MS_LibControl MS_Lib; */ - BOOLEAN MS_IsRWPage; - WORD MS_Model; + bool MS_IsRWPage; + u16 MS_Model; /* ----- SM Control Data ---------------- */ - BYTE SM_DeviceID; - BYTE SM_CardID; + u8 SM_DeviceID; + u8 SM_CardID; - PBYTE testbuf; - BYTE BIN_FLAG; - DWORD bl_num; + u8 *testbuf; + u8 BIN_FLAG; + u32 bl_num; int SrbStatus; /* ------Power Managerment --------------- */ - BOOLEAN Power_IsResum; + bool Power_IsResum; }; /* Convert between us_data and the corresponding Scsi_Host */