@@ -207,20 +207,19 @@ __irq_startup_managed(struct irq_desc *desc, struct cpumask *aff, bool force)
207207 * Catch code which fiddles with enable_irq() on a managed
208208 * and potentially shutdown IRQ. Chained interrupt
209209 * installment or irq auto probing should not happen on
210- * managed irqs either. Emit a warning, break the affinity
211- * and start it up as a normal interrupt.
210+ * managed irqs either.
212211 */
213212 if (WARN_ON_ONCE (force ))
214- return IRQ_STARTUP_NORMAL ;
213+ return IRQ_STARTUP_ABORT ;
215214 /*
216215 * The interrupt was requested, but there is no online CPU
217216 * in it's affinity mask. Put it into managed shutdown
218217 * state and let the cpu hotplug mechanism start it up once
219218 * a CPU in the mask becomes available.
220219 */
221- irqd_set_managed_shutdown (d );
222220 return IRQ_STARTUP_ABORT ;
223221 }
222+ irq_domain_activate_irq (d );
224223 return IRQ_STARTUP_MANAGED ;
225224}
226225#else
@@ -236,7 +235,9 @@ static int __irq_startup(struct irq_desc *desc)
236235 struct irq_data * d = irq_desc_get_irq_data (desc );
237236 int ret = 0 ;
238237
239- irq_domain_activate_irq (d );
238+ /* Warn if this interrupt is not activated but try nevertheless */
239+ WARN_ON_ONCE (!irqd_is_activated (d ));
240+
240241 if (d -> chip -> irq_startup ) {
241242 ret = d -> chip -> irq_startup (d );
242243 irq_state_clr_disabled (desc );
@@ -269,6 +270,7 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force)
269270 irq_set_affinity_locked (d , aff , false);
270271 break ;
271272 case IRQ_STARTUP_ABORT :
273+ irqd_set_managed_shutdown (d );
272274 return 0 ;
273275 }
274276 }
@@ -278,6 +280,22 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force)
278280 return ret ;
279281}
280282
283+ int irq_activate (struct irq_desc * desc )
284+ {
285+ struct irq_data * d = irq_desc_get_irq_data (desc );
286+
287+ if (!irqd_affinity_is_managed (d ))
288+ irq_domain_activate_irq (d );
289+ return 0 ;
290+ }
291+
292+ void irq_activate_and_startup (struct irq_desc * desc , bool resend )
293+ {
294+ if (WARN_ON (irq_activate (desc )))
295+ return ;
296+ irq_startup (desc , resend , IRQ_START_FORCE );
297+ }
298+
281299static void __irq_disable (struct irq_desc * desc , bool mask );
282300
283301void irq_shutdown (struct irq_desc * desc )
@@ -953,7 +971,7 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
953971 irq_settings_set_norequest (desc );
954972 irq_settings_set_nothread (desc );
955973 desc -> action = & chained_action ;
956- irq_startup (desc , IRQ_RESEND , IRQ_START_FORCE );
974+ irq_activate_and_startup (desc , IRQ_RESEND );
957975 }
958976}
959977
0 commit comments