Skip to content

Commit 321a0fd

Browse files
committed
genirq/chip: Rework irq_set_handler_data()
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 fa870e0 commit 321a0fd

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

kernel/irq/chip.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,19 @@ int irq_set_irq_type(unsigned int irq, unsigned int type)
6767
EXPORT_SYMBOL(irq_set_irq_type);
6868

6969
/**
70-
* irq_set_handler_data - set irq handler data for an irq
71-
* @irq: Interrupt number
72-
* @data: Pointer to interrupt specific data
70+
* irq_set_handler_data - set irq handler data for an irq
71+
* @irq: Interrupt number
72+
* @data: Pointer to interrupt specific data
7373
*
74-
* Set the hardware irq controller data for an irq
74+
* Set the hardware irq controller data for an irq
7575
*/
7676
int irq_set_handler_data(unsigned int irq, void *data)
7777
{
78-
unsigned long flags;
79-
struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
80-
81-
if (!desc)
82-
return -EINVAL;
83-
desc->irq_common_data.handler_data = data;
84-
irq_put_desc_unlock(desc, flags);
85-
return 0;
78+
scoped_irqdesc_get_and_lock(irq, 0) {
79+
scoped_irqdesc->irq_common_data.handler_data = data;
80+
return 0;
81+
}
82+
return -EINVAL;
8683
}
8784
EXPORT_SYMBOL(irq_set_handler_data);
8885

0 commit comments

Comments
 (0)