Skip to contentSkip to conversation

usb: host: Disable controller wakeup on removal

PATCH In review Myeonghun Pak 2 participants 5 messages Sep 13 – Sep 14

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover usb: host: Disable controller wakeup on removal

These three independent patches balance the controller wakeup enable in the generic EHCI, generic OHCI and Exynos OHCI drivers. Each disables controller wakeup after usb_remove_hcd(), before releasing the remaining driver-owned resources. No shared USB core behavior is changed.

For generic EHCI, a wakeup-capable ACPI companion provides the capability setting through acpi_bind_one(). For the two OHCI drivers, ohci_run() sets controller capability when OHCI_CTRL_RWC is present. If probe successfully enables wakeup, the attached source otherwise survives ordinary driver unbind because the controller device itself remains registered.

This issue was identified during our ongoing static-analysis research while reviewing kernel code. The patches and explanations were prepared with LLM assistance.

Compile-tested only; no hardware runtime testing was performed.

Myeonghun Pak (3):
usb: ehci-platform: Disable controller wakeup on removal
usb: ohci-platform: Disable controller wakeup on removal
usb: ohci-exynos: Disable controller wakeup on removal

 drivers/usb/host/ehci-platform.c | 1 +
 drivers/usb/host/ohci-exynos.c   | 1 +
 drivers/usb/host/ohci-platform.c | 1 +
 3 files changed, 3 insertions(+)

base-commit: fd73f4a6659897191fa0d40695fe370925dd3780

#1 lore raw

PATCH 1/3 usb: ehci-platform: Disable controller wakeup on removal

On wakeup-capable ACPI controllers, a successful probe-time wakeup enable leaves a source attached after driver unbind: usb_remove_hcd() does not disable controller wakeup.

Disable it after usb_remove_hcd() to balance the enable.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 776c15d0ad0c ("USB: ehci-platform: Add ACPI bindings for the EHCI platform driver.")
Assisted-by OpenAI:GPT-5.6
---
 drivers/usb/host/ehci-platform.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ehci-platform.c +1 -0
index f61f095..b749de0 100644
@@ -420,6 +420,7 @@ static void ehci_platform_remove(struct platform_device *dev)
 		quirk_poll_end(priv);
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 
 	if (pdata->power_off)
 		pdata->power_off(dev);
#3 lore raw

PATCH 2/3 usb: ohci-platform: Disable controller wakeup on removal

In reply to Myeonghun Pak

When OHCI reports remote-wakeup capability, a successful wakeup enable leaves a source attached after driver unbind: usb_remove_hcd() does not disable controller wakeup.

Disable it after usb_remove_hcd() to balance the enable.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes fa3364b5a2d7 ("USB: OHCI: Add a generic platform device driver")
Assisted-by OpenAI:GPT-5.6
---
 drivers/usb/host/ohci-platform.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-platform.c +1 -0
index c801527..c2a90a4 100644
@@ -246,6 +246,7 @@ static void ohci_platform_remove(struct platform_device *dev)
 
 	pm_runtime_get_sync(&dev->dev);
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(&dev->dev);
 
 	if (pdata->power_off)
 		pdata->power_off(dev);
#4 lore raw

PATCH 3/3 usb: ohci-exynos: Disable controller wakeup on removal

In reply to Myeonghun Pak

When OHCI reports remote-wakeup capability, a successful wakeup enable leaves a source attached after driver unbind: usb_remove_hcd() does not disable controller wakeup.

Disable it after usb_remove_hcd() to balance the enable.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 62194244cf87 ("USB: Add Samsung Exynos OHCI diver")
Assisted-by OpenAI:GPT-5.6
---
 drivers/usb/host/ohci-exynos.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-exynos.c +1 -0
index cc5cb09..86ff7a0 100644
@@ -194,6 +194,7 @@ static void exynos_ohci_remove(struct platform_device *pdev)
 	pdev->dev.of_node = exynos_ohci->of_node;
 
 	usb_remove_hcd(hcd);
+	device_wakeup_disable(hcd->self.controller);
 
 	exynos_ohci_phy_disable(&pdev->dev);
 
maintainer Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] usb: ehci-platform: Disable controller wakeup on removal

In reply to Myeonghun Pak
Quoted 9 lines · Myeonghun Pak

On wakeup-capable ACPI controllers, a successful probe-time wakeup enable leaves a source attached after driver unbind: usb_remove_hcd() does not disable controller wakeup.

Disable it after usb_remove_hcd() to balance the enable.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Quoted 6 lines
Fixes 776c15d0ad0c ("USB: ehci-platform: Add ACPI bindings for the EHCI platform driver.")
Assisted-by OpenAI:GPT-5.6

---

For all three patches: