lkml.org 
[lkml]   [2019]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 10/12] hikey960: Support usb functionality of Hikey960
From
Date
Hi Chunfeng Yun,

On 2019/3/4 9:47, Chunfeng Yun wrote:

>> +
>> + hisi_hikey_usb->role_sw = usb_role_switch_get(dev);
>> + if (!hisi_hikey_usb->role_sw)
>> + return -EPROBE_DEFER;
> Here return EPROBE_DEFFER means the related device_connection is
> registered after this probe is called, right?
> if not, use IS_ERR_OR_NULL then return PTR_ERR is enough
Yes, the driver which register the usb_role_switch may finish probe after
this driver is probed for the first time.
>> + else if (IS_ERR(hisi_hikey_usb->role_sw))
>> + return PTR_ERR(hisi_hikey_usb->role_sw);
>> +
>> + ret = usb_role_switch_register_notifier(hisi_hikey_usb->role_sw,
>> + &hisi_hikey_usb->nb);
>> + if (ret) {
>> + usb_role_switch_put(hisi_hikey_usb->role_sw);
>> + return ret;
>> + }
>> +
>> + platform_set_drvdata(pdev, hisi_hikey_usb);
>> +
>> + return 0;
>> +}
>> +

>
>
> .
>

\
 
 \ /
  Last update: 2019-03-04 02:56    [W:0.105 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site