fixes checkpatch checks Signed-off-by: Simone Serra <serrazimone@xxxxxxxxx> --- drivers/staging/rtl8723bs/core/rtw_efuse.c | 172 ++++++++++----------- 1 file changed, 81 insertions(+), 91 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c index d2d69321d47a..2ec77d7fa296 100644 --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c @@ -9,7 +9,6 @@ #include <hal_data.h> #include <linux/jiffies.h> - /* Define global variables */ u8 fakeEfuseBank; u32 fakeEfuseUsedBytes; @@ -38,7 +37,7 @@ Efuse_Read1ByteFromFakeContent(u16 Offset, u8 *Value) if (fakeEfuseBank == 0) *Value = fakeEfuseContent[Offset]; else - *Value = fakeBTEfuseContent[fakeEfuseBank-1][Offset]; + *Value = fakeBTEfuseContent[fakeEfuseBank - 1][Offset]; return true; } @@ -50,7 +49,7 @@ Efuse_Write1ByteToFakeContent(u16 Offset, u8 Value) if (fakeEfuseBank == 0) fakeEfuseContent[Offset] = Value; else - fakeBTEfuseContent[fakeEfuseBank-1][Offset] = Value; + fakeBTEfuseContent[fakeEfuseBank - 1][Offset] = Value; return true; } @@ -74,10 +73,9 @@ Efuse_Write1ByteToFakeContent(u16 Offset, u8 Value) *--------------------------------------------------------------------------- */ void -Efuse_PowerSwitch( -struct adapter *padapter, -u8 bWrite, -u8 PwrState) +Efuse_PowerSwitch(struct adapter *padapter, + u8 bWrite, + u8 PwrState) { padapter->HalFunc.EfusePowerSwitch(padapter, bWrite, PwrState); } @@ -100,10 +98,9 @@ u8 PwrState) *--------------------------------------------------------------------------- */ u16 -Efuse_GetCurrentSize( - struct adapter *padapter, - u8 efuseType, - bool bPseudoTest) +Efuse_GetCurrentSize(struct adapter *padapter, + u8 efuseType, + bool bPseudoTest) { return padapter->HalFunc.EfuseGetCurrentSize(padapter, efuseType, bPseudoTest); @@ -145,34 +142,31 @@ Efuse_CalculateWordCnts(u8 word_en) /* */ void -efuse_ReadEFuse( - struct adapter *Adapter, - u8 efuseType, - u16 _offset, - u16 _size_byte, - u8 *pbuf, -bool bPseudoTest +efuse_ReadEFuse(struct adapter *Adapter, + u8 efuseType, + u16 _offset, + u16 _size_byte, + u8 *pbuf, + bool bPseudoTest ); void -efuse_ReadEFuse( - struct adapter *Adapter, - u8 efuseType, - u16 _offset, - u16 _size_byte, - u8 *pbuf, -bool bPseudoTest +efuse_ReadEFuse(struct adapter *Adapter, + u8 efuseType, + u16 _offset, + u16 _size_byte, + u8 *pbuf, + bool bPseudoTest ) { Adapter->HalFunc.ReadEFuse(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest); } void -EFUSE_GetEfuseDefinition( - struct adapter *padapter, - u8 efuseType, - u8 type, - void *pOut, - bool bPseudoTest +EFUSE_GetEfuseDefinition(struct adapter *padapter, + u8 efuseType, + u8 type, + void *pOut, + bool bPseudoTest ) { padapter->HalFunc.EFUSEGetEfuseDefinition(padapter, efuseType, type, pOut, bPseudoTest); @@ -196,52 +190,52 @@ EFUSE_GetEfuseDefinition( *--------------------------------------------------------------------------- */ u8 -EFUSE_Read1Byte( -struct adapter *Adapter, -u16 Address) +EFUSE_Read1Byte(struct adapter *Adapter, + u16 Address) { u8 Bytetemp = {0x00}; u8 temp = {0x00}; u32 k = 0; u16 contentLen = 0; - EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false); + EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, + (void *)&contentLen, false); if (Address < contentLen) {/* E-fuse 512Byte */ /* Write E-fuse Register address bit0~7 */ temp = Address & 0xFF; - rtw_write8(Adapter, EFUSE_CTRL+1, temp); - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2); + rtw_write8(Adapter, EFUSE_CTRL + 1, temp); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 2); /* Write E-fuse Register address bit8~9 */ temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC); - rtw_write8(Adapter, EFUSE_CTRL+2, temp); + rtw_write8(Adapter, EFUSE_CTRL + 2, temp); /* Write 0x30[31]= 0 */ - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); temp = Bytetemp & 0x7F; - rtw_write8(Adapter, EFUSE_CTRL+3, temp); + rtw_write8(Adapter, EFUSE_CTRL + 3, temp); /* Wait Write-ready (0x30[31]= 1) */ - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); while (!(Bytetemp & 0x80)) { - Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); + Bytetemp = rtw_read8(Adapter, EFUSE_CTRL + 3); k++; if (k == 1000) break; } return rtw_read8(Adapter, EFUSE_CTRL); - } else + } else { return 0xFF; + } } /* EFUSE_Read1Byte */ /* 11/16/2008 MH Read one byte from real Efuse. */ u8 -efuse_OneByteRead( -struct adapter *padapter, -u16 addr, -u8 *data, -bool bPseudoTest) +efuse_OneByteRead(struct adapter *padapter, + u16 addr, + u8 *data, + bool bPseudoTest) { u32 tmpidx = 0; u8 bResult; @@ -257,16 +251,16 @@ bool bPseudoTest) /* -----------------e-fuse reg ctrl --------------------------------- */ /* address */ - rtw_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xff)); - rtw_write8(padapter, EFUSE_CTRL+2, ((u8)((addr>>8) & 0x03)) | - (rtw_read8(padapter, EFUSE_CTRL+2)&0xFC)); + rtw_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xff)); + rtw_write8(padapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) | + (rtw_read8(padapter, EFUSE_CTRL + 2) & 0xFC)); /* rtw_write8(padapter, EFUSE_CTRL+3, 0x72); read cmd */ /* Write bit 32 0 */ - readbyte = rtw_read8(padapter, EFUSE_CTRL+3); - rtw_write8(padapter, EFUSE_CTRL+3, (readbyte & 0x7f)); + readbyte = rtw_read8(padapter, EFUSE_CTRL + 3); + rtw_write8(padapter, EFUSE_CTRL + 3, (readbyte & 0x7f)); - while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 1000)) { + while (!(0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 1000)) { mdelay(1); tmpidx++; } @@ -291,16 +285,13 @@ u8 efuse_OneByteWrite(struct adapter *padapter, u16 addr, u8 data, bool bPseudoT if (bPseudoTest) return Efuse_Write1ByteToFakeContent(addr, data); - /* -----------------e-fuse reg ctrl --------------------------------- */ /* address */ - efuseValue = rtw_read32(padapter, EFUSE_CTRL); - efuseValue |= (BIT21|BIT31); + efuseValue |= (BIT21 | BIT31); efuseValue &= ~(0x3FFFF); - efuseValue |= ((addr<<8 | data) & 0x3FFFF); - + efuseValue |= ((addr << 8 | data) & 0x3FFFF); /* <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. */ @@ -308,9 +299,9 @@ u8 efuse_OneByteWrite(struct adapter *padapter, u16 addr, u8 data, bool bPseudoT /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) */ /* PHY_SetMacReg(padapter, 0x34, BIT11, 1); */ rtw_write16(padapter, 0x34, rtw_read16(padapter, 0x34) | (BIT11)); - rtw_write32(padapter, EFUSE_CTRL, 0x90600000|((addr<<8 | data))); + rtw_write32(padapter, EFUSE_CTRL, 0x90600000 | ((addr << 8 | data))); - while ((0x80 & rtw_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) { + while ((0x80 & rtw_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) { mdelay(1); tmpidx++; } @@ -328,9 +319,9 @@ u8 efuse_OneByteWrite(struct adapter *padapter, u16 addr, u8 data, bool bPseudoT int Efuse_PgPacketRead(struct adapter *padapter, - u8 offset, - u8 *data, - bool bPseudoTest) + u8 offset, + u8 *data, + bool bPseudoTest) { return padapter->HalFunc.Efuse_PgPacketRead(padapter, offset, data, bPseudoTest); @@ -338,10 +329,10 @@ Efuse_PgPacketRead(struct adapter *padapter, int Efuse_PgPacketWrite(struct adapter *padapter, - u8 offset, - u8 word_en, - u8 *data, - bool bPseudoTest) + u8 offset, + u8 word_en, + u8 *data, + bool bPseudoTest) { return padapter->HalFunc.Efuse_PgPacketWrite(padapter, offset, word_en, data, bPseudoTest); @@ -367,34 +358,33 @@ Efuse_PgPacketWrite(struct adapter *padapter, */ void efuse_WordEnableDataRead(u8 word_en, - u8 *sourdata, - u8 *targetdata) + u8 *sourdata, + u8 *targetdata) { - if (!(word_en&BIT(0))) { + if (!(word_en & BIT(0))) { targetdata[0] = sourdata[0]; targetdata[1] = sourdata[1]; } - if (!(word_en&BIT(1))) { + if (!(word_en & BIT(1))) { targetdata[2] = sourdata[2]; targetdata[3] = sourdata[3]; } - if (!(word_en&BIT(2))) { + if (!(word_en & BIT(2))) { targetdata[4] = sourdata[4]; targetdata[5] = sourdata[5]; } - if (!(word_en&BIT(3))) { + if (!(word_en & BIT(3))) { targetdata[6] = sourdata[6]; targetdata[7] = sourdata[7]; } } - u8 Efuse_WordEnableDataWrite(struct adapter *padapter, - u16 efuse_addr, - u8 word_en, - u8 *data, - bool bPseudoTest) + u16 efuse_addr, + u8 word_en, + u8 *data, + bool bPseudoTest) { return padapter->HalFunc.Efuse_WordEnableDataWrite(padapter, efuse_addr, word_en, data, @@ -419,18 +409,18 @@ Efuse_WordEnableDataWrite(struct adapter *padapter, *--------------------------------------------------------------------------- */ void -Efuse_ReadAllMap( - struct adapter *padapter, - u8 efuseType, - u8 *Efuse, - bool bPseudoTest); +Efuse_ReadAllMap(struct adapter *padapter, + u8 efuseType, + u8 *Efuse, + bool bPseudoTest); void Efuse_ReadAllMap(struct adapter *padapter, u8 efuseType, u8 *Efuse, bool bPseudoTest) { u16 mapLen = 0; Efuse_PowerSwitch(padapter, false, true); - EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, bPseudoTest); + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, + (void *)&mapLen, bPseudoTest); efuse_ReadEFuse(padapter, efuseType, 0, mapLen, Efuse, bPseudoTest); @@ -470,7 +460,7 @@ static void efuse_ShadowRead2Byte(struct adapter *padapter, u16 Offset, u16 *Val struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); *Value = pEEPROM->efuse_eeprom_data[Offset]; - *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; + *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8; } /* EFUSE_ShadowRead2Byte */ @@ -480,9 +470,9 @@ static void efuse_ShadowRead4Byte(struct adapter *padapter, u16 Offset, u32 *Val struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); *Value = pEEPROM->efuse_eeprom_data[Offset]; - *Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8; - *Value |= pEEPROM->efuse_eeprom_data[Offset+2]<<16; - *Value |= pEEPROM->efuse_eeprom_data[Offset+3]<<24; + *Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8; + *Value |= pEEPROM->efuse_eeprom_data[Offset + 2] << 16; + *Value |= pEEPROM->efuse_eeprom_data[Offset + 3] << 24; } /* efuse_ShadowRead4Byte */ @@ -508,7 +498,8 @@ void EFUSE_ShadowMapUpdate(struct adapter *padapter, u8 efuseType, bool bPseudoT struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); u16 mapLen = 0; - EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, (void *)&mapLen, bPseudoTest); + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_MAP_LEN, + (void *)&mapLen, bPseudoTest); if (pEEPROM->bautoload_fail_flag) memset(pEEPROM->efuse_eeprom_data, 0xFF, mapLen); @@ -519,7 +510,6 @@ void EFUSE_ShadowMapUpdate(struct adapter *padapter, u8 efuseType, bool bPseudoT /* void *)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); */ } /* EFUSE_ShadowMapUpdate */ - /*----------------------------------------------------------------------------- * Function: EFUSE_ShadowRead * -- 2.25.1