Skip to contentSkip to conversation

staging: vt6655: fix sparse issues

PATCH In review Guillaume Clement 2 participants 7 messages Jul 22, 2014 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: vt6655: fix sparse issues

Those patches fix warnings reported by sparse on the vt6655 driver. This will allow to more easily find real errors with sparse later if one appears.

Note that checkpatch does return an error for patch 1 and 2 (line over 80 characters) but the line length was not increased by this patch. If needed, I can do another patch set to fix the 80 column warnings too.

[PATCH 1/5] staging: vt6655: change type of PortOffset to void [PATCH 2/5] staging: vt6655:fix warning for unexported non-static [PATCH 3/5] staging: vt6655: statify some variables [PATCH 4/5] staging: vt6655: remove unused functions [PATCH 5/5] staging: vt6655: Fix unused function warning

#1 lore raw

PATCH 1/5 staging: vt6655: change type of PortOffset to void __iomem *

PortOffset was an unsigned long, but used as an pointer to io memory. Sometimes it was not properly cast before use, which caused many warning by sparse.

By updating its type to void __iomem *, and reflecting the changes where it is needed, this removes most of those warnings.

---
 drivers/staging/vt6655/baseband.c    |  30 +++++-----
 drivers/staging/vt6655/baseband.h    |  24 ++++----
 drivers/staging/vt6655/card.c        |   8 +--
 drivers/staging/vt6655/card.h        |   8 +--
 drivers/staging/vt6655/device.h      |   2 +-
 drivers/staging/vt6655/device_main.c |   6 +-
 drivers/staging/vt6655/key.c         |  18 +++---
 drivers/staging/vt6655/key.h         |  16 +++---
 drivers/staging/vt6655/mac.c         | 104 +++++++++++++++++-----------------
 drivers/staging/vt6655/mac.h         | 106 +++++++++++++++++------------------
 drivers/staging/vt6655/rf.c          |  16 +++---
 drivers/staging/vt6655/rf.h          |   8 +--
 drivers/staging/vt6655/srom.c        |  24 ++++----
 drivers/staging/vt6655/srom.h        |  24 ++++----
 drivers/staging/vt6655/upc.h         |  18 ++----
 15 files changed, 203 insertions(+), 209 deletions(-)
drivers/staging/vt6655/baseband.c +15 -15
index 490ca96..0985563 100644
@@ -1987,7 +1987,7 @@ BBvCalculateParameter(
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData)
+bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData)
 {
 	unsigned short ww;
 	unsigned char byValue;
@@ -2029,7 +2029,7 @@ bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned ch
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData)
+bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData)
 {
 	unsigned short ww;
 	unsigned char byValue;
@@ -2070,7 +2070,7 @@ bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned c
  * Return Value: true if all TestBits are set; false otherwise.
  *
  */
-bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
+bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
 {
 	unsigned char byOrgData;
 
@@ -2092,7 +2092,7 @@ bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned cha
  * Return Value: true if all TestBits are clear; false otherwise.
  *
  */
-bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
+bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
 {
 	unsigned char byOrgData;
 
@@ -2119,7 +2119,7 @@ bool BBbVT3253Init(PSDevice pDevice)
 {
 	bool bResult = true;
 	int        ii;
-	unsigned long dwIoBase = pDevice->PortOffset;
+	void __iomem *dwIoBase = pDevice->PortOffset;
 	unsigned char byRFType = pDevice->byRFType;
 	unsigned char byLocalID = pDevice->byLocalID;
 
@@ -2285,7 +2285,7 @@ bool BBbVT3253Init(PSDevice pDevice)
  * Return Value: none
  *
  */
-void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs)
+void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs)
 {
 	int  ii;
 	unsigned char byBase = 1;
@@ -2312,7 +2312,7 @@ void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs)
 void BBvLoopbackOn(PSDevice pDevice)
 {
 	unsigned char byData;
-	unsigned long dwIoBase = pDevice->PortOffset;
+	void __iomem *dwIoBase = pDevice->PortOffset;
 
 	/* CR C9 = 0x00 */
 	BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9); /* CR201 */
@@ -2365,7 +2365,7 @@ void BBvLoopbackOn(PSDevice pDevice)
 void BBvLoopbackOff(PSDevice pDevice)
 {
 	unsigned char byData;
-	unsigned long dwIoBase = pDevice->PortOffset;
+	void __iomem *dwIoBase = pDevice->PortOffset;
 
 	BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9); /* CR201 */
 	BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88); /* CR136 */
@@ -2448,7 +2448,7 @@ void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData)
  *
  */
 void
-BBvSoftwareReset(unsigned long dwIoBase)
+BBvSoftwareReset(void __iomem *dwIoBase)
 {
 	BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
 	BBbWriteEmbedded(dwIoBase, 0x50, 0);
@@ -2469,7 +2469,7 @@ BBvSoftwareReset(unsigned long dwIoBase)
  *
  */
 void
-BBvPowerSaveModeON(unsigned long dwIoBase)
+BBvPowerSaveModeON(void __iomem *dwIoBase)
 {
 	unsigned char byOrgData;
 
@@ -2491,7 +2491,7 @@ BBvPowerSaveModeON(unsigned long dwIoBase)
  *
  */
 void
-BBvPowerSaveModeOFF(unsigned long dwIoBase)
+BBvPowerSaveModeOFF(void __iomem *dwIoBase)
 {
 	unsigned char byOrgData;
 
@@ -2515,7 +2515,7 @@ BBvPowerSaveModeOFF(unsigned long dwIoBase)
  */
 
 void
-BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
+BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
 {
 	unsigned char byBBTxConf;
 
@@ -2548,7 +2548,7 @@ BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
  */
 
 void
-BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
+BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
 {
 	unsigned char byBBRxConf;
 
@@ -2578,14 +2578,14 @@ BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
  *
  */
 void
-BBvSetDeepSleep(unsigned long dwIoBase, unsigned char byLocalID)
+BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID)
 {
 	BBbWriteEmbedded(dwIoBase, 0x0C, 0x17); /* CR12 */
 	BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9); /* CR13 */
 }
 
 void
-BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID)
+BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID)
 {
 	BBbWriteEmbedded(dwIoBase, 0x0C, 0x00); /* CR12 */
 	BBbWriteEmbedded(dwIoBase, 0x0D, 0x01); /* CR13 */
drivers/staging/vt6655/baseband.h +12 -12
index e31bb76..2466e2f8 100644
@@ -99,26 +99,26 @@ BBvCalculateParameter(
 	unsigned char *pbyPhySgn
 );
 
-bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
-bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData);
+bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
+bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData);
 
-void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs);
+void BBvReadAllRegs(void __iomem *dwIoBase, unsigned char *pbyBBRegs);
 void BBvLoopbackOn(PSDevice pDevice);
 void BBvLoopbackOff(PSDevice pDevice);
 void BBvSetShortSlotTime(PSDevice pDevice);
-bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
-bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
+bool BBbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
+bool BBbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byTestBits);
 void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData);
 
 // VT3253 Baseband
 bool BBbVT3253Init(PSDevice pDevice);
-void BBvSoftwareReset(unsigned long dwIoBase);
-void BBvPowerSaveModeON(unsigned long dwIoBase);
-void BBvPowerSaveModeOFF(unsigned long dwIoBase);
-void BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode);
-void BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode);
-void BBvSetDeepSleep(unsigned long dwIoBase, unsigned char byLocalID);
-void BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID);
+void BBvSoftwareReset(void __iomem *dwIoBase);
+void BBvPowerSaveModeON(void __iomem *dwIoBase);
+void BBvPowerSaveModeOFF(void __iomem *dwIoBase);
+void BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode);
+void BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode);
+void BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID);
+void BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID);
 
 // timer for antenna diversity
 
drivers/staging/vt6655/card.c +4 -4
index 0b2ca2f..988858b 100644
@@ -1891,7 +1891,7 @@ unsigned char CARDbyGetPktType(void *pDeviceHandler)
  * Return Value: none
  *
  */
-void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode)
+void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode)
 {
 	switch (wLoopbackMode) {
 	case CARD_LB_NONE:
@@ -1980,7 +1980,7 @@ QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
  * Return Value: true if success; otherwise false
  *
  */
-bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF)
+bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF)
 {
 	unsigned short ww;
 	unsigned char byData;
@@ -2053,7 +2053,7 @@ QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
  * Return Value: none
  *
  */
-void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval)
+void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval)
 {
 	QWORD   qwNextTBTT;
 
@@ -2084,7 +2084,7 @@ void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterva
  * Return Value: none
  *
  */
-void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
+void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
 {
 	qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
 	// Set NextTBTT
drivers/staging/vt6655/card.h +4 -4
index 829be92..2ab46f3 100644
@@ -89,11 +89,11 @@ void vUpdateIFS(void *pDeviceHandler);
 void CARDvUpdateBasicTopRate(void *pDeviceHandler);
 bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
 bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
-void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode);
+void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
 bool CARDbSoftwareReset(void *pDeviceHandler);
-void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval);
-void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
-bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF);
+void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
+void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
+bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF);
 QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
 QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
 bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
drivers/staging/vt6655/device.h +1 -1
index aab63ca..647e36fe 100644
@@ -391,7 +391,7 @@ typedef struct __device_info {
 
 	CHIP_TYPE                   chip_id;
 
-	unsigned long               PortOffset;
+	void __iomem                *PortOffset;
 	unsigned long dwIsr;
 	u32                         memaddr;
 	u32                         ioaddr;
drivers/staging/vt6655/device_main.c +3 -3
index d17cb1a..4dcdfca 100644
@@ -891,9 +891,9 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
 
 #endif
 
-	pDevice->PortOffset = (unsigned long)ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size);
+	pDevice->PortOffset = ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size);
 
-	if (pDevice->PortOffset == 0) {
+	if (pDevice->PortOffset == NULL) {
 		printk(KERN_ERR DEVICE_NAME ": Failed to IO remapping ..\n");
 		device_free_info(pDevice);
 		return -ENODEV;
@@ -1079,7 +1079,7 @@ static void device_free_info(PSDevice pDevice) {
 		unregister_netdev(dev);
 
 	if (pDevice->PortOffset)
-		iounmap((void *)pDevice->PortOffset);
+		iounmap(pDevice->PortOffset);
 
 	if (pDevice->pcid)
 		pci_release_regions(pDevice->pcid);
drivers/staging/vt6655/key.c +9 -9
index 09a8bf5..f5bc4a2 100644
@@ -58,7 +58,7 @@ static int msglevel = MSG_LEVEL_INFO;
 
 /*---------------------  Static Functions  --------------------------*/
 static void
-s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase)
+s_vCheckKeyTableValid(PSKeyManagement pTable, void __iomem *dwIoBase)
 {
 	int i;
 
@@ -91,7 +91,7 @@ s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase)
  * Return Value: none
  *
  */
-void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase)
+void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase)
 {
 	int i;
 	int jj;
@@ -187,7 +187,7 @@ bool KeybSetKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 )
 {
@@ -351,7 +351,7 @@ bool KeybRemoveKey(
 	PSKeyManagement pTable,
 	unsigned char *pbyBSSID,
 	unsigned long dwKeyIndex,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 )
 {
 	int  i;
@@ -418,7 +418,7 @@ bool KeybRemoveKey(
 bool KeybRemoveAllKey(
 	PSKeyManagement pTable,
 	unsigned char *pbyBSSID,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 )
 {
 	int i, u;
@@ -453,7 +453,7 @@ bool KeybRemoveAllKey(
 void KeyvRemoveWEPKey(
 	PSKeyManagement pTable,
 	unsigned long dwKeyIndex,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 )
 {
 	if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
@@ -473,7 +473,7 @@ void KeyvRemoveWEPKey(
 
 void KeyvRemoveAllWEPKey(
 	PSKeyManagement pTable,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 )
 {
 	int i;
@@ -610,7 +610,7 @@ bool KeybSetDefaultKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 )
 {
@@ -716,7 +716,7 @@ bool KeybSetAllGroupKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 )
 {
drivers/staging/vt6655/key.h +8 -8
index 4b8b4b6..4eee192 100644
@@ -97,7 +97,7 @@ typedef struct tagSKeyManagement
 
 /*---------------------  Export Functions  --------------------------*/
 
-void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase);
+void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase);
 
 bool KeybGetKey(
 	PSKeyManagement pTable,
@@ -114,7 +114,7 @@ bool KeybSetKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 );
 
@@ -125,7 +125,7 @@ bool KeybSetDefaultKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 );
 
@@ -133,7 +133,7 @@ bool KeybRemoveKey(
 	PSKeyManagement pTable,
 	unsigned char *pbyBSSID,
 	unsigned long dwKeyIndex,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 );
 
 bool KeybGetTransmitKey(
@@ -151,18 +151,18 @@ bool KeybCheckPairewiseKey(
 bool KeybRemoveAllKey(
 	PSKeyManagement pTable,
 	unsigned char *pbyBSSID,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 );
 
 void KeyvRemoveWEPKey(
 	PSKeyManagement pTable,
 	unsigned long dwKeyIndex,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 );
 
 void KeyvRemoveAllWEPKey(
 	PSKeyManagement pTable,
-	unsigned long dwIoBase
+	void __iomem *dwIoBase
 );
 
 bool KeybSetAllGroupKey(
@@ -172,7 +172,7 @@ bool KeybSetAllGroupKey(
 	PQWORD          pKeyRSC,
 	unsigned char *pbyKey,
 	unsigned char byKeyDecMode,
-	unsigned long dwIoBase,
+	void __iomem *dwIoBase,
 	unsigned char byLocalID
 );
 
drivers/staging/vt6655/mac.c +52 -52

416 lines not on this page · raw message

drivers/staging/vt6655/mac.h +53 -53

131 lines not on this page · raw message

drivers/staging/vt6655/rf.c +8 -8
index 99c89a1..33913e5 100644
@@ -424,7 +424,7 @@ static const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = {
  * Return Value: true if succeeded; false if failed.
  *
  */
-static bool s_bAL7230Init(unsigned long dwIoBase)
+static bool s_bAL7230Init(void __iomem *dwIoBase)
 {
 	int     ii;
 	bool bResult;
@@ -467,7 +467,7 @@ static bool s_bAL7230Init(unsigned long dwIoBase)
 }
 
 // Need to Pull PLLON low when writing channel registers through 3-wire interface
-static bool s_bAL7230SelectChannel(unsigned long dwIoBase, unsigned char byChannel)
+static bool s_bAL7230SelectChannel(void __iomem *dwIoBase, unsigned char byChannel)
 {
 	bool bResult;
 
@@ -567,7 +567,7 @@ static bool s_bAL7230SelectChannel(unsigned long dwIoBase, unsigned char byChann
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData)
+bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData)
 {
 	unsigned short ww;
 	unsigned long dwValue;
@@ -626,7 +626,7 @@ bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData)
  * Return Value: true if succeeded; false if failed.
  *
  */
-static bool RFbAL2230Init(unsigned long dwIoBase)
+static bool RFbAL2230Init(void __iomem *dwIoBase)
 {
 	int     ii;
 	bool bResult;
@@ -673,7 +673,7 @@ static bool RFbAL2230Init(unsigned long dwIoBase)
 	return bResult;
 }
 
-static bool RFbAL2230SelectChannel(unsigned long dwIoBase, unsigned char byChannel)
+static bool RFbAL2230SelectChannel(void __iomem *dwIoBase, unsigned char byChannel)
 {
 	bool bResult;
 
@@ -783,7 +783,7 @@ bool RFbInit(
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel)
+bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel)
 {
 	bool bResult = true;
 	switch (byRFType) {
@@ -818,7 +818,7 @@ bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned c
  * Return Value: None.
  *
  */
-bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel)
+bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel)
 {
 	int   ii;
 	unsigned char byInitCount = 0;
@@ -1070,7 +1070,7 @@ RFvRSSITodBm(
 
 // Post processing for the 11b/g and 11a.
 // for save time on changing Reg2,3,5,7,10,12,15
-bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel)
+bool RFbAL7230SelectChannelPostProcess(void __iomem *dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel)
 {
 	bool bResult;
 
drivers/staging/vt6655/rf.h +4 -4
index ef3c6de..ba55561 100644
@@ -74,12 +74,12 @@
 
 /*---------------------  Export Functions  --------------------------*/
 
-bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData);
-bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel);
+bool IFRFbWriteEmbedded(void __iomem *dwIoBase, unsigned long dwData);
+bool RFbSelectChannel(void __iomem *dwIoBase, unsigned char byRFType, unsigned char byChannel);
 bool RFbInit(
 	PSDevice  pDevice
 );
-bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel);
+bool RFvWriteWakeProgSyn(void __iomem *dwIoBase, unsigned char byRFType, unsigned int uChannel);
 bool RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH);
 bool RFbRawSetPower(
 	PSDevice  pDevice,
@@ -95,7 +95,7 @@ RFvRSSITodBm(
 );
 
 //{{ RobertYu: 20050104
-bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel);
+bool RFbAL7230SelectChannelPostProcess(void __iomem *dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel);
 //}} RobertYu
 
 #endif // __RF_H__
drivers/staging/vt6655/srom.c +12 -12
index eaddc33..5396e58 100644
@@ -73,7 +73,7 @@
  * Return Value: data read
  *
  */
-unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntOffset)
+unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset)
 {
 	unsigned short wDelay, wNoACK;
 	unsigned char byWait;
@@ -121,7 +121,7 @@ unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntO
  * Return Value: true if succeeded; false if failed.
  *
  */
-bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byData)
+bool SROMbWriteEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byData)
 {
 	unsigned short wDelay, wNoACK;
 	unsigned char byWait;
@@ -173,7 +173,7 @@ bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, un
  * Return Value: none
  *
  */
-void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits)
+void SROMvRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits)
 {
 	unsigned char byOrgData;
 
@@ -193,7 +193,7 @@ void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsign
  *      none
  *
  */
-void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits)
+void SROMvRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits)
 {
 	unsigned char byOrgData;
 
@@ -215,7 +215,7 @@ void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsig
  * Return Value: true if all test bits on; otherwise false
  *
  */
-bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
+bool SROMbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
 {
 	unsigned char byOrgData;
 
@@ -237,7 +237,7 @@ bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsi
  * Return Value: true if all test bits off; otherwise false
  *
  */
-bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
+bool SROMbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
 {
 	unsigned char byOrgData;
 
@@ -257,7 +257,7 @@ bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, uns
  * Return Value: none
  *
  */
-void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
+void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs)
 {
 	int     ii;
 
@@ -281,7 +281,7 @@ void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
  * Return Value: none
  *
  */
-void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
+void SROMvWriteAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs)
 {
 	int     ii;
 
@@ -304,7 +304,7 @@ void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
  * Return Value: none
  *
  */
-void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress)
+void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress)
 {
 	unsigned char ii;
 
@@ -328,7 +328,7 @@ void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddres
  * Return Value: none
  *
  */
-void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress)
+void SROMvWriteEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress)
 {
 	unsigned char ii;
 
@@ -351,7 +351,7 @@ void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddre
  * Return Value: none
  *
  */
-void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId)
+void SROMvReadSubSysVenId(void __iomem *dwIoBase, unsigned long *pdwSubSysVenId)
 {
 	unsigned char *pbyData;
 
@@ -376,7 +376,7 @@ void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId)
  * Return Value: true if success; otherwise false
  *
  */
-bool SROMbAutoLoad(unsigned long dwIoBase)
+bool SROMbAutoLoad(void __iomem *dwIoBase)
 {
 	unsigned char byWait;
 	int     ii;
drivers/staging/vt6655/srom.h +12 -12
index 1df58c5..3128e53 100644
@@ -133,23 +133,23 @@ typedef struct tagSSromReg {
 
 /*---------------------  Export Functions  --------------------------*/
 
-unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntOffset);
-bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byData);
+unsigned char SROMbyReadEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset);
+bool SROMbWriteEmbedded(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byData);
 
-void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits);
-void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits);
+void SROMvRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits);
+void SROMvRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byBits);
 
-bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits);
-bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits);
+bool SROMbIsRegBitsOn(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits);
+bool SROMbIsRegBitsOff(void __iomem *dwIoBase, unsigned char byContntOffset, unsigned char byTestBits);
 
-void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs);
-void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs);
+void SROMvReadAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs);
+void SROMvWriteAllContents(void __iomem *dwIoBase, unsigned char *pbyEepromRegs);
 
-void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress);
-void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress);
+void SROMvReadEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress);
+void SROMvWriteEtherAddress(void __iomem *dwIoBase, unsigned char *pbyEtherAddress);
 
-void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId);
+void SROMvReadSubSysVenId(void __iomem *dwIoBase, unsigned long *pdwSubSysVenId);
 
-bool SROMbAutoLoad(unsigned long dwIoBase);
+bool SROMbAutoLoad(void __iomem *dwIoBase);
 
 #endif // __EEPROM_H__
drivers/staging/vt6655/upc.h +6 -12
index 155e664..af12a86 100644
@@ -72,38 +72,32 @@ do {						\
 
 #define VNSvInPortB(dwIOAddress, pbyData)				\
 do {									\
-	volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
-	*(pbyData) = readb(pbyAddr);					\
+	*(pbyData) = readb(dwIOAddress);				\
 } while (0)
 
 #define VNSvInPortW(dwIOAddress, pwData)				\
 do {									\
-	volatile unsigned short *pwAddr = (unsigned short *)(dwIOAddress); \
-	*(pwData) = readw(pwAddr);					\
+	*(pwData) = readw(dwIOAddress);					\
 } while (0)
 
 #define VNSvInPortD(dwIOAddress, pdwData)				\
 do {									\
-	volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \
-	*(pdwData) = readl(pdwAddr);					\
+	*(pdwData) = readl(dwIOAddress);				\
 } while (0)
 
 #define VNSvOutPortB(dwIOAddress, byData)				\
 do {									\
-	volatile unsigned char *pbyAddr = (unsigned char *)(dwIOAddress); \
-	writeb((unsigned char)byData, pbyAddr);				\
+	writeb((unsigned char)byData, dwIOAddress);			\
 } while (0)
 
 #define VNSvOutPortW(dwIOAddress, wData)				\
 do {									\
-	volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
-	writew((unsigned short)wData, pwAddr);				\
+	writew((unsigned short)wData, dwIOAddress);			\
 } while (0)
 
 #define VNSvOutPortD(dwIOAddress, dwData)				\
 do {									\
-	volatile unsigned long *pdwAddr = (unsigned long *)(dwIOAddress); \
-	writel((unsigned long)dwData, pdwAddr);				\
+	writel((unsigned long)dwData, dwIOAddress);			\
 } while (0)
 
 #endif
Signature · 1 line
1.8.5.5
#2 lore raw

Re: [PATCH 1/5] staging: vt6655: change type of PortOffset to void __iomem *

Quoted 6 lines · Guillaume Clement

PortOffset was an unsigned long, but used as an pointer to io memory. Sometimes it was not properly cast before use, which caused many warning by sparse.

By updating its type to void __iomem *, and reflecting the changes where it is needed, this removes most of those warnings.

Nice job, that's the correct way to fix this.

greg k-h

#3 lore raw

PATCH 2/5 staging: vt6655:fix warning for unexported non-static functions

In reply to Guillaume Clement

There is one function in aes_ccmp.c which is exported, but sparse sees it unexported because it doesn't include the header that exports it.

---
 drivers/staging/vt6655/aes_ccmp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/vt6655/aes_ccmp.c +1 -0
index 4ccfe06..a25e6cf 100644
@@ -35,6 +35,7 @@
 
 #include "device.h"
 #include "80211hdr.h"
+#include "aes_ccmp.h"
 
 /*---------------------  Static Definitions -------------------------*/
 
Signature · 1 line
1.8.5.5
#4 lore raw

PATCH 3/5 staging: vt6655: statify some variables

In reply to Guillaume Clement

Some variables are used only in the context of their .c file, which gives warnings with sparse.

---
 drivers/staging/vt6655/baseband.c    | 14 +++++++-------
 drivers/staging/vt6655/bssdb.c       |  4 ++--
 drivers/staging/vt6655/card.c        |  6 +++---
 drivers/staging/vt6655/device_main.c |  4 ++--
 drivers/staging/vt6655/wcmd.c        |  2 +-
 drivers/staging/vt6655/wmgr.c        | 10 +++++-----
 6 files changed, 20 insertions(+), 20 deletions(-)
drivers/staging/vt6655/baseband.c +7 -7
index 0985563..67bc3b4 100644
@@ -75,7 +75,7 @@ static int msglevel = MSG_LEVEL_INFO;
 /*---------------------  Static Variables  --------------------------*/
 
 #define CB_VT3253_INIT_FOR_RFMD 446
-unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
+static unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
 	{0x00, 0x30},
 	{0x01, 0x00},
 	{0x02, 0x00},
@@ -525,7 +525,7 @@ unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
 };
 
 #define CB_VT3253B0_INIT_FOR_RFMD 256
-unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
+static unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
 	{0x00, 0x31},
 	{0x01, 0x00},
 	{0x02, 0x00},
@@ -786,7 +786,7 @@ unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
 
 #define CB_VT3253B0_AGC_FOR_RFMD2959 195
 /* For RFMD2959 */
-unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
+static unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
 	{0xF0, 0x00},
 	{0xF1, 0x3E},
 	{0xF0, 0x80},
@@ -986,7 +986,7 @@ unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
 
 #define CB_VT3253B0_INIT_FOR_AIROHA2230 256
 /* For AIROHA */
-unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
+static unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
 	{0x00, 0x31},
 	{0x01, 0x00},
 	{0x02, 0x00},
@@ -1247,7 +1247,7 @@ unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
 
 #define CB_VT3253B0_INIT_FOR_UW2451 256
 /* For UW2451 */
-unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
+static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
 	{0x00, 0x31},
 	{0x01, 0x00},
 	{0x02, 0x00},
@@ -1508,7 +1508,7 @@ unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
 
 #define CB_VT3253B0_AGC 193
 /* For AIROHA */
-unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
+static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
 	{0xF0, 0x00},
 	{0xF1, 0x00},
 	{0xF0, 0x80},
@@ -1704,7 +1704,7 @@ unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
 	{0xF0, 0x00},
 };
 
-const unsigned short awcFrameTime[MAX_RATE] =
+static const unsigned short awcFrameTime[MAX_RATE] =
 {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216};
 
 /*---------------------  Static Functions  --------------------------*/
drivers/staging/vt6655/bssdb.c +2 -2
index 59679cd..eb3474d 100644
@@ -65,14 +65,14 @@
 /*---------------------  Static Variables  --------------------------*/
 static int msglevel = MSG_LEVEL_INFO;
 
-const unsigned short awHWRetry0[5][5] = {
+static const unsigned short awHWRetry0[5][5] = {
 	{RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
 	{RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
 	{RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
 	{RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
 	{RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
 };
-const unsigned short awHWRetry1[5][5] = {
+static const unsigned short awHWRetry1[5][5] = {
 	{RATE_18M, RATE_18M, RATE_12M, RATE_6M, RATE_6M},
 	{RATE_24M, RATE_24M, RATE_18M, RATE_6M, RATE_6M},
 	{RATE_36M, RATE_36M, RATE_24M, RATE_12M, RATE_12M},
drivers/staging/vt6655/card.c +3 -3
index 988858b..e29dcd8 100644
@@ -87,7 +87,7 @@ static unsigned char abyDefaultSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x0
 
 /*---------------------  Static Variables  --------------------------*/
 
-const unsigned short cwRXBCNTSFOff[MAX_RATE] =
+static const unsigned short cwRXBCNTSFOff[MAX_RATE] =
 {17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3};
 
 /*---------------------  Static Functions  --------------------------*/
@@ -1576,7 +1576,7 @@ CARDvSafeResetRx(
  * Return Value: response Control frame rate
  *
  */
-unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx)
+static unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx)
 {
 	PSDevice    pDevice = (PSDevice) pDeviceHandler;
 	unsigned int ui = (unsigned int) wRateIdx;
@@ -1603,7 +1603,7 @@ unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRate
  * Return Value: response Control frame rate
  *
  */
-unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx)
+static unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx)
 {
 	PSDevice pDevice = (PSDevice) pDeviceHandler;
 	unsigned int ui = (unsigned int) wRateIdx;
drivers/staging/vt6655/device_main.c +2 -2
index 4dcdfca..5576c30 100644
@@ -260,7 +260,7 @@ static CHIP_INFO chip_info_table[] = {
 	{0, NULL}
 };
 
-const struct pci_device_id vt6655_pci_id_table[] = {
+static const struct pci_device_id vt6655_pci_id_table[] = {
 	{ PCI_VDEVICE(VIA, 0x3253), (kernel_ulong_t)chip_info_table},
 	{ 0, }
 };
@@ -285,7 +285,7 @@ static int  device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
 static int viawget_suspend(struct pci_dev *pcid, pm_message_t state);
 static int viawget_resume(struct pci_dev *pcid);
-struct notifier_block device_notifier = {
+static struct notifier_block device_notifier = {
 	.notifier_call = device_notify_reboot,
 	.next = NULL,
 	.priority = 0,
drivers/staging/vt6655/wcmd.c +1 -1
index a689645..a379cec 100644
@@ -234,7 +234,7 @@ s_vProbeChannel(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeProbeRequest(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
drivers/staging/vt6655/wmgr.c +5 -5
index cc4f5b9..9853a8f 100644
@@ -3144,7 +3144,7 @@ s_MgrMakeBeacon(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeProbeResponse(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
@@ -3326,7 +3326,7 @@ s_MgrMakeProbeResponse(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeAssocRequest(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
@@ -3586,7 +3586,7 @@ s_MgrMakeAssocRequest(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeReAssocRequest(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
@@ -3831,7 +3831,7 @@ s_MgrMakeReAssocRequest(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeAssocResponse(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
@@ -3902,7 +3902,7 @@ s_MgrMakeAssocResponse(
  *
  -*/
 
-PSTxMgmtPacket
+static PSTxMgmtPacket
 s_MgrMakeReAssocResponse(
 	PSDevice pDevice,
 	PSMgmtObject pMgmt,
Signature · 1 line
1.8.5.5
#5 lore raw

PATCH 4/5 staging: vt6655: remove unused functions

In reply to Guillaume Clement

The IEEE11hbMgrRxAction is not exported and never used. Deleting it allows to delete other functions that were only used by IEEE11hbMgrRxAction.

This allows to fix several warnings reported by sparse.

---
 drivers/staging/vt6655/IEEE11h.c | 175 ---------------------------------------
 1 file changed, 175 deletions(-)
drivers/staging/vt6655/IEEE11h.c +0 -175
index 6cfad1c..180a27c 100644
@@ -41,7 +41,6 @@
 #include "channel.h"
 
 /*---------------------  Static Definitions -------------------------*/
-static int          msglevel                = MSG_LEVEL_INFO;
 
 #pragma pack(1)
 
@@ -98,185 +97,11 @@ typedef struct _WLAN_FRAME_TPCREP {
 /*---------------------  Static Variables  --------------------------*/
 
 /*---------------------  Static Functions  --------------------------*/
-static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
-			unsigned int uLength)
-{
-	size_t    uNumOfEIDs = 0;
-	bool bResult = true;
-
-	if (uLength <= WLAN_A3FR_MAXLEN)
-		memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
-	uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ,
-					  sMSRReqEIDs))/
-		      (sizeof(WLAN_IE_MEASURE_REQ)));
-	pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP)
-				       (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
-	pMgmt->uLengthOfRepEIDs = 0;
-	bResult = CARDbStartMeasure(pMgmt->pAdapter,
-				    ((PWLAN_FRAME_MSRREQ)
-				     (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
-				    uNumOfEIDs
-);
-	return bResult;
-}
-
-static bool s_bRxTPCReq(PSMgmtObject pMgmt,
-			PWLAN_FRAME_TPCREQ pTPCReq,
-			unsigned char byRate,
-			unsigned char byRSSI)
-{
-	PWLAN_FRAME_TPCREP  pFrame;
-	PSTxMgmtPacket      pTxPacket = NULL;
-
-	pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
-	memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
-	pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
-						    sizeof(STxMgmtPacket));
-
-	pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket +
-				      sizeof(STxMgmtPacket));
-
-	pFrame->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
-				    WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
-);
-
-	memcpy(pFrame->Header.abyAddr1,
-	       pTPCReq->Header.abyAddr2,
-	       WLAN_ADDR_LEN);
-	memcpy(pFrame->Header.abyAddr2,
-	       CARDpGetCurrentAddress(pMgmt->pAdapter),
-	       WLAN_ADDR_LEN);
-	memcpy(pFrame->Header.abyAddr3,
-	       pMgmt->abyCurrBSSID,
-	       WLAN_BSSID_LEN);
-
-	pFrame->byCategory = 0;
-	pFrame->byAction = 3;
-	pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ)
-				 (pMgmt->abyCurrentMSRReq))->byDialogToken;
-
-	pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
-	pFrame->sTPCRepEIDs.len = 2;
-	pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
-	switch (byRate) {
-	case RATE_54M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI;
-		break;
-	case RATE_48M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI;
-		break;
-	case RATE_36M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI;
-		break;
-	case RATE_24M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI;
-		break;
-	case RATE_18M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI;
-		break;
-	case RATE_12M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI;
-		break;
-	case RATE_9M:
-		pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI;
-		break;
-	case RATE_6M:
-	default:
-		pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI;
-		break;
-	}
-
-	pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP);
-	pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) -
-		WLAN_HDR_ADDR3_LEN;
-	if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)
-		return false;
-	return true;
-}
 
 /*---------------------  Export Variables  --------------------------*/
 
 /*---------------------  Export Functions  --------------------------*/
 
-/*+
- *
- * Description:
- *      Handles action management frames.
- *
- * Parameters:
- *  In:
- *      pMgmt           - Management Object structure
- *      pRxPacket       - Received packet
- *  Out:
- *      none
- *
- * Return Value: None.
- *
- -*/
-bool
-IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket)
-{
-	PSMgmtObject            pMgmt = (PSMgmtObject) pMgmtHandle;
-	PWLAN_FRAME_ACTION      pAction = NULL;
-	unsigned int uLength = 0;
-	PWLAN_IE_CH_SW          pChannelSwitch = NULL;
-
-	/* decode the frame */
-	uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen;
-	if (uLength > WLAN_A3FR_MAXLEN)
-		return false;
-
-	pAction = (PWLAN_FRAME_ACTION)
-		(((PSRxMgmtPacket)pRxPacket)->p80211Header);
-
-	if (pAction->byCategory == 0) {
-		switch (pAction->byAction) {
-		case ACTION_MSRREQ:
-			return s_bRxMSRReq(pMgmt,
-					   (PWLAN_FRAME_MSRREQ)
-					   pAction,
-					   uLength);
-			break;
-		case ACTION_MSRREP:
-			break;
-		case ACTION_TPCREQ:
-			return s_bRxTPCReq(pMgmt,
-					   (PWLAN_FRAME_TPCREQ) pAction,
-					   ((PSRxMgmtPacket)pRxPacket)->byRxRate,
-					   (unsigned char)
-					   ((PSRxMgmtPacket)pRxPacket)->uRSSI);
-			break;
-		case ACTION_TPCREP:
-			break;
-		case ACTION_CHSW:
-			pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars);
-			if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH)
-			    && (pChannelSwitch->len == 3)) {
-				/* valid element id */
-				CARDbChannelSwitch(pMgmt->pAdapter,
-						   pChannelSwitch->byMode,
-						   get_channel_mapping(pMgmt->pAdapter,
-								       pChannelSwitch->byChannel,
-								       pMgmt->eCurrentPHYMode),
-						   pChannelSwitch->byCount);
-			}
-			break;
-		default:
-			DBG_PRT(MSG_LEVEL_DEBUG,
-				KERN_INFO "Unknown Action = %d\n",
-				pAction->byAction);
-			break;
-		}
-	} else {
-		DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown Category = %d\n",
-			pAction->byCategory);
-		pAction->byCategory |= 0x80;
-
-		return true;
-	}
-	return true;
-}
-
 bool IEEE11hbMSRRepTx(void *pMgmtHandle)
 {
 	PSMgmtObject            pMgmt = (PSMgmtObject) pMgmtHandle;
Signature · 1 line
1.8.5.5
#6 lore raw

PATCH 5/5 staging: vt6655: Fix unused function warning

In reply to Guillaume Clement

Sparse reports that MimeThread is not used. Actually, it can be used if THREAD is defined. By enclosing the MimeThread function into the same #ifdef as the caller of MimeThread, this fixes the sparse warnings.

---
 drivers/staging/vt6655/device_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/vt6655/device_main.c +5 -1
index 5576c30..fe9e13c 100644
@@ -98,7 +98,9 @@ MODULE_AUTHOR("VIA Networking Technologies, Inc., <[email protected]>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver");
 
+#ifdef	THREAD
 static int mlme_kill;
+#endif
 
 #define DEVICE_PARAM(N, D)
 
@@ -1596,7 +1598,8 @@ void	InitRxManagementQueue(PSDevice  pDevice)
 //PLICE_DEBUG<-
 
 //PLICE_DEBUG ->
-int MlmeThread(
+#ifdef	THREAD
+static int MlmeThread(
 	void *Context)
 {
 	PSDevice	pDevice =  (PSDevice) Context;
@@ -1619,6 +1622,7 @@ int MlmeThread(
 
 	return 0;
 }
+#endif
 
 static int  device_open(struct net_device *dev) {
 	PSDevice pDevice = (PSDevice)netdev_priv(dev);
Signature · 1 line
1.8.5.5