All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
@ 2015-11-16 17:09 Ranjith Thangavel
  2015-11-16 17:21 ` Hartley Sweeten
  0 siblings, 1 reply; 7+ messages in thread
From: Ranjith Thangavel @ 2015-11-16 17:09 UTC (permalink / raw)
  To: gregkh; +Cc: abbotti, hsweeten, devel, linux-kernel, ranjithece24

BIT macro is used for defining BIT location instead of
shifting operator, usleep_range is preferred over
udelay - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
---
 drivers/staging/comedi/drivers/dmm32at.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index d312fda..9f8c9eb 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -508,7 +508,7 @@ static int dmm32at_reset(struct comedi_device *dev)
 	outb(DMM32AT_CTRL_RESETA, dev->iobase + DMM32AT_CTRL_REG);
 
 	/* allow a millisecond to reset */
-	udelay(1000);
+	usleep_range(1000, 1050);
 
 	/* zero scan and fifo control */
 	outb(0x0, dev->iobase + DMM32AT_FIFO_CTRL_REG);
@@ -524,7 +524,7 @@ static int dmm32at_reset(struct comedi_device *dev)
 	outb(DMM32AT_RANGE_U10, dev->iobase + DMM32AT_AI_CFG_REG);
 
 	/* should take 10 us to settle, here's a hundred */
-	udelay(100);
+	usleep_range(100, 150);
 
 	/* read back the values */
 	ailo = inb(dev->iobase + DMM32AT_AI_LO_CHAN_REG);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
  2015-11-16 17:09 [PATCH] comedi: dmm32at: Fix coding style - use BIT macro Ranjith Thangavel
@ 2015-11-16 17:21 ` Hartley Sweeten
  0 siblings, 0 replies; 7+ messages in thread
From: Hartley Sweeten @ 2015-11-16 17:21 UTC (permalink / raw)
  To: Ranjith Thangavel, gregkh; +Cc: abbotti, devel, linux-kernel

On Monday, November 16, 2015 10:09 AM, Ranjith Thangavel wrote:
> BIT macro is used for defining BIT location instead of
> shifting operator, usleep_range is preferred over
> udelay - coding style issue
>
> Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
> ---
>  drivers/staging/comedi/drivers/dmm32at.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
> index d312fda..9f8c9eb 100644
> --- a/drivers/staging/comedi/drivers/dmm32at.c
> +++ b/drivers/staging/comedi/drivers/dmm32at.c
> @@ -508,7 +508,7 @@ static int dmm32at_reset(struct comedi_device *dev)
>  	outb(DMM32AT_CTRL_RESETA, dev->iobase + DMM32AT_CTRL_REG);
>  
>  	/* allow a millisecond to reset */
> -	udelay(1000);
> +	usleep_range(1000, 1050);
>  
>  	/* zero scan and fifo control */
>  	outb(0x0, dev->iobase + DMM32AT_FIFO_CTRL_REG);
> @@ -524,7 +524,7 @@ static int dmm32at_reset(struct comedi_device *dev)
>  	outb(DMM32AT_RANGE_U10, dev->iobase + DMM32AT_AI_CFG_REG);
>  
>  	/* should take 10 us to settle, here's a hundred */
> -	udelay(100);
> +	usleep_range(100, 150);
>  
>  	/* read back the values */
>  	ailo = inb(dev->iobase + DMM32AT_AI_LO_CHAN_REG);

Nothing in this patch uses the BIT macro.

Please make sure your commit messages actually match the patch.

You also posted a different patch on Saturday with the exact same commit message.

Hartley


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
  2015-11-18 16:26 ` Ian Abbott
  2015-11-18 16:34   ` Ian Abbott
@ 2015-11-19  7:51   ` Dan Carpenter
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-11-19  7:51 UTC (permalink / raw)
  To: Ian Abbott; +Cc: Ranjith Thangavel, gregkh, devel, linux-kernel

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
  2015-11-18 16:26 ` Ian Abbott
@ 2015-11-18 16:34   ` Ian Abbott
  2015-11-19  7:51   ` Dan Carpenter
  1 sibling, 0 replies; 7+ messages in thread
From: Ian Abbott @ 2015-11-18 16:34 UTC (permalink / raw)
  To: Ranjith Thangavel, gregkh; +Cc: hsweeten, devel, linux-kernel

