[U-Boot] [PATCH 05/16] usb: hub: Add a new API to test if a hub device is root hub

Bin Meng bmeng.cn at gmail.com
Wed Jun 28 08:27:10 UTC 2017


Hi Marek,

On Sat, Jun 24, 2017 at 1:55 AM, Marek Vasut <marex at denx.de> wrote:
> On 06/23/2017 11:54 AM, Bin Meng wrote:
>> Sometimes we need know if a given hub device is root hub or not.
>> Add a new API to test this.
>>
>> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>> ---
>>
>>  common/usb_hub.c | 10 ++++++++++
>>  include/usb.h    |  8 ++++++++
>>  2 files changed, 18 insertions(+)
>>
>> diff --git a/common/usb_hub.c b/common/usb_hub.c
>> index 18bd827..d780251 100644
>> --- a/common/usb_hub.c
>> +++ b/common/usb_hub.c
>> @@ -74,6 +74,16 @@ static inline bool usb_hub_is_superspeed(struct usb_device *hdev)
>>       return hdev->descriptor.bDeviceProtocol == 3;
>>  }
>>
>> +#ifdef CONFIG_DM_USB
>> +bool usb_hub_is_root_hub(struct udevice *hub)
>> +{
>> +     if (device_get_uclass_id(hub->parent) != UCLASS_USB_HUB)
>
> Can this call fail ?

No,

Regards,
Bin


More information about the U-Boot mailing list