genirq/manage: Rework irq_set_irqchip_state()
Use the new guards to get and lock the interrupt descriptor and tidy up the code. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/20250429065422.670808288@linutronix.depull/1250/head
parent
782249a997
commit
193879e28b
|
|
@ -2703,39 +2703,26 @@ EXPORT_SYMBOL_GPL(irq_get_irqchip_state);
|
||||||
*/
|
*/
|
||||||
int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool val)
|
int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool val)
|
||||||
{
|
{
|
||||||
struct irq_desc *desc;
|
scoped_irqdesc_get_and_buslock(irq, 0) {
|
||||||
struct irq_data *data;
|
struct irq_data *data = irq_desc_get_irq_data(scoped_irqdesc);
|
||||||
struct irq_chip *chip;
|
struct irq_chip *chip;
|
||||||
unsigned long flags;
|
|
||||||
int err = -EINVAL;
|
|
||||||
|
|
||||||
desc = irq_get_desc_buslock(irq, &flags, 0);
|
do {
|
||||||
if (!desc)
|
chip = irq_data_get_irq_chip(data);
|
||||||
return err;
|
|
||||||
|
|
||||||
data = irq_desc_get_irq_data(desc);
|
if (WARN_ON_ONCE(!chip))
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
do {
|
if (chip->irq_set_irqchip_state)
|
||||||
chip = irq_data_get_irq_chip(data);
|
break;
|
||||||
if (WARN_ON_ONCE(!chip)) {
|
|
||||||
err = -ENODEV;
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
if (chip->irq_set_irqchip_state)
|
|
||||||
break;
|
|
||||||
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
|
|
||||||
data = data->parent_data;
|
|
||||||
#else
|
|
||||||
data = NULL;
|
|
||||||
#endif
|
|
||||||
} while (data);
|
|
||||||
|
|
||||||
if (data)
|
data = irqd_get_parent_data(data);
|
||||||
err = chip->irq_set_irqchip_state(data, which, val);
|
} while (data);
|
||||||
|
|
||||||
out_unlock:
|
if (data)
|
||||||
irq_put_desc_busunlock(desc, flags);
|
return chip->irq_set_irqchip_state(data, which, val);
|
||||||
return err;
|
}
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(irq_set_irqchip_state);
|
EXPORT_SYMBOL_GPL(irq_set_irqchip_state);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue