public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n)
@ 2015-11-08 20:39 Egor Uleyskiy
  2015-11-08 21:43 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Egor Uleyskiy @ 2015-11-08 20:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Egor Uleyskiy, Manohar Vanga, Martyn Welch, Trivial Patch Monkey,
	linux-kernel

From: Egor Uleyskiy <egor.ulieiskii@gmail.com>

Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
---
 drivers/staging/vme/devices/vme_pio2.h | 93 ++++++++++++++++------------------
 1 file changed, 45 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/devices/vme_pio2.h
index d5d94c4..29d7a58 100644
--- a/drivers/staging/vme/devices/vme_pio2.h
+++ b/drivers/staging/vme/devices/vme_pio2.h
@@ -1,6 +1,8 @@
 #ifndef _VME_PIO2_H_
 #define _VME_PIO2_H_
 
+#include <linux/bitops.h>
+
 #define PIO2_CARDS_MAX			32
 
 #define PIO2_VARIANT_LENGTH		5
@@ -48,8 +50,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
 					PIO2_REGS_INT_MASK6,
 					PIO2_REGS_INT_MASK7 };
 
-
-
 #define PIO2_REGS_CTRL			0x18
 #define PIO2_REGS_VME_VECTOR		0x19
 #define PIO2_REGS_CNTR0			0x20
@@ -63,7 +63,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
 
 #define PIO2_REGS_ID			0x30
 
-
 /* PIO2_REGS_DATAx (0x0 - 0x3) */
 
 static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
@@ -71,38 +70,38 @@ static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
 					2, 2, 2, 2, 2, 2, 2, 2,
 					3, 3, 3, 3, 3, 3, 3, 3 };
 
-#define PIO2_CHANNEL0_BIT		(1 << 0)
-#define PIO2_CHANNEL1_BIT		(1 << 1)
-#define PIO2_CHANNEL2_BIT		(1 << 2)
-#define PIO2_CHANNEL3_BIT		(1 << 3)
-#define PIO2_CHANNEL4_BIT		(1 << 4)
-#define PIO2_CHANNEL5_BIT		(1 << 5)
-#define PIO2_CHANNEL6_BIT		(1 << 6)
-#define PIO2_CHANNEL7_BIT		(1 << 7)
-#define PIO2_CHANNEL8_BIT		(1 << 0)
-#define PIO2_CHANNEL9_BIT		(1 << 1)
-#define PIO2_CHANNEL10_BIT		(1 << 2)
-#define PIO2_CHANNEL11_BIT		(1 << 3)
-#define PIO2_CHANNEL12_BIT		(1 << 4)
-#define PIO2_CHANNEL13_BIT		(1 << 5)
-#define PIO2_CHANNEL14_BIT		(1 << 6)
-#define PIO2_CHANNEL15_BIT		(1 << 7)
-#define PIO2_CHANNEL16_BIT		(1 << 0)
-#define PIO2_CHANNEL17_BIT		(1 << 1)
-#define PIO2_CHANNEL18_BIT		(1 << 2)
-#define PIO2_CHANNEL19_BIT		(1 << 3)
-#define PIO2_CHANNEL20_BIT		(1 << 4)
-#define PIO2_CHANNEL21_BIT		(1 << 5)
-#define PIO2_CHANNEL22_BIT		(1 << 6)
-#define PIO2_CHANNEL23_BIT		(1 << 7)
-#define PIO2_CHANNEL24_BIT		(1 << 0)
-#define PIO2_CHANNEL25_BIT		(1 << 1)
-#define PIO2_CHANNEL26_BIT		(1 << 2)
-#define PIO2_CHANNEL27_BIT		(1 << 3)
-#define PIO2_CHANNEL28_BIT		(1 << 4)
-#define PIO2_CHANNEL29_BIT		(1 << 5)
-#define PIO2_CHANNEL30_BIT		(1 << 6)
-#define PIO2_CHANNEL31_BIT		(1 << 7)
+#define PIO2_CHANNEL0_BIT		BIT(0)
+#define PIO2_CHANNEL1_BIT		BIT(1)
+#define PIO2_CHANNEL2_BIT		BIT(2)
+#define PIO2_CHANNEL3_BIT		BIT(3)
+#define PIO2_CHANNEL4_BIT		BIT(4)
+#define PIO2_CHANNEL5_BIT		BIT(5)
+#define PIO2_CHANNEL6_BIT		BIT(6)
+#define PIO2_CHANNEL7_BIT		BIT(7)
+#define PIO2_CHANNEL8_BIT		BIT(0)
+#define PIO2_CHANNEL9_BIT		BIT(1)
+#define PIO2_CHANNEL10_BIT		BIT(2)
+#define PIO2_CHANNEL11_BIT		BIT(3)
+#define PIO2_CHANNEL12_BIT		BIT(4)
+#define PIO2_CHANNEL13_BIT		BIT(5)
+#define PIO2_CHANNEL14_BIT		BIT(6)
+#define PIO2_CHANNEL15_BIT		BIT(7)
+#define PIO2_CHANNEL16_BIT		BIT(0)
+#define PIO2_CHANNEL17_BIT		BIT(1)
+#define PIO2_CHANNEL18_BIT		BIT(2)
+#define PIO2_CHANNEL19_BIT		BIT(3)
+#define PIO2_CHANNEL20_BIT		BIT(4)
+#define PIO2_CHANNEL21_BIT		BIT(5)
+#define PIO2_CHANNEL22_BIT		BIT(6)
+#define PIO2_CHANNEL23_BIT		BIT(7)
+#define PIO2_CHANNEL24_BIT		BIT(0)
+#define PIO2_CHANNEL25_BIT		BIT(1)
+#define PIO2_CHANNEL26_BIT		BIT(2)
+#define PIO2_CHANNEL27_BIT		BIT(3)
+#define PIO2_CHANNEL28_BIT		BIT(4)
+#define PIO2_CHANNEL29_BIT		BIT(5)
+#define PIO2_CHANNEL30_BIT		BIT(6)
+#define PIO2_CHANNEL31_BIT		BIT(7)
 
 static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
 					PIO2_CHANNEL2_BIT, PIO2_CHANNEL3_BIT,
