mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] usb: chipidea: removing of_find_property
@ 2015-11-17 11:20 Måns Rullgård
  2015-11-17 11:40 ` [PATCH v2] " Saurabh Sengar
  0 siblings, 1 reply; 4+ 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] 4+ messages in thread

end of thread, other threads:[~2015-11-17 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201511172007.DmGhbpj1%fengguang.wu@intel.com>
2015-11-17 12:58 ` [PATCH v2] usb: chipidea: removing of_find_property Julia Lawall
2015-11-17 13:11   ` Saurabh Sengar
2015-11-17 11:20 [PATCH] " Måns Rullgård
2015-11-17 11:40 ` [PATCH v2] " Saurabh Sengar
2015-11-17 11:44   ` Måns Rullgård

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

all inboxes | Powered by JetHome®