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


Groups > linux.kernel > #1272906

Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
Date 2015-11-19 09:00 +0100
Message-ID <qwsim-6pI-3@gated-at.bofh.it> (permalink)
References <quMuS-6NX-9@gated-at.bofh.it> <qwdMm-5n6-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Nov 18, 2015 at 04:26:52PM +0000, Ian Abbott wrote:
> >+#define DMM32AT_AI_CFG_SCINT_10US	(BIT(5) & ~BIT(4))
> >+#define DMM32AT_AI_CFG_SCINT_5US	(BIT(5) | BIT(4))
> 
> The values of DMM32AT_AI_CFG_SCINT_20US etc. are numerically
> correct, but look a bit strange.  The `(BIT(5) & ~BIT(4))` looks
> especially strange and could be changed to `BIT(5)`.  These are all
> really shifted 2-bit values, so perhaps the BIT() macro isn't the
> best representation.
> 

BIT(5) & ~BIT(4) is silly.  Don't do that.

The original code was fine.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro Ian Abbott <abbotti@mev.co.uk> - 2015-11-18 17:30 +0100
  Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro Ian Abbott <abbotti@mev.co.uk> - 2015-11-18 17:40 +0100
  Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro Dan Carpenter <dan.carpenter@oracle.com> - 2015-11-19 09:00 +0100

csiph-web