Skip to content

Commit 972f90f

Browse files
inochisaRevySR
authored andcommitted
FROMLIST: genirq: Add irq_chip_(startup/shutdown)_parent
Add helper irq_chip_startup_parent and irq_chip_shutdown_parent. The helper implement the default behavior in case irq_startup or irq_shutdown is not implemented for the parent interrupt chip, which will fallback to irq_chip_enable_parent or irq_chip_disable_parent if not available. Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Inochi Amaoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Han Gao <[email protected]>
1 parent 8fc1922 commit 972f90f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

include/linux/irq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ extern int irq_chip_set_parent_state(struct irq_data *data,
669669
extern int irq_chip_get_parent_state(struct irq_data *data,
670670
enum irqchip_irq_state which,
671671
bool *state);
672+
extern void irq_chip_shutdown_parent(struct irq_data *data);
673+
extern unsigned int irq_chip_startup_parent(struct irq_data *data);
672674
extern void irq_chip_enable_parent(struct irq_data *data);
673675
extern void irq_chip_disable_parent(struct irq_data *data);
674676
extern void irq_chip_ack_parent(struct irq_data *data);

kernel/irq/chip.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,43 @@ int irq_chip_get_parent_state(struct irq_data *data,
12011201
}
12021202
EXPORT_SYMBOL_GPL(irq_chip_get_parent_state);
12031203

1204+
/**
1205+
* irq_chip_shutdown_parent - Shutdown the parent interrupt
1206+
* @data: Pointer to interrupt specific data
1207+
*
1208+
* Invokes the irq_shutdown() callback of the parent if available or falls
1209+
* back to irq_chip_disable_parent().
1210+
*/
1211+
void irq_chip_shutdown_parent(struct irq_data *data)
1212+
{
1213+
struct irq_data *parent = data->parent_data;
1214+
1215+
if (parent->chip->irq_shutdown)
1216+
parent->chip->irq_shutdown(parent);
1217+
else
1218+
irq_chip_disable_parent(data);
1219+
}
1220+
EXPORT_SYMBOL_GPL(irq_chip_shutdown_parent);
1221+
1222+
/**
1223+
* irq_chip_startup_parent - Startup the parent interrupt
1224+
* @data: Pointer to interrupt specific data
1225+
*
1226+
* Invokes the irq_startup() callback of the parent if available or falls
1227+
* back to irq_chip_enable_parent().
1228+
*/
1229+
unsigned int irq_chip_startup_parent(struct irq_data *data)
1230+
{
1231+
struct irq_data *parent = data->parent_data;
1232+
1233+
if (parent->chip->irq_startup)
1234+
return parent->chip->irq_startup(parent);
1235+
1236+
irq_chip_enable_parent(data);
1237+
return 0;
1238+
}
1239+
EXPORT_SYMBOL_GPL(irq_chip_startup_parent);
1240+
12041241
/**
12051242
* irq_chip_enable_parent - Enable the parent interrupt (defaults to unmask if
12061243
* NULL)

0 commit comments

Comments
 (0)