| .. | .. |
|---|
| 121 | 121 | return 0; |
|---|
| 122 | 122 | } |
|---|
| 123 | 123 | |
|---|
| 124 | | -static void __dwc2_disable_regulators(void *data) |
|---|
| 125 | | -{ |
|---|
| 126 | | - struct dwc2_hsotg *hsotg = data; |
|---|
| 127 | | - |
|---|
| 128 | | - regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); |
|---|
| 129 | | -} |
|---|
| 130 | | - |
|---|
| 131 | 124 | static int __dwc2_lowlevel_phy_enable(struct dwc2_hsotg *hsotg) |
|---|
| 132 | 125 | { |
|---|
| 133 | 126 | struct platform_device *pdev = to_platform_device(hsotg->dev); |
|---|
| .. | .. |
|---|
| 198 | 191 | |
|---|
| 199 | 192 | static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) |
|---|
| 200 | 193 | { |
|---|
| 201 | | - struct platform_device *pdev = to_platform_device(hsotg->dev); |
|---|
| 202 | 194 | int ret; |
|---|
| 203 | 195 | |
|---|
| 204 | 196 | ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies), |
|---|
| 205 | 197 | hsotg->supplies); |
|---|
| 206 | | - if (ret) |
|---|
| 207 | | - return ret; |
|---|
| 208 | | - |
|---|
| 209 | | - ret = devm_add_action_or_reset(&pdev->dev, |
|---|
| 210 | | - __dwc2_disable_regulators, hsotg); |
|---|
| 211 | 198 | if (ret) |
|---|
| 212 | 199 | return ret; |
|---|
| 213 | 200 | |
|---|
| .. | .. |
|---|
| 249 | 236 | |
|---|
| 250 | 237 | clk_bulk_disable_unprepare(hsotg->num_clks, hsotg->clks); |
|---|
| 251 | 238 | |
|---|
| 252 | | - return 0; |
|---|
| 239 | + return regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); |
|---|
| 253 | 240 | } |
|---|
| 254 | 241 | |
|---|
| 255 | 242 | /** |
|---|
| .. | .. |
|---|
| 699 | 686 | error: |
|---|
| 700 | 687 | pm_runtime_put_sync(hsotg->dev); |
|---|
| 701 | 688 | pm_runtime_disable(hsotg->dev); |
|---|
| 702 | | - if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) |
|---|
| 689 | + if (hsotg->ll_hw_enabled) |
|---|
| 703 | 690 | dwc2_lowlevel_hw_disable(hsotg); |
|---|
| 704 | 691 | return retval; |
|---|
| 705 | 692 | } |
|---|