[PATCH v4 08/14] usb: hub: Use usb_hub_set_port_power() to control port power everywhere

From: Chen-Yu Tsai

Date: Thu Jul 09 2026 - 06:04:00 EST


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.

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
---
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 c7fa73673582..369280a217cc 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));
}
@@ -5436,7 +5433,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.795.g602f6c329a-goog