On 18/11/15 16:26, Ian Abbott wrote:
> On 14/11/15 17:10, Ranjith Thangavel wrote:
>> BIT macro is used for defining BIT location instead of
>> shifting operator, usleep_range is preferred over
>> udelay - coding style issue
>
> Those two things should be done in separate patches.

Sorry, I didn't see you've reposted this as two separate patches, so 
ignore my previous reply.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
  2015-11-14 17:10 Ranjith Thangavel
  2015-11-16 14:43 ` Dan Carpenter
@ 2015-11-18 16:26 ` Ian Abbott
  2015-11-18 16:34   ` Ian Abbott
  2015-11-19  7:51   ` Dan Carpenter
  1 sibling, 2 replies; 7+ messages in thread
From: Ian Abbott @ 2015-11-18 16:26 UTC (permalink / raw)
  To: Ranjith Thangavel, gregkh; +Cc: hsweeten, devel, linux-kernel

On 14/11/15 17:10, Ranjith Thangavel wrote:
> BIT macro is used for defining BIT location instead of
> shifting operator, usleep_range is preferred over
> udelay - coding style issue

Those two things should be done in separate patches.

> Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
> ---
>   drivers/staging/comedi/drivers/dmm32at.c |  104 +++++++++++++++---------------
>   1 file changed, 52 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
> index 958c0d4..0836d39 100644
> --- a/drivers/staging/comedi/drivers/dmm32at.c
> +++ b/drivers/staging/comedi/drivers/dmm32at.c
> @@ -46,74 +46,74 @@
>   #define DMM32AT_AI_START_CONV_REG	0x00
>   #define DMM32AT_AI_LSB_REG		0x00
>   #define DMM32AT_AUX_DOUT_REG		0x01
> -#define DMM32AT_AUX_DOUT2		(1 << 2)  /* J3.42 - OUT2 (OUT2EN) */
> -#define DMM32AT_AUX_DOUT1		(1 << 1)  /* J3.43 */
> -#define DMM32AT_AUX_DOUT0		(1 << 0)  /* J3.44 - OUT0 (OUT0EN) */
> +#define DMM32AT_AUX_DOUT2		BIT(2)  /* J3.42 - OUT2 (OUT2EN) */
> +#define DMM32AT_AUX_DOUT1		BIT(1)  /* J3.43 */
> +#define DMM32AT_AUX_DOUT0		BIT(0)  /* J3.44 - OUT0 (OUT0EN) */
>   #define DMM32AT_AI_MSB_REG		0x01
>   #define DMM32AT_AI_LO_CHAN_REG		0x02
>   #define DMM32AT_AI_HI_CHAN_REG		0x03
>   #define DMM32AT_AUX_DI_REG		0x04
> -#define DMM32AT_AUX_DI_DACBUSY		(1 << 7)
> -#define DMM32AT_AUX_DI_CALBUSY		(1 << 6)
> -#define DMM32AT_AUX_DI3			(1 << 3)  /* J3.45 - ADCLK (CLKSEL) */
> -#define DMM32AT_AUX_DI2			(1 << 2)  /* J3.46 - GATE12 (GT12EN) */
> -#define DMM32AT_AUX_DI1			(1 << 1)  /* J3.47 - GATE0 (GT0EN) */
> -#define DMM32AT_AUX_DI0			(1 << 0)  /* J3.48 - CLK0 (SRC0) */
> +#define DMM32AT_AUX_DI_DACBUSY		BIT(7)
> +#define DMM32AT_AUX_DI_CALBUSY		BIT(6)
> +#define DMM32AT_AUX_DI3			BIT(3)  /* J3.45 - ADCLK (CLKSEL) */
> +#define DMM32AT_AUX_DI2			BIT(2)  /* J3.46 - GATE12 (GT12EN) */
> +#define DMM32AT_AUX_DI1			BIT(1)  /* J3.47 - GATE0 (GT0EN) */
> +#define DMM32AT_AUX_DI0			BIT(0)  /* J3.48 - CLK0 (SRC0) */
>   #define DMM32AT_AO_LSB_REG		0x04
>   #define DMM32AT_AO_MSB_REG		0x05
>   #define DMM32AT_AO_MSB_DACH(x)		((x) << 6)
>   #define DMM32AT_FIFO_DEPTH_REG		0x06
>   #define DMM32AT_FIFO_CTRL_REG		0x07
> -#define DMM32AT_FIFO_CTRL_FIFOEN	(1 << 3)
> -#define DMM32AT_FIFO_CTRL_SCANEN	(1 << 2)
> -#define DMM32AT_FIFO_CTRL_FIFORST	(1 << 1)
> +#define DMM32AT_FIFO_CTRL_FIFOEN	BIT(3)
> +#define DMM32AT_FIFO_CTRL_SCANEN	BIT(2)
> +#define DMM32AT_FIFO_CTRL_FIFORST	BIT(1)
>   #define DMM32AT_FIFO_STATUS_REG		0x07
> -#define DMM32AT_FIFO_STATUS_EF		(1 << 7)
> -#define DMM32AT_FIFO_STATUS_HF		(1 << 6)
> -#define DMM32AT_FIFO_STATUS_FF		(1 << 5)
> -#define DMM32AT_FIFO_STATUS_OVF		(1 << 4)
> -#define DMM32AT_FIFO_STATUS_FIFOEN	(1 << 3)
> -#define DMM32AT_FIFO_STATUS_SCANEN	(1 << 2)
> -#define DMM32AT_FIFO_STATUS_PAGE_MASK	(3 << 0)
> +#define DMM32AT_FIFO_STATUS_EF		BIT(7)
> +#define DMM32AT_FIFO_STATUS_HF		BIT(6)
> +#define DMM32AT_FIFO_STATUS_FF		BIT(5)
> +#define DMM32AT_FIFO_STATUS_OVF		BIT(4)
> +#define DMM32AT_FIFO_STATUS_FIFOEN	BIT(3)
> +#define DMM32AT_FIFO_STATUS_SCANEN	BIT(2)
> +#define DMM32AT_FIFO_STATUS_PAGE_MASK	0

As Dan Carpenter pointer out the new value of 
DMM32AT_FIFO_STATUS_PAGE_MASK is wrong (the old value was 3).

>   #define DMM32AT_CTRL_REG		0x08
> -#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_PAGE_8254		0
> +#define DMM32AT_CTRL_PAGE_8255		BIT(0)
> +#define DMM32AT_CTRL_PAGE_CALIB		0

The new value of DMM32AT_CTRL_PAGE_CALIB is wrong - the old value is 3. 
  DMM32AT_CTRL_PAGE_8254, DMM32AT_CTRL_PAGE_8255 and 
DMM32AT_CTRL_PAGE_CALIB are 2-bit values, so the BIT() macro isn't 
really the best representation.

(To be honest, I don't really know what the preferred representation of 
shifted multi-bit values is.)

>   #define DMM32AT_AI_STATUS_REG		0x08
> -#define DMM32AT_AI_STATUS_STS		(1 << 7)
> -#define DMM32AT_AI_STATUS_SD1		(1 << 6)
> -#define DMM32AT_AI_STATUS_SD0		(1 << 5)
> +#define DMM32AT_AI_STATUS_STS		BIT(7)
> +#define DMM32AT_AI_STATUS_SD1		BIT(6)
> +#define DMM32AT_AI_STATUS_SD0		BIT(5)
>   #define DMM32AT_AI_STATUS_ADCH_MASK	(0x1f << 0)
>   #define DMM32AT_INTCLK_REG		0x09
> -#define DMM32AT_INTCLK_ADINT		(1 << 7)
> -#define DMM32AT_INTCLK_DINT		(1 << 6)
> -#define DMM32AT_INTCLK_TINT		(1 << 5)
> -#define DMM32AT_INTCLK_CLKEN		(1 << 1)  /* 1=see below  0=software */
> -#define DMM32AT_INTCLK_CLKSEL		(1 << 0)  /* 1=OUT2  0=EXTCLK */
> +#define DMM32AT_INTCLK_ADINT		BIT(7)
> +#define DMM32AT_INTCLK_DINT		BIT(6)
> +#define DMM32AT_INTCLK_TINT		BIT(5)
> +#define DMM32AT_INTCLK_CLKEN		BIT(1)  /* 1=see below  0=software */
> +#define DMM32AT_INTCLK_CLKSEL		BIT(0)  /* 1=OUT2  0=EXTCLK */
>   #define DMM32AT_CTRDIO_CFG_REG		0x0a
> -#define DMM32AT_CTRDIO_CFG_FREQ12	(1 << 7)  /* CLK12 1=100KHz 0=10MHz */
> -#define DMM32AT_CTRDIO_CFG_FREQ0	(1 << 6)  /* CLK0  1=10KHz  0=10MHz */
> -#define DMM32AT_CTRDIO_CFG_OUT2EN	(1 << 5)  /* J3.42 1=OUT2 is DOUT2 */
> -#define DMM32AT_CTRDIO_CFG_OUT0EN	(1 << 4)  /* J3,44 1=OUT0 is DOUT0 */
> -#define DMM32AT_CTRDIO_CFG_GT0EN	(1 << 2)  /* J3.47 1=DIN1 is GATE0 */
> -#define DMM32AT_CTRDIO_CFG_SRC0		(1 << 1)  /* CLK0 is 0=FREQ0 1=J3.48 */
> -#define DMM32AT_CTRDIO_CFG_GT12EN	(1 << 0)  /* J3.46 1=DIN2 is GATE12 */
> +#define DMM32AT_CTRDIO_CFG_FREQ12	BIT(7)  /* CLK12 1=100KHz 0=10MHz */
> +#define DMM32AT_CTRDIO_CFG_FREQ0	BIT(6)  /* CLK0  1=10KHz  0=10MHz */
> +#define DMM32AT_CTRDIO_CFG_OUT2EN	BIT(5)  /* J3.42 1=OUT2 is DOUT2 */
> +#define DMM32AT_CTRDIO_CFG_OUT0EN	BIT(4)  /* J3,44 1=OUT0 is DOUT0 */
> +#define DMM32AT_CTRDIO_CFG_GT0EN	BIT(2)  /* J3.47 1=DIN1 is GATE0 */
> +#define DMM32AT_CTRDIO_CFG_SRC0		BIT(1)  /* CLK0 is 0=FREQ0 1=J3.48 */
> +#define DMM32AT_CTRDIO_CFG_GT12EN	BIT(0)  /* J3.46 1=DIN2 is GATE12 */
>   #define DMM32AT_AI_CFG_REG		0x0b
> -#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_SCINT_20US	0
> +#define DMM32AT_AI_CFG_SCINT_15US	BIT(4)
> +#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.

> +#define DMM32AT_AI_CFG_RANGE		BIT(3)  /* 0=5V  1=10V */
> +#define DMM32AT_AI_CFG_ADBU		BIT(2)  /* 0=bipolar  1=unipolar */
>   #define DMM32AT_AI_CFG_GAIN(x)		((x) << 0)
>   #define DMM32AT_AI_READBACK_REG		0x0b
> -#define DMM32AT_AI_READBACK_WAIT	(1 << 7)  /* DMM32AT_AI_STATUS_STS */
> -#define DMM32AT_AI_READBACK_RANGE	(1 << 3)
> -#define DMM32AT_AI_READBACK_ADBU	(1 << 2)
> -#define DMM32AT_AI_READBACK_GAIN_MASK	(3 << 0)
> +#define DMM32AT_AI_READBACK_WAIT	BIT(7)  /* DMM32AT_AI_STATUS_STS */
> +#define DMM32AT_AI_READBACK_RANGE	BIT(3)
> +#define DMM32AT_AI_READBACK_ADBU	BIT(2)
> +#define DMM32AT_AI_READBACK_GAIN_MASK	0

The value of DMM32AT_AI_READBACK_GAIN_MASK is wrong - the old value was 3.

>
>   #define DMM32AT_CLK1 0x0d
>   #define DMM32AT_CLK2 0x0e
> @@ -508,7 +508,7 @@ static int dmm32at_reset(struct comedi_device *dev)
>   	outb(DMM32AT_CTRL_RESETA, dev->iobase + DMM32AT_CTRL_REG);
>
>   	/* allow a millisecond to reset */
> -	udelay(1000);
> +	usleep_range(1000, 1050);
>
>   	/* zero scan and fifo control */
>   	outb(0x0, dev->iobase + DMM32AT_FIFO_CTRL_REG);
> @@ -524,7 +524,7 @@ static int dmm32at_reset(struct comedi_device *dev)
>   	outb(DMM32AT_RANGE_U10, dev->iobase + DMM32AT_AI_CFG_REG);
>
>   	/* should take 10 us to settle, here's a hundred */
> -	udelay(100);
> +	usleep_range(100, 150);
>
>   	/* read back the values */
>   	ailo = inb(dev->iobase + DMM32AT_AI_LO_CHAN_REG);
>

