[PATCH v1] m68k: apollo: Remove a duplicate assignment in dn_timer_int

Minjie Du posted 1 patch 2 years, 7 months ago
arch/m68k/apollo/config.c | 1 -
1 file changed, 1 deletion(-)
[PATCH v1] m68k: apollo: Remove a duplicate assignment in dn_timer_int
Posted by Minjie Du 2 years, 7 months ago
Delete a duplicate statement from this function implementation.

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 arch/m68k/apollo/config.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 42a8b8e2b..5645d2018 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -173,7 +173,6 @@ irqreturn_t dn_timer_int(int irq, void *dev_id)
 	legacy_timer_tick(1);
 	timer_heartbeat();
 
-	x = *(volatile unsigned char *)(apollo_timer + 3);
 	x = *(volatile unsigned char *)(apollo_timer + 5);
 
 	return IRQ_HANDLED;
-- 
2.39.0
Re: [PATCH v1] m68k: apollo: Remove a duplicate assignment in dn_timer_int
Posted by Geert Uytterhoeven 2 years, 7 months ago
Hi Minjie,

On Wed, Jul 5, 2023 at 2:13 PM Minjie Du <duminjie@vivo.com> wrote:
> Delete a duplicate statement from this function implementation.
>
> Signed-off-by: Minjie Du <duminjie@vivo.com>

Thanks for your patch, which is presumably untested on real hardware?

> --- a/arch/m68k/apollo/config.c
> +++ b/arch/m68k/apollo/config.c
> @@ -173,7 +173,6 @@ irqreturn_t dn_timer_int(int irq, void *dev_id)
>         legacy_timer_tick(1);
>         timer_heartbeat();
>
> -       x = *(volatile unsigned char *)(apollo_timer + 3);
>         x = *(volatile unsigned char *)(apollo_timer + 5);

This is intentional: the use of volatile makes sure the registers at
offsets 3 and 5 are read, in that order.

I agree this could be made more obvious by converting the code to the
more modern READ_ONCE() helper.
But please do not send such a patch without testing.

>
>         return IRQ_HANDLED;

NAKed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH v1] m68k: apollo: Remove a duplicate assignment in dn_timer_int
Posted by Andreas Schwab 2 years, 7 months ago
On Jul 05 2023, Minjie Du wrote:

> Delete a duplicate statement from this function implementation.
>
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  arch/m68k/apollo/config.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
> index 42a8b8e2b..5645d2018 100644
> --- a/arch/m68k/apollo/config.c
> +++ b/arch/m68k/apollo/config.c
> @@ -173,7 +173,6 @@ irqreturn_t dn_timer_int(int irq, void *dev_id)
>  	legacy_timer_tick(1);
>  	timer_heartbeat();
>  
> -	x = *(volatile unsigned char *)(apollo_timer + 3);
>  	x = *(volatile unsigned char *)(apollo_timer + 5);

They are not the same: 3 != 5.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."