Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: omap: remove IRQ_NOAUTOEN used with shared irq

IRQ_NOAUTOEN cannot be used with shared IRQs, since commit 04c848d39879
("genirq: Warn when IRQ_NOAUTOEN is used with shared interrupts") and
kernel now throws a warn dump. But OMAP DWC3 driver uses this flag. As
per commit 12a7f17fac5b ("usb: dwc3: omap: fix race of pm runtime with
irq handler in probe") that introduced this flag, PM runtime can race
with IRQ handler when deferred probing happens due to extcon,
therefore IRQ_NOAUTOEN needs to be set so that irq is not enabled until
extcon is registered.

Remove setting of IRQ_NOAUTOEN and move the registration of
shared irq to a point after dwc3_omap_extcon_register() and
of_platform_populate(). This avoids possibility of probe deferring and
above said race condition.

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Vignesh R and committed by
Felipe Balbi
ee249b45 541768b0

+8 -10
+8 -10
drivers/usb/dwc3/dwc3-omap.c
··· 512 512 513 513 /* check the DMA Status */ 514 514 reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); 515 - irq_set_status_flags(omap->irq, IRQ_NOAUTOEN); 516 - ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, 517 - dwc3_omap_interrupt_thread, IRQF_SHARED, 518 - "dwc3-omap", omap); 519 - if (ret) { 520 - dev_err(dev, "failed to request IRQ #%d --> %d\n", 521 - omap->irq, ret); 522 - goto err1; 523 - } 524 515 525 516 ret = dwc3_omap_extcon_register(omap); 526 517 if (ret < 0) ··· 523 532 goto err1; 524 533 } 525 534 535 + ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt, 536 + dwc3_omap_interrupt_thread, IRQF_SHARED, 537 + "dwc3-omap", omap); 538 + if (ret) { 539 + dev_err(dev, "failed to request IRQ #%d --> %d\n", 540 + omap->irq, ret); 541 + goto err1; 542 + } 526 543 dwc3_omap_enable_irqs(omap); 527 - enable_irq(omap->irq); 528 544 return 0; 529 545 530 546 err1: