public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: removing of_find_property
@ 2015-11-17 11:07 Saurabh Sengar
  2015-11-17 11:20 ` Måns Rullgård
  0 siblings, 1 reply; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-17 11:07 UTC (permalink / raw)
  To: Peter.Chen, gregkh, linux-usb, linux-kernel; +Cc: Saurabh Sengar

call to of_find_property() before of_property_read_u32() is unnecessary.
of_property_read_u32() anyway calls to of_find_property() only.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
 drivers/usb/chipidea/core.c | 67 ++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 965d0e2..8a4c22c 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -643,6 +643,7 @@ static int ci_get_platdata(struct device *dev,
 	struct extcon_dev *ext_vbus, *ext_id;
 	struct ci_hdrc_cable *cable;
 	int ret;
+	u32 pval;
 
 	if (!platdata->phy_mode)
 		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
@@ -688,52 +689,48 @@ static int ci_get_platdata(struct device *dev,
 	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
-	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
-		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
-				     &platdata->phy_clkgate_delay_us);
+	if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
+				     &pval))
+		platdata->phy_clkgate_delay_us = pval;
 
 	platdata->itc_setting = 1;
-	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "itc-setting",
-			&platdata->itc_setting);
-		if (ret) {
-			dev_err(dev,
-				"failed to get itc-setting\n");
-			return ret;
-		}
+
+	ret = of_property_read_u32(dev->of_node, "itc-setting", &pval);
+	if (!ret)
+		platdata->itc_setting = pval;
+	else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get itc-setting\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
-			&platdata->ahb_burst_config);
-		if (ret) {
-			dev_err(dev,
-				"failed to get ahb-burst-config\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
+				&pval);
+	if (!ret) {
+		platdata->ahb_burst_config = pval;
 		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get ahb-burst-config\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
-			&platdata->tx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get tx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
+				&pval);
+	if (!ret) {
+		platdata->tx_burst_size = pval;
 		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get tx-burst-size-dword\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
-			&platdata->rx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get rx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
+				&pval);
+	if (!ret) {
+		platdata->rx_burst_size = pval;
 		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get rx-burst-size-dword\n");
+		return ret;
 	}
 
 	ext_id = ERR_PTR(-ENODEV);
-- 
1.9.1


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

* Re: [PATCH] usb: chipidea: removing of_find_property
  2015-11-17 11:07 [PATCH] usb: chipidea: removing of_find_property Saurabh Sengar
@ 2015-11-17 11:20 ` Måns Rullgård
  2015-11-17 11:40   ` [PATCH v2] " Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Måns Rullgård @ 2015-11-17 11:20 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: Peter.Chen, gregkh, linux-usb, linux-kernel

Saurabh Sengar <saurabh.truth@gmail.com> writes:

> call to of_find_property() before of_property_read_u32() is unnecessary.
> of_property_read_u32() anyway calls to of_find_property() only.
>
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
>  drivers/usb/chipidea/core.c | 67 ++++++++++++++++++++++-----------------------
>  1 file changed, 32 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 965d0e2..8a4c22c 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -643,6 +643,7 @@ static int ci_get_platdata(struct device *dev,
>  	struct extcon_dev *ext_vbus, *ext_id;
>  	struct ci_hdrc_cable *cable;
>  	int ret;
> +	u32 pval;
>
>  	if (!platdata->phy_mode)
>  		platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
> @@ -688,52 +689,48 @@ static int ci_get_platdata(struct device *dev,
>  	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>
> -	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> -		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> -				     &platdata->phy_clkgate_delay_us);
> +	if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> +				     &pval))
> +		platdata->phy_clkgate_delay_us = pval;

You don't need to use the pval temporary as of_property_read_u32 only
modifies the destination on success.

-- 
Måns Rullgård
mans@mansr.com

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

* [PATCH v2] usb: chipidea: removing of_find_property
  2015-11-17 11:20 ` Måns Rullgård
@ 2015-11-17 11:40   ` Saurabh Sengar
  2015-11-17 11:44     ` Måns Rullgård
  0 siblings, 1 reply; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-17 11:40 UTC (permalink / raw)
  To: mans, Peter.Chen, gregkh, linux-usb, linux-kernel; +Cc: Saurabh Sengar

call to of_find_property() before of_property_read_u32() is unnecessary.
of_property_read_u32() anyway calls to of_find_property() only.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
v2: removed pval variable
 drivers/usb/chipidea/core.c | 61 +++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 965d0e2..916a20d 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
 	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
-	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
-		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
-				     &platdata->phy_clkgate_delay_us);
+	if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
+				     &platdata->phy_clkgate_delay_us))
 
 	platdata->itc_setting = 1;
