[U-Boot] [PATCH v6 5/8] usb: dwc2: use dev_read_bool() instead of fdt_getprop()

rock-chips(daniel.meng) daniel.meng at rock-chips.com
Fri Jun 23 03:55:31 UTC 2017



On 2017/6/23 1:29, Heiko Stuebner wrote:
> 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 at 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?

Yes, I forgot this.

>
>




More information about the U-Boot mailing list