staging: vt6656: Use BIT() macro instead of hex value
PATCH 1/1 staging: vt6656: Use BIT() macro instead of hex value
Use the BIT() macro instead of the hexadecimal value to define the different bits in registers.
--- drivers/staging/vt6656/desc.h | 35 ++--- drivers/staging/vt6656/device.h | 9 +- drivers/staging/vt6656/mac.h | 263 ++++++++++++++++---------------- 3 files changed, 155 insertions(+), 152 deletions(-)
drivers/staging/vt6656/desc.h +18 -17
@@ -18,6 +18,7 @@#ifndef __DESC_H__#define __DESC_H__ +#include <linux/bits.h> #include <linux/types.h> #include <linux/mm.h>
@@ -36,32 +37,32 @@/* * bits in the RSR register */ -#define RSR_ADDRBROAD 0x80 -#define RSR_ADDRMULTI 0x40 +#define RSR_ADDRBROAD BIT(7) +#define RSR_ADDRMULTI BIT(6)#define RSR_ADDRUNI 0x00 -#define RSR_IVLDTYP 0x20/* invalid packet type */ -#define RSR_IVLDLEN 0x10/* invalid len (> 2312 byte) */ -#define RSR_BSSIDOK 0x08 -#define RSR_CRCOK 0x04 -#define RSR_BCNSSIDOK 0x02 -#define RSR_ADDROK 0x01 +#define RSR_IVLDTYP BIT(5)/* invalid packet type */ +#define RSR_IVLDLEN BIT(4)/* invalid len (> 2312 byte) */ +#define RSR_BSSIDOK BIT(3) +#define RSR_CRCOK BIT(2) +#define RSR_BCNSSIDOK BIT(1) +#define RSR_ADDROK BIT(0)/* * bits in the new RSR register */ -#define NEWRSR_DECRYPTOK 0x10 -#define NEWRSR_CFPIND 0x08 -#define NEWRSR_HWUTSF 0x04 -#define NEWRSR_BCNHITAID 0x02 -#define NEWRSR_BCNHITAID0 0x01 +#define NEWRSR_DECRYPTOK BIT(4) +#define NEWRSR_CFPIND BIT(3) +#define NEWRSR_HWUTSF BIT(2) +#define NEWRSR_BCNHITAID BIT(1) +#define NEWRSR_BCNHITAID0 BIT(0)/* * bits in the TSR register */ -#define TSR_RETRYTMO 0x08 -#define TSR_TMO 0x04 -#define TSR_ACKDATA 0x02 -#define TSR_VALID 0x01 +#define TSR_RETRYTMO BIT(3) +#define TSR_TMO BIT(2) +#define TSR_ACKDATA BIT(1) +#define TSR_VALID BIT(0)#define FIFOCTL_AUTO_FB_1 0x1000#define FIFOCTL_AUTO_FB_0 0x0800
drivers/staging/vt6656/device.h +5 -4
@@ -16,6 +16,7 @@#ifndef __DEVICE_H__#define __DEVICE_H__ +#include <linux/bits.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -129,12 +130,12 @@#define EEP_OFS_OFDMA_PWR_TBL 0x50/* Bits in EEP_OFS_ANTENNA */ -#define EEP_ANTENNA_MAIN 0x1 -#define EEP_ANTENNA_AUX 0x2 -#define EEP_ANTINV 0x4 +#define EEP_ANTENNA_MAIN BIT(0) +#define EEP_ANTENNA_AUX BIT(1) +#define EEP_ANTINV BIT(2)/* Bits in EEP_OFS_RADIOCTL */ -#define EEP_RADIOCTL_ENABLE 0x80 +#define EEP_RADIOCTL_ENABLE BIT(7)/* control commands */ #define MESSAGE_TYPE_READ 0x1
drivers/staging/vt6656/mac.h +132 -131
332 lines not on this page · raw message
--
2.20.1
Quoted 7 lines · Oscar Carter
drivers/staging/vt6656/desc.h +2
-4-#define RSR_ADDRBROAD 0x80 -#define RSR_ADDRMULTI 0x40 +#define RSR_ADDRBROAD BIT(7) +#define RSR_ADDRMULTI BIT(6)#define RSR_ADDRUNI 0x00 -#define RSR_IVLDTYP 0x20/* invalid packet type */ -#define RSR_IVLDLEN 0x10/* invalid len (> 2312 byte) */
drivers/staging/vt6656/desc.h line 48
Quoted 10 lines
drivers/staging/vt6656/desc.h +6
-4-#define RSR_BSSIDOK 0x08 -#define RSR_CRCOK 0x04 -#define RSR_BCNSSIDOK 0x02 -#define RSR_ADDROK 0x01 +#define RSR_IVLDTYP BIT(5)/* invalid packet type */ +#define RSR_IVLDLEN BIT(4)/* invalid len (> 2312 byte) */ +#define RSR_BSSIDOK BIT(3) +#define RSR_CRCOK BIT(2) +#define RSR_BCNSSIDOK BIT(1) +#define RSR_ADDROK BIT(0)
I like these ones because I do think the new version is more clear now.
drivers/staging/vt6656/mac.h line 181
Quoted 10 lines
/* Bits in the
EnhanceCFG_0register */
#defineEnCFG_BBType_a0x00drivers/staging/vt6656/mac.h +4
-4-#define EnCFG_BBType_b 0x01 -#define EnCFG_BBType_g 0x02 -#define EnCFG_BBType_MASK 0x03 -#define EnCFG_ProtectMd 0x20 +#define EnCFG_BBType_b BIT(0) +#define EnCFG_BBType_g BIT(1) +#define EnCFG_BBType_MASK (BIT(0) | BIT(1)) +#define EnCFG_ProtectMd BIT(5)
Probably EnCFG_BBType_MASK should be defined using the other defines.
#define EnCFG_BBType_MASK (EnCFG_BBType_b | EnCFG_BBType_g)
Otherwise it looks good. Can you change that one thing and then add my Reviewed-by: Dan Carpenter <[email protected]>
regards,
dan carpenter
Quoted 35 lines · Dan Carpenter
Quoted 7 lines · Oscar Carter
drivers/staging/vt6656/desc.h +2
-4-#define RSR_ADDRBROAD 0x80 -#define RSR_ADDRMULTI 0x40 +#define RSR_ADDRBROAD BIT(7) +#define RSR_ADDRMULTI BIT(6)#define RSR_ADDRUNI 0x00 -#define RSR_IVLDTYP 0x20/* invalid packet type */ -#define RSR_IVLDLEN 0x10/* invalid len (> 2312 byte) */ drivers/staging/vt6656/desc.h line 48
Quoted 10 lines
drivers/staging/vt6656/desc.h +6
-4-#define RSR_BSSIDOK 0x08 -#define RSR_CRCOK 0x04 -#define RSR_BCNSSIDOK 0x02 -#define RSR_ADDROK 0x01 +#define RSR_IVLDTYP BIT(5)/* invalid packet type */ +#define RSR_IVLDLEN BIT(4)/* invalid len (> 2312 byte) */ +#define RSR_BSSIDOK BIT(3) +#define RSR_CRCOK BIT(2) +#define RSR_BCNSSIDOK BIT(1) +#define RSR_ADDROK BIT(0)I like these ones because I do think the new version is more clear now.
drivers/staging/vt6656/mac.h line 181
Quoted 10 lines
/* Bits in the
EnhanceCFG_0register */
#defineEnCFG_BBType_a0x00drivers/staging/vt6656/mac.h +4
-4-#define EnCFG_BBType_b 0x01 -#define EnCFG_BBType_g 0x02 -#define EnCFG_BBType_MASK 0x03 -#define EnCFG_ProtectMd 0x20 +#define EnCFG_BBType_b BIT(0) +#define EnCFG_BBType_g BIT(1) +#define EnCFG_BBType_MASK (BIT(0) | BIT(1)) +#define EnCFG_ProtectMd BIT(5)Probably
EnCFG_BBType_MASKshould be defined using the other defines.
Quoted 5 lines
#define
EnCFG_BBType_MASK(EnCFG_BBType_b|EnCFG_BBType_g)Otherwise it looks good. Can you change that one thing and then add my Reviewed-by: Dan Carpenter <[email protected]>
Ok, i will make this change and i will send and incremental patch with the "Fixes:" tag due to the this patch has already been added to the staging-next branch of the greg staging tree.
Quoted 3 lines
regards,
dan carpenter
thanks,
oscar carter