-	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "itc-setting",
-			&platdata->itc_setting);
-		if (ret) {
-			dev_err(dev,
-				"failed to get itc-setting\n");
-			return ret;
-		}
+
+	ret = of_property_read_u32(dev->of_node, "itc-setting",
+					&platdata->itc_setting);
+	if (ret && ret != -EINVAL) {
+		dev_err(dev, "failed to get itc-setting\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
-			&platdata->ahb_burst_config);
-		if (ret) {
-			dev_err(dev,
-				"failed to get ahb-burst-config\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
+				&platdata->ahb_burst_config);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get ahb-burst-config\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
-			&platdata->tx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get tx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
+				&platdata->tx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get tx-burst-size-dword\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
-			&platdata->rx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get rx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
+				&platdata->rx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get rx-burst-size-dword\n");
+		return ret;
 	}
 
 	ext_id = ERR_PTR(-ENODEV);
-- 
1.9.1


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

* Re: [PATCH v2] usb: chipidea: removing of_find_property
  2015-11-17 11:40   ` [PATCH v2] " Saurabh Sengar
@ 2015-11-17 11:44     ` Måns Rullgård
  2015-11-17 11:52       ` [PATCH v3] " Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Måns Rullgård @ 2015-11-17 11:44 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: Peter.Chen, gregkh, linux-usb, linux-kernel

Saurabh Sengar <saurabh.truth@gmail.com> writes:

> call to of_find_property() before of_property_read_u32() is unnecessary.
> of_property_read_u32() anyway calls to of_find_property() only.
>
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> v2: removed pval variable
>  drivers/usb/chipidea/core.c | 61 +++++++++++++++++++--------------------------
>  1 file changed, 26 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 965d0e2..916a20d 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
>  	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>
> -	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> -		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> -				     &platdata->phy_clkgate_delay_us);
> +	if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> +				     &platdata->phy_clkgate_delay_us))
>
>  	platdata->itc_setting = 1;

Drop that if().  Since we're ignoring of_property_read_u32() failing,
there is no need to test its return value, and code above incorrectly
makes the next statement conditional.

-- 
Måns Rullgård
mans@mansr.com

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

* [PATCH v3] usb: chipidea: removing of_find_property
  2015-11-17 11:44     ` Måns Rullgård
@ 2015-11-17 11:52       ` Saurabh Sengar
  2015-11-18  3:38         ` Peter Chen
  0 siblings, 1 reply; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-17 11:52 UTC (permalink / raw)
  To: mans, Peter.Chen, gregkh, linux-usb, linux-kernel; +Cc: Saurabh Sengar

call to of_find_property() before of_property_read_u32() is unnecessary.
of_property_read_u32() anyway calls to of_find_property() only.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
v2 : removed pval variable
v3 : removed unnecessary if condition
 drivers/usb/chipidea/core.c | 59 +++++++++++++++++++--------------------------
 1 file changed, 25 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 965d0e2..960a925 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
 	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
-	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
-		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
+	of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
 				     &platdata->phy_clkgate_delay_us);
 
 	platdata->itc_setting = 1;
