Skip to contentSkip to conversation

staging: vt6656: Cleanup of the vnt_get_frame_time function

PATCH Superseded Oscar Carter 1 participant 4 messages Apr 7, 2020 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover staging: vt6656: Cleanup of the vnt_get_frame_time function

This patch series makes a cleanup of the vnt_get_frame_time function.

The first patch makes use of the define RATE_11M instead of a magic number. The second patch remove unnecessary local variable initialization.

Changelog v1 -> v2
- Not use the ARRAY_SIZE macro to compare against the tx_rate variable.

Oscar Carter (2):
staging: vt6656: Use define instead of magic number for tx_rate
staging: vt6656: Remove unnecessary local variable initialization

 drivers/staging/vt6656/baseband.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.20.1

#1 lore raw

PATCH v2 1/2 staging: vt6656: Use define instead of magic number for tx_rate

Use the define RATE_11M present in the file "device.h" instead of the magic number 3. So the code is more clear.

---
 drivers/staging/vt6656/baseband.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/vt6656/baseband.c +2 -1
index a19a563d8bcc..092e56668a09 100644
@@ -24,6 +24,7 @@
 
 #include <linux/bits.h>
 #include <linux/kernel.h>
+#include "device.h"
 #include "mac.h"
 #include "baseband.h"
 #include "rf.h"
@@ -141,7 +142,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
 
 	rate = (unsigned int)vnt_frame_time[tx_rate];
 
-	if (tx_rate <= 3) {
+	if (tx_rate <= RATE_11M) {
 		if (preamble_type == 1)
 			preamble = 96;
 		else

--
2.20.1

#2 lore raw

PATCH v2 2/2 staging: vt6656: Remove unnecessary local variable initialization

In reply to Oscar Carter

Don't initialize the rate variable as it is set a few lines later.

---
 drivers/staging/vt6656/baseband.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/baseband.c +1 -1
index 092e56668a09..5d9bc97916a5 100644
@@ -135,7 +135,7 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
 {
 	unsigned int frame_time;
 	unsigned int preamble;
-	unsigned int rate = 0;
+	unsigned int rate;
 
 	if (tx_rate > RATE_54M)
 		return 0;

--
2.20.1

#3 lore raw
In reply to Oscar Carter
Quoted 12 lines · Oscar Carter

This patch series makes a cleanup of the vnt_get_frame_time function.

The first patch makes use of the define RATE_11M instead of a magic number. The second patch remove unnecessary local variable initialization.

Changelog v1 -> v2
- Not use the ARRAY_SIZE macro to compare against the tx_rate variable.

Oscar Carter (2):
staging: vt6656: Use define instead of magic number for tx_rate
staging: vt6656: Remove unnecessary local variable initialization

Quoted 6 lines
 drivers/staging/vt6656/baseband.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.20.1

Don't review this patch series as I have sent a new version. Sorry.

Thanks
Oscar Carter