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

Revert "usb: phy: add usb phy notify port status API"

This reverts commit a08799cf17c22375752abfad3b4a2b34b3acb287.

The recently added Realtek PHY drivers depend on the new port status
notification mechanism which was built on the deprecated USB PHY
implementation and devicetree binding.

Specifically, using these PHYs would require describing the very same
PHY using both the generic "phy" property and the deprecated "usb-phy"
property which is clearly wrong.

We should not be building new functionality on top of the legacy USB PHY
implementation even if it is currently stuck in some kind of
transitional limbo.

Revert the new notification interface which is broken by design.

Fixes: a08799cf17c2 ("usb: phy: add usb phy notify port status API")
Cc: stable@vger.kernel.org # 6.6
Cc: Stanley Chang <stanley_chang@realtek.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231106110654.31090-4-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
1a229d86 7a784bcd

-36
-23
drivers/usb/core/hub.c
··· 622 622 ret = 0; 623 623 } 624 624 mutex_unlock(&hub->status_mutex); 625 - 626 - /* 627 - * There is no need to lock status_mutex here, because status_mutex 628 - * protects hub->status, and the phy driver only checks the port 629 - * status without changing the status. 630 - */ 631 - if (!ret) { 632 - struct usb_device *hdev = hub->hdev; 633 - 634 - /* 635 - * Only roothub will be notified of port state changes, 636 - * since the USB PHY only cares about changes at the next 637 - * level. 638 - */ 639 - if (is_root_hub(hdev)) { 640 - struct usb_hcd *hcd = bus_to_hcd(hdev->bus); 641 - 642 - if (hcd->usb_phy) 643 - usb_phy_notify_port_status(hcd->usb_phy, 644 - port1 - 1, *status, *change); 645 - } 646 - } 647 - 648 625 return ret; 649 626 } 650 627
-13
include/linux/usb/phy.h
··· 144 144 */ 145 145 int (*set_wakeup)(struct usb_phy *x, bool enabled); 146 146 147 - /* notify phy port status change */ 148 - int (*notify_port_status)(struct usb_phy *x, int port, 149 - u16 portstatus, u16 portchange); 150 - 151 147 /* notify phy connect status change */ 152 148 int (*notify_connect)(struct usb_phy *x, 153 149 enum usb_device_speed speed); ··· 312 316 { 313 317 if (x && x->set_wakeup) 314 318 return x->set_wakeup(x, enabled); 315 - else 316 - return 0; 317 - } 318 - 319 - static inline int 320 - usb_phy_notify_port_status(struct usb_phy *x, int port, u16 portstatus, u16 portchange) 321 - { 322 - if (x && x->notify_port_status) 323 - return x->notify_port_status(x, port, portstatus, portchange); 324 319 else 325 320 return 0; 326 321 }