-	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "itc-setting",
-			&platdata->itc_setting);
-		if (ret) {
-			dev_err(dev,
-				"failed to get itc-setting\n");
-			return ret;
-		}
+
+	ret = of_property_read_u32(dev->of_node, "itc-setting",
+					&platdata->itc_setting);
+	if (ret && ret != -EINVAL) {
+		dev_err(dev, "failed to get itc-setting\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
-			&platdata->ahb_burst_config);
-		if (ret) {
-			dev_err(dev,
-				"failed to get ahb-burst-config\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
+				&platdata->ahb_burst_config);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get ahb-burst-config\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
-			&platdata->tx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get tx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
+				&platdata->tx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get tx-burst-size-dword\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
-			&platdata->rx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get rx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
+				&platdata->rx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get rx-burst-size-dword\n");
+		return ret;
 	}
 
 	ext_id = ERR_PTR(-ENODEV);
-- 
1.9.1


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

* Re: [PATCH v2] usb: chipidea: removing of_find_property
       [not found] <201511172007.DmGhbpj1%fengguang.wu@intel.com>
@ 2015-11-17 12:58 ` Julia Lawall
  2015-11-17 13:11   ` Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Julia Lawall @ 2015-11-17 12:58 UTC (permalink / raw)
  To: Saurabh Sengar
  Cc: mans, Peter.Chen, gregkh, linux-usb, linux-kernel, Saurabh Sengar,
	kbuild-all

Please check.  The code, with the blank line on line 692, looks strange.

julia

On Tue, 17 Nov 2015, kbuild test robot wrote:

> CC: kbuild-all@01.org
> In-Reply-To: <1447760410-3426-1-git-send-email-saurabh.truth@gmail.com>
> TO: Saurabh Sengar <saurabh.truth@gmail.com>
> CC: mans@mansr.com, Peter.Chen@freescale.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Sengar <saurabh.truth@gmail.com>
> CC: Saurabh Sengar <saurabh.truth@gmail.com>
>
> Hi Saurabh,
>
> [auto build test WARNING on peter.chen-usb/ci-for-usb-next]
> [also build test WARNING on v4.4-rc1 next-20151117]
>
> url:    https://github.com/0day-ci/linux/commits/Saurabh-Sengar/usb-chipidea-removing-of_find_property/20151117-194333
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb ci-for-usb-next
> :::::: branch date: 68 minutes ago
> :::::: commit date: 68 minutes ago
>
> >> drivers/usb/chipidea/core.c:693:1-27: code aligned with following code on line 695
>
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 4375ac1189e900bbde912d31ec3bb66572c0784a
> vim +693 drivers/usb/chipidea/core.c
>
> 63863b98 Heikki Krogerus   2015-09-21  687  	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
> 4f6743d5 Michael Grzeschik 2014-02-19  688  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
> 4f6743d5 Michael Grzeschik 2014-02-19  689
> 4375ac11 Saurabh Sengar    2015-11-17  690  	if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> 4375ac11 Saurabh Sengar    2015-11-17  691  				     &platdata->phy_clkgate_delay_us))
> 1fbf4628 Fabio Estevam     2015-09-08  692
> df96ed8d Peter Chen        2014-09-22 @693  	platdata->itc_setting = 1;
> 4375ac11 Saurabh Sengar    2015-11-17  694
> df96ed8d Peter Chen        2014-09-22 @695  	ret = of_property_read_u32(dev->of_node, "itc-setting",
> df96ed8d Peter Chen        2014-09-22  696  					&platdata->itc_setting);
> 4375ac11 Saurabh Sengar    2015-11-17  697  	if (ret && ret != -EINVAL) {
> 4375ac11 Saurabh Sengar    2015-11-17  698  		dev_err(dev, "failed to get itc-setting\n");
>
> :::::: The code at line 693 was first introduced by commit
> :::::: df96ed8dced21426c54c7f69cf7513e75280957a usb: chipidea: introduce ITC tuning interface
>
> :::::: TO: Peter Chen <peter.chen@freescale.com>
> :::::: CC: Peter Chen <peter.chen@freescale.com>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>

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

* Re: [PATCH v2] usb: chipidea: removing of_find_property
  2015-11-17 12:58 ` [PATCH v2] " Julia Lawall
@ 2015-11-17 13:11   ` Saurabh Sengar
  0 siblings, 0 replies; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-17 13:11 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Måns Rullgård, Peter.Chen, Greg KH, linux-usb,
	linux-kernel, kbuild-all

Hi Julia,

You have used v2 of patch, I have sent v3 of patch too. 1:30 hour before
Please use version 3 as that is the latest.
version 3 : https://lkml.org/lkml/2015/11/17/243

Sorry for trouble.

Regards,
Saurabh

On 17 November 2015 at 18:28, Julia Lawall <julia.lawall@lip6.fr> wrote:
> Please check.  The code, with the blank line on line 692, looks strange.
>
> julia
>
> On Tue, 17 Nov 2015, kbuild test robot wrote:
>
>> CC: kbuild-all@01.org
>> In-Reply-To: <1447760410-3426-1-git-send-email-saurabh.truth@gmail.com>
>> TO: Saurabh Sengar <saurabh.truth@gmail.com>
>> CC: mans@mansr.com, Peter.Chen@freescale.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Saurabh Sengar <saurabh.truth@gmail.com>
>> CC: Saurabh Sengar <saurabh.truth@gmail.com>
>>
>> Hi Saurabh,
>>
>> [auto build test WARNING on peter.chen-usb/ci-for-usb-next]
>> [also build test WARNING on v4.4-rc1 next-20151117]
>>
>> url:    https://github.com/0day-ci/linux/commits/Saurabh-Sengar/usb-chipidea-removing-of_find_property/20151117-194333
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb ci-for-usb-next
>> :::::: branch date: 68 minutes ago
>> :::::: commit date: 68 minutes ago
>>
>> >> drivers/usb/chipidea/core.c:693:1-27: code aligned with following code on line 695
>>
>> git remote add linux-review https://github.com/0day-ci/linux
>> git remote update linux-review
>> git checkout 4375ac1189e900bbde912d31ec3bb66572c0784a
>> vim +693 drivers/usb/chipidea/core.c
>>
>> 63863b98 Heikki Krogerus   2015-09-21  687    if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>> 4f6743d5 Michael Grzeschik 2014-02-19  688            platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>> 4f6743d5 Michael Grzeschik 2014-02-19  689
>> 4375ac11 Saurabh Sengar    2015-11-17  690    if (!of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>> 4375ac11 Saurabh Sengar    2015-11-17  691                                 &platdata->phy_clkgate_delay_us))
>> 1fbf4628 Fabio Estevam     2015-09-08  692
>> df96ed8d Peter Chen        2014-09-22 @693    platdata->itc_setting = 1;
>> 4375ac11 Saurabh Sengar    2015-11-17  694
>> df96ed8d Peter Chen        2014-09-22 @695    ret = of_property_read_u32(dev->of_node, "itc-setting",
>> df96ed8d Peter Chen        2014-09-22  696                                    &platdata->itc_setting);
>> 4375ac11 Saurabh Sengar    2015-11-17  697    if (ret && ret != -EINVAL) {
>> 4375ac11 Saurabh Sengar    2015-11-17  698            dev_err(dev, "failed to get itc-setting\n");
>>
>> :::::: The code at line 693 was first introduced by commit
>> :::::: df96ed8dced21426c54c7f69cf7513e75280957a usb: chipidea: introduce ITC tuning interface
>>
>> :::::: TO: Peter Chen <peter.chen@freescale.com>
>> :::::: CC: Peter Chen <peter.chen@freescale.com>
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>>

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

* Re: [PATCH v3] usb: chipidea: removing of_find_property
  2015-11-17 11:52       ` [PATCH v3] " Saurabh Sengar
@ 2015-11-18  3:38         ` Peter Chen
  2015-11-18  4:00           ` Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Chen @ 2015-11-18  3:38 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: mans, gregkh, linux-usb, linux-kernel

On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote:
> call to of_find_property() before of_property_read_u32() is unnecessary.
> of_property_read_u32() anyway calls to of_find_property() only.
> 
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> v2 : removed pval variable
> v3 : removed unnecessary if condition
>  drivers/usb/chipidea/core.c | 59 +++++++++++++++++++--------------------------
>  1 file changed, 25 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 965d0e2..960a925 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
>  	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>  
> -	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> -		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> +	of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>  				     &platdata->phy_clkgate_delay_us);
>  
>  	platdata->itc_setting = 1;
> -	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "itc-setting",
> -			&platdata->itc_setting);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get itc-setting\n");
> -			return ret;
> -		}
> +
> +	ret = of_property_read_u32(dev->of_node, "itc-setting",
> +					&platdata->itc_setting);
> +	if (ret && ret != -EINVAL) {
> +		dev_err(dev, "failed to get itc-setting\n");
> +		return ret;
>  	}

For this one, you may not need to check return value, since
platdata->itc_setting is optional, and doesn't need to set
any flags if platdata->itc_setting is valid.

Other changes are ok for me.

Peter

>  
> -	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> -			&platdata->ahb_burst_config);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get ahb-burst-config\n");
> -			return ret;
> -		}
> +	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> +				&platdata->ahb_burst_config);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get ahb-burst-config\n");
> +		return ret;
>  	}
>  
> -	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> -			&platdata->tx_burst_size);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get tx-burst-size-dword\n");
> -			return ret;
> -		}
> +	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> +				&platdata->tx_burst_size);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get tx-burst-size-dword\n");
> +		return ret;
>  	}
>  
> -	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> -			&platdata->rx_burst_size);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get rx-burst-size-dword\n");
> -			return ret;
> -		}
> +	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> +				&platdata->rx_burst_size);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get rx-burst-size-dword\n");
> +		return ret;
>  	}
>  
>  	ext_id = ERR_PTR(-ENODEV);
> -- 
> 1.9.1
> 

-- 

Best Regards,
Peter Chen

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

* Re: [PATCH v3] usb: chipidea: removing of_find_property
  2015-11-18  3:38         ` Peter Chen
@ 2015-11-18  4:00           ` Saurabh Sengar
  2015-11-18  4:10             ` [PATCH v4] " Saurabh Sengar
  2015-11-18  4:44             ` [PATCH v3] " Peter Chen
  0 siblings, 2 replies; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-18  4:00 UTC (permalink / raw)
  To: Peter Chen; +Cc: Måns Rullgård, Greg KH, linux-usb, linux-kernel

Hi Peter,

Yes itc_setting is still optional, in case dts does not pass this
property, return type will be -EINVAL and there would be no problem.
The function will break only if there is 'No data'(-ENODATA) or
'overflow'(-ENODATA) error for this property.
In case this is not OK, I will send a another patch(v4) as you have suggested.

Regards,
Saurabh

On 18 November 2015 at 09:08, Peter Chen <peter.chen@freescale.com> wrote:
> On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote:
>> call to of_find_property() before of_property_read_u32() is unnecessary.
>> of_property_read_u32() anyway calls to of_find_property() only.
>>
>> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
>> ---
>> v2 : removed pval variable
>> v3 : removed unnecessary if condition
>>  drivers/usb/chipidea/core.c | 59 +++++++++++++++++++--------------------------
>>  1 file changed, 25 insertions(+), 34 deletions(-)
>>
>> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
>> index 965d0e2..960a925 100644
>> --- a/drivers/usb/chipidea/core.c
>> +++ b/drivers/usb/chipidea/core.c
>> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
>>       if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>>               platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>>
>> -     if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
>> -             of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>> +     of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>>                                    &platdata->phy_clkgate_delay_us);
>>
>>       platdata->itc_setting = 1;
>> -     if (of_find_property(dev->of_node, "itc-setting", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "itc-setting",
>> -                     &platdata->itc_setting);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get itc-setting\n");
>> -                     return ret;
>> -             }
>> +
>> +     ret = of_property_read_u32(dev->of_node, "itc-setting",
>> +                                     &platdata->itc_setting);
>> +     if (ret && ret != -EINVAL) {
>> +             dev_err(dev, "failed to get itc-setting\n");
>> +             return ret;
>>       }
>
> For this one, you may not need to check return value, since
> platdata->itc_setting is optional, and doesn't need to set
> any flags if platdata->itc_setting is valid.
>
> Other changes are ok for me.
>
> Peter
>
>>
>> -     if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
>> -                     &platdata->ahb_burst_config);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get ahb-burst-config\n");
>> -                     return ret;
>> -             }
>> +     ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
>> +                             &platdata->ahb_burst_config);
>> +     if (!ret) {
>>               platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
>> +     } else if (ret != -EINVAL) {
>> +             dev_err(dev, "failed to get ahb-burst-config\n");
>> +             return ret;
>>       }
>>
>> -     if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
>> -                     &platdata->tx_burst_size);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get tx-burst-size-dword\n");
>> -                     return ret;
>> -             }
>> +     ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
>> +                             &platdata->tx_burst_size);
>> +     if (!ret) {
>>               platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
>> +     } else if (ret != -EINVAL) {
>> +             dev_err(dev, "failed to get tx-burst-size-dword\n");
>> +             return ret;
>>       }
>>
>> -     if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
>> -                     &platdata->rx_burst_size);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get rx-burst-size-dword\n");
>> -                     return ret;
>> -             }
>> +     ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
>> +                             &platdata->rx_burst_size);
>> +     if (!ret) {
>>               platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
>> +     } else if (ret != -EINVAL) {
>> +             dev_err(dev, "failed to get rx-burst-size-dword\n");
>> +             return ret;
>>       }
>>
>>       ext_id = ERR_PTR(-ENODEV);
>> --
>> 1.9.1
>>
>
> --
>
> Best Regards,
> Peter Chen

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

* [PATCH v4] usb: chipidea: removing of_find_property
  2015-11-18  4:00           ` Saurabh Sengar
@ 2015-11-18  4:10             ` Saurabh Sengar
  2015-11-18  6:05               ` Peter Chen
  2015-11-18  4:44             ` [PATCH v3] " Peter Chen
  1 sibling, 1 reply; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-18  4:10 UTC (permalink / raw)
  To: mans, Peter.Chen, gregkh, linux-usb, linux-kernel; +Cc: Saurabh Sengar

call to of_find_property() before of_property_read_u32() is unnecessary.
of_property_read_u32() anyway calls to of_find_property() only.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
v4 : removed return type check for optional property 'itc-setting'

 drivers/usb/chipidea/core.c | 57 +++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 965d0e2..3d1c3c5 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev,
 	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
 		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
 
-	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
-		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
+	of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
 				     &platdata->phy_clkgate_delay_us);
 
 	platdata->itc_setting = 1;
-	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "itc-setting",
-			&platdata->itc_setting);
-		if (ret) {
-			dev_err(dev,
-				"failed to get itc-setting\n");
-			return ret;
-		}
-	}
 
-	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
-			&platdata->ahb_burst_config);
-		if (ret) {
-			dev_err(dev,
-				"failed to get ahb-burst-config\n");
-			return ret;
-		}
+	of_property_read_u32(dev->of_node, "itc-setting",
+					&platdata->itc_setting);
+
+	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
+				&platdata->ahb_burst_config);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get ahb-burst-config\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
-			&platdata->tx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get tx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
+				&platdata->tx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get tx-burst-size-dword\n");
+		return ret;
 	}
 
-	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
-		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
-			&platdata->rx_burst_size);
-		if (ret) {
-			dev_err(dev,
-				"failed to get rx-burst-size-dword\n");
-			return ret;
-		}
+	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
+				&platdata->rx_burst_size);
+	if (!ret) {
 		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
+	} else if (ret != -EINVAL) {
+		dev_err(dev, "failed to get rx-burst-size-dword\n");
+		return ret;
 	}
 
 	ext_id = ERR_PTR(-ENODEV);
-- 
1.9.1


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

* Re: [PATCH v3] usb: chipidea: removing of_find_property
  2015-11-18  4:00           ` Saurabh Sengar
  2015-11-18  4:10             ` [PATCH v4] " Saurabh Sengar
@ 2015-11-18  4:44             ` Peter Chen
  1 sibling, 0 replies; 15+ messages in thread
From: Peter Chen @ 2015-11-18  4:44 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: Måns Rullgård, Greg KH, linux-usb, linux-kernel

On Wed, Nov 18, 2015 at 09:30:39AM +0530, Saurabh Sengar wrote:
> Hi Peter,
> 
> Yes itc_setting is still optional, in case dts does not pass this
> property, return type will be -EINVAL and there would be no problem.
> The function will break only if there is 'No data'(-ENODATA) or
> 'overflow'(-ENODATA) error for this property.

If there is an error, the variable pass to of_property_read_u32 will
not be changed.

Peter
> In case this is not OK, I will send a another patch(v4) as you have suggested.
> 
> Regards,
> Saurabh
> 
> On 18 November 2015 at 09:08, Peter Chen <peter.chen@freescale.com> wrote:
> > On Tue, Nov 17, 2015 at 05:22:26PM +0530, Saurabh Sengar wrote:
> >> call to of_find_property() before of_property_read_u32() is unnecessary.
> >> of_property_read_u32() anyway calls to of_find_property() only.
> >>
> >> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> >> ---
> >> v2 : removed pval variable
> >> v3 : removed unnecessary if condition
> >>  drivers/usb/chipidea/core.c | 59 +++++++++++++++++++--------------------------
> >>  1 file changed, 25 insertions(+), 34 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> >> index 965d0e2..960a925 100644
> >> --- a/drivers/usb/chipidea/core.c
> >> +++ b/drivers/usb/chipidea/core.c
> >> @@ -688,52 +688,43 @@ static int ci_get_platdata(struct device *dev,
> >>       if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
> >>               platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
> >>
> >> -     if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> >> -             of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> >> +     of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> >>                                    &platdata->phy_clkgate_delay_us);
> >>
> >>       platdata->itc_setting = 1;
> >> -     if (of_find_property(dev->of_node, "itc-setting", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "itc-setting",
> >> -                     &platdata->itc_setting);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get itc-setting\n");
> >> -                     return ret;
> >> -             }
> >> +
> >> +     ret = of_property_read_u32(dev->of_node, "itc-setting",
> >> +                                     &platdata->itc_setting);
> >> +     if (ret && ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get itc-setting\n");
> >> +             return ret;
> >>       }
> >
> > For this one, you may not need to check return value, since
> > platdata->itc_setting is optional, and doesn't need to set
> > any flags if platdata->itc_setting is valid.
> >
> > Other changes are ok for me.
> >
> > Peter
> >
> >>
> >> -     if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> -                     &platdata->ahb_burst_config);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get ahb-burst-config\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> +                             &platdata->ahb_burst_config);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get ahb-burst-config\n");
> >> +             return ret;
> >>       }
> >>
> >> -     if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> >> -                     &platdata->tx_burst_size);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get tx-burst-size-dword\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> >> +                             &platdata->tx_burst_size);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get tx-burst-size-dword\n");
> >> +             return ret;
> >>       }
> >>
> >> -     if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> >> -                     &platdata->rx_burst_size);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get rx-burst-size-dword\n");
> >> -                     return ret;
> >> -             }
> >> +     ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> >> +                             &platdata->rx_burst_size);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get rx-burst-size-dword\n");
> >> +             return ret;
> >>       }
> >>
> >>       ext_id = ERR_PTR(-ENODEV);
> >> --
> >> 1.9.1
> >>
> >
> > --
> >
> > Best Regards,
> > Peter Chen

