Commit 3e346d41bfcdf803284b06ef6e4bf13fa2b86277
Committed by
Greg Kroah-Hartman
1 parent
a47cc24cd1
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
USB: PHY: tegra: Call tegra_usb_phy_close only on device removal
tegra_usb_phy_close() is supposed to undo the effects of tegra_usb_phy_init(). It is also currently added as the USB PHY shutdown callback, which is wrong, since tegra_usb_phy_init() is only called during probing wheras the shutdown callback can get called multiple times. This then leads to warnings about unbalanced regulator_disable if the EHCI driver is unbound and bound again at runtime. Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 3 additions and 5 deletions Side-by-side Diff
drivers/usb/phy/phy-tegra-usb.c
... | ... | @@ -685,10 +685,8 @@ |
685 | 685 | return gpio_direction_output(phy->reset_gpio, 0); |
686 | 686 | } |
687 | 687 | |
688 | -static void tegra_usb_phy_close(struct usb_phy *x) | |
688 | +static void tegra_usb_phy_close(struct tegra_usb_phy *phy) | |
689 | 689 | { |
690 | - struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy); | |
691 | - | |
692 | 690 | if (!IS_ERR(phy->vbus)) |
693 | 691 | regulator_disable(phy->vbus); |
694 | 692 | |
695 | 693 | |
... | ... | @@ -1060,14 +1058,13 @@ |
1060 | 1058 | if (err < 0) |
1061 | 1059 | return err; |
1062 | 1060 | |
1063 | - tegra_phy->u_phy.shutdown = tegra_usb_phy_close; | |
1064 | 1061 | tegra_phy->u_phy.set_suspend = tegra_usb_phy_suspend; |
1065 | 1062 | |
1066 | 1063 | platform_set_drvdata(pdev, tegra_phy); |
1067 | 1064 | |
1068 | 1065 | err = usb_add_phy_dev(&tegra_phy->u_phy); |
1069 | 1066 | if (err < 0) { |
1070 | - tegra_usb_phy_close(&tegra_phy->u_phy); | |
1067 | + tegra_usb_phy_close(tegra_phy); | |
1071 | 1068 | return err; |
1072 | 1069 | } |
1073 | 1070 | |
... | ... | @@ -1079,6 +1076,7 @@ |
1079 | 1076 | struct tegra_usb_phy *tegra_phy = platform_get_drvdata(pdev); |
1080 | 1077 | |
1081 | 1078 | usb_remove_phy(&tegra_phy->u_phy); |
1079 | + tegra_usb_phy_close(tegra_phy); | |
1082 | 1080 | |
1083 | 1081 | return 0; |
1084 | 1082 | } |