aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2022-08-04 10:52:46 +0200
committerJohan Hovold <johan+linaro@kernel.org>2022-08-30 13:32:47 +0200
commitbf9c67d2109ae64882975cac61ab6737b269629c (patch)
treedc363aad3871c35c88d5c89dad3bd03d3d3f80e5
parent6a99b3b0306fe415548173fe422bdfdd1e8d3ef6 (diff)
usb: dwc3: qcom: only parse 'maximum-speed' once
Add a temporary variable to the interconnect-initialisation helper to avoid parsing and decoding the 'maximum-speed' devicetree property twice. Reviewed-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Andrew Halaney <ahalaney@redhat.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
-rw-r--r--drivers/usb/dwc3/dwc3-qcom.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 197583ff3f3d..087bb24081b4 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -243,6 +243,7 @@ static int dwc3_qcom_interconnect_disable(struct dwc3_qcom *qcom)
*/
static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
{
+ enum usb_device_speed max_speed;
struct device *dev = qcom->dev;
int ret;
@@ -263,8 +264,8 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
return PTR_ERR(qcom->icc_path_apps);
}
- if (usb_get_maximum_speed(&qcom->dwc3->dev) >= USB_SPEED_SUPER ||
- usb_get_maximum_speed(&qcom->dwc3->dev) == USB_SPEED_UNKNOWN)
+ max_speed = usb_get_maximum_speed(&qcom->dwc3->dev);
+ if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
ret = icc_set_bw(qcom->icc_path_ddr,
USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
else