The usleep_range() stuff is unrelated to the use of the BIT() macro and 
should be in a separate patch.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
  2015-11-14 17:10 Ranjith Thangavel
@ 2015-11-16 14:43 ` Dan Carpenter
  2015-11-18 16:26 ` Ian Abbott
  1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2015-11-16 14:43 UTC (permalink / raw)
  To: Ranjith Thangavel; +Cc: gregkh, devel, abbotti, linux-kernel

This one is buggy.  For example:

> -#define DMM32AT_FIFO_STATUS_PAGE_MASK	(3 << 0)
> +#define DMM32AT_FIFO_STATUS_PAGE_MASK	0

There are other bugs as well.  Please, be more careful.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] comedi: dmm32at: Fix coding style - use BIT macro
@ 2015-11-14 17:10 Ranjith Thangavel
  2015-11-16 14:43 ` Dan Carpenter
  2015-11-18 16:26 ` Ian Abbott
  0 siblings, 2 replies; 7+ messages in thread
From: Ranjith Thangavel @ 2015-11-14 17:10 UTC (permalink / raw)
  To: gregkh; +Cc: abbotti, hsweeten, devel, linux-kernel, ranjithece24

BIT macro is used for defining BIT location instead of
shifting operator, usleep_range is preferred over
udelay - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
---
 drivers/staging/comedi/drivers/dmm32at.c |  104 +++++++++++++++---------------
 1 file changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 958c0d4..0836d39 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -46,74 +46,74 @@
 #define DMM32AT_AI_START_CONV_REG	0x00
 #define DMM32AT_AI_LSB_REG		0x00
 #define DMM32AT_AUX_DOUT_REG		0x01
-#define DMM32AT_AUX_DOUT2		(1 << 2)  /* J3.42 - OUT2 (OUT2EN) */
-#define DMM32AT_AUX_DOUT1		(1 << 1)  /* J3.43 */
-#define DMM32AT_AUX_DOUT0		(1 << 0)  /* J3.44 - OUT0 (OUT0EN) */
+#define DMM32AT_AUX_DOUT2		BIT(2)  /* J3.42 - OUT2 (OUT2EN) */
+#define DMM32AT_AUX_DOUT1		BIT(1)  /* J3.43 */
+#define DMM32AT_AUX_DOUT0		BIT(0)  /* J3.44 - OUT0 (OUT0EN) */
 #define DMM32AT_AI_MSB_REG		0x01
 #define DMM32AT_AI_LO_CHAN_REG		0x02
 #define DMM32AT_AI_HI_CHAN_REG		0x03
 #define DMM32AT_AUX_DI_REG		0x04
-#define DMM32AT_AUX_DI_DACBUSY		(1 << 7)
-#define DMM32AT_AUX_DI_CALBUSY		(1 << 6)
-#define DMM32AT_AUX_DI3			(1 << 3)  /* J3.45 - ADCLK (CLKSEL) */
-#define DMM32AT_AUX_DI2			(1 << 2)  /* J3.46 - GATE12 (GT12EN) */
-#define DMM32AT_AUX_DI1			(1 << 1)  /* J3.47 - GATE0 (GT0EN) */
-#define DMM32AT_AUX_DI0			(1 << 0)  /* J3.48 - CLK0 (SRC0) */
+#define DMM32AT_AUX_DI_DACBUSY		BIT(7)
+#define DMM32AT_AUX_DI_CALBUSY		BIT(6)
+#define DMM32AT_AUX_DI3			BIT(3)  /* J3.45 - ADCLK (CLKSEL) */
+#define DMM32AT_AUX_DI2			BIT(2)  /* J3.46 - GATE12 (GT12EN) */
+#define DMM32AT_AUX_DI1			BIT(1)  /* J3.47 - GATE0 (GT0EN) */
+#define DMM32AT_AUX_DI0			BIT(0)  /* J3.48 - CLK0 (SRC0) */
 #define DMM32AT_AO_LSB_REG		0x04
 #define DMM32AT_AO_MSB_REG		0x05
 #define DMM32AT_AO_MSB_DACH(x)		((x) << 6)
 #define DMM32AT_FIFO_DEPTH_REG		0x06
 #define DMM32AT_FIFO_CTRL_REG		0x07
-#define DMM32AT_FIFO_CTRL_FIFOEN	(1 << 3)
-#define DMM32AT_FIFO_CTRL_SCANEN	(1 << 2)
-#define DMM32AT_FIFO_CTRL_FIFORST	(1 << 1)
+#define DMM32AT_FIFO_CTRL_FIFOEN	BIT(3)
+#define DMM32AT_FIFO_CTRL_SCANEN	BIT(2)
+#define DMM32AT_FIFO_CTRL_FIFORST	BIT(1)
 #define DMM32AT_FIFO_STATUS_REG		0x07
-#define DMM32AT_FIFO_STATUS_EF		(1 << 7)
-#define DMM32AT_FIFO_STATUS_HF		(1 << 6)
-#define DMM32AT_FIFO_STATUS_FF		(1 << 5)
-#define DMM32AT_FIFO_STATUS_OVF		(1 << 4)
-#define DMM32AT_FIFO_STATUS_FIFOEN	(1 << 3)
-#define DMM32AT_FIFO_STATUS_SCANEN	(1 << 2)
-#define DMM32AT_FIFO_STATUS_PAGE_MASK	(3 << 0)
+#define DMM32AT_FIFO_STATUS_EF		BIT(7)
+#define DMM32AT_FIFO_STATUS_HF		BIT(6)
+#define DMM32AT_FIFO_STATUS_FF		BIT(5)
+#define DMM32AT_FIFO_STATUS_OVF		BIT(4)
+#define DMM32AT_FIFO_STATUS_FIFOEN	BIT(3)
+#define DMM32AT_FIFO_STATUS_SCANEN	BIT(2)
+#define DMM32AT_FIFO_STATUS_PAGE_MASK	0
 #define DMM32AT_CTRL_REG		0x08
-#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_PAGE_8254		0
+#define DMM32AT_CTRL_PAGE_8255		BIT(0)
+#define DMM32AT_CTRL_PAGE_CALIB		0
 #define DMM32AT_AI_STATUS_REG		0x08
-#define DMM32AT_AI_STATUS_STS		(1 << 7)
-#define DMM32AT_AI_STATUS_SD1		(1 << 6)
-#define DMM32AT_AI_STATUS_SD0		(1 << 5)
+#define DMM32AT_AI_STATUS_STS		BIT(7)
+#define DMM32AT_AI_STATUS_SD1		BIT(6)
+#define DMM32AT_AI_STATUS_SD0		BIT(5)
 #define DMM32AT_AI_STATUS_ADCH_MASK	(0x1f << 0)
 #define DMM32AT_INTCLK_REG		0x09
-#define DMM32AT_INTCLK_ADINT		(1 << 7)
-#define DMM32AT_INTCLK_DINT		(1 << 6)
-#define DMM32AT_INTCLK_TINT		(1 << 5)
-#define DMM32AT_INTCLK_CLKEN		(1 << 1)  /* 1=see below  0=software */
-#define DMM32AT_INTCLK_CLKSEL		(1 << 0)  /* 1=OUT2  0=EXTCLK */
+#define DMM32AT_INTCLK_ADINT		BIT(7)
+#define DMM32AT_INTCLK_DINT		BIT(6)
+#define DMM32AT_INTCLK_TINT		BIT(5)
+#define DMM32AT_INTCLK_CLKEN		BIT(1)  /* 1=see below  0=software */
+#define DMM32AT_INTCLK_CLKSEL		BIT(0)  /* 1=OUT2  0=EXTCLK */
 #define DMM32AT_CTRDIO_CFG_REG		0x0a
-#define DMM32AT_CTRDIO_CFG_FREQ12	(1 << 7)  /* CLK12 1=100KHz 0=10MHz */
-#define DMM32AT_CTRDIO_CFG_FREQ0	(1 << 6)  /* CLK0  1=10KHz  0=10MHz */
-#define DMM32AT_CTRDIO_CFG_OUT2EN	(1 << 5)  /* J3.42 1=OUT2 is DOUT2 */
-#define DMM32AT_CTRDIO_CFG_OUT0EN	(1 << 4)  /* J3,44 1=OUT0 is DOUT0 */
-#define DMM32AT_CTRDIO_CFG_GT0EN	(1 << 2)  /* J3.47 1=DIN1 is GATE0 */
-#define DMM32AT_CTRDIO_CFG_SRC0		(1 << 1)  /* CLK0 is 0=FREQ0 1=J3.48 */
-#define DMM32AT_CTRDIO_CFG_GT12EN	(1 << 0)  /* J3.46 1=DIN2 is GATE12 */
+#define DMM32AT_CTRDIO_CFG_FREQ12	BIT(7)  /* CLK12 1=100KHz 0=10MHz */
+#define DMM32AT_CTRDIO_CFG_FREQ0	BIT(6)  /* CLK0  1=10KHz  0=10MHz */
+#define DMM32AT_CTRDIO_CFG_OUT2EN	BIT(5)  /* J3.42 1=OUT2 is DOUT2 */
+#define DMM32AT_CTRDIO_CFG_OUT0EN	BIT(4)  /* J3,44 1=OUT0 is DOUT0 */
+#define DMM32AT_CTRDIO_CFG_GT0EN	BIT(2)  /* J3.47 1=DIN1 is GATE0 */
+#define DMM32AT_CTRDIO_CFG_SRC0		BIT(1)  /* CLK0 is 0=FREQ0 1=J3.48 */
+#define DMM32AT_CTRDIO_CFG_GT12EN	BIT(0)  /* J3.46 1=DIN2 is GATE12 */
 #define DMM32AT_AI_CFG_REG		0x0b
-#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_SCINT_20US	0
+#define DMM32AT_AI_CFG_SCINT_15US	BIT(4)
+#define DMM32AT_AI_CFG_SCINT_10US	(BIT(5) & ~BIT(4))
+#define DMM32AT_AI_CFG_SCINT_5US	(BIT(5) | BIT(4))
+#define DMM32AT_AI_CFG_RANGE		BIT(3)  /* 0=5V  1=10V */
+#define DMM32AT_AI_CFG_ADBU		BIT(2)  /* 0=bipolar  1=unipolar */
 #define DMM32AT_AI_CFG_GAIN(x)		((x) << 0)
 #define DMM32AT_AI_READBACK_REG		0x0b
-#define DMM32AT_AI_READBACK_WAIT	(1 << 7)  /* DMM32AT_AI_STATUS_STS */
-#define DMM32AT_AI_READBACK_RANGE	(1 << 3)
-#define DMM32AT_AI_READBACK_ADBU	(1 << 2)
-#define DMM32AT_AI_READBACK_GAIN_MASK	(3 << 0)
+#define DMM32AT_AI_READBACK_WAIT	BIT(7)  /* DMM32AT_AI_STATUS_STS */
+#define DMM32AT_AI_READBACK_RANGE	BIT(3)
+#define DMM32AT_AI_READBACK_ADBU	BIT(2)
+#define DMM32AT_AI_READBACK_GAIN_MASK	0
 
 #define DMM32AT_CLK1 0x0d
 #define DMM32AT_CLK2 0x0e
@@ -508,7 +508,7 @@ static int dmm32at_reset(struct comedi_device *dev)
 	outb(DMM32AT_CTRL_RESETA, dev->iobase + DMM32AT_CTRL_REG);
 
 	/* allow a millisecond to reset */
-	udelay(1000);
+	usleep_range(1000, 1050);
 
 	/* zero scan and fifo control */
 	outb(0x0, dev->iobase + DMM32AT_FIFO_CTRL_REG);
@@ -524,7 +524,7 @@ static int dmm32at_reset(struct comedi_device *dev)
 	outb(DMM32AT_RANGE_U10, dev->iobase + DMM32AT_AI_CFG_REG);
 
 	/* should take 10 us to settle, here's a hundred */
-	udelay(100);
+	usleep_range(100, 150);
 
 	/* read back the values */
 	ailo = inb(dev->iobase + DMM32AT_AI_LO_CHAN_REG);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-11-19  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 17:09 [PATCH] comedi: dmm32at: Fix coding style - use BIT macro Ranjith Thangavel
2015-11-16 17:21 ` Hartley Sweeten
  -- strict thread matches above, loose matches on Subject: below --
2015-11-14 17:10 Ranjith Thangavel
2015-11-16 14:43 ` Dan Carpenter
2015-11-18 16:26 ` Ian Abbott
2015-11-18 16:34   ` Ian Abbott
2015-11-19  7:51   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.