Skip to content

Commit

Permalink
usb: dwc3: qcom: clean up suspend callbacks
Browse files Browse the repository at this point in the history
Clean up the suspend callbacks by separating the error and success paths
to improve readability.

Also drop a related redundant initialisation.

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220804151001.23612-10-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Aug 18, 2022
1 parent e3fafbd commit ac6928f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions drivers/usb/dwc3/dwc3-qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,14 +959,15 @@ static int __maybe_unused dwc3_qcom_pm_suspend(struct device *dev)
{
struct dwc3_qcom *qcom = dev_get_drvdata(dev);
bool wakeup = device_may_wakeup(dev);
int ret = 0;

int ret;

ret = dwc3_qcom_suspend(qcom, wakeup);
if (!ret)
qcom->pm_suspended = true;
if (ret)
return ret;

return ret;
qcom->pm_suspended = true;

return 0;
}

static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
Expand All @@ -976,10 +977,12 @@ static int __maybe_unused dwc3_qcom_pm_resume(struct device *dev)
int ret;

ret = dwc3_qcom_resume(qcom, wakeup);
if (!ret)
qcom->pm_suspended = false;
if (ret)
return ret;

return ret;
qcom->pm_suspended = false;

return 0;
}

static int __maybe_unused dwc3_qcom_runtime_suspend(struct device *dev)
Expand Down

0 comments on commit ac6928f

Please sign in to comment.