-- 

Best Regards,
Peter Chen

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

* Re: [PATCH v4] usb: chipidea: removing of_find_property
  2015-11-18  4:10             ` [PATCH v4] " Saurabh Sengar
@ 2015-11-18  6:05               ` Peter Chen
  2015-11-18  6:18                 ` Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Chen @ 2015-11-18  6:05 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: mans, gregkh, linux-usb, linux-kernel

On Wed, Nov 18, 2015 at 09:40:12AM +0530, Saurabh Sengar wrote:
> call to of_find_property() before of_property_read_u32() is unnecessary.
> of_property_read_u32() anyway calls to of_find_property() only.
> 
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> v4 : removed return type check for optional property 'itc-setting'
> 
>  drivers/usb/chipidea/core.c | 57 +++++++++++++++++----------------------------
>  1 file changed, 22 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 965d0e2..3d1c3c5 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev,
>  	if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>  		platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>  
> -	if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> -		of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> +	of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>  				     &platdata->phy_clkgate_delay_us);
>  
>  	platdata->itc_setting = 1;
> -	if (of_find_property(dev->of_node, "itc-setting", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "itc-setting",
> -			&platdata->itc_setting);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get itc-setting\n");
> -			return ret;
> -		}
> -	}
>  
> -	if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> -			&platdata->ahb_burst_config);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get ahb-burst-config\n");
> -			return ret;
> -		}
> +	of_property_read_u32(dev->of_node, "itc-setting",
> +					&platdata->itc_setting);
> +
> +	ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> +				&platdata->ahb_burst_config);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get ahb-burst-config\n");
> +		return ret;
>  	}

Sorry, one more comment, why we don't quit if the 'ret' is other error
value?

Peter

>  
> -	if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> -			&platdata->tx_burst_size);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get tx-burst-size-dword\n");
> -			return ret;
> -		}
> +	ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword",
> +				&platdata->tx_burst_size);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get tx-burst-size-dword\n");
> +		return ret;
>  	}
>  
> -	if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) {
> -		ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> -			&platdata->rx_burst_size);
> -		if (ret) {
> -			dev_err(dev,
> -				"failed to get rx-burst-size-dword\n");
> -			return ret;
> -		}
> +	ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword",
> +				&platdata->rx_burst_size);
> +	if (!ret) {
>  		platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST;
> +	} else if (ret != -EINVAL) {
> +		dev_err(dev, "failed to get rx-burst-size-dword\n");
> +		return ret;
>  	}
>  
>  	ext_id = ERR_PTR(-ENODEV);
> -- 
> 1.9.1
> 

-- 

Best Regards,
Peter Chen

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

* Re: [PATCH v4] usb: chipidea: removing of_find_property
  2015-11-18  6:05               ` Peter Chen
