* [PATCH] m68k: mac: Remove forward declaration for mac_nmi_handler()
@ 2022-07-06 13:48 Geert Uytterhoeven
2022-07-07 2:11 ` Finn Thain
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2022-07-06 13:48 UTC (permalink / raw)
To: Finn Thain; +Cc: linux-m68k, linux-kernel, Geert Uytterhoeven
Move mac_nmi_handler() before its caller, so its forward declaration can
be dropped. While at it, make the function static, and absorb the
variable in_nmi, which is only used inside the function.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
To be queued in the m68k tree for v5.20.
arch/m68k/mac/macints.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index e3575388cd05a8cc..883e48230f87a187 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -129,8 +129,6 @@
extern void show_registers(struct pt_regs *);
-irqreturn_t mac_nmi_handler(int, void *);
-
static unsigned int mac_irq_startup(struct irq_data *);
static void mac_irq_shutdown(struct irq_data *);
@@ -142,6 +140,21 @@ static struct irq_chip mac_irq_chip = {
.irq_shutdown = mac_irq_shutdown,
};
+static irqreturn_t mac_nmi_handler(int irq, void *dev_id)
+{
+ static volatile int in_nmi;
+
+ if (in_nmi)
+ return IRQ_HANDLED;
+ in_nmi = 1;
+
+ pr_info("Non-Maskable Interrupt\n");
+ show_registers(get_irq_regs());
+
+ in_nmi = 0;
+ return IRQ_HANDLED;
+}
+
void __init mac_init_IRQ(void)
{
m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
@@ -254,18 +267,3 @@ static void mac_irq_shutdown(struct irq_data *data)
else
mac_irq_disable(data);
}
-
-static volatile int in_nmi;
-
-irqreturn_t mac_nmi_handler(int irq, void *dev_id)
-{
- if (in_nmi)
- return IRQ_HANDLED;
- in_nmi = 1;
-
- pr_info("Non-Maskable Interrupt\n");
- show_registers(get_irq_regs());
-
- in_nmi = 0;
- return IRQ_HANDLED;
-}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] m68k: mac: Remove forward declaration for mac_nmi_handler()
2022-07-06 13:48 [PATCH] m68k: mac: Remove forward declaration for mac_nmi_handler() Geert Uytterhoeven
@ 2022-07-07 2:11 ` Finn Thain
0 siblings, 0 replies; 2+ messages in thread
From: Finn Thain @ 2022-07-07 2:11 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
On Wed, 6 Jul 2022, Geert Uytterhoeven wrote:
> Move mac_nmi_handler() before its caller, so its forward declaration can
> be dropped. While at it, make the function static, and absorb the
> variable in_nmi, which is only used inside the function.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Finn Thain <fthain@linux-m68k.org>
BTW, this code needs the race condition fixed but I think that would
require CONFIG_ADVANCED && CONFIG_RMW_INSNS, and arch/m68k/Kconfig.cpu
advises against it. There is some discussion of Amiga and Atari in
relation to RMW and it's claimed "it is also said to destabilize other
machines" which may be true but doesn't help much.
> ---
> To be queued in the m68k tree for v5.20.
>
> arch/m68k/mac/macints.c | 32 +++++++++++++++-----------------
> 1 file changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
> index e3575388cd05a8cc..883e48230f87a187 100644
> --- a/arch/m68k/mac/macints.c
> +++ b/arch/m68k/mac/macints.c
> @@ -129,8 +129,6 @@
>
> extern void show_registers(struct pt_regs *);
>
> -irqreturn_t mac_nmi_handler(int, void *);
> -
> static unsigned int mac_irq_startup(struct irq_data *);
> static void mac_irq_shutdown(struct irq_data *);
>
> @@ -142,6 +140,21 @@ static struct irq_chip mac_irq_chip = {
> .irq_shutdown = mac_irq_shutdown,
> };
>
> +static irqreturn_t mac_nmi_handler(int irq, void *dev_id)
> +{
> + static volatile int in_nmi;
> +
> + if (in_nmi)
> + return IRQ_HANDLED;
> + in_nmi = 1;
> +
> + pr_info("Non-Maskable Interrupt\n");
> + show_registers(get_irq_regs());
> +
> + in_nmi = 0;
> + return IRQ_HANDLED;
> +}
> +
> void __init mac_init_IRQ(void)
> {
> m68k_setup_irq_controller(&mac_irq_chip, handle_simple_irq, IRQ_USER,
> @@ -254,18 +267,3 @@ static void mac_irq_shutdown(struct irq_data *data)
> else
> mac_irq_disable(data);
> }
> -
> -static volatile int in_nmi;
> -
> -irqreturn_t mac_nmi_handler(int irq, void *dev_id)
> -{
> - if (in_nmi)
> - return IRQ_HANDLED;
> - in_nmi = 1;
> -
> - pr_info("Non-Maskable Interrupt\n");
> - show_registers(get_irq_regs());
> -
> - in_nmi = 0;
> - return IRQ_HANDLED;
> -}
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-07 2:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:48 [PATCH] m68k: mac: Remove forward declaration for mac_nmi_handler() Geert Uytterhoeven
2022-07-07 2:11 ` Finn Thain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®