@@ -123,12 +122,12 @@ static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
 					};
 
 /* PIO2_REGS_INT_STAT_CNTR (0xc) */
-#define PIO2_COUNTER0			(1 << 0)
-#define PIO2_COUNTER1			(1 << 1)
-#define PIO2_COUNTER2			(1 << 2)
-#define PIO2_COUNTER3			(1 << 3)
-#define PIO2_COUNTER4			(1 << 4)
-#define PIO2_COUNTER5			(1 << 5)
+#define PIO2_COUNTER0			BIT(0)
+#define PIO2_COUNTER1			BIT(1)
+#define PIO2_COUNTER2			BIT(2)
+#define PIO2_COUNTER3			BIT(3)
+#define PIO2_COUNTER4			BIT(4)
+#define PIO2_COUNTER5			BIT(5)
 
 static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
 					PIO2_COUNTER2, PIO2_COUNTER3,
@@ -136,8 +135,8 @@ static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
 
 /* PIO2_REGS_CTRL (0x18) */
 #define PIO2_VME_INT_MASK		0x7
-#define PIO2_LED			(1 << 6)
-#define PIO2_LOOP			(1 << 7)
+#define PIO2_LED			BIT(6)
+#define PIO2_LOOP			BIT(7)
 
 /* PIO2_REGS_VME_VECTOR (0x19) */
 #define PIO2_VME_VECTOR_SPUR		0x0
@@ -182,7 +181,7 @@ static const int PIO2_CNTR_CTRL[6] = { PIO2_REGS_CTRL_WRD0,
 					PIO2_REGS_CTRL_WRD1 };
 
 #define PIO2_CNTR_SC_DEV0		0
-#define PIO2_CNTR_SC_DEV1		(1 << 6)
+#define PIO2_CNTR_SC_DEV1		BIT(6)
 #define PIO2_CNTR_SC_DEV2		(2 << 6)
 #define PIO2_CNTR_SC_RDBACK		(3 << 6)
 
@@ -191,12 +190,12 @@ static const int PIO2_CNTR_SC_DEV[6] = { PIO2_CNTR_SC_DEV0, PIO2_CNTR_SC_DEV1,
 					PIO2_CNTR_SC_DEV1, PIO2_CNTR_SC_DEV2 };
 
 #define PIO2_CNTR_RW_LATCH		0
-#define PIO2_CNTR_RW_LSB		(1 << 4)
+#define PIO2_CNTR_RW_LSB		BIT(4)
 #define PIO2_CNTR_RW_MSB		(2 << 4)
 #define PIO2_CNTR_RW_BOTH		(3 << 4)
 
 #define PIO2_CNTR_MODE0			0
-#define PIO2_CNTR_MODE1			(1 << 1)
+#define PIO2_CNTR_MODE1			BIT(1)
 #define PIO2_CNTR_MODE2			(2 << 1)
 #define PIO2_CNTR_MODE3			(3 << 1)
 #define PIO2_CNTR_MODE4			(4 << 1)
@@ -204,8 +203,6 @@ static const int PIO2_CNTR_SC_DEV[6] = { PIO2_CNTR_SC_DEV0, PIO2_CNTR_SC_DEV1,
 
 #define PIO2_CNTR_BCD			1
 
-
-
 enum pio2_bank_config { NOFIT, INPUT, OUTPUT, BOTH };
 enum pio2_int_config { NONE = 0, LOW2HIGH = 1, HIGH2LOW = 2, EITHER = 4 };
 
-- 
2.5.0


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

* Re: [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n)
  2015-11-08 20:39 [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n) Egor Uleyskiy
@ 2015-11-08 21:43 ` Andy Shevchenko
  2015-11-24 23:28   ` Greg Kroah-Hartman
       [not found]   ` <CAEccXefJK9PE73B2njX-on0RWKZbiOk-ARwJe8V1xLHP1i0FAQ@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2015-11-08 21:43 UTC (permalink / raw)
  To: Egor Uleyskiy
  Cc: Greg Kroah-Hartman, Manohar Vanga, Martyn Welch,
	Trivial Patch Monkey, linux-kernel@vger.kernel.org

On Sun, Nov 8, 2015 at 10:39 PM, Egor Uleyskiy <egor.ulieiskii@gmail.com> wrote:
> From: Egor Uleyskiy <egor.ulieiskii@gmail.com>
>
> Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
> ---
>  drivers/staging/vme/devices/vme_pio2.h | 93 ++++++++++++++++------------------
>  1 file changed, 45 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/devices/vme_pio2.h
> index d5d94c4..29d7a58 100644
> --- a/drivers/staging/vme/devices/vme_pio2.h
> +++ b/drivers/staging/vme/devices/vme_pio2.h
> @@ -1,6 +1,8 @@
>  #ifndef _VME_PIO2_H_
>  #define _VME_PIO2_H_
>
> +#include <linux/bitops.h>
> +
>  #define PIO2_CARDS_MAX                 32
>
>  #define PIO2_VARIANT_LENGTH            5
> @@ -48,8 +50,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
>                                         PIO2_REGS_INT_MASK6,
>                                         PIO2_REGS_INT_MASK7 };
>
> -
> -
>  #define PIO2_REGS_CTRL                 0x18
>  #define PIO2_REGS_VME_VECTOR           0x19
>  #define PIO2_REGS_CNTR0                        0x20
> @@ -63,7 +63,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
>
>  #define PIO2_REGS_ID                   0x30
>
> -
>  /* PIO2_REGS_DATAx (0x0 - 0x3) */
>
>  static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
> @@ -71,38 +70,38 @@ static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
>                                         2, 2, 2, 2, 2, 2, 2, 2,
>                                         3, 3, 3, 3, 3, 3, 3, 3 };
>
> -#define PIO2_CHANNEL0_BIT              (1 << 0)
> -#define PIO2_CHANNEL1_BIT              (1 << 1)
> -#define PIO2_CHANNEL2_BIT              (1 << 2)
> -#define PIO2_CHANNEL3_BIT              (1 << 3)
> -#define PIO2_CHANNEL4_BIT              (1 << 4)
> -#define PIO2_CHANNEL5_BIT              (1 << 5)
> -#define PIO2_CHANNEL6_BIT              (1 << 6)
> -#define PIO2_CHANNEL7_BIT              (1 << 7)
> -#define PIO2_CHANNEL8_BIT              (1 << 0)
> -#define PIO2_CHANNEL9_BIT              (1 << 1)
> -#define PIO2_CHANNEL10_BIT             (1 << 2)
> -#define PIO2_CHANNEL11_BIT             (1 << 3)
> -#define PIO2_CHANNEL12_BIT             (1 << 4)
> -#define PIO2_CHANNEL13_BIT             (1 << 5)
> -#define PIO2_CHANNEL14_BIT             (1 << 6)
> -#define PIO2_CHANNEL15_BIT             (1 << 7)
> -#define PIO2_CHANNEL16_BIT             (1 << 0)
> -#define PIO2_CHANNEL17_BIT             (1 << 1)
> -#define PIO2_CHANNEL18_BIT             (1 << 2)
> -#define PIO2_CHANNEL19_BIT             (1 << 3)
> -#define PIO2_CHANNEL20_BIT             (1 << 4)
> -#define PIO2_CHANNEL21_BIT             (1 << 5)
> -#define PIO2_CHANNEL22_BIT             (1 << 6)
> -#define PIO2_CHANNEL23_BIT             (1 << 7)
> -#define PIO2_CHANNEL24_BIT             (1 << 0)
> -#define PIO2_CHANNEL25_BIT             (1 << 1)
> -#define PIO2_CHANNEL26_BIT             (1 << 2)
> -#define PIO2_CHANNEL27_BIT             (1 << 3)
> -#define PIO2_CHANNEL28_BIT             (1 << 4)
> -#define PIO2_CHANNEL29_BIT             (1 << 5)
> -#define PIO2_CHANNEL30_BIT             (1 << 6)
> -#define PIO2_CHANNEL31_BIT             (1 << 7)
> +#define PIO2_CHANNEL0_BIT              BIT(0)
> +#define PIO2_CHANNEL1_BIT              BIT(1)
> +#define PIO2_CHANNEL2_BIT              BIT(2)
> +#define PIO2_CHANNEL3_BIT              BIT(3)
> +#define PIO2_CHANNEL4_BIT              BIT(4)
> +#define PIO2_CHANNEL5_BIT              BIT(5)
> +#define PIO2_CHANNEL6_BIT              BIT(6)
> +#define PIO2_CHANNEL7_BIT              BIT(7)
> +#define PIO2_CHANNEL8_BIT              BIT(0)
> +#define PIO2_CHANNEL9_BIT              BIT(1)
> +#define PIO2_CHANNEL10_BIT             BIT(2)
> +#define PIO2_CHANNEL11_BIT             BIT(3)
> +#define PIO2_CHANNEL12_BIT             BIT(4)
> +#define PIO2_CHANNEL13_BIT             BIT(5)
> +#define PIO2_CHANNEL14_BIT             BIT(6)
> +#define PIO2_CHANNEL15_BIT             BIT(7)
> +#define PIO2_CHANNEL16_BIT             BIT(0)
> +#define PIO2_CHANNEL17_BIT             BIT(1)
> +#define PIO2_CHANNEL18_BIT             BIT(2)
> +#define PIO2_CHANNEL19_BIT             BIT(3)
> +#define PIO2_CHANNEL20_BIT             BIT(4)
> +#define PIO2_CHANNEL21_BIT             BIT(5)
> +#define PIO2_CHANNEL22_BIT             BIT(6)
> +#define PIO2_CHANNEL23_BIT             BIT(7)
> +#define PIO2_CHANNEL24_BIT             BIT(0)
> +#define PIO2_CHANNEL25_BIT             BIT(1)
> +#define PIO2_CHANNEL26_BIT             BIT(2)
> +#define PIO2_CHANNEL27_BIT             BIT(3)
> +#define PIO2_CHANNEL28_BIT             BIT(4)
> +#define PIO2_CHANNEL29_BIT             BIT(5)
> +#define PIO2_CHANNEL30_BIT             BIT(6)
> +#define PIO2_CHANNEL31_BIT             BIT(7)
>
>  static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
>                                         PIO2_CHANNEL2_BIT, PIO2_CHANNEL3_BIT,
> @@ -123,12 +122,12 @@ static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
>                                         };
>
>  /* PIO2_REGS_INT_STAT_CNTR (0xc) */
> -#define PIO2_COUNTER0                  (1 << 0)
> -#define PIO2_COUNTER1                  (1 << 1)
> -#define PIO2_COUNTER2                  (1 << 2)
> -#define PIO2_COUNTER3                  (1 << 3)
> -#define PIO2_COUNTER4                  (1 << 4)
> -#define PIO2_COUNTER5                  (1 << 5)
> +#define PIO2_COUNTER0                  BIT(0)
> +#define PIO2_COUNTER1                  BIT(1)
> +#define PIO2_COUNTER2                  BIT(2)
> +#define PIO2_COUNTER3                  BIT(3)
> +#define PIO2_COUNTER4                  BIT(4)
> +#define PIO2_COUNTER5                  BIT(5)
>
>  static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
>                                         PIO2_COUNTER2, PIO2_COUNTER3,
> @@ -136,8 +135,8 @@ static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
>
>  /* PIO2_REGS_CTRL (0x18) */
>  #define PIO2_VME_INT_MASK              0x7
> -#define PIO2_LED                       (1 << 6)
> -#define PIO2_LOOP                      (1 << 7)
> +#define PIO2_LED                       BIT(6)
> +#define PIO2_LOOP                      BIT(7)
>
>  /* PIO2_REGS_VME_VECTOR (0x19) */
>  #define PIO2_VME_VECTOR_SPUR           0x0
> @@ -182,7 +181,7 @@ static const int PIO2_CNTR_CTRL[6] = { PIO2_REGS_CTRL_WRD0,
>                                         PIO2_REGS_CTRL_WRD1 };
>
>  #define PIO2_CNTR_SC_DEV0              0
> -#define PIO2_CNTR_SC_DEV1              (1 << 6)
> +#define PIO2_CNTR_SC_DEV1              BIT(6)
>  #define PIO2_CNTR_SC_DEV2              (2 << 6)
>  #define PIO2_CNTR_SC_RDBACK            (3 << 6)

With the first parts which are an excellent clean up, this one makes
two styles out of one.
Greg, what would you suggest to do? For my opinion in such cases
direct values or previous syntax looks better.

>
> @@ -191,12 +190,12 @@ static const int PIO2_CNTR_SC_DEV[6] = { PIO2_CNTR_SC_DEV0, PIO2_CNTR_SC_DEV1,
>                                         PIO2_CNTR_SC_DEV1, PIO2_CNTR_SC_DEV2 };
>
>  #define PIO2_CNTR_RW_LATCH             0
> -#define PIO2_CNTR_RW_LSB               (1 << 4)
> +#define PIO2_CNTR_RW_LSB               BIT(4)
>  #define PIO2_CNTR_RW_MSB               (2 << 4)
>  #define PIO2_CNTR_RW_BOTH              (3 << 4)
>
>  #define PIO2_CNTR_MODE0                        0
> -#define PIO2_CNTR_MODE1                        (1 << 1)
> +#define PIO2_CNTR_MODE1                        BIT(1)
>  #define PIO2_CNTR_MODE2                        (2 << 1)
>  #define PIO2_CNTR_MODE3                        (3 << 1)
>  #define PIO2_CNTR_MODE4                        (4 << 1)
> @@ -204,8 +203,6 @@ static const int PIO2_CNTR_SC_DEV[6] = { PIO2_CNTR_SC_DEV0, PIO2_CNTR_SC_DEV1,
>
>  #define PIO2_CNTR_BCD                  1
>
> -
> -
>  enum pio2_bank_config { NOFIT, INPUT, OUTPUT, BOTH };
>  enum pio2_int_config { NONE = 0, LOW2HIGH = 1, HIGH2LOW = 2, EITHER = 4 };
>
> --
> 2.5.0
>
> --
> 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/



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n)
  2015-11-08 21:43 ` Andy Shevchenko
@ 2015-11-24 23:28   ` Greg Kroah-Hartman
       [not found]   ` <CAEccXefJK9PE73B2njX-on0RWKZbiOk-ARwJe8V1xLHP1i0FAQ@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2015-11-24 23:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Egor Uleyskiy, Manohar Vanga, Martyn Welch, Trivial Patch Monkey,
	linux-kernel@vger.kernel.org

On Sun, Nov 08, 2015 at 11:43:28PM +0200, Andy Shevchenko wrote:
> On Sun, Nov 8, 2015 at 10:39 PM, Egor Uleyskiy <egor.ulieiskii@gmail.com> wrote:
> > From: Egor Uleyskiy <egor.ulieiskii@gmail.com>
> >
> > Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
> > ---
> >  drivers/staging/vme/devices/vme_pio2.h | 93 ++++++++++++++++------------------
> >  1 file changed, 45 insertions(+), 48 deletions(-)
> >
> > diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/devices/vme_pio2.h
> > index d5d94c4..29d7a58 100644
> > --- a/drivers/staging/vme/devices/vme_pio2.h
> > +++ b/drivers/staging/vme/devices/vme_pio2.h
> > @@ -1,6 +1,8 @@
> >  #ifndef _VME_PIO2_H_
> >  #define _VME_PIO2_H_
> >
> > +#include <linux/bitops.h>
> > +
> >  #define PIO2_CARDS_MAX                 32
> >
> >  #define PIO2_VARIANT_LENGTH            5
> > @@ -48,8 +50,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
> >                                         PIO2_REGS_INT_MASK6,
> >                                         PIO2_REGS_INT_MASK7 };
> >
> > -
> > -
> >  #define PIO2_REGS_CTRL                 0x18
> >  #define PIO2_REGS_VME_VECTOR           0x19
> >  #define PIO2_REGS_CNTR0                        0x20
> > @@ -63,7 +63,6 @@ static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0,
> >
> >  #define PIO2_REGS_ID                   0x30
> >
> > -
> >  /* PIO2_REGS_DATAx (0x0 - 0x3) */
> >
> >  static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
> > @@ -71,38 +70,38 @@ static const int PIO2_CHANNEL_BANK[32] = { 0, 0, 0, 0, 0, 0, 0, 0,
> >                                         2, 2, 2, 2, 2, 2, 2, 2,
> >                                         3, 3, 3, 3, 3, 3, 3, 3 };
> >
> > -#define PIO2_CHANNEL0_BIT              (1 << 0)
> > -#define PIO2_CHANNEL1_BIT              (1 << 1)
> > -#define PIO2_CHANNEL2_BIT              (1 << 2)
> > -#define PIO2_CHANNEL3_BIT              (1 << 3)
> > -#define PIO2_CHANNEL4_BIT              (1 << 4)
> > -#define PIO2_CHANNEL5_BIT              (1 << 5)
> > -#define PIO2_CHANNEL6_BIT              (1 << 6)
> > -#define PIO2_CHANNEL7_BIT              (1 << 7)
> > -#define PIO2_CHANNEL8_BIT              (1 << 0)
> > -#define PIO2_CHANNEL9_BIT              (1 << 1)
> > -#define PIO2_CHANNEL10_BIT             (1 << 2)
> > -#define PIO2_CHANNEL11_BIT             (1 << 3)
> > -#define PIO2_CHANNEL12_BIT             (1 << 4)
> > -#define PIO2_CHANNEL13_BIT             (1 << 5)
> > -#define PIO2_CHANNEL14_BIT             (1 << 6)
> > -#define PIO2_CHANNEL15_BIT             (1 << 7)
> > -#define PIO2_CHANNEL16_BIT             (1 << 0)
> > -#define PIO2_CHANNEL17_BIT             (1 << 1)
> > -#define PIO2_CHANNEL18_BIT             (1 << 2)
> > -#define PIO2_CHANNEL19_BIT             (1 << 3)
> > -#define PIO2_CHANNEL20_BIT             (1 << 4)
> > -#define PIO2_CHANNEL21_BIT             (1 << 5)
> > -#define PIO2_CHANNEL22_BIT             (1 << 6)
> > -#define PIO2_CHANNEL23_BIT             (1 << 7)
> > -#define PIO2_CHANNEL24_BIT             (1 << 0)
> > -#define PIO2_CHANNEL25_BIT             (1 << 1)
> > -#define PIO2_CHANNEL26_BIT             (1 << 2)
> > -#define PIO2_CHANNEL27_BIT             (1 << 3)
> > -#define PIO2_CHANNEL28_BIT             (1 << 4)
> > -#define PIO2_CHANNEL29_BIT             (1 << 5)
> > -#define PIO2_CHANNEL30_BIT             (1 << 6)
> > -#define PIO2_CHANNEL31_BIT             (1 << 7)
> > +#define PIO2_CHANNEL0_BIT              BIT(0)
> > +#define PIO2_CHANNEL1_BIT              BIT(1)
> > +#define PIO2_CHANNEL2_BIT              BIT(2)
> > +#define PIO2_CHANNEL3_BIT              BIT(3)
> > +#define PIO2_CHANNEL4_BIT              BIT(4)
> > +#define PIO2_CHANNEL5_BIT              BIT(5)
> > +#define PIO2_CHANNEL6_BIT              BIT(6)
> > +#define PIO2_CHANNEL7_BIT              BIT(7)
> > +#define PIO2_CHANNEL8_BIT              BIT(0)
> > +#define PIO2_CHANNEL9_BIT              BIT(1)
> > +#define PIO2_CHANNEL10_BIT             BIT(2)
> > +#define PIO2_CHANNEL11_BIT             BIT(3)
> > +#define PIO2_CHANNEL12_BIT             BIT(4)
> > +#define PIO2_CHANNEL13_BIT             BIT(5)
> > +#define PIO2_CHANNEL14_BIT             BIT(6)
> > +#define PIO2_CHANNEL15_BIT             BIT(7)
> > +#define PIO2_CHANNEL16_BIT             BIT(0)
> > +#define PIO2_CHANNEL17_BIT             BIT(1)
> > +#define PIO2_CHANNEL18_BIT             BIT(2)
> > +#define PIO2_CHANNEL19_BIT             BIT(3)
> > +#define PIO2_CHANNEL20_BIT             BIT(4)
> > +#define PIO2_CHANNEL21_BIT             BIT(5)
> > +#define PIO2_CHANNEL22_BIT             BIT(6)
> > +#define PIO2_CHANNEL23_BIT             BIT(7)
> > +#define PIO2_CHANNEL24_BIT             BIT(0)
> > +#define PIO2_CHANNEL25_BIT             BIT(1)
> > +#define PIO2_CHANNEL26_BIT             BIT(2)
> > +#define PIO2_CHANNEL27_BIT             BIT(3)
> > +#define PIO2_CHANNEL28_BIT             BIT(4)
> > +#define PIO2_CHANNEL29_BIT             BIT(5)
> > +#define PIO2_CHANNEL30_BIT             BIT(6)
> > +#define PIO2_CHANNEL31_BIT             BIT(7)
> >
> >  static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
> >                                         PIO2_CHANNEL2_BIT, PIO2_CHANNEL3_BIT,
> > @@ -123,12 +122,12 @@ static const int PIO2_CHANNEL_BIT[32] = { PIO2_CHANNEL0_BIT, PIO2_CHANNEL1_BIT,
> >                                         };
> >
> >  /* PIO2_REGS_INT_STAT_CNTR (0xc) */
> > -#define PIO2_COUNTER0                  (1 << 0)
> > -#define PIO2_COUNTER1                  (1 << 1)
> > -#define PIO2_COUNTER2                  (1 << 2)
> > -#define PIO2_COUNTER3                  (1 << 3)
> > -#define PIO2_COUNTER4                  (1 << 4)
> > -#define PIO2_COUNTER5                  (1 << 5)
> > +#define PIO2_COUNTER0                  BIT(0)
> > +#define PIO2_COUNTER1                  BIT(1)
> > +#define PIO2_COUNTER2                  BIT(2)
> > +#define PIO2_COUNTER3                  BIT(3)
> > +#define PIO2_COUNTER4                  BIT(4)
> > +#define PIO2_COUNTER5                  BIT(5)
> >
> >  static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
> >                                         PIO2_COUNTER2, PIO2_COUNTER3,
> > @@ -136,8 +135,8 @@ static const int PIO2_COUNTER[6] = { PIO2_COUNTER0, PIO2_COUNTER1,
> >
> >  /* PIO2_REGS_CTRL (0x18) */
> >  #define PIO2_VME_INT_MASK              0x7
> > -#define PIO2_LED                       (1 << 6)
> > -#define PIO2_LOOP                      (1 << 7)
> > +#define PIO2_LED                       BIT(6)
> > +#define PIO2_LOOP                      BIT(7)
> >
> >  /* PIO2_REGS_VME_VECTOR (0x19) */
> >  #define PIO2_VME_VECTOR_SPUR           0x0
> > @@ -182,7 +181,7 @@ static const int PIO2_CNTR_CTRL[6] = { PIO2_REGS_CTRL_WRD0,
> >                                         PIO2_REGS_CTRL_WRD1 };
> >
> >  #define PIO2_CNTR_SC_DEV0              0
> > -#define PIO2_CNTR_SC_DEV1              (1 << 6)
> > +#define PIO2_CNTR_SC_DEV1              BIT(6)
> >  #define PIO2_CNTR_SC_DEV2              (2 << 6)
> >  #define PIO2_CNTR_SC_RDBACK            (3 << 6)
> 
> With the first parts which are an excellent clean up, this one makes
> two styles out of one.
> Greg, what would you suggest to do? For my opinion in such cases
> direct values or previous syntax looks better.

Yes, this should not be changed.

thanks,

greg k-h

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

* Re: [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n)
       [not found]   ` <CAEccXefJK9PE73B2njX-on0RWKZbiOk-ARwJe8V1xLHP1i0FAQ@mail.gmail.com>
@ 2015-11-24 23:28     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2015-11-24 23:28 UTC (permalink / raw)
  To: Martyn Welch
  Cc: Andy Shevchenko, Trivial Patch Monkey, LKML, Manohar Vanga,
	Egor Uleyskiy

On Mon, Nov 09, 2015 at 08:03:18AM +0000, Martyn Welch wrote:
> 
> On 8 Nov 2015 23:22, "Andy Shevchenko" <andy.shevchenko@gmail.com> wrote:
> >
> > On Sun, Nov 8, 2015 at 10:39 PM, Egor Uleyskiy <egor.ulieiskii@gmail.com>
> wrote:
> > > From: Egor Uleyskiy <egor.ulieiskii@gmail.com>
> > >
> > > Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
> > > ---
> > >  drivers/staging/vme/devices/vme_pio2.h | 93
> ++++++++++++++++------------------
> > >  1 file changed, 45 insertions(+), 48 deletions(-)
> > >
> > > diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/
> devices/vme_pio2.h
> > > index d5d94c4..29d7a58 100644
> > > --- a/drivers/staging/vme/devices/vme_pio2.h
> > > +++ b/drivers/staging/vme/devices/vme_pio2.h
> 
> <snip>
> 
> > > @@ -182,7 +181,7 @@ static const int PIO2_CNTR_CTRL[6] = {
> PIO2_REGS_CTRL_WRD0,
> > >                                         PIO2_REGS_CTRL_WRD1 };
> > >
> > >  #define PIO2_CNTR_SC_DEV0              0
> > > -#define PIO2_CNTR_SC_DEV1              (1 << 6)
> > > +#define PIO2_CNTR_SC_DEV1              BIT(6)
> > >  #define PIO2_CNTR_SC_DEV2              (2 << 6)
> > >  #define PIO2_CNTR_SC_RDBACK            (3 << 6)
> >
> > With the first parts which are an excellent clean up, this one makes
> > two styles out of one.
> > Greg, what would you suggest to do? For my opinion in such cases
> > direct values or previous syntax looks better.
> >
> 
> If BIT() can't be applied uniformly, I'm afraid I don't see the value in using
> it.
> 
> Has there been some general push to use BIT(x) rather than (1 << x) that I've
> missed?
> 
> I'm not sure how I feel about these macros, is there some advantage that I'm
> missing?

It's easier to understand for the most part, so yes, it is good to do
where it makes sense (hint, not for this last chunk...)

thanks,

greg k-h

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

end of thread, other threads:[~2015-11-24 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-08 20:39 [PATCH] drivers: staging: vme: Changed (1 << n) to BIT(n) Egor Uleyskiy
2015-11-08 21:43 ` Andy Shevchenko
2015-11-24 23:28   ` Greg Kroah-Hartman
     [not found]   ` <CAEccXefJK9PE73B2njX-on0RWKZbiOk-ARwJe8V1xLHP1i0FAQ@mail.gmail.com>
2015-11-24 23:28     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox