Skip to content

Commit fa870e0

Browse files
committed
genirq/chip: Rework irq_set_irq_type()
Use the new guards to get and lock the interrupt descriptor and tidy up the code. Fixup the kernel doc comment while at it. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 46ff4d1 commit fa870e0

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

kernel/irq/chip.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,15 @@ int irq_set_chip(unsigned int irq, const struct irq_chip *chip)
5454
EXPORT_SYMBOL(irq_set_chip);
5555

5656
/**
57-
* irq_set_irq_type - set the irq trigger type for an irq
58-
* @irq: irq number
59-
* @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
57+
* irq_set_irq_type - set the irq trigger type for an irq
58+
* @irq: irq number
59+
* @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
6060
*/
6161
int irq_set_irq_type(unsigned int irq, unsigned int type)
6262
{
63-
unsigned long flags;
64-
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
65-
int ret = 0;
66-
67-
if (!desc)
68-
return -EINVAL;
69-
70-
ret = __irq_set_trigger(desc, type);
71-
irq_put_desc_busunlock(desc, flags);
72-
return ret;
63+
scoped_irqdesc_get_and_buslock(irq, IRQ_GET_DESC_CHECK_GLOBAL)
64+
return __irq_set_trigger(scoped_irqdesc, type);
65+
return -EINVAL;
7366
}
7467
EXPORT_SYMBOL(irq_set_irq_type);
7568

0 commit comments

Comments
 (0)