Re: [PATCH 5/5] Staging: comedi: dmm32at: Prefer using the BIT macro

From: Ian Abbott
Date: Wed Jun 08 2016 - 05:54:41 EST


On 08/06/16 06:30, Ravishankar Karkala Mallikarjunayya wrote:
This fixes all occurences of (1<<x) by BIT(x) to get rid of checkpatch.pl
"CHECK" output "Prefer using the BIT macro"

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@xxxxxxxxx>
---
drivers/staging/comedi/drivers/dmm32at.c | 86 ++++++++++++++++----------------
1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 958c0d4..4ca6104 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c

Most of these are fine, but...

[snip]
#define DMM32AT_CTRL_PAGE_8254 (0 << 0)
-#define DMM32AT_CTRL_PAGE_8255 (1 << 0)
+#define DMM32AT_CTRL_PAGE_8255 BIT(0)
#define DMM32AT_CTRL_PAGE_CALIB (3 << 0)

That one makes the code less readable as the above three macros are for the same bitfield, and should have similar-looking macro expansions.

[snip]
#define DMM32AT_AI_CFG_SCINT_20US (0 << 4)
-#define DMM32AT_AI_CFG_SCINT_15US (1 << 4)
+#define DMM32AT_AI_CFG_SCINT_15US BIT(4)
#define DMM32AT_AI_CFG_SCINT_10US (2 << 4)
#define DMM32AT_AI_CFG_SCINT_5US (3 << 4)

The same thing here.

[snip]

--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@xxxxxxxxx> )=-
-=( Web: http://www.mev.co.uk/ )=-