[PATCH v3 07/13] usb: hub: Use usb_hub_set_port_power() to control port power everywhere
Chen-Yu Tsai
wenst at chromium.org
Fri Jul 3 04:03:08 PDT 2026
There are still some instances in the USB hub driver where port power is
directly controlled by toggling the USB_PORT_FEAT_POWER feature flag.
Switch these instances over to usb_hub_set_port_power() so that only one
unified function to do this exists. This makes adding external power
control with the power sequencing API easier and consistently applied.
Signed-off-by: Chen-Yu Tsai <wenst at chromium.org>
---
Changes since v2:
- New patch
---
drivers/usb/core/hub.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index da0a4cc8e15a..8ae97e8c26aa 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -975,11 +975,8 @@ static void hub_power_on(struct usb_hub *hub, bool do_delay)
dev_dbg(hub->intfdev, "trying to enable port power on "
"non-switchable hub\n");
for (port1 = 1; port1 <= hub->hdev->maxchild; port1++)
- if (test_bit(port1, hub->power_bits))
- set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER);
- else
- usb_clear_port_feature(hub->hdev, port1,
- USB_PORT_FEAT_POWER);
+ usb_hub_set_port_power(hub->hdev, hub, port1,
+ test_bit(port1, hub->power_bits));
if (do_delay)
msleep(hub_power_on_good_delay(hub));
}
@@ -5452,7 +5449,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
if (hub_is_port_power_switchable(hub)
&& !usb_port_is_power_on(port_dev, portstatus)
&& !port_dev->port_owner)
- set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
+ usb_hub_set_port_power(hdev, hub, port1, true);
if (portstatus & USB_PORT_STAT_ENABLE)
goto done;
--
2.55.0.rc0.799.gd6f94ed593-goog
More information about the linux-arm-kernel
mailing list