Skip to contentSkip to conversation

staging: vt6655: Remove uncalled functions.

PATCH Superseded Briana Oursler 3 participants 8 messages Mar 29, 2020 – Mar 31, 2020 Staging

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover staging: vt6655: Remove uncalled functions.

This patchset removes functions that are not called in the driver but are prototyped in card.h. Each commit limits its scope to one function definition and related documentation in code. References in the developer's initial changelog were left in place.

Functions were checked for calls using the Elixir Cross Referencer and git grep.

Briana Oursler (3):
Staging: vt6655: Remove CARDbSoftwareReset definition.
Staging: vt6655: Remove CARDvSetLoopbackMode definition.
Staging: vt6655: Remove CARDbRadioPowerOn definition.

 drivers/staging/vt6655/card.c | 105 ----------------------------------
 drivers/staging/vt6655/card.h |   4 --
 2 files changed, 109 deletions(-)
Signature · 1 line
2.24.1
#1 lore raw

PATCH 1/3 Staging: vt6655: Remove CARDbSoftwareReset definition.

Remove uncalled function CARDbSoftwareReset and comments related to it.

---
 drivers/staging/vt6655/card.c | 20 --------------------
 drivers/staging/vt6655/card.h |  1 -
 2 files changed, 21 deletions(-)
drivers/staging/vt6655/card.c +0 -20
index e65c9825ea5a..135010d2c7d3 100644
@@ -12,7 +12,6 @@
  *      CARDbAddBasicRate - Add to BasicRateSet
  *      CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet
  *      CARDvSetLoopbackMode - Set Loopback mode
- *      CARDbSoftwareReset - Sortware reset NIC
  *      CARDqGetTSFOffset - Calculate TSFOffset
  *      CARDbGetCurrentTSF - Read Current NIC TSF counter
  *      CARDqGetNextTBTT - Calculate Next Beacon TSF counter
@@ -843,25 +842,6 @@ void CARDvSetLoopbackMode(struct vnt_private *priv,
 	/* set Baseband loopback */
 }
 
-/*
- * Description: Software Reset NIC
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be reset
- *  Out:
- *      none
- *
- * Return Value: none
- */
-bool CARDbSoftwareReset(struct vnt_private *priv)
-{
-	/* reset MAC */
-	if (!MACbSafeSoftwareReset(priv))
-		return false;
-
-	return true;
-}
 
 /*
  * Description: Calculate TSF offset of two TSF input
drivers/staging/vt6655/card.h +0 -1
index 337266add6b2..a811ac8942a0 100644
@@ -46,7 +46,6 @@ void CARDvUpdateBasicTopRate(struct vnt_private *priv);
 bool CARDbIsOFDMinBasicRate(struct vnt_private *priv);
 void CARDvSetLoopbackMode(struct vnt_private *priv,
 			  unsigned short wLoopbackMode);
-bool CARDbSoftwareReset(struct vnt_private *priv);
 void CARDvSetFirstNextTBTT(struct vnt_private *priv,
 			   unsigned short wBeaconInterval);
 void CARDvUpdateNextTBTT(struct vnt_private *priv, u64 qwTSF,
Signature · 1 line
2.24.1
#2 lore raw

Re: [Outreachy kernel] [PATCH 1/3] Staging: vt6655: Remove CARDbSoftwareReset definition.

Quoted 1 line · On Sat, 28 Mar 2020 18:23:40 -0700 Briana Oursler <[email protected]>…

Remove uncalled function CARDbSoftwareReset and comments related to it.

I'm not a native English speaker, so I'm not entirely sure about this:
would you really *call* a function "uncalled"?

To me, an "uncalled" function sounds like an undesired function. Which is true, but that's not, strictly speaking, the reason why you're removing it. You're removing it because it's not called. Not because it's uncalled.

Or... is it exactly the same?

Quoted 32 lines
---
 drivers/staging/vt6655/card.c | 20 --------------------
 drivers/staging/vt6655/card.h |  1 -
 2 files changed, 21 deletions(-)
drivers/staging/vt6655/card.c +0 -11
index e65c9825ea5a..135010d2c7d3 100644
@@ -12,7 +12,6 @@
  *      CARDbAddBasicRate - Add to BasicRateSet
  *      CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet
  *      CARDvSetLoopbackMode - Set Loopback mode
- *      CARDbSoftwareReset - Sortware reset NIC
  *      CARDqGetTSFOffset - Calculate TSFOffset
  *      CARDbGetCurrentTSF - Read Current NIC TSF counter
  *      CARDqGetNextTBTT - Calculate Next Beacon TSF counter
@@ -843,25 +842,6 @@ void CARDvSetLoopbackMode(struct vnt_private *priv,
 	/* set Baseband loopback */
 }
 
-/*
- * Description: Software Reset NIC
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be reset
- *  Out:
- *      none
- *
- * Return Value: none

drivers/staging/vt6655/card.c void CARDvSetLoopbackMode(struct vnt_private *priv, · line 845

Quoted 10 lines
drivers/staging/vt6655/card.c +0 -9
- */
-bool CARDbSoftwareReset(struct vnt_private *priv)
-{
-	/* reset MAC */
-	if (!MACbSafeSoftwareReset(priv))
-		return false;
-
-	return true;
-}
 

This newline should be removed for consistency. I mean, either this one, or the one after CARDvSetLoopbackMode() -- nobody will be able to tell which one you chose. :)

Quoted 2 lines
drivers/staging/vt6655/card.c +0 -0
 /*
  * Description: Calculate TSF offset of two TSF input
Signature · 1 line
Stefano
#3 lore raw

Re: [Outreachy kernel] [PATCH 1/3] Staging: vt6655: Remove CARDbSoftwareReset definition.

Quoted 8 lines · Stefano Brivio
Quoted 1 line · On Sat, 28 Mar 2020 18:23:40 -0700 Briana Oursler <[email protected]>…

Remove uncalled function CARDbSoftwareReset and comments related to it.

I'm not a native English speaker, so I'm not entirely sure about this:
would you really *call* a function "uncalled"?

Quoted 6 lines

To me, an "uncalled" function sounds like an undesired function. Which is true, but that's not, strictly speaking, the reason why you're removing it. You're removing it because it's not called. Not because it's uncalled.

Or... is it exactly the same?

Actually, it seems minimally ok to me. But "Remove the function XXX that is never called" would indeed be more clear.

julia

Quoted 59 lines
Quoted 33 lines
---
 drivers/staging/vt6655/card.c | 20 --------------------
 drivers/staging/vt6655/card.h |  1 -
 2 files changed, 21 deletions(-)
drivers/staging/vt6655/card.c +0 -11
index e65c9825ea5a..135010d2c7d3 100644
@@ -12,7 +12,6 @@
  *      CARDbAddBasicRate - Add to BasicRateSet
  *      CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet
  *      CARDvSetLoopbackMode - Set Loopback mode
- *      CARDbSoftwareReset - Sortware reset NIC
  *      CARDqGetTSFOffset - Calculate TSFOffset
  *      CARDbGetCurrentTSF - Read Current NIC TSF counter
  *      CARDqGetNextTBTT - Calculate Next Beacon TSF counter
@@ -843,25 +842,6 @@ void CARDvSetLoopbackMode(struct vnt_private *priv,
 	/* set Baseband loopback */
 }
 
-/*
- * Description: Software Reset NIC
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be reset
- *  Out:
- *      none
- *
- * Return Value: none

drivers/staging/vt6655/card.c void CARDvSetLoopbackMode(struct vnt_private *priv, · line 845

Quoted 10 lines
drivers/staging/vt6655/card.c +0 -9
- */
-bool CARDbSoftwareReset(struct vnt_private *priv)
-{
-	/* reset MAC */
-	if (!MACbSafeSoftwareReset(priv))
-		return false;
-
-	return true;
-}
 

This newline should be removed for consistency. I mean, either this one, or the one after CARDvSetLoopbackMode() -- nobody will be able to tell which one you chose. :)

drivers/staging/vt6655/card.c void CARDvSetLoopbackMode(struct vnt_private *priv, · line 847

Quoted 2 lines
drivers/staging/vt6655/card.c +0 -0
 /*
  * Description: Calculate TSF offset of two TSF input

--
Stefano

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200330164514.7f0c2272%40elisabeth.

#4 lore raw

Re: [Outreachy kernel] [PATCH 1/3] Staging: vt6655: Remove CARDbSoftwareReset definition.

Quoted 20 lines · Julia Lawall
Quoted 17 lines · Stefano Brivio
Quoted 2 lines · On Sat, 28 Mar 2020 18:23:40 -0700 Briana Oursler <[email protected]>…

Remove uncalled function CARDbSoftwareReset and comments related to it.

I'm not a native English speaker, so I'm not entirely sure about this:
would you really *call* a function "uncalled"?

To me, an "uncalled" function sounds like an undesired function. Which
is true, but that's not, strictly speaking, the reason why you're removing it. You're removing it because it's not called. Not because
it's uncalled.

Quoted 8 lines
Quoted 1 line

Or... is it exactly the same?

Actually, it seems minimally ok to me. But "Remove the function XXX that
is never called" would indeed be more clear.

julia

Okay, that makes sense, I will go ahead and make the change. I'll update the phrase as it appears throughout the series shortly. Thanks, Julia, clear commit descriptions are definitely tough for me at this stage.

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
---
 drivers/staging/vt6655/card.c | 20 --------------------
 drivers/staging/vt6655/card.h |  1 -
 2 files changed, 21 deletions(-)
drivers/staging/vt6655/card.c +0 -0
index e65c9825ea5a..135010d2c7d3 100644
@@ -12,7 +12,6 @@
  *      CARDbAddBasicRate - Add to BasicRateSet
  *      CARDbIsOFDMinBasicRate - Check if any OFDM rate is in

BasicRateSet

  *      CARDvSetLoopbackMode - Set Loopback mode
- *      CARDbSoftwareReset - Sortware reset NIC
  *      CARDqGetTSFOffset - Calculate TSFOffset
  *      CARDbGetCurrentTSF - Read Current NIC TSF counter
  *      CARDqGetNextTBTT - Calculate Next Beacon TSF counter
drivers/staging/vt6655/card.c +0 -17
@@ -843,25 +842,6 @@ void CARDvSetLoopbackMode(struct vnt_private
 *priv,
 	/* set Baseband loopback */
 }
 
-/*
- * Description: Software Reset NIC
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be reset
- *  Out:
- *      none
- *
- * Return Value: none
- */
-bool CARDbSoftwareReset(struct vnt_private *priv)
-{
-	/* reset MAC */
-	if (!MACbSafeSoftwareReset(priv))
-		return false;
-
Quoted 8 lines
Quoted 8 lines

drivers/staging/vt6655/card.c void CARDvSetLoopbackMode(struct vnt_private *priv, · line 845

Quoted 3 lines
drivers/staging/vt6655/card.c +0 -2
-	return true;
-}
 

This newline should be removed for consistency. I mean, either this one, or the one after CARDvSetLoopbackMode() -- nobody will be able to tell which one you chose. :)

Will do!

Thanks for reviewing,

Briana

Quoted 15 lines
Quoted 15 lines
Quoted 2 lines
drivers/staging/vt6655/card.c +0 -0
 /*

* Description: Calculate TSF offset of two TSF input

--
Stefano

--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20200330164514.7f0c2272%40elisabeth
.

#5 lore raw

PATCH 2/3 Staging: vt6655: Remove CARDvSetLoopbackMode definition.

In reply to Briana Oursler

Remove uncalled function CARDvSetLoopbackMode and comments related to it.

---
 drivers/staging/vt6655/card.c | 30 ------------------------------
 drivers/staging/vt6655/card.h |  2 --
 2 files changed, 32 deletions(-)
drivers/staging/vt6655/card.c +0 -30
index 135010d2c7d3..222b6ef61d9c 100644
@@ -11,7 +11,6 @@
  *      CARDvUpdateBasicTopRate - Update BasicTopRate
  *      CARDbAddBasicRate - Add to BasicRateSet
  *      CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet
- *      CARDvSetLoopbackMode - Set Loopback mode
  *      CARDqGetTSFOffset - Calculate TSFOffset
  *      CARDbGetCurrentTSF - Read Current NIC TSF counter
  *      CARDqGetNextTBTT - Calculate Next Beacon TSF counter
@@ -814,35 +813,6 @@ unsigned char CARDbyGetPktType(struct vnt_private *priv)
 		return PK_TYPE_11GB;
 }
 
-/*
- * Description: Set NIC Loopback mode
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be set
- *      wLoopbackMode   - Loopback mode to be set
- *  Out:
- *      none
- *
- * Return Value: none
- */
-void CARDvSetLoopbackMode(struct vnt_private *priv,
-			  unsigned short wLoopbackMode)
-{
-	switch (wLoopbackMode) {
-	case CARD_LB_NONE:
-	case CARD_LB_MAC:
-	case CARD_LB_PHY:
-		break;
-	default:
-		break;
-	}
-	/* set MAC loopback */
-	MACvSetLoopbackMode(priv, LOBYTE(wLoopbackMode));
-	/* set Baseband loopback */
-}
-
-
 /*
  * Description: Calculate TSF offset of two TSF input
  *              Get TSF Offset from RxBCN's TSF and local TSF
drivers/staging/vt6655/card.h +0 -2
index a811ac8942a0..32405027e269 100644
@@ -44,8 +44,6 @@ struct vnt_private;
 void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type);
 void CARDvUpdateBasicTopRate(struct vnt_private *priv);
 bool CARDbIsOFDMinBasicRate(struct vnt_private *priv);
-void CARDvSetLoopbackMode(struct vnt_private *priv,
-			  unsigned short wLoopbackMode);
 void CARDvSetFirstNextTBTT(struct vnt_private *priv,
 			   unsigned short wBeaconInterval);
 void CARDvUpdateNextTBTT(struct vnt_private *priv, u64 qwTSF,
Signature · 1 line
2.24.1
#6 lore raw

PATCH 3/3 Staging: vt6655: Remove CARDbRadioPowerOn definition.

In reply to Briana Oursler

Remove uncalled function comments related to it.

---
 drivers/staging/vt6655/card.c | 55 -----------------------------------
 drivers/staging/vt6655/card.h |  1 -
 2 files changed, 56 deletions(-)
drivers/staging/vt6655/card.c +0 -55
index 222b6ef61d9c..67b23ab0b0d1 100644
@@ -17,7 +17,6 @@
  *      CARDvSetFirstNextTBTT - Set NIC Beacon time
  *      CARDvUpdateNextTBTT - Sync. NIC Beacon time
  *      CARDbRadioPowerOff - Turn Off NIC Radio Power
- *      CARDbRadioPowerOn - Turn On NIC Radio Power
  *
  * Revision History:
  *      06-10-2003 Bryan YC Fan:  Re-write codes to support VT3253 spec.
@@ -437,60 +436,6 @@ void CARDbRadioPowerOff(struct vnt_private *priv)
 		      LED_ACTSET);  /* LED issue */
 }
 
-/*
- * Description: Turn on Radio power
- *
- * Parameters:
- *  In:
- *      priv         - The adapter to be turned on
- *  Out:
- *      none
- *
- * Return Value: true if success; otherwise false
- */
-bool CARDbRadioPowerOn(struct vnt_private *priv)
-{
-	bool bResult = true;
-
-	pr_debug("chester power on\n");
-	if (priv->bRadioControlOff) {
-		if (priv->bHWRadioOff)
-			pr_debug("chester bHWRadioOff\n");
-		if (priv->bRadioControlOff)
-			pr_debug("chester bRadioControlOff\n");
-		return false; }
-
-	if (!priv->bRadioOff) {
-		pr_debug("chester pbRadioOff\n");
-		return true; }
-
-	BBvExitDeepSleep(priv, priv->byLocalID);
-
-	MACvRegBitsOn(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
-
-	switch (priv->byRFType) {
-	case RF_RFMD2959:
-		MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				  SOFTPWRCTL_TXPEINV);
-		MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				   SOFTPWRCTL_SWPE1);
-		break;
-
-	case RF_AIROHA:
-	case RF_AL2230S:
-	case RF_AIROHA7230:
-		MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL,
-				  (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
-		break;
-	}
-
-	priv->bRadioOff = false;
-	pr_debug("chester power on\n");
-	MACvRegBitsOff(priv->PortOffset, MAC_REG_GPIOCTL0,
-		       LED_ACTSET); /* LED issue */
-	return bResult;
-}
-
 void CARDvSafeResetTx(struct vnt_private *priv)
 {
 	unsigned int uu;
drivers/staging/vt6655/card.h +0 -1
index 32405027e269..568a2ddd6588 100644
@@ -55,7 +55,6 @@ unsigned char CARDbyGetPktType(struct vnt_private *priv);
 void CARDvSafeResetTx(struct vnt_private *priv);
 void CARDvSafeResetRx(struct vnt_private *priv);
 void CARDbRadioPowerOff(struct vnt_private *priv);
-bool CARDbRadioPowerOn(struct vnt_private *priv);
 bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type);
 bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
 		    u64 qwBSSTimestamp);
Signature · 1 line
2.24.1
#7 lore raw
In reply to Briana Oursler
Quoted 7 lines · On Sat, 28 Mar 2020 18:23:39 -0700 Briana Oursler <[email protected]>…

This patchset removes functions that are not called in the driver but are prototyped in card.h. Each commit limits its scope to one function definition and related documentation in code. References in the developer's initial changelog were left in place.

Functions were checked for calls using the Elixir Cross Referencer and git grep.

As you're removing dead code that is actually compiled, you are also shrinking the binary size down, and that's typically reported for this kind of changes. You can show this in the cover letter, or also at each patch if the size change is significant.

I'm not sure what's the "best" way to show that, two commands that are often used are 'size' and scripts/bloat-o-meter. For this series:

$ scripts/bloat-o-meter -t drivers/staging/vt6655/vt6655_stage.o drivers/staging/vt6655.changed/vt6655_stage.o
add/remove: 0/3 grow/shrink: 0/0 up/down: 0/-310 (-310)
Function                                     old     new   delta
CARDbSoftwareReset                             5       -      -5
CARDvSetLoopbackMode                           9       -      -9
CARDbRadioPowerOn                            296       -    -296
Total: Before=33438, After=33128, chg -0.93%
$ size -G drivers/staging/vt6655{,.changed}/vt6655_stage.o
      text       data        bss      total filename
     34359      24382          0      58741 drivers/staging/vt6655/vt6655_stage.o
     34023      24242          0      58265 drivers/staging/vt6655.changed/vt6655_stage.o
Signature · 1 line
Stefano