staging: vt6655: Fix name and return value of CARDbGetCurrentTSF
cover staging: vt6655: Fix name and return value of CARDbGetCurrentTSF
Fix name of the function that uses CamelCase which is not accepted by checkpatch.pl
Replace unused return value.
Tested with vt6655 on mini PCI Module Transferred this patch over wlan connection of vt6655
Philipp Hortmann (2):
staging: vt6655: Rename function CARDbGetCurrentTSF
staging: vt6655: Replace unused return value of card_get_current_tsf
drivers/staging/vt6655/card.c | 22 ++++++++++------------ drivers/staging/vt6655/card.h | 2 +- drivers/staging/vt6655/device_main.c | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 staging: vt6655: Rename function CARDbGetCurrentTSF
The name of the function uses CamelCase which
is not accepted by checkpatch.pl
--- drivers/staging/vt6655/card.c | 10 +++++----- drivers/staging/vt6655/card.h | 2 +- drivers/staging/vt6655/device_main.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/vt6655/card.c +5 -5
@@ -11,7 +11,7 @@* CARDbAddBasicRate - Add to BasicRateSet * CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet * CARDqGetTSFOffset - Calculate TSFOffset -* CARDbGetCurrentTSF - Read Current NIC TSF counter +* card_get_current_tsf - Read Current NIC TSF counter * CARDqGetNextTBTT - Calculate Next Beacon TSF counter * CARDvSetFirstNextTBTT - Set NIC Beacon time * CARDvUpdateNextTBTT - Sync. NIC Beacon time
@@ -288,7 +288,7 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,u64 local_tsf;u64 qwTSFOffset =0 ; -CARDbGetCurrentTSF (priv, &local_tsf); +card_get_current_tsf (priv, &local_tsf);if (qwBSSTimestamp != local_tsf) { qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,
@@ -322,7 +322,7 @@ bool CARDbSetBeaconPeriod(struct vnt_private *priv, {u64 qwNextTBTT =0 ; -CARDbGetCurrentTSF (priv, &qwNextTBTT);/* Get Local TSF counter */ +card_get_current_tsf (priv, &qwNextTBTT);/* Get Local TSF counter */ qwNextTBTT =CARDqGetNextTBTT (qwNextTBTT, wBeaconInterval);
@@ -739,7 +739,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)* * Return Value: true if success; otherwise false */ -bool CARDbGetCurrentTSF (struct vnt_private *priv,u64 *pqwCurrTSF) +bool card_get_current_tsf (struct vnt_private *priv,u64 *pqwCurrTSF) {void __iomem *iobase = priv->port_offset;unsigned short ww;
@@ -811,7 +811,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv,void __iomem *iobase = priv->port_offset;u64 qwNextTBTT =0 ; -CARDbGetCurrentTSF (priv, &qwNextTBTT);/* Get Local TSF counter */ +card_get_current_tsf (priv, &qwNextTBTT);/* Get Local TSF counter */ qwNextTBTT =CARDqGetNextTBTT (qwNextTBTT, wBeaconInterval);/* Set NextTBTT */
drivers/staging/vt6655/card.h +1 -1
@@ -46,7 +46,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInterval);void CARDvUpdateNextTBTT (struct vnt_private *priv,u64 qwTSF,unsigned short wBeaconInterval); -bool CARDbGetCurrentTSF (struct vnt_private *priv,u64 *pqwCurrTSF); +bool card_get_current_tsf (struct vnt_private *priv,u64 *pqwCurrTSF);u64 CARDqGetNextTBTT (u64 qwTSF,unsigned short wBeaconInterval);u64 CARDqGetTSFOffset (unsigned char byRxRate,u64 qwTSF1,u64 qwTSF2);unsigned char CARDbyGetPktType (struct vnt_private *priv);
drivers/staging/vt6655/device_main.c +1 -1
@@ -1603,7 +1603,7 @@ static u64 vnt_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)struct vnt_private *priv = hw->priv;u64 tsf; -CARDbGetCurrentTSF (priv, &tsf); +card_get_current_tsf (priv, &tsf);return tsf; }
Signature · 1 line
2.25.1
PATCH 2/2 staging: vt6655: Replace unused return value of card_get_current_tsf
In reply to Philipp HortmannReplace unused return value with u64 to increase readability, reduce address and dereference operators and omit pqwCurrTSF that uses CamelCase which is not accepted by checkpatch.pl
---
Diffs for testing:
u64 qwNextTBTT;
qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */
+ dev_info(&priv->pcid->dev, "CARDbSetBeaconPeriod 0x%016llx", qwNextTBTT);
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
/* set HW beacon interval */@@ -810,7 +810,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv,
u64 qwNextTBTT;
qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */
+ dev_info(&priv->pcid->dev, "CARDvSetFirstNextTBTT 0x%016llx", qwNextTBTT);
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
/* Set NextTBTT */
VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
Log:
vt6655 0000:01:05.0: CARDbSetBeaconPeriod 0x00 00 00 01 4a 89 52 c4
vt6655 0000:01:05.0: CARDvSetFirstNextTBTT 0x00 00 00 01 4a 89 52 dc
---
drivers/staging/vt6655/card.c | 20 +++++++++-----------
drivers/staging/vt6655/card.h | 2 +-
drivers/staging/vt6655/device_main.c | 2 +-
3 files changed, 11 insertions(+), 13 deletions(-)drivers/staging/vt6655/card.c +9 -11
@@ -288,7 +288,7 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,u64 local_tsf;u64 qwTSFOffset =0 ; -card_get_current_tsf (priv, &local_tsf); + local_tsf =card_get_current_tsf (priv);if (qwBSSTimestamp != local_tsf) { qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,
@@ -320,9 +320,9 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,bool CARDbSetBeaconPeriod (struct vnt_private *priv,unsigned short wBeaconInterval) { -u64 qwNextTBTT =0 ; +u64 qwNextTBTT; -card_get_current_tsf (priv, &qwNextTBTT);/* Get Local TSF counter */ + qwNextTBTT =card_get_current_tsf (priv);/* Get Local TSF counter */ qwNextTBTT =CARDqGetNextTBTT (qwNextTBTT, wBeaconInterval);
@@ -739,7 +739,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)* * Return Value: true if success; otherwise false */ -bool card_get_current_tsf (struct vnt_private *priv,u64 *pqwCurrTSF) +u64 card_get_current_tsf (struct vnt_private *priv) {void __iomem *iobase = priv->port_offset;unsigned short ww;
@@ -753,16 +753,14 @@ bool card_get_current_tsf(struct vnt_private *priv, u64 *pqwCurrTSF)break ; }if (ww ==W_MAX_TIMEOUT ) -return false; +return 0 ; low =ioread32 (iobase +MAC_REG_TSFCNTR ); high =ioread32 (iobase +MAC_REG_TSFCNTR +4 );#ifdef __BIG_ENDIAN - *pqwCurrTSF = high + ((u64 )low <<32 ); +return high + ((u64 )low <<32 );#else - *pqwCurrTSF = low + ((u64 )high <<32 ); +return low + ((u64 )high <<32 );#endif - -return true; }/*
@@ -809,9 +807,9 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInterval) {void __iomem *iobase = priv->port_offset; -u64 qwNextTBTT =0 ; +u64 qwNextTBTT; -card_get_current_tsf (priv, &qwNextTBTT);/* Get Local TSF counter */ + qwNextTBTT =card_get_current_tsf (priv);/* Get Local TSF counter */ qwNextTBTT =CARDqGetNextTBTT (qwNextTBTT, wBeaconInterval);/* Set NextTBTT */
drivers/staging/vt6655/card.h +1 -1
@@ -46,7 +46,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInterval);void CARDvUpdateNextTBTT (struct vnt_private *priv,u64 qwTSF,unsigned short wBeaconInterval); -bool card_get_current_tsf (struct vnt_private *priv,u64 *pqwCurrTSF); +u64 card_get_current_tsf (struct vnt_private *priv);u64 CARDqGetNextTBTT (u64 qwTSF,unsigned short wBeaconInterval);u64 CARDqGetTSFOffset (unsigned char byRxRate,u64 qwTSF1,u64 qwTSF2);unsigned char CARDbyGetPktType (struct vnt_private *priv);
drivers/staging/vt6655/device_main.c +1 -1
@@ -1603,7 +1603,7 @@ static u64 vnt_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)struct vnt_private *priv = hw->priv;u64 tsf; -card_get_current_tsf (priv, &tsf); + tsf =card_get_current_tsf (priv);return tsf; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] staging: vt6655: Rename function CARDbGetCurrentTSF
In reply to Philipp HortmannQuoted 24 lines · Philipp Hortmann
The name of the function uses CamelCase which
is not accepted by checkpatch.plSigned-off-by Philipp Hortmann <[email protected]>--- drivers/staging/vt6655/card.c | 10 +++++----- drivers/staging/vt6655/card.h | 2 +- drivers/staging/vt6655/device_main.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)drivers/staging/vt6655/card.c +1
-1@@ -11,7 +11,7 @@* CARDbAddBasicRate - Add to BasicRateSet * CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet * CARDqGetTSFOffset - Calculate TSFOffset -* CARDbGetCurrentTSF - Read Current NIC TSF counter +* card_get_current_tsf - Read Current NIC TSF counter * CARDqGetNextTBTT - Calculate Next Beacon TSF counter * CARDvSetFirstNextTBTT - Set NIC Beacon time * CARDvUpdateNextTBTT - Sync. NIC Beacon time
drivers/staging/vt6655/card.c bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate, · line 291
Quoted 5 lines
drivers/staging/vt6655/card.c +1
-1@@ -288,7 +288,7 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,u64 local_tsf;u64 qwTSFOffset =0 ; -CARDbGetCurrentTSF (priv, &local_tsf); +card_get_current_tsf (priv, &local_tsf);
Why is the value being passed as a reference and the error value (if any), is not checked at all?
Shouldn't this just return the value as it obviously must always work? (retorical question, something is wrong here...)
And this is a horrible global function name, can you prefix it with the driver name to give us a chance to keep the global namespace sane? vt6655_get_current_tsf() would be better.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] staging: vt6655: Replace unused return value of card_get_current_tsf
In reply to Philipp HortmannQuoted 11 lines · Philipp Hortmann
Replace unused return value with u64 to increase readability, reduce address and dereference operators and omit pqwCurrTSF that uses CamelCase which is not accepted by checkpatch.pl
Signed-off-by Philipp Hortmann <[email protected]>---
Diffs for testing:
u64 qwNextTBTT;qwNextTBTT =
card_get_current_tsf(priv); /* Get Local TSF counter */
+dev_info(&priv->pcid->dev, "CARDbSetBeaconPeriod 0x%016llx", qwNextTBTT);
Don't put a diff in a diff please, git _should_ handle it, but I know other tools that will choke on it.
Quoted 25 lines
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); /* set HW beacon interval */(quoted diff) +1
-0@@ -810,7 +810,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, u64 qwNextTBTT; qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */ + dev_info(&priv->pcid->dev, "CARDvSetFirstNextTBTT 0x%016llx", qwNextTBTT); qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); /* Set NextTBTT */ VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);Log:
vt6655 0000:01:05.0: CARDbSetBeaconPeriod0x0000 00 01 4a 89 52 c4 vt6655 0000:01:05.0: CARDvSetFirstNextTBTT0x0000 00 01 4a 89 52 dc--- drivers/staging/vt6655/card.c | 20 +++++++++----------- drivers/staging/vt6655/card.h | 2 +- drivers/staging/vt6655/device_main.c | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-)drivers/staging/vt6655/card.c +0
-0
drivers/staging/vt6655/card.c bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate, · line 291
Quoted 5 lines
drivers/staging/vt6655/card.c +1
-1@@ -288,7 +288,7 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,u64 local_tsf;u64 qwTSFOffset =0 ; -card_get_current_tsf (priv, &local_tsf); + local_tsf =card_get_current_tsf (priv);
{sigh} I should read all patches in the series before complaining about previous ones, sorry about that.
Looks much better, except for the function name.
Quoted 25 lines
drivers/staging/vt6655/card.c +3
-3if (qwBSSTimestamp != local_tsf) { qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,@@ -320,9 +320,9 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,bool CARDbSetBeaconPeriod (struct vnt_private *priv,unsigned short wBeaconInterval) { -u64 qwNextTBTT =0 ; +u64 qwNextTBTT; -card_get_current_tsf (priv, &qwNextTBTT);/* Get Local TSF counter */ + qwNextTBTT =card_get_current_tsf (priv);/* Get Local TSF counter */ qwNextTBTT =CARDqGetNextTBTT (qwNextTBTT, wBeaconInterval);@@ -739,7 +739,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)* * Return Value: true if success; otherwise false */ -bool card_get_current_tsf (struct vnt_private *priv,u64 *pqwCurrTSF) +u64 card_get_current_tsf (struct vnt_private *priv) {void __iomem *iobase = priv->port_offset;unsigned short ww;
drivers/staging/vt6655/card.c bool card_get_current_tsf(struct vnt_private *priv, u64 *pqwCurrTSF) · line 759
Quoted 8 lines
drivers/staging/vt6655/card.c +1
-1@@ -753,16 +753,14 @@ bool card_get_current_tsf(struct vnt_private *priv, u64 *pqwCurrTSF)break ; }if (ww ==W_MAX_TIMEOUT ) -return false; +return 0 ; low =ioread32 (iobase +MAC_REG_TSFCNTR ); high =ioread32 (iobase +MAC_REG_TSFCNTR +4 );#ifdef __BIG_ENDIAN
Note, this #ifdef really should never be in kernel code if you are doing things properly. There are functions to handle this correctly...
Things get "fun" when you have devices in one endian running on busses of other endian. Hopefully this driver never has to deal with that, but for many others we do, so please stick with the normal functions to handle this whenever possible.
thanks,
greg k-h