Skip to content

Commit 6f8b796

Browse files
andy-shevKAGA-KOKO
authored andcommitted
genirq: Move irq_thread_fn() further up in the code
In a preparation to reuse irq_thread_fn() move it further up in the code. No functional change intended. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent e70140b commit 6f8b796

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

kernel/irq/manage.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,45 +1182,42 @@ static void irq_finalize_oneshot(struct irq_desc *desc,
11821182
}
11831183

11841184
/*
1185-
* Interrupts which are not explicitly requested as threaded
1186-
* interrupts rely on the implicit bh/preempt disable of the hard irq
1187-
* context. So we need to disable bh here to avoid deadlocks and other
1188-
* side effects.
1185+
* Interrupts explicitly requested as threaded interrupts want to be
1186+
* preemptible - many of them need to sleep and wait for slow busses to
1187+
* complete.
11891188
*/
1190-
static irqreturn_t
1191-
irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action)
1189+
static irqreturn_t irq_thread_fn(struct irq_desc *desc, struct irqaction *action)
11921190
{
1193-
irqreturn_t ret;
1191+
irqreturn_t ret = action->thread_fn(action->irq, action->dev_id);
11941192

1195-
local_bh_disable();
1196-
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1197-
local_irq_disable();
1198-
ret = action->thread_fn(action->irq, action->dev_id);
11991193
if (ret == IRQ_HANDLED)
12001194
atomic_inc(&desc->threads_handled);
12011195

12021196
irq_finalize_oneshot(desc, action);
1203-
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1204-
local_irq_enable();
1205-
local_bh_enable();
12061197
return ret;
12071198
}
12081199

12091200
/*
1210-
* Interrupts explicitly requested as threaded interrupts want to be
1211-
* preemptible - many of them need to sleep and wait for slow busses to
1212-
* complete.
1201+
* Interrupts which are not explicitly requested as threaded
1202+
* interrupts rely on the implicit bh/preempt disable of the hard irq
1203+
* context. So we need to disable bh here to avoid deadlocks and other
1204+
* side effects.
12131205
*/
1214-
static irqreturn_t irq_thread_fn(struct irq_desc *desc,
1215-
struct irqaction *action)
1206+
static irqreturn_t irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action)
12161207
{
12171208
irqreturn_t ret;
12181209

1210+
local_bh_disable();
1211+
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1212+
local_irq_disable();
12191213
ret = action->thread_fn(action->irq, action->dev_id);
12201214
if (ret == IRQ_HANDLED)
12211215
atomic_inc(&desc->threads_handled);
12221216

12231217
irq_finalize_oneshot(desc, action);
1218+
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1219+
local_irq_enable();
1220+
local_bh_enable();
12241221
return ret;
12251222
}
12261223

0 commit comments

Comments
 (0)