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

Ian Abbott abbotti at mev.co.uk
Wed Jun 8 09:54:25 UTC 2016


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 at gmail.com>
> ---
>   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 at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list