This series clean up the interconnect-initialisation helper somewhat in
order to improve readability.
Johan
Johan Hovold (2):
usb: dwc3: qcom: only parse 'maximum-speed' once
usb: dwc3: qcom: clean up icc init
drivers/usb/dwc3/dwc3-qcom.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--
2.35.1
Add a temporary variable to the interconnect-initialisation helper to
avoid parsing and decoding the 'maximum-speed' devicetree property
twice.
Signed-off-by: Johan Hovold <[email protected]>
---
drivers/usb/dwc3/dwc3-qcom.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 6814861bed6c..196efa9f2545 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
--
2.35.1
On Fri, Aug 05, 2022 at 09:44:59AM +0200, Johan Hovold wrote:
> Add a temporary variable to the interconnect-initialisation helper to
> avoid parsing and decoding the 'maximum-speed' devicetree property
> twice.
>
> Signed-off-by: Johan Hovold <[email protected]>
Reviewed-by: Matthias Kaehlcke <[email protected]>
On Fri, Aug 05, 2022 at 09:44:59AM +0200, Johan Hovold wrote:
> Add a temporary variable to the interconnect-initialisation helper to
> avoid parsing and decoding the 'maximum-speed' devicetree property
> twice.
>
> Signed-off-by: Johan Hovold <[email protected]>
Reviewed-by: Andrew Halaney <[email protected]>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 6814861bed6c..196efa9f2545 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
> --
> 2.35.1
>