public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v6 5/8] usb: dwc2: use dev_read_bool() instead of fdt_getprop()
Date: Thu, 22 Jun 2017 19:29:15 +0200	[thread overview]
Message-ID: <2547757.S1d95WA6co@phil> (raw)
In-Reply-To: <1498017507-12184-6-git-send-email-daniel.meng@rock-chips.com>

Hi,

Am Mittwoch, 21. Juni 2017, 11:58:24 CEST schrieb Meng Dongyang:
> Use dev_read_bool() instead of fdt_getprop() to get the property
> from DTS. And add a comment for "hnp-srp-disable" property to
> fully describe its effect.
> 
> Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
> ---
> 
> Changes in v6:
> - New patch
> - Use dev_read_bool() instead of fdt_getprop()
> - Add a comment for "hnp-srp-disable" feature
> 
>  drivers/usb/host/dwc2.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
> index 841e596..3996f67 100644
> --- a/drivers/usb/host/dwc2.c
> +++ b/drivers/usb/host/dwc2.c
> @@ -43,6 +43,10 @@ struct dwc2_priv {
>  	struct dwc2_core_regs *regs;
>  	int root_hub_devnum;
>  	bool ext_vbus;
> +	/*
> +	 * The hnp/srp capability must be disabled if the platform
> +	 * does't support hnp/srp. Otherwise the force mode can't work.
> +	 */
>  	bool hnp_srp_disable;
>  	bool oc_disable;
>  };
> @@ -1247,15 +1251,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
>  		return -EINVAL;
>  	priv->regs = (struct dwc2_core_regs *)addr;
>  
> -	prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
> -			   "disable-over-current", NULL);
> -	if (prop)
> -		priv->oc_disable = true;
> -
> -	prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
> -			   "hnp-srp-disable", NULL);
> -	if (prop)
> -		priv->hnp_srp_disable = true;
> +	priv->oc_disable = dev_read_bool(dev, "disable-over-current");
> +	priv->hnp_srp_disable = dev_read_bool(dev, "hnp-srp-disable");

with this patch applied, I get

drivers/usb/host/dwc2.c: In function ‘dwc2_usb_ofdata_to_platdata’:
drivers/usb/host/dwc2.c:1246:14: warning: unused variable ‘prop’ [-Wunused-variable]
  const void *prop;
              ^~~~

so you might want to remove the prop var as well?

  reply	other threads:[~2017-06-22 17:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  3:58 [U-Boot] [PATCH v6 0/8] rk3328: add support of usb host and gadget Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 1/8] usb: Kconfig: add depends on features for xhci-rockchip driver Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 2/8] usb: host: xhci-rockchip: use fixed regulator to control vbus Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 3/8] rockchip: dts: rk3328: add fix-regulator node for xhci Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 4/8] rockchip: configs: rk3328: enable dwc2 driver and config fastboot Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 5/8] usb: dwc2: use dev_read_bool() instead of fdt_getprop() Meng Dongyang
2017-06-22 17:29   ` Heiko Stuebner [this message]
2017-06-23  3:55     ` rock-chips
2017-06-21  3:58 ` [U-Boot] [PATCH v6 6/8] rockchip: rk3328: board: add support of dwc2 gadget Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 7/8] rockchip: dts: rk3328: support and enable dwc2 Meng Dongyang
2017-06-21  3:58 ` [U-Boot] [PATCH v6 8/8] rockchip: dts: rk3399: control vbus of typec by fixed regulator Meng Dongyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2547757.S1d95WA6co@phil \
    --to=heiko@sntech.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox