All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: dwc3: qcom: clean up icc init
@ 2022-08-05  7:44 Johan Hovold
  2022-08-05  7:44 ` [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once Johan Hovold
  2022-08-05  7:45 ` [PATCH 2/2] usb: dwc3: qcom: clean up icc init Johan Hovold
  0 siblings, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2022-08-05  7:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	linux-usb, linux-kernel, Johan Hovold

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once
  2022-08-05  7:44 [PATCH 0/2] usb: dwc3: qcom: clean up icc init Johan Hovold
@ 2022-08-05  7:44 ` Johan Hovold
  2022-08-05 17:44   ` Matthias Kaehlcke
  2022-08-05 20:34   ` Andrew Halaney
  2022-08-05  7:45 ` [PATCH 2/2] usb: dwc3: qcom: clean up icc init Johan Hovold
  1 sibling, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2022-08-05  7:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	linux-usb, linux-kernel, Johan Hovold

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 <johan+linaro@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] usb: dwc3: qcom: clean up icc init
  2022-08-05  7:44 [PATCH 0/2] usb: dwc3: qcom: clean up icc init Johan Hovold
  2022-08-05  7:44 ` [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once Johan Hovold
@ 2022-08-05  7:45 ` Johan Hovold
  2022-08-05 17:52   ` Matthias Kaehlcke
  1 sibling, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2022-08-05  7:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	linux-usb, linux-kernel, Johan Hovold

Clean up the interconnect-initialisation helper by increasing
indentation of (or merging) continuation lines and adding brackets
around multi-line blocks in order to improve readability.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/usb/dwc3/dwc3-qcom.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 196efa9f2545..f2ff4fe1490a 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -253,7 +253,7 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
 	qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr");
 	if (IS_ERR(qcom->icc_path_ddr)) {
 		dev_err(dev, "failed to get usb-ddr path: %ld\n",
-			PTR_ERR(qcom->icc_path_ddr));
+				PTR_ERR(qcom->icc_path_ddr));
 		return PTR_ERR(qcom->icc_path_ddr);
 	}
 
@@ -265,20 +265,19 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
 	}
 
 	max_speed = usb_get_maximum_speed(&qcom->dwc3->dev);
-	if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
+	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
+				USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
+	} else {
 		ret = icc_set_bw(qcom->icc_path_ddr,
-			USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
-
+				USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
+	}
 	if (ret) {
 		dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret);
 		return ret;
 	}
 
-	ret = icc_set_bw(qcom->icc_path_apps,
-		APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
+	ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
 	if (ret) {
 		dev_err(dev, "failed to set bandwidth for apps-usb path: %d\n", ret);
 		return ret;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once
  2022-08-05  7:44 ` [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once Johan Hovold
@ 2022-08-05 17:44   ` Matthias Kaehlcke
  2022-08-05 20:34   ` Andrew Halaney
  1 sibling, 0 replies; 7+ messages in thread
From: Matthias Kaehlcke @ 2022-08-05 17:44 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Greg Kroah-Hartman, Felipe Balbi, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, linux-usb, linux-kernel

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 <johan+linaro@kernel.org>

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: dwc3: qcom: clean up icc init
  2022-08-05  7:45 ` [PATCH 2/2] usb: dwc3: qcom: clean up icc init Johan Hovold
@ 2022-08-05 17:52   ` Matthias Kaehlcke
  2022-08-07  9:50     ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Matthias Kaehlcke @ 2022-08-05 17:52 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Greg Kroah-Hartman, Felipe Balbi, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, linux-usb, linux-kernel

On Fri, Aug 05, 2022 at 09:45:00AM +0200, Johan Hovold wrote:
> Clean up the interconnect-initialisation helper by increasing
> indentation of (or merging) continuation lines and adding brackets
> around multi-line blocks in order to improve readability.
> 
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 196efa9f2545..f2ff4fe1490a 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -253,7 +253,7 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
>  	qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr");
>  	if (IS_ERR(qcom->icc_path_ddr)) {
>  		dev_err(dev, "failed to get usb-ddr path: %ld\n",
> -			PTR_ERR(qcom->icc_path_ddr));
> +				PTR_ERR(qcom->icc_path_ddr));

What's wrong with the existing indentation? It looks similar to the indentation
changes you do below for icc_set_bw().

Maybe your preference is double indentation for continuation lines rather than
aligning them roughly with the opening parenthesis of the calling function?

>  		return PTR_ERR(qcom->icc_path_ddr);
>  	}
>  
> @@ -265,20 +265,19 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
>  	}
>  
>  	max_speed = usb_get_maximum_speed(&qcom->dwc3->dev);
> -	if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
> +	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
> +				USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
> +	} else {
>  		ret = icc_set_bw(qcom->icc_path_ddr,
> -			USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
> -
> +				USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
> +	}
>  	if (ret) {
>  		dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret);
>  		return ret;
>  	}
>  
> -	ret = icc_set_bw(qcom->icc_path_apps,
> -		APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
> +	ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
>  	if (ret) {
>  		dev_err(dev, "failed to set bandwidth for apps-usb path: %d\n", ret);
>  		return ret;

Reviewed-by: Matthias Kaehlcke <mka@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once
  2022-08-05  7:44 ` [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once Johan Hovold
  2022-08-05 17:44   ` Matthias Kaehlcke
@ 2022-08-05 20:34   ` Andrew Halaney
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Halaney @ 2022-08-05 20:34 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Greg Kroah-Hartman, Felipe Balbi, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, linux-usb, linux-kernel

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 <johan+linaro@kernel.org>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>

> ---
>  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
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: dwc3: qcom: clean up icc init
  2022-08-05 17:52   ` Matthias Kaehlcke
@ 2022-08-07  9:50     ` Johan Hovold
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2022-08-07  9:50 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Johan Hovold, Greg Kroah-Hartman, Felipe Balbi, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-usb,
	linux-kernel

On Fri, Aug 05, 2022 at 10:52:22AM -0700, Matthias Kaehlcke wrote:
> On Fri, Aug 05, 2022 at 09:45:00AM +0200, Johan Hovold wrote:
> > Clean up the interconnect-initialisation helper by increasing
> > indentation of (or merging) continuation lines and adding brackets
> > around multi-line blocks in order to improve readability.
> > 
> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > ---
> >  drivers/usb/dwc3/dwc3-qcom.c | 15 +++++++--------
> >  1 file changed, 7 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> > index 196efa9f2545..f2ff4fe1490a 100644
> > --- a/drivers/usb/dwc3/dwc3-qcom.c
> > +++ b/drivers/usb/dwc3/dwc3-qcom.c
> > @@ -253,7 +253,7 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
> >  	qcom->icc_path_ddr = of_icc_get(dev, "usb-ddr");
> >  	if (IS_ERR(qcom->icc_path_ddr)) {
> >  		dev_err(dev, "failed to get usb-ddr path: %ld\n",
> > -			PTR_ERR(qcom->icc_path_ddr));
> > +				PTR_ERR(qcom->icc_path_ddr));
> 
> What's wrong with the existing indentation? It looks similar to the indentation
> changes you do below for icc_set_bw().

The indentation of continuation lines in this driver is a bit
inconsistent, but the above change matches the next conditional and the
rest of the function (which does not use open-parenthesis alignment).

> Maybe your preference is double indentation for continuation lines rather than
> aligning them roughly with the opening parenthesis of the calling function?

I generally prefer two tabs over excessive indentation involving space
characters that need to be added or removed in continuation lines just
because a symbol name is updated.

> >  		return PTR_ERR(qcom->icc_path_ddr);
> >  	}
> >  
> > @@ -265,20 +265,19 @@ static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom)
> >  	}
> >  
> >  	max_speed = usb_get_maximum_speed(&qcom->dwc3->dev);
> > -	if (max_speed >= USB_SPEED_SUPER || max_speed == USB_SPEED_UNKNOWN)
> > +	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
> > +				USB_MEMORY_AVG_SS_BW, USB_MEMORY_PEAK_SS_BW);
> > +	} else {
> >  		ret = icc_set_bw(qcom->icc_path_ddr,
> > -			USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
> > -
> > +				USB_MEMORY_AVG_HS_BW, USB_MEMORY_PEAK_HS_BW);
> > +	}
> >  	if (ret) {
> >  		dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret);
> >  		return ret;
> >  	}
> >  
> > -	ret = icc_set_bw(qcom->icc_path_apps,
> > -		APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
> > +	ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW);
> >  	if (ret) {
> >  		dev_err(dev, "failed to set bandwidth for apps-usb path: %d\n", ret);
> >  		return ret;

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-07  9:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05  7:44 [PATCH 0/2] usb: dwc3: qcom: clean up icc init Johan Hovold
2022-08-05  7:44 ` [PATCH 1/2] usb: dwc3: qcom: only parse 'maximum-speed' once Johan Hovold
2022-08-05 17:44   ` Matthias Kaehlcke
2022-08-05 20:34   ` Andrew Halaney
2022-08-05  7:45 ` [PATCH 2/2] usb: dwc3: qcom: clean up icc init Johan Hovold
2022-08-05 17:52   ` Matthias Kaehlcke
2022-08-07  9:50     ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.