summaryrefslogtreecommitdiffstats
path: root/drivers/phy/tegra/xusb.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2020-03-18 23:25:54 +0100
committerThierry Reding <treding@nvidia.com>2020-03-19 14:00:04 +0100
commit2f8da84def73e1dd89385146e1dbb2ae2c8e0a6a (patch)
tree49393740be1a16f05e58d9aa54787616a0ea6784 /drivers/phy/tegra/xusb.h
parentphy: tegra: Print -EPROBE_DEFER error message at debug level (diff)
downloadlinux-2f8da84def73e1dd89385146e1dbb2ae2c8e0a6a.tar.xz
linux-2f8da84def73e1dd89385146e1dbb2ae2c8e0a6a.zip
phy: tegra: Fix regulator leak
Devices are created for each port of the XUSB pad controller. Each USB 2 and USB 3 port can potentially have an associated VBUS power supply that needs to be removed when the device is removed. Since port devices never bind to a driver, the driver core will not get to perform the cleanup of device-managed resources that usually happens on driver unbind. Now, the driver core will also perform device-managed resource cleanup for driver-less devices when they are released. However, when a device link is created between the regulator and the port device, as part of regulator_get(), the regulator takes a reference to the port device and prevents it from being released unless regulator_put() is called, which will never happen. Avoid this by using the non-device-managed API and manually releasing the regulator reference when the port is unregistered. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/phy/tegra/xusb.h')
-rw-r--r--drivers/phy/tegra/xusb.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/phy/tegra/xusb.h b/drivers/phy/tegra/xusb.h
index 51d7aae0d623..fb32ffcb13fd 100644
--- a/drivers/phy/tegra/xusb.h
+++ b/drivers/phy/tegra/xusb.h
@@ -308,6 +308,7 @@ to_usb2_port(struct tegra_xusb_port *port)
struct tegra_xusb_usb2_port *
tegra_xusb_find_usb2_port(struct tegra_xusb_padctl *padctl,
unsigned int index);
+void tegra_xusb_usb2_port_remove(struct tegra_xusb_port *port);
struct tegra_xusb_ulpi_port {
struct tegra_xusb_port base;
@@ -355,8 +356,10 @@ to_usb3_port(struct tegra_xusb_port *port)
struct tegra_xusb_usb3_port *
tegra_xusb_find_usb3_port(struct tegra_xusb_padctl *padctl,
unsigned int index);
+void tegra_xusb_usb3_port_remove(struct tegra_xusb_port *port);
struct tegra_xusb_port_ops {
+ void (*remove)(struct tegra_xusb_port *port);
int (*enable)(struct tegra_xusb_port *port);
void (*disable)(struct tegra_xusb_port *port);
struct tegra_xusb_lane *(*map)(struct tegra_xusb_port *port);