@ 2015-11-18  6:18                 ` Saurabh Sengar
  2015-11-18  7:24                   ` Peter Chen
  0 siblings, 1 reply; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-18  6:18 UTC (permalink / raw)
  To: Peter Chen; +Cc: Måns Rullgård, Greg KH, linux-usb, linux-kernel

On 18 November 2015 at 11:35, Peter Chen <peter.chen@freescale.com> wrote:
> On Wed, Nov 18, 2015 at 09:40:12AM +0530, Saurabh Sengar wrote:
>> call to of_find_property() before of_property_read_u32() is unnecessary.
>> of_property_read_u32() anyway calls to of_find_property() only.
>>
>> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
>> ---
>> v4 : removed return type check for optional property 'itc-setting'
>>
>>  drivers/usb/chipidea/core.c | 57 +++++++++++++++++----------------------------
>>  1 file changed, 22 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
>> index 965d0e2..3d1c3c5 100644
>> --- a/drivers/usb/chipidea/core.c
>> +++ b/drivers/usb/chipidea/core.c
>> @@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev,
>>       if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
>>               platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
>>
>> -     if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
>> -             of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>> +     of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
>>                                    &platdata->phy_clkgate_delay_us);
>>
>>       platdata->itc_setting = 1;
>> -     if (of_find_property(dev->of_node, "itc-setting", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "itc-setting",
>> -                     &platdata->itc_setting);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get itc-setting\n");
>> -                     return ret;
>> -             }
>> -     }
>>
>> -     if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
>> -             ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
>> -                     &platdata->ahb_burst_config);
>> -             if (ret) {
>> -                     dev_err(dev,
>> -                             "failed to get ahb-burst-config\n");
>> -                     return ret;
>> -             }
>> +     of_property_read_u32(dev->of_node, "itc-setting",
>> +                                     &platdata->itc_setting);
>> +
>> +     ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
>> +                             &platdata->ahb_burst_config);
>> +     if (!ret) {
>>               platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
>> +     } else if (ret != -EINVAL) {
>> +             dev_err(dev, "failed to get ahb-burst-config\n");
>> +             return ret;
>>       }

>Sorry, one more comment, why we don't quit if the 'ret' is other error
>value?
>
> Peter

We quit if error is anything other then -EINVAL.
In case of -EINVAL, it means we are deliberating ignoring that
property thus left it.
Also the previous functionality was like this when we were using
of_find_property().
Please let me know if this need to be changed, that we need to return
in all kind of error, I will fix it and send it in patch v5.


Regards,
Saurabh

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

* Re: [PATCH v4] usb: chipidea: removing of_find_property
  2015-11-18  6:18                 ` Saurabh Sengar
@ 2015-11-18  7:24                   ` Peter Chen
  2015-11-18  7:41                     ` Saurabh Sengar
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Chen @ 2015-11-18  7:24 UTC (permalink / raw)
  To: Saurabh Sengar; +Cc: Måns Rullgård, Greg KH, linux-usb, linux-kernel

On Wed, Nov 18, 2015 at 11:48:36AM +0530, Saurabh Sengar wrote:
> On 18 November 2015 at 11:35, Peter Chen <peter.chen@freescale.com> wrote:
> > On Wed, Nov 18, 2015 at 09:40:12AM +0530, Saurabh Sengar wrote:
> >> call to of_find_property() before of_property_read_u32() is unnecessary.
> >> of_property_read_u32() anyway calls to of_find_property() only.
> >>
> >> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> >> ---
> >> v4 : removed return type check for optional property 'itc-setting'
> >>
> >>  drivers/usb/chipidea/core.c | 57 +++++++++++++++++----------------------------
> >>  1 file changed, 22 insertions(+), 35 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> >> index 965d0e2..3d1c3c5 100644
> >> --- a/drivers/usb/chipidea/core.c
> >> +++ b/drivers/usb/chipidea/core.c
> >> @@ -688,52 +688,39 @@ static int ci_get_platdata(struct device *dev,
> >>       if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
> >>               platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
> >>
> >> -     if (of_find_property(dev->of_node, "phy-clkgate-delay-us", NULL))
> >> -             of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> >> +     of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
> >>                                    &platdata->phy_clkgate_delay_us);
> >>
> >>       platdata->itc_setting = 1;
> >> -     if (of_find_property(dev->of_node, "itc-setting", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "itc-setting",
> >> -                     &platdata->itc_setting);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get itc-setting\n");
> >> -                     return ret;
> >> -             }
> >> -     }
> >>
> >> -     if (of_find_property(dev->of_node, "ahb-burst-config", NULL)) {
> >> -             ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> -                     &platdata->ahb_burst_config);
> >> -             if (ret) {
> >> -                     dev_err(dev,
> >> -                             "failed to get ahb-burst-config\n");
> >> -                     return ret;
> >> -             }
> >> +     of_property_read_u32(dev->of_node, "itc-setting",
> >> +                                     &platdata->itc_setting);
> >> +
> >> +     ret = of_property_read_u32(dev->of_node, "ahb-burst-config",
> >> +                             &platdata->ahb_burst_config);
> >> +     if (!ret) {
> >>               platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST;
> >> +     } else if (ret != -EINVAL) {
> >> +             dev_err(dev, "failed to get ahb-burst-config\n");
> >> +             return ret;
> >>       }
> 
> >Sorry, one more comment, why we don't quit if the 'ret' is other error
> >value?
> >
> > Peter
> 
> We quit if error is anything other then -EINVAL.
> In case of -EINVAL, it means we are deliberating ignoring that
> property thus left it.
> Also the previous functionality was like this when we were using
> of_find_property().
> Please let me know if this need to be changed, that we need to return
> in all kind of error, I will fix it and send it in patch v5.
> 

I am clear now, I will queue it.

-- 

Best Regards,
Peter Chen

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

* Re: [PATCH v4] usb: chipidea: removing of_find_property
  2015-11-18  7:24                   ` Peter Chen
