usb: typec: fusb302: Revert incorrect threaded irq fix

The fusb302 irq handler has been carefully optimized by Hans de Goede in
commit 207338ec5a27 ("usb: typec: fusb302: Improve suspend/resume
handling"). A recent 'fix' undid most of that work to avoid a virtio-gpio
driver bug.

This reverts the incorrect fix, since it is of very low quality. It
reverts the quirks from Hans change (and thus reintroduces the problems
fixed by Hans) while keeping the overhead from the original change.

The proper fix to support using fusb302 with an interrupt line provided
by virtio-gpio must be implemented in the virtio driver instead, which
should support disabling the IRQ from the fusb302 interrupt routine.

Cc: Hans de Goede <hansg@kernel.org>
Cc: Yongbo Zhang <giraffesnn123@gmail.com>
Fixes: 1c2d81bded19 ("usb: typec: fusb302: fix scheduling while atomic when using virtio-gpio")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20250818-fusb302-unthreaded-irq-v1-1-3a9a11a9f56f@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Sebastian Reichel and committed by Greg Kroah-Hartman 309b6341 70fb252a

+8 -4
+8 -4
drivers/usb/typec/tcpm/fusb302.c
··· 1485 struct fusb302_chip *chip = dev_id; 1486 unsigned long flags; 1487 1488 spin_lock_irqsave(&chip->irq_lock, flags); 1489 if (chip->irq_suspended) 1490 chip->irq_while_suspended = true; ··· 1630 } 1631 done: 1632 mutex_unlock(&chip->lock); 1633 } 1634 1635 static int init_gpio(struct fusb302_chip *chip) ··· 1755 goto destroy_workqueue; 1756 } 1757 1758 - ret = devm_request_threaded_irq(dev, chip->gpio_int_n_irq, 1759 - NULL, fusb302_irq_intn, 1760 - IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1761 - "fsc_interrupt_int_n", chip); 1762 if (ret < 0) { 1763 dev_err(dev, "cannot request IRQ for GPIO Int_N, ret=%d", ret); 1764 goto tcpm_unregister_port; ··· 1782 struct fusb302_chip *chip = i2c_get_clientdata(client); 1783 1784 disable_irq_wake(chip->gpio_int_n_irq); 1785 cancel_work_sync(&chip->irq_work); 1786 cancel_delayed_work_sync(&chip->bc_lvl_handler); 1787 tcpm_unregister_port(chip->tcpm_port);
··· 1485 struct fusb302_chip *chip = dev_id; 1486 unsigned long flags; 1487 1488 + /* Disable our level triggered IRQ until our irq_work has cleared it */ 1489 + disable_irq_nosync(chip->gpio_int_n_irq); 1490 + 1491 spin_lock_irqsave(&chip->irq_lock, flags); 1492 if (chip->irq_suspended) 1493 chip->irq_while_suspended = true; ··· 1627 } 1628 done: 1629 mutex_unlock(&chip->lock); 1630 + enable_irq(chip->gpio_int_n_irq); 1631 } 1632 1633 static int init_gpio(struct fusb302_chip *chip) ··· 1751 goto destroy_workqueue; 1752 } 1753 1754 + ret = request_irq(chip->gpio_int_n_irq, fusb302_irq_intn, 1755 + IRQF_ONESHOT | IRQF_TRIGGER_LOW, 1756 + "fsc_interrupt_int_n", chip); 1757 if (ret < 0) { 1758 dev_err(dev, "cannot request IRQ for GPIO Int_N, ret=%d", ret); 1759 goto tcpm_unregister_port; ··· 1779 struct fusb302_chip *chip = i2c_get_clientdata(client); 1780 1781 disable_irq_wake(chip->gpio_int_n_irq); 1782 + free_irq(chip->gpio_int_n_irq, chip); 1783 cancel_work_sync(&chip->irq_work); 1784 cancel_delayed_work_sync(&chip->bc_lvl_handler); 1785 tcpm_unregister_port(chip->tcpm_port);