linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT
@ 2019-04-03 20:45 Lucas Oshiro
  2019-04-04  6:41 ` Alexandru Ardelean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lucas Oshiro @ 2019-04-03 20:45 UTC (permalink / raw)
  To: lars, Michael.Hennerich, stefan.popa, jic23, knaack.h, pmeerw, gregkh
  Cc: linux-iio, devel, linux-kernel, kernel-usp

Replace bitshifts on lines 54, 56 and 78 of ad7746.c.

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
---
 drivers/staging/iio/cdc/ad7746.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 0eb28fea876e..ea48b14cee72 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -51,9 +51,9 @@
 #define AD7746_CAPSETUP_CACHOP		BIT(0)
 
 /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
-#define AD7746_VTSETUP_VTEN		(1 << 7)
+#define AD7746_VTSETUP_VTEN		BIT(7)
 #define AD7746_VTSETUP_VTMD_INT_TEMP	(0 << 5)
-#define AD7746_VTSETUP_VTMD_EXT_TEMP	(1 << 5)
+#define AD7746_VTSETUP_VTMD_EXT_TEMP	BIT(5)
 #define AD7746_VTSETUP_VTMD_VDD_MON	(2 << 5)
 #define AD7746_VTSETUP_VTMD_EXT_VIN	(3 << 5)
 #define AD7746_VTSETUP_EXTREF		BIT(4)
@@ -75,7 +75,7 @@
 #define AD7746_CONF_VTFS_MASK		GENMASK(7, 6)
 #define AD7746_CONF_CAPFS_MASK		GENMASK(5, 3)
 #define AD7746_CONF_MODE_IDLE		(0 << 0)
-#define AD7746_CONF_MODE_CONT_CONV	(1 << 0)
+#define AD7746_CONF_MODE_CONT_CONV	BIT(0)
 #define AD7746_CONF_MODE_SINGLE_CONV	(2 << 0)
 #define AD7746_CONF_MODE_PWRDN		(3 << 0)
 #define AD7746_CONF_MODE_OFFS_CAL	(5 << 0)
-- 
2.21.0


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

* Re: [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT
  2019-04-03 20:45 [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT Lucas Oshiro
@ 2019-04-04  6:41 ` Alexandru Ardelean
  2019-04-04  9:12 ` Dan Carpenter
  2019-04-08 12:34 ` Joe Perches
  2 siblings, 0 replies; 4+ messages in thread
From: Alexandru Ardelean @ 2019-04-04  6:41 UTC (permalink / raw)
  To: Lucas Oshiro
  Cc: lars, Hennerich, Michael, stefan.popa, Jonathan Cameron,
	knaack.h, Peter Meerwald-Stadler, gregkh, linux-iio, devel, LKML,
	kernel-usp

On Wed, Apr 3, 2019 at 11:46 PM Lucas Oshiro <lucasseikioshiro@gmail.com> wrote:
>
> Replace bitshifts on lines 54, 56 and 78 of ad7746.c.
>

Hey,
This is only partially done.
If doing conversions to BIT(x) macro, I would say to do them for all cases.

Thanks
Alex

> Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
> ---
>  drivers/staging/iio/cdc/ad7746.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
> index 0eb28fea876e..ea48b14cee72 100644
> --- a/drivers/staging/iio/cdc/ad7746.c
> +++ b/drivers/staging/iio/cdc/ad7746.c
> @@ -51,9 +51,9 @@
>  #define AD7746_CAPSETUP_CACHOP         BIT(0)
>
>  /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
> -#define AD7746_VTSETUP_VTEN            (1 << 7)
> +#define AD7746_VTSETUP_VTEN            BIT(7)
>  #define AD7746_VTSETUP_VTMD_INT_TEMP   (0 << 5)
> -#define AD7746_VTSETUP_VTMD_EXT_TEMP   (1 << 5)
> +#define AD7746_VTSETUP_VTMD_EXT_TEMP   BIT(5)
>  #define AD7746_VTSETUP_VTMD_VDD_MON    (2 << 5)
>  #define AD7746_VTSETUP_VTMD_EXT_VIN    (3 << 5)
>  #define AD7746_VTSETUP_EXTREF          BIT(4)
> @@ -75,7 +75,7 @@
>  #define AD7746_CONF_VTFS_MASK          GENMASK(7, 6)
>  #define AD7746_CONF_CAPFS_MASK         GENMASK(5, 3)
>  #define AD7746_CONF_MODE_IDLE          (0 << 0)
> -#define AD7746_CONF_MODE_CONT_CONV     (1 << 0)
> +#define AD7746_CONF_MODE_CONT_CONV     BIT(0)
>  #define AD7746_CONF_MODE_SINGLE_CONV   (2 << 0)
>  #define AD7746_CONF_MODE_PWRDN         (3 << 0)
>  #define AD7746_CONF_MODE_OFFS_CAL      (5 << 0)
> --
> 2.21.0
>

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

* Re: [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT
  2019-04-03 20:45 [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT Lucas Oshiro
  2019-04-04  6:41 ` Alexandru Ardelean
@ 2019-04-04  9:12 ` Dan Carpenter
  2019-04-08 12:34 ` Joe Perches
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-04-04  9:12 UTC (permalink / raw)
  To: Lucas Oshiro
  Cc: lars, Michael.Hennerich, stefan.popa, jic23, knaack.h, pmeerw,
	gregkh, linux-iio, devel, linux-kernel, kernel-usp

On Wed, Apr 03, 2019 at 05:45:02PM -0300, Lucas Oshiro wrote:
>  #define AD7746_VTSETUP_VTMD_INT_TEMP	(0 << 5)
> -#define AD7746_VTSETUP_VTMD_EXT_TEMP	(1 << 5)
> +#define AD7746_VTSETUP_VTMD_EXT_TEMP	BIT(5)

No, the original is more readable.  Otherwise you can't see that it's
part of a set.

Just ignore checkpatch when it gives nonsense advice.

regards,
dan carpenter


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

* Re: [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT
  2019-04-03 20:45 [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT Lucas Oshiro
  2019-04-04  6:41 ` Alexandru Ardelean
  2019-04-04  9:12 ` Dan Carpenter
@ 2019-04-08 12:34 ` Joe Perches
  2 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2019-04-08 12:34 UTC (permalink / raw)
  To: Lucas Oshiro, lars, Michael.Hennerich, stefan.popa, jic23,
	knaack.h, pmeerw, gregkh
  Cc: linux-iio, devel, linux-kernel, kernel-usp

On Wed, 2019-04-03 at 17:45 -0300, Lucas Oshiro wrote:
> Replace bitshifts on lines 54, 56 and 78 of ad7746.c.

checkpatch is not something that should be followed
blindly.  Look at the shifted blocks and determine if
you think it was better before your proposed change.

> diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
[]
> @@ -51,9 +51,9 @@
>  #define AD7746_CAPSETUP_CACHOP		BIT(0)
>  
>  /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
> -#define AD7746_VTSETUP_VTEN		(1 << 7)
> +#define AD7746_VTSETUP_VTEN		BIT(7)
>  #define AD7746_VTSETUP_VTMD_INT_TEMP	(0 << 5)
> -#define AD7746_VTSETUP_VTMD_EXT_TEMP	(1 << 5)
> +#define AD7746_VTSETUP_VTMD_EXT_TEMP	BIT(5)
>  #define AD7746_VTSETUP_VTMD_VDD_MON	(2 << 5)
>  #define AD7746_VTSETUP_VTMD_EXT_VIN	(3 << 5)
>  #define AD7746_VTSETUP_EXTREF		BIT(4)
> @@ -75,7 +75,7 @@
>  #define AD7746_CONF_VTFS_MASK		GENMASK(7, 6)
>  #define AD7746_CONF_CAPFS_MASK		GENMASK(5, 3)
>  #define AD7746_CONF_MODE_IDLE		(0 << 0)
> -#define AD7746_CONF_MODE_CONT_CONV	(1 << 0)
> +#define AD7746_CONF_MODE_CONT_CONV	BIT(0)
>  #define AD7746_CONF_MODE_SINGLE_CONV	(2 << 0)
>  #define AD7746_CONF_MODE_PWRDN		(3 << 0)
>  #define AD7746_CONF_MODE_OFFS_CAL	(5 << 0)

Now the code looks unbalanced.


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

end of thread, other threads:[~2019-04-08 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 20:45 [PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT Lucas Oshiro
2019-04-04  6:41 ` Alexandru Ardelean
2019-04-04  9:12 ` Dan Carpenter
2019-04-08 12:34 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).