Skip to content

Commit 5cd05f3

Browse files
committed
genirq/chip: Rework irq_set_handler() variants
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 b3801dd commit 5cd05f3

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

kernel/irq/chip.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -941,35 +941,23 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
941941
}
942942
}
943943

944-
void
945-
__irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
946-
const char *name)
944+
void __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
945+
const char *name)
947946
{
948-
unsigned long flags;
949-
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, 0);
950-
951-
if (!desc)
952-
return;
953-
954-
__irq_do_set_handler(desc, handle, is_chained, name);
955-
irq_put_desc_busunlock(desc, flags);
947+
scoped_irqdesc_get_and_lock(irq, 0)
948+
__irq_do_set_handler(scoped_irqdesc, handle, is_chained, name);
956949
}
957950
EXPORT_SYMBOL_GPL(__irq_set_handler);
958951

959-
void
960-
irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
961-
void *data)
952+
void irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
953+
void *data)
962954
{
963-
unsigned long flags;
964-
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, 0);
955+
scoped_irqdesc_get_and_buslock(irq, 0) {
956+
struct irq_desc *desc = scoped_irqdesc;
965957

966-
if (!desc)
967-
return;
968-
969-
desc->irq_common_data.handler_data = data;
970-
__irq_do_set_handler(desc, handle, 1, NULL);
971-
972-
irq_put_desc_busunlock(desc, flags);
958+
desc->irq_common_data.handler_data = data;
959+
__irq_do_set_handler(desc, handle, 1, NULL);
960+
}
973961
}
974962
EXPORT_SYMBOL_GPL(irq_set_chained_handler_and_data);
975963

0 commit comments

Comments
 (0)