diff mbox

[U-Boot,5/8] timer: altera_timer: use BIT macro

Message ID 1446189498-26549-5-git-send-email-thomas@wytron.com.tw
State Accepted, archived
Delegated to: Thomas Chou
Headers show

Commit Message

Thomas Chou Oct. 30, 2015, 7:18 a.m. UTC
Replace numerical bit shift with BIT macro
in altera_timer

:%s/(1 << nr)/BIT(nr)/g
where nr = 0, 1, 2 .... 31

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 drivers/timer/altera_timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jagan Teki Oct. 30, 2015, 8:13 a.m. UTC | #1
On 30 October 2015 at 12:48, Thomas Chou <thomas@wytron.com.tw> wrote:
> Replace numerical bit shift with BIT macro
> in altera_timer
>
> :%s/(1 << nr)/BIT(nr)/g
> where nr = 0, 1, 2 .... 31
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---

Reviewed-by: Jagan Teki <jteki@openedev.com>

>  drivers/timer/altera_timer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
> index 2ef9ad6..288357c 100644
> --- a/drivers/timer/altera_timer.c
> +++ b/drivers/timer/altera_timer.c
> @@ -31,9 +31,9 @@ struct altera_timer_platdata {
>  };
>
>  /* control register */
> -#define ALTERA_TIMER_CONT      (1 << 1)        /* Continuous mode */
> -#define ALTERA_TIMER_START     (1 << 2)        /* Start timer */
> -#define ALTERA_TIMER_STOP      (1 << 3)        /* Stop timer */
> +#define ALTERA_TIMER_CONT      BIT(1)  /* Continuous mode */
> +#define ALTERA_TIMER_START     BIT(2)  /* Start timer */
> +#define ALTERA_TIMER_STOP      BIT(3)  /* Stop timer */
>
>  static int altera_timer_get_count(struct udevice *dev, unsigned long *count)
>  {
> --
> 2.5.0

thanks!
Thomas Chou Nov. 3, 2015, 5:21 a.m. UTC | #2
On 2015年10月30日 15:18, Thomas Chou wrote:
> Replace numerical bit shift with BIT macro
> in altera_timer
>
> :%s/(1 << nr)/BIT(nr)/g
> where nr = 0, 1, 2 .... 31
>
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> ---
>   drivers/timer/altera_timer.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>

Applied to u-boot-nios.

> diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
> index 2ef9ad6..288357c 100644
> --- a/drivers/timer/altera_timer.c
> +++ b/drivers/timer/altera_timer.c
> @@ -31,9 +31,9 @@ struct altera_timer_platdata {
>   };
>
>   /* control register */
> -#define ALTERA_TIMER_CONT	(1 << 1)	/* Continuous mode */
> -#define ALTERA_TIMER_START	(1 << 2)	/* Start timer */
> -#define ALTERA_TIMER_STOP	(1 << 3)	/* Stop timer */
> +#define ALTERA_TIMER_CONT	BIT(1)	/* Continuous mode */
> +#define ALTERA_TIMER_START	BIT(2)	/* Start timer */
> +#define ALTERA_TIMER_STOP	BIT(3)	/* Stop timer */
>
>   static int altera_timer_get_count(struct udevice *dev, unsigned long *count)
>   {
>
diff mbox

Patch

diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
index 2ef9ad6..288357c 100644
--- a/drivers/timer/altera_timer.c
+++ b/drivers/timer/altera_timer.c
@@ -31,9 +31,9 @@  struct altera_timer_platdata {
 };
 
 /* control register */
-#define ALTERA_TIMER_CONT	(1 << 1)	/* Continuous mode */
-#define ALTERA_TIMER_START	(1 << 2)	/* Start timer */
-#define ALTERA_TIMER_STOP	(1 << 3)	/* Stop timer */
+#define ALTERA_TIMER_CONT	BIT(1)	/* Continuous mode */
+#define ALTERA_TIMER_START	BIT(2)	/* Start timer */
+#define ALTERA_TIMER_STOP	BIT(3)	/* Stop timer */
 
 static int altera_timer_get_count(struct udevice *dev, unsigned long *count)
 {