Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419249

Re: [PATCH 1/1] Staging: comedi: dmm32at: fix BIT macro issue.

From Ian Abbott <abbotti@mev.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] Staging: comedi: dmm32at: fix BIT macro issue.
Date 2016-06-10 12:40 +0200
Message-ID <rIs13-3pw-7@gated-at.bofh.it> (permalink)
References <rI6WB-6am-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/06/16 13:04, Ravishankar Karkala Mallikarjunayya wrote:
> This Replace all occurences of (1<<x) by BIT(x) and DMM32AT_CTRL(x),
> DMM32AT_AI_CFG(x) macros to get rid of checkpatch.pl
> "CHECK" output "Prefer using the BIT macro"
>
> Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
> ---
>   drivers/staging/comedi/drivers/dmm32at.c | 98 ++++++++++++++++----------------
>   1 file changed, 50 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
> index 958c0d4..0d50105 100644
> --- a/drivers/staging/comedi/drivers/dmm32at.c
> +++ b/drivers/staging/comedi/drivers/dmm32at.c
[snip]
> -#define DMM32AT_CTRL_RESETA		(1 << 5)
> -#define DMM32AT_CTRL_RESETD		(1 << 4)
> -#define DMM32AT_CTRL_INTRST		(1 << 3)
> -#define DMM32AT_CTRL_PAGE_8254		(0 << 0)
> -#define DMM32AT_CTRL_PAGE_8255		(1 << 0)
> -#define DMM32AT_CTRL_PAGE_CALIB		(3 << 0)
> +#define DMM32AT_CTRL_RESETA		BIT(5)
> +#define DMM32AT_CTRL_RESETD		BIT(4)
> +#define DMM32AT_CTRL_INTRST		BIT(3)
> +#define DMM32AT_CTRL(x)			((x) << 0)
> +#define DMM32AT_CTRL_PAGE_8254		DMM32AT_CTRL(0)
> +#define DMM32AT_CTRL_PAGE_8255		DMM32AT_CTRL(1)
> +#define DMM32AT_CTRL_PAGE_CALIB		DMM32AT_CTRL(3)

The macro name DMM32AT_CTRL(x) is not specific enough.  It should be 
DMM32AT_CTRL_PAGE(x) to match the names of the macros that use it 
(DMM32AT_CTRL_PAGE_8254 etc.).

[snip]
> -#define DMM32AT_AI_CFG_SCINT_20US	(0 << 4)
> -#define DMM32AT_AI_CFG_SCINT_15US	(1 << 4)
> -#define DMM32AT_AI_CFG_SCINT_10US	(2 << 4)
> -#define DMM32AT_AI_CFG_SCINT_5US	(3 << 4)
> -#define DMM32AT_AI_CFG_RANGE		(1 << 3)  /* 0=5V  1=10V */
> -#define DMM32AT_AI_CFG_ADBU		(1 << 2)  /* 0=bipolar  1=unipolar */
> +#define DMM32AT_AI_CFG(x)		((x) << 4)
> +#define DMM32AT_AI_CFG_SCINT_20US	DMM32AT_AI_CFG(0)
> +#define DMM32AT_AI_CFG_SCINT_15US	DMM32AT_AI_CFG(1)
> +#define DMM32AT_AI_CFG_SCINT_10US	DMM32AT_AI_CFG(2)
> +#define DMM32AT_AI_CFG_SCINT_5US	DMM32AT_AI_CFG(3)

The same thing here.  Please rename DMM32AT_AI_CFG(x) to 
DMM32AT_AI_CFG_SCINT(x).

(Don't forget to update the patch description to match these changes.)

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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] Staging: comedi: dmm32at: fix BIT macro issue. Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com> - 2016-06-09 14:10 +0200
  Re: [PATCH 1/1] Staging: comedi: dmm32at: fix BIT macro issue. Ian Abbott <abbotti@mev.co.uk> - 2016-06-10 12:40 +0200

csiph-web