mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
genirq: Reuse irq_is_nmi()
Move irq_is_nmi() to the internal header file and reuse it all over the place. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240423024037.3331215-1-ruanjinjie@huawei.com
This commit is contained in:
parent
88d724e230
commit
6678ae1918
@ -280,6 +280,11 @@ static inline int irq_desc_is_chained(struct irq_desc *desc)
|
||||
return (desc->action && desc->action == &chained_action);
|
||||
}
|
||||
|
||||
static inline bool irq_is_nmi(struct irq_desc *desc)
|
||||
{
|
||||
return desc->istate & IRQS_NMI;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
bool irq_pm_check_wakeup(struct irq_desc *desc);
|
||||
void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action);
|
||||
|
@ -965,11 +965,6 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
|
||||
return desc && desc->kstat_irqs ? per_cpu(desc->kstat_irqs->cnt, cpu) : 0;
|
||||
}
|
||||
|
||||
static bool irq_is_nmi(struct irq_desc *desc)
|
||||
{
|
||||
return desc->istate & IRQS_NMI;
|
||||
}
|
||||
|
||||
unsigned int kstat_irqs_desc(struct irq_desc *desc, const struct cpumask *cpumask)
|
||||
{
|
||||
unsigned int sum = 0;
|
||||
|
@ -564,7 +564,7 @@ irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
|
||||
/* The release function is promised process context */
|
||||
might_sleep();
|
||||
|
||||
if (!desc || desc->istate & IRQS_NMI)
|
||||
if (!desc || irq_is_nmi(desc))
|
||||
return -EINVAL;
|
||||
|
||||
/* Complete initialisation of *notify */
|
||||
@ -902,7 +902,7 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
|
||||
return -EINVAL;
|
||||
|
||||
/* Don't use NMIs as wake up interrupts please */
|
||||
if (desc->istate & IRQS_NMI) {
|
||||
if (irq_is_nmi(desc)) {
|
||||
ret = -EINVAL;
|
||||
goto out_unlock;
|
||||
}
|
||||
@ -1628,7 +1628,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
|
||||
*/
|
||||
unsigned int oldtype;
|
||||
|
||||
if (desc->istate & IRQS_NMI) {
|
||||
if (irq_is_nmi(desc)) {
|
||||
pr_err("Invalid attempt to share NMI for %s (irq %d) on irqchip %s.\n",
|
||||
new->name, irq, desc->irq_data.chip->name);
|
||||
ret = -EINVAL;
|
||||
@ -2081,7 +2081,7 @@ const void *free_nmi(unsigned int irq, void *dev_id)
|
||||
unsigned long flags;
|
||||
const void *devname;
|
||||
|
||||
if (!desc || WARN_ON(!(desc->istate & IRQS_NMI)))
|
||||
if (!desc || WARN_ON(!irq_is_nmi(desc)))
|
||||
return NULL;
|
||||
|
||||
if (WARN_ON(irq_settings_is_per_cpu_devid(desc)))
|
||||
@ -2547,7 +2547,7 @@ void free_percpu_nmi(unsigned int irq, void __percpu *dev_id)
|
||||
if (!desc || !irq_settings_is_per_cpu_devid(desc))
|
||||
return;
|
||||
|
||||
if (WARN_ON(!(desc->istate & IRQS_NMI)))
|
||||
if (WARN_ON(!irq_is_nmi(desc)))
|
||||
return;
|
||||
|
||||
kfree(__free_percpu_irq(irq, dev_id));
|
||||
@ -2683,7 +2683,7 @@ int request_percpu_nmi(unsigned int irq, irq_handler_t handler,
|
||||
return -EINVAL;
|
||||
|
||||
/* The line cannot already be NMI */
|
||||
if (desc->istate & IRQS_NMI)
|
||||
if (irq_is_nmi(desc))
|
||||
return -EINVAL;
|
||||
|
||||
action = kzalloc(sizeof(struct irqaction), GFP_KERNEL);
|
||||
@ -2744,7 +2744,7 @@ int prepare_percpu_nmi(unsigned int irq)
|
||||
if (!desc)
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN(!(desc->istate & IRQS_NMI),
|
||||
if (WARN(!irq_is_nmi(desc),
|
||||
KERN_ERR "prepare_percpu_nmi called for a non-NMI interrupt: irq %u\n",
|
||||
irq)) {
|
||||
ret = -EINVAL;
|
||||
@ -2786,7 +2786,7 @@ void teardown_percpu_nmi(unsigned int irq)
|
||||
if (!desc)
|
||||
return;
|
||||
|
||||
if (WARN_ON(!(desc->istate & IRQS_NMI)))
|
||||
if (WARN_ON(!irq_is_nmi(desc)))
|
||||
goto out;
|
||||
|
||||
irq_nmi_teardown(desc);
|
||||
|
@ -190,7 +190,7 @@ int irq_inject_interrupt(unsigned int irq)
|
||||
* - not NMI type
|
||||
* - activated
|
||||
*/
|
||||
if ((desc->istate & IRQS_NMI) || !irqd_is_activated(&desc->irq_data))
|
||||
if (irq_is_nmi(desc) || !irqd_is_activated(&desc->irq_data))
|
||||
err = -EINVAL;
|
||||
else
|
||||
err = check_irq_resend(desc, true);
|
||||
|
Loading…
Reference in New Issue
Block a user