Skip to contentSkip to conversation

staging: r8723au: clean up in file rtw_efuse.c

PATCH Superseded Alison Schofield 2 participants 12 messages Oct 25, 2015 – Oct 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8723au: clean up in file rtw_efuse.c

This patchset removes the last 29 checkpatch warnings & errors in file rtw_efuse.c. It tallies to more than twice as many deletions as additions due to the removal of large, mostly blank, per function comment blocks.

Alison Schofield (4):
staging: r8723au: use kernel preferred style for commenting
staging: r8723au: insert correct spacing around operands
staging: r8723au: move function type in line with function name
staging: r8723au: remove external function declarations from .c file

 drivers/staging/rtl8723au/core/rtw_efuse.c | 320 +++++++++--------------------
 1 file changed, 92 insertions(+), 228 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 staging: r8723au: use kernel preferred style for commenting

Reworked comments per kernel coding style to improve readability.

Corrects checkpatch.pl:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 242 +++++++----------------------
 1 file changed, 60 insertions(+), 182 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +60 -182
index 92a34db..f847374 100644
@@ -21,34 +21,17 @@
 #include <rtl8723a_hal.h>
 #include <usb_ops_linux.h>
 
-/*------------------------Define local variable------------------------------*/
-
-/*  */
 #define REG_EFUSE_CTRL		0x0030
-#define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
-/*  */
+#define EFUSE_CTRL		REG_EFUSE_CTRL	/* E-Fuse Control */
 
 #define VOLTAGE_V25		0x03
 #define LDOE25_SHIFT		28
 
-/*-----------------------------------------------------------------------------
- * Function:	Efuse_PowerSwitch
- *
- * Overview:	When we want to enable write operation, we should change to
- *				pwr on state. When we stop write, we should switch to 500k mode
- *				and disable LDO 2.5V.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/17/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/*
+ * When we want to enable write operation, we should change to
+ * pwr on state. When we stop write, we should switch to 500k mode
+ * and disable LDO 2.5V.
+ */
 static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 			      u8 bWrite, u8 PwrState)
 {
@@ -58,22 +41,26 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 	if (PwrState == true) {
 		rtl8723au_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
 
-		/*  1.2V Power: From VDDON with Power
-		    Cut(0x0000h[15]), default valid */
+		/*
+		 * 1.2V Power: From VDDON with Power
+		 * Cut(0x0000h[15]), default valid
+		 */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_ISO_CTRL);
 		if (!(tmpV16 & PWC_EV12V)) {
 			tmpV16 |= PWC_EV12V;
 			rtl8723au_write16(padapter, REG_SYS_ISO_CTRL, tmpV16);
 		}
-		/*  Reset: 0x0000h[28], default valid */
+		/* Reset: 0x0000h[28], default valid */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN);
 		if (!(tmpV16 & FEN_ELDR)) {
 			tmpV16 |= FEN_ELDR;
 			rtl8723au_write16(padapter, REG_SYS_FUNC_EN, tmpV16);
 		}
 
-		/*  Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock
-		    from ANA, default valid */
+		/*
+		 * Clock: Gated(0x0008h[5]) 8M(0x0008h[1])
+		 * clock from ANA, default valid
+		 */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_CLKR);
 		if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) {
 			tmpV16 |= (LOADER_CLK_EN | ANA8M);
@@ -113,24 +100,19 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 	return ret;
 }
 
-/*  11/16/2008 MH Add description. Get current efuse area enabled word!!. */
+/* Get current efuse area enabled word */
 u8
 Efuse_CalculateWordCnts23a(u8 word_en)
 {
 	return hweight8((~word_en) & 0xf);
 }
 
-/*  */
-/*	Description: */
-/*		Execute E-Fuse read byte operation. */
-/*		Referred from SD1 Richard. */
-/*  */
-/*	Assumption: */
-/*		1. Boot from E-Fuse and successfully auto-load. */
-/*		2. PASSIVE_LEVEL (USB interface) */
-/*  */
-/*	Created by Roger, 2008.10.21. */
-/*  */
+/*
+ * Description: Execute E-Fuse read byte operation.
+ *
+ * Assumptions: 1. Boot from E-Fuse and successfully auto-load.
+ *              2. PASSIVE_LEVEL (USB interface)
+ */
 void
 ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 {
@@ -156,10 +138,13 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 		retry++;
 	}
 
-	/*  20100205 Joseph: Add delay suggested by SD1 Victor. */
-	/*  This fix the problem that Efuse read error in high temperature condition. */
-	/*  Designer says that there shall be some delay after ready bit is set, or the */
-	/*  result will always stay on last data we read. */
+	/*
+	 * Added suggested delay. This fixes the problem that
+	 * Efuse read error in high temperature condition.
+	 * Designer says that there shall be some delay after
+	 * ready bit is set, or the result will always stay
+	 * on last data we read.
+	 */
 	udelay(50);
 	value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
 
@@ -249,22 +234,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
 	}
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_Read1Byte23a
- *
- * Overview:	Copy from WMAC fot EFUSE read 1 byte.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 09/23/2008	MHC		Copy from WMAC.
- *
- *---------------------------------------------------------------------------*/
+/* Copy from WMAC for EFUSE read 1 byte. */
 u8
 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 {
@@ -306,25 +276,9 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 		return data;
 	} else
 		return 0xFF;
-}/* EFUSE_Read1Byte23a */
-
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_Write1Byte
- *
- * Overview:	Copy from WMAC fot EFUSE write 1 byte.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 09/23/2008	MHC		Copy from WMAC.
- *
- *---------------------------------------------------------------------------*/
+}
 
+/* Copy from WMAC fot EFUSE write 1 byte. */
 void
 EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
 void
@@ -367,22 +321,22 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 			}
 		}
 	}
-}/* EFUSE_Write1Byte */
+}
 
-/*  11/16/2008 MH Read one byte from real Efuse. */
+/* Read one byte from real Efuse. */
 int
 efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
 
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
+	/*  -----------------e-fuse reg ctrl ---------------------------- */
 	/* address */
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03)) |
 	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC));
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72);/* read cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72); /* read cmd */
 
 	while(!(0x80 &rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100))
 		tmpidx++;
@@ -396,7 +350,7 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 	return bResult;
 }
 
-/*  11/16/2008 MH Write one byte to reald Efuse. */
+/* Write one byte to reald Efuse. */
 int
 efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 {
@@ -405,14 +359,14 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 
 	/* return	0; */
 
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
+	/*  -----------------e-fuse reg ctrl ------------------------- */
 	/* address */
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+2,
 	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)|(u8)((addr>>8)&0x03));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL, data);/* data */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2); /* write cmd */
 
 	while((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) &&
 	      (tmpidx<100)) {
@@ -427,23 +381,7 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 	return bResult;
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	efuse_WordEnableDataRead23a
- *
- * Overview:	Read allowed word in current efuse section data.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/16/2008	MHC		Create Version 0.
- * 11/21/2008	MHC		Fix Write bug when we only enable late word.
- *
- *---------------------------------------------------------------------------*/
+/* Read allowed word in current efuse section data. */
 void
 efuse_WordEnableDataRead23a(u8	word_en,
 			 u8	*sourdata,
@@ -477,9 +415,7 @@ static int efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value)
 	return efuse_OneByteWrite23a(padapter, address, *value);
 }
 
-/*
- * read/write raw efuse data
- */
+/* read/write raw efuse data */
 int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 			u16 cnts, u8 *data)
 {
@@ -507,7 +443,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 
 	Efuse_PowerSwitch(padapter, bWrite, true);
 
-	/*  e-fuse one byte read / write */
+	/* e-fuse one byte read/write */
 	for (i = 0; i < cnts; i++) {
 		if (start_addr >= real_content_len) {
 			res = _FAIL;
@@ -523,7 +459,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 
 	return res;
 }
-/*  */
+
 u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 {
 	u16 max_size;
@@ -532,7 +468,7 @@ u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 				 (void *)&max_size);
 	return max_size;
 }
-/*  */
+
 int rtw_efuse_map_read23a(struct rtw_adapter *padapter,
 			  u16 addr, u16 cnts, u8 *data)
 {
@@ -573,22 +509,7 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 	return _SUCCESS;
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	Efuse_ReadAllMap
- *
- * Overview:	Read All Efuse content
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/11/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/* Read All Efuse content */
 void
 Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void
@@ -606,33 +527,21 @@ Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 	Efuse_PowerSwitch(pAdapter, false, false);
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	efuse_ShadowRead1Byte
- *			efuse_ShadowRead2Byte
- *			efuse_ShadowRead4Byte
- *
- * Overview:	Read from efuse init map by one/two/four bytes !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
+/*
+ * Functions:	efuse_ShadowRead1Byte
+ *		efuse_ShadowRead2Byte
+ *		efuse_ShadowRead4Byte
  *
- *---------------------------------------------------------------------------*/
+ * Read from efuse init map by one/two/four bytes
+ */
 static void
 efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, u8 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
-}	/*  EFUSE_ShadowRead23a1Byte */
+}
 
-/* Read Two Bytes */
 static void
 efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 {
@@ -640,9 +549,8 @@ efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
 	*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
-}	/*  EFUSE_ShadowRead23a2Byte */
+}
 
-/* Read Four Bytes */
 static void
 efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 {
@@ -652,24 +560,10 @@ efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 	*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 */
+}
+
+/* Transfer current EFUSE content to shadow init and modify map. */
 
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_ShadowMapUpdate23a
- *
- * Overview:	Transfer current EFUSE content to shadow init and modify map.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/13/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
 void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
@@ -683,25 +577,9 @@ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 	else
 		Efuse_ReadAllMap(pAdapter, efuseType,
 				 pEEPROM->efuse_eeprom_data);
+}
 
-}/*  EFUSE_ShadowMapUpdate23a */
-
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_ShadowRead23a
- *
- * Overview:	Read from efuse init map !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/* Read from efuse init map */
 void
 EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
 		    u8 Type, u16 Offset, u32 *Value)
@@ -712,4 +590,4 @@ EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
 		efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value);
 	else if (Type == 4)
 		efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
-}	/*  EFUSE_ShadowRead23a */
+}
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/4 staging: r8723au: insert correct spacing around operands

In reply to Alison Schofield

Adds required spacing around operands to improve readability. Corrects checkpatch.pl ERROR: spaces required *

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +16 -12
index f847374..0fb4726 100644
@@ -332,13 +332,15 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 
 	/*  -----------------e-fuse reg ctrl ---------------------------- */
 	/* address */
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03)) |
-	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
+			 ((u8)((addr >> 8) & 0x03)) |
+			 (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72); /* read cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0x72); /* read cmd */
 
-	while(!(0x80 &rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100))
+	while (!(0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
+	       (tmpidx < 100))
 		tmpidx++;
 	if (tmpidx < 100) {
 		*data = rtl8723au_read8(pAdapter, EFUSE_CTRL);
@@ -361,15 +363,16 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 
 	/*  -----------------e-fuse reg ctrl ------------------------- */
 	/* address */
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+2,
-	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)|(u8)((addr>>8)&0x03));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
+			 (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC) |
+			 (u8)((addr >> 8) & 0x03));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2); /* write cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */
 
-	while((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) &&
-	      (tmpidx<100)) {
+	while ((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
+	       (tmpidx < 100)) {
 		tmpidx++;
 	}
 
@@ -421,7 +424,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 {
 	int i = 0;
 	u16 real_content_len = 0, max_available_size = 0;
-	int res = _FAIL ;
+	int res = _FAIL;
 	int (*rw8)(struct rtw_adapter *, u16, u8*);
 
 	EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
@@ -463,6 +466,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 {
 	u16 max_size;
+
 	EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
 				 TYPE_AVAILABLE_EFUSE_BYTES_TOTAL,
 				 (void *)&max_size);
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/4 staging: r8723au: move function type in line with function name

In reply to Alison Schofield

Move function types to be adjacent to the function names in declarations to improve readability.

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 58 +++++++++++-------------------
 1 file changed, 21 insertions(+), 37 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +21 -37
index 0fb4726..bf27ea4 100644
@@ -87,8 +87,7 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 	}
 }
 
-u16
-Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
+u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	u16 ret = 0;
 
@@ -101,8 +100,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 }
 
 /* Get current efuse area enabled word */
-u8
-Efuse_CalculateWordCnts23a(u8 word_en)
+u8 Efuse_CalculateWordCnts23a(u8 word_en)
 {
 	return hweight8((~word_en) & 0xf);
 }
@@ -113,8 +111,7 @@ Efuse_CalculateWordCnts23a(u8 word_en)
  * Assumptions: 1. Boot from E-Fuse and successfully auto-load.
  *              2. PASSIVE_LEVEL (USB interface)
  */
-void
-ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
+void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 {
 	u32	value32;
 	u8	readbyte;
@@ -151,9 +148,8 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 	*pbuf = (u8)(value32 & 0xff);
 }
 
-void
-EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
-			    u8 type, void *pOut)
+void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
+				 u8 type, void *pOut)
 {
 	u8 *pu1Tmp;
 	u16 *pu2Tmp;
@@ -235,8 +231,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
 }
 
 /* Copy from WMAC for EFUSE read 1 byte. */
-u8
-EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
+u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 {
 	u8	data;
 	u8	Bytetemp = {0x00};
@@ -279,10 +274,8 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void
-EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
-void
-EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
+void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
+void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
 	u8	temp = {0x00};
@@ -324,8 +317,7 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 }
 
 /* Read one byte from real Efuse. */
-int
-efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
+int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
@@ -353,8 +345,7 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 }
 
 /* Write one byte to reald Efuse. */
-int
-efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
+int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
@@ -385,10 +376,7 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 }
 
 /* Read allowed word in current efuse section data. */
-void
-efuse_WordEnableDataRead23a(u8	word_en,
-			 u8	*sourdata,
-			 u8	*targetdata)
+void efuse_WordEnableDataRead23a(u8 word_en, u8 *sourdata, u8 *targetdata)
 {
 	if (!(word_en&BIT(0))) {
 		targetdata[0] = sourdata[0];
@@ -514,10 +502,8 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void
-Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
-void
-Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
+void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
+void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
 
@@ -538,16 +524,16 @@ Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
  *
  * Read from efuse init map by one/two/four bytes
  */
-static void
-efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, u8 *Value)
+static void efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u8 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
 }
 
-static void
-efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
+static void efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u16 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
@@ -555,8 +541,8 @@ efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 	*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
 }
 
-static void
-efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
+static void efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u32 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
@@ -567,7 +553,6 @@ efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 }
 
 /* Transfer current EFUSE content to shadow init and modify map. */
-
 void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
@@ -584,9 +569,8 @@ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 }
 
 /* Read from efuse init map */
-void
-EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
-		    u8 Type, u16 Offset, u32 *Value)
+void EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, u8 Type,
+			 u16 Offset, u32 *Value)
 {
 	if (Type == 1)
 		efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value);
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/4 staging: r8723au: remove external function declarations from .c file

In reply to Alison Schofield

Remove unused external function declarations.

Addresses checkpatch.pl:
WARNING: externs should be avoided in .c files

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -2
index bf27ea4..906b578 100644
@@ -274,7 +274,6 @@ u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
 void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
@@ -502,7 +501,6 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
Signature · 1 line
2.1.4
#5 lore raw

Re: [Outreachy kernel] [PATCH 4/4] staging: r8723au: remove external function declarations from .c file

Quoted 15 lines · Alison Schofield

Remove unused external function declarations.

Addresses checkpatch.pl:
WARNING: externs should be avoided in .c files

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -0
index bf27ea4..906b578 100644

drivers/staging/rtl8723au/core/rtw_efuse.c u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) · line 277

Quoted 4 lines
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -1
@@ -274,7 +274,6 @@ u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);

Are these really external declarations?

julia

Quoted 21 lines
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -1
 void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
@@ -502,7 +501,6 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
Signature · 8 lines
2.1.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a039d39e612445309cc6263707209995cb3cc071.1445752141.git.amsfield22%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#6 lore raw

Re: [Outreachy kernel] [PATCH 4/4] staging: r8723au: remove external function declarations from .c file

Quoted 19 lines · Julia Lawall
Quoted 17 lines · Alison Schofield

Remove unused external function declarations.

Addresses checkpatch.pl:
WARNING: externs should be avoided in .c files

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -0
index bf27ea4..906b578 100644
@@ -274,7 +274,6 @@ u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
Quoted 7 lines

drivers/staging/rtl8723au/core/rtw_efuse.c u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address) · line 277

Quoted 2 lines
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -1
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);

Are these really external declarations?

julia

No, they are fwd declarations...guessing some artifact. I'll update the commit msg and resend. Thanks.

Quoted 21 lines
Quoted 21 lines
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -1
 void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
@@ -502,7 +501,6 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
Signature · 8 lines
2.1.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a039d39e612445309cc6263707209995cb3cc071.1445752141.git.amsfield22%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#7 lore raw

v2 cover staging: r8723au: clean up in file rtw_efuse.c

In reply to Alison Schofield

This patchset removes the last 29 checkpatch warnings & errors in file rtw_efuse.c. It tallies to more than twice as many deletions as additions due to the reduction of large, mostly blank, per function comment blocks.

Changes in v2:
- Cover letter: 'reduction' not 'removal' of comment blocks.

- Patch 1:       no changes
- Patch 2:       no changes
- Patch 3:       no changes
- Patch 4:       commit msg edited to say forward declaration were

removed, not external declarations.

Alison Schofield (4):
staging: r8723au: use kernel preferred style for commenting
staging: r8723au: insert correct spacing around operands
staging: r8723au: move function type in line with function name
staging: r8723au: remove unneeded forward function declarations

 drivers/staging/rtl8723au/core/rtw_efuse.c | 320 +++++++++--------------------
 1 file changed, 92 insertions(+), 228 deletions(-)
Signature · 1 line
2.1.4
#8 lore raw

PATCH v2 1/4 staging: r8723au: use kernel preferred style for commenting

Reworked comments per kernel coding style to improve readability.

Corrects checkpatch.pl:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 242 +++++++----------------------
 1 file changed, 60 insertions(+), 182 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +60 -182
index 92a34db..f847374 100644
@@ -21,34 +21,17 @@
 #include <rtl8723a_hal.h>
 #include <usb_ops_linux.h>
 
-/*------------------------Define local variable------------------------------*/
-
-/*  */
 #define REG_EFUSE_CTRL		0x0030
-#define EFUSE_CTRL			REG_EFUSE_CTRL		/*  E-Fuse Control. */
-/*  */
+#define EFUSE_CTRL		REG_EFUSE_CTRL	/* E-Fuse Control */
 
 #define VOLTAGE_V25		0x03
 #define LDOE25_SHIFT		28
 
-/*-----------------------------------------------------------------------------
- * Function:	Efuse_PowerSwitch
- *
- * Overview:	When we want to enable write operation, we should change to
- *				pwr on state. When we stop write, we should switch to 500k mode
- *				and disable LDO 2.5V.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/17/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/*
+ * When we want to enable write operation, we should change to
+ * pwr on state. When we stop write, we should switch to 500k mode
+ * and disable LDO 2.5V.
+ */
 static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 			      u8 bWrite, u8 PwrState)
 {
@@ -58,22 +41,26 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 	if (PwrState == true) {
 		rtl8723au_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON);
 
-		/*  1.2V Power: From VDDON with Power
-		    Cut(0x0000h[15]), default valid */
+		/*
+		 * 1.2V Power: From VDDON with Power
+		 * Cut(0x0000h[15]), default valid
+		 */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_ISO_CTRL);
 		if (!(tmpV16 & PWC_EV12V)) {
 			tmpV16 |= PWC_EV12V;
 			rtl8723au_write16(padapter, REG_SYS_ISO_CTRL, tmpV16);
 		}
-		/*  Reset: 0x0000h[28], default valid */
+		/* Reset: 0x0000h[28], default valid */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN);
 		if (!(tmpV16 & FEN_ELDR)) {
 			tmpV16 |= FEN_ELDR;
 			rtl8723au_write16(padapter, REG_SYS_FUNC_EN, tmpV16);
 		}
 
-		/*  Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock
-		    from ANA, default valid */
+		/*
+		 * Clock: Gated(0x0008h[5]) 8M(0x0008h[1])
+		 * clock from ANA, default valid
+		 */
 		tmpV16 = rtl8723au_read16(padapter, REG_SYS_CLKR);
 		if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) {
 			tmpV16 |= (LOADER_CLK_EN | ANA8M);
@@ -113,24 +100,19 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 	return ret;
 }
 
-/*  11/16/2008 MH Add description. Get current efuse area enabled word!!. */
+/* Get current efuse area enabled word */
 u8
 Efuse_CalculateWordCnts23a(u8 word_en)
 {
 	return hweight8((~word_en) & 0xf);
 }
 
-/*  */
-/*	Description: */
-/*		Execute E-Fuse read byte operation. */
-/*		Referred from SD1 Richard. */
-/*  */
-/*	Assumption: */
-/*		1. Boot from E-Fuse and successfully auto-load. */
-/*		2. PASSIVE_LEVEL (USB interface) */
-/*  */
-/*	Created by Roger, 2008.10.21. */
-/*  */
+/*
+ * Description: Execute E-Fuse read byte operation.
+ *
+ * Assumptions: 1. Boot from E-Fuse and successfully auto-load.
+ *              2. PASSIVE_LEVEL (USB interface)
+ */
 void
 ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 {
@@ -156,10 +138,13 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 		retry++;
 	}
 
-	/*  20100205 Joseph: Add delay suggested by SD1 Victor. */
-	/*  This fix the problem that Efuse read error in high temperature condition. */
-	/*  Designer says that there shall be some delay after ready bit is set, or the */
-	/*  result will always stay on last data we read. */
+	/*
+	 * Added suggested delay. This fixes the problem that
+	 * Efuse read error in high temperature condition.
+	 * Designer says that there shall be some delay after
+	 * ready bit is set, or the result will always stay
+	 * on last data we read.
+	 */
 	udelay(50);
 	value32 = rtl8723au_read32(Adapter, EFUSE_CTRL);
 
@@ -249,22 +234,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
 	}
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_Read1Byte23a
- *
- * Overview:	Copy from WMAC fot EFUSE read 1 byte.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 09/23/2008	MHC		Copy from WMAC.
- *
- *---------------------------------------------------------------------------*/
+/* Copy from WMAC for EFUSE read 1 byte. */
 u8
 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 {
@@ -306,25 +276,9 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 		return data;
 	} else
 		return 0xFF;
-}/* EFUSE_Read1Byte23a */
-
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_Write1Byte
- *
- * Overview:	Copy from WMAC fot EFUSE write 1 byte.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 09/23/2008	MHC		Copy from WMAC.
- *
- *---------------------------------------------------------------------------*/
+}
 
+/* Copy from WMAC fot EFUSE write 1 byte. */
 void
 EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
 void
@@ -367,22 +321,22 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 			}
 		}
 	}
-}/* EFUSE_Write1Byte */
+}
 
-/*  11/16/2008 MH Read one byte from real Efuse. */
+/* Read one byte from real Efuse. */
 int
 efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
 
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
+	/*  -----------------e-fuse reg ctrl ---------------------------- */
 	/* address */
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03)) |
 	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC));
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72);/* read cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72); /* read cmd */
 
 	while(!(0x80 &rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100))
 		tmpidx++;
@@ -396,7 +350,7 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 	return bResult;
 }
 
-/*  11/16/2008 MH Write one byte to reald Efuse. */
+/* Write one byte to reald Efuse. */
 int
 efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 {
@@ -405,14 +359,14 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 
 	/* return	0; */
 
-	/*  -----------------e-fuse reg ctrl --------------------------------- */
+	/*  -----------------e-fuse reg ctrl ------------------------- */
 	/* address */
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL+2,
 	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)|(u8)((addr>>8)&0x03));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL, data);/* data */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2);/* write cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2); /* write cmd */
 
 	while((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) &&
 	      (tmpidx<100)) {
@@ -427,23 +381,7 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 	return bResult;
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	efuse_WordEnableDataRead23a
- *
- * Overview:	Read allowed word in current efuse section data.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/16/2008	MHC		Create Version 0.
- * 11/21/2008	MHC		Fix Write bug when we only enable late word.
- *
- *---------------------------------------------------------------------------*/
+/* Read allowed word in current efuse section data. */
 void
 efuse_WordEnableDataRead23a(u8	word_en,
 			 u8	*sourdata,
@@ -477,9 +415,7 @@ static int efuse_write8(struct rtw_adapter *padapter, u16 address, u8 *value)
 	return efuse_OneByteWrite23a(padapter, address, *value);
 }
 
-/*
- * read/write raw efuse data
- */
+/* read/write raw efuse data */
 int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 			u16 cnts, u8 *data)
 {
@@ -507,7 +443,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 
 	Efuse_PowerSwitch(padapter, bWrite, true);
 
-	/*  e-fuse one byte read / write */
+	/* e-fuse one byte read/write */
 	for (i = 0; i < cnts; i++) {
 		if (start_addr >= real_content_len) {
 			res = _FAIL;
@@ -523,7 +459,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 
 	return res;
 }
-/*  */
+
 u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 {
 	u16 max_size;
@@ -532,7 +468,7 @@ u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 				 (void *)&max_size);
 	return max_size;
 }
-/*  */
+
 int rtw_efuse_map_read23a(struct rtw_adapter *padapter,
 			  u16 addr, u16 cnts, u8 *data)
 {
@@ -573,22 +509,7 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 	return _SUCCESS;
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	Efuse_ReadAllMap
- *
- * Overview:	Read All Efuse content
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/11/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/* Read All Efuse content */
 void
 Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void
@@ -606,33 +527,21 @@ Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 	Efuse_PowerSwitch(pAdapter, false, false);
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	efuse_ShadowRead1Byte
- *			efuse_ShadowRead2Byte
- *			efuse_ShadowRead4Byte
- *
- * Overview:	Read from efuse init map by one/two/four bytes !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
+/*
+ * Functions:	efuse_ShadowRead1Byte
+ *		efuse_ShadowRead2Byte
+ *		efuse_ShadowRead4Byte
  *
- *---------------------------------------------------------------------------*/
+ * Read from efuse init map by one/two/four bytes
+ */
 static void
 efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, u8 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
-}	/*  EFUSE_ShadowRead23a1Byte */
+}
 
-/* Read Two Bytes */
 static void
 efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 {
@@ -640,9 +549,8 @@ efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
 	*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
-}	/*  EFUSE_ShadowRead23a2Byte */
+}
 
-/* Read Four Bytes */
 static void
 efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 {
@@ -652,24 +560,10 @@ efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 	*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 */
+}
+
+/* Transfer current EFUSE content to shadow init and modify map. */
 
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_ShadowMapUpdate23a
- *
- * Overview:	Transfer current EFUSE content to shadow init and modify map.
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/13/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
 void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
@@ -683,25 +577,9 @@ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 	else
 		Efuse_ReadAllMap(pAdapter, efuseType,
 				 pEEPROM->efuse_eeprom_data);
+}
 
-}/*  EFUSE_ShadowMapUpdate23a */
-
-/*-----------------------------------------------------------------------------
- * Function:	EFUSE_ShadowRead23a
- *
- * Overview:	Read from efuse init map !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
- *
- *---------------------------------------------------------------------------*/
+/* Read from efuse init map */
 void
 EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
 		    u8 Type, u16 Offset, u32 *Value)
@@ -712,4 +590,4 @@ EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
 		efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value);
 	else if (Type == 4)
 		efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
-}	/*  EFUSE_ShadowRead23a */
+}
Signature · 1 line
2.1.4
#9 lore raw

PATCH v2 2/4 staging: r8723au: insert correct spacing around operands

In reply to Alison Schofield

Adds required spacing around operands to improve readability. Corrects checkpatch.pl ERROR: spaces required *

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +16 -12
index f847374..0fb4726 100644
@@ -332,13 +332,15 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 
 	/*  -----------------e-fuse reg ctrl ---------------------------- */
 	/* address */
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+2, ((u8)((addr>>8) &0x03)) |
-	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
+			 ((u8)((addr >> 8) & 0x03)) |
+			 (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3,  0x72); /* read cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0x72); /* read cmd */
 
-	while(!(0x80 &rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) && (tmpidx<100))
+	while (!(0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
+	       (tmpidx < 100))
 		tmpidx++;
 	if (tmpidx < 100) {
 		*data = rtl8723au_read8(pAdapter, EFUSE_CTRL);
@@ -361,15 +363,16 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 
 	/*  -----------------e-fuse reg ctrl ------------------------- */
 	/* address */
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+1, (u8)(addr&0xff));
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+2,
-	(rtl8723au_read8(pAdapter, EFUSE_CTRL+2)&0xFC)|(u8)((addr>>8)&0x03));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 2,
+			 (rtl8723au_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC) |
+			 (u8)((addr >> 8) & 0x03));
 	rtl8723au_write8(pAdapter, EFUSE_CTRL, data); /* data */
 
-	rtl8723au_write8(pAdapter, EFUSE_CTRL+3, 0xF2); /* write cmd */
+	rtl8723au_write8(pAdapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */
 
-	while((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL+3)) &&
-	      (tmpidx<100)) {
+	while ((0x80 & rtl8723au_read8(pAdapter, EFUSE_CTRL + 3)) &&
+	       (tmpidx < 100)) {
 		tmpidx++;
 	}
 
@@ -421,7 +424,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 {
 	int i = 0;
 	u16 real_content_len = 0, max_available_size = 0;
-	int res = _FAIL ;
+	int res = _FAIL;
 	int (*rw8)(struct rtw_adapter *, u16, u8*);
 
 	EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
@@ -463,6 +466,7 @@ int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bWrite, u16 start_addr,
 u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter)
 {
 	u16 max_size;
+
 	EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI,
 				 TYPE_AVAILABLE_EFUSE_BYTES_TOTAL,
 				 (void *)&max_size);
Signature · 1 line
2.1.4
#10 lore raw

PATCH v2 3/4 staging: r8723au: move function type in line with function name

In reply to Alison Schofield

Move function types to be adjacent to the function names in declarations to improve readability.

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 58 +++++++++++-------------------
 1 file changed, 21 insertions(+), 37 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +21 -37
index 0fb4726..bf27ea4 100644
@@ -87,8 +87,7 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter,
 	}
 }
 
-u16
-Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
+u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	u16 ret = 0;
 
@@ -101,8 +100,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
 }
 
 /* Get current efuse area enabled word */
-u8
-Efuse_CalculateWordCnts23a(u8 word_en)
+u8 Efuse_CalculateWordCnts23a(u8 word_en)
 {
 	return hweight8((~word_en) & 0xf);
 }
@@ -113,8 +111,7 @@ Efuse_CalculateWordCnts23a(u8 word_en)
  * Assumptions: 1. Boot from E-Fuse and successfully auto-load.
  *              2. PASSIVE_LEVEL (USB interface)
  */
-void
-ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
+void ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 {
 	u32	value32;
 	u8	readbyte;
@@ -151,9 +148,8 @@ ReadEFuseByte23a(struct rtw_adapter *Adapter, u16 _offset, u8 *pbuf)
 	*pbuf = (u8)(value32 & 0xff);
 }
 
-void
-EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
-			    u8 type, void *pOut)
+void EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
+				 u8 type, void *pOut)
 {
 	u8 *pu1Tmp;
 	u16 *pu2Tmp;
@@ -235,8 +231,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType,
 }
 
 /* Copy from WMAC for EFUSE read 1 byte. */
-u8
-EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
+u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 {
 	u8	data;
 	u8	Bytetemp = {0x00};
@@ -279,10 +274,8 @@ EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void
-EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
-void
-EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
+void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
+void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
 	u8	temp = {0x00};
@@ -324,8 +317,7 @@ EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 }
 
 /* Read one byte from real Efuse. */
-int
-efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
+int efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
@@ -353,8 +345,7 @@ efuse_OneByteRead23a(struct rtw_adapter *pAdapter, u16 addr, u8 *data)
 }
 
 /* Write one byte to reald Efuse. */
-int
-efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
+int efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 {
 	u8	tmpidx = 0;
 	int	bResult;
@@ -385,10 +376,7 @@ efuse_OneByteWrite23a(struct rtw_adapter *pAdapter, u16 addr, u8 data)
 }
 
 /* Read allowed word in current efuse section data. */
-void
-efuse_WordEnableDataRead23a(u8	word_en,
-			 u8	*sourdata,
-			 u8	*targetdata)
+void efuse_WordEnableDataRead23a(u8 word_en, u8 *sourdata, u8 *targetdata)
 {
 	if (!(word_en&BIT(0))) {
 		targetdata[0] = sourdata[0];
@@ -514,10 +502,8 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void
-Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
-void
-Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
+void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
+void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
 
@@ -538,16 +524,16 @@ Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
  *
  * Read from efuse init map by one/two/four bytes
  */
-static void
-efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset, u8 *Value)
+static void efuse_ShadowRead1Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u8 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
 	*Value = pEEPROM->efuse_eeprom_data[Offset];
 }
 
-static void
-efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
+static void efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u16 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
@@ -555,8 +541,8 @@ efuse_ShadowRead2Byte(struct rtw_adapter *pAdapter, u16 Offset, u16 *Value)
 	*Value |= pEEPROM->efuse_eeprom_data[Offset+1]<<8;
 }
 
-static void
-efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
+static void efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset,
+				  u32 *Value)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
 
@@ -567,7 +553,6 @@ efuse_ShadowRead4Byte(struct rtw_adapter *pAdapter, u16 Offset, u32 *Value)
 }
 
 /* Transfer current EFUSE content to shadow init and modify map. */
-
 void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 {
 	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(pAdapter);
@@ -584,9 +569,8 @@ void EFUSE_ShadowMapUpdate23a(struct rtw_adapter *pAdapter, u8 efuseType)
 }
 
 /* Read from efuse init map */
-void
-EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter,
-		    u8 Type, u16 Offset, u32 *Value)
+void EFUSE_ShadowRead23a(struct rtw_adapter *pAdapter, u8 Type,
+			 u16 Offset, u32 *Value)
 {
 	if (Type == 1)
 		efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value);
Signature · 1 line
2.1.4
#11 lore raw

PATCH v2 4/4 staging: r8723au: remove unneeded forward function declarations

In reply to Alison Schofield

Remove unneeded forward function declarations.

Addresses checkpatch.pl:
WARNING: externs should be avoided in .c files

---
 drivers/staging/rtl8723au/core/rtw_efuse.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/rtl8723au/core/rtw_efuse.c +0 -2
index bf27ea4..906b578 100644
@@ -274,7 +274,6 @@ u8 EFUSE_Read1Byte23a(struct rtw_adapter *Adapter, u16 Address)
 }
 
 /* Copy from WMAC fot EFUSE write 1 byte. */
-void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value);
 void EFUSE_Write1Byte(struct rtw_adapter *Adapter, u16 Address, u8 Value)
 {
 	u8	Bytetemp = {0x00};
@@ -502,7 +501,6 @@ int rtw_BT_efuse_map_read23a(struct rtw_adapter *padapter,
 }
 
 /* Read All Efuse content */
-void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse);
 void Efuse_ReadAllMap(struct rtw_adapter *pAdapter, u8 efuseType, u8 *Efuse)
 {
 	u16	mapLen = 0;
Signature · 1 line
2.1.4