@ 2015-11-18  7:41                     ` Saurabh Sengar
  0 siblings, 0 replies; 15+ messages in thread
From: Saurabh Sengar @ 2015-11-18  7:41 UTC (permalink / raw)
  To: Peter Chen; +Cc: Måns Rullgård, Greg KH, linux-usb, linux-kernel

On 18 November 2015 at 12:54, Peter Chen <peter.chen@freescale.com> wrote:
> I am clear now, I will queue it.


Thank you

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

end of thread, other threads:[~2015-11-18  7:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 11:07 [PATCH] usb: chipidea: removing of_find_property Saurabh Sengar
2015-11-17 11:20 ` Måns Rullgård
2015-11-17 11:40   ` [PATCH v2] " Saurabh Sengar
2015-11-17 11:44     ` Måns Rullgård
2015-11-17 11:52       ` [PATCH v3] " Saurabh Sengar
2015-11-18  3:38         ` Peter Chen
2015-11-18  4:00           ` Saurabh Sengar
2015-11-18  4:10             ` [PATCH v4] " Saurabh Sengar
2015-11-18  6:05               ` Peter Chen
2015-11-18  6:18                 ` Saurabh Sengar
2015-11-18  7:24                   ` Peter Chen
2015-11-18  7:41                     ` Saurabh Sengar
2015-11-18  4:44             ` [PATCH v3] " Peter Chen
     [not found] <201511172007.DmGhbpj1%fengguang.wu@intel.com>
2015-11-17 12:58 ` [PATCH v2] " Julia Lawall
2015-11-17 13:11   ` Saurabh Sengar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox