[U-Boot] [PATCH 2/6] usb: host: xhci-omap: fix double weak board_usb_init functions

Uri Mashiach uri.mashiach at compulab.co.il
Sun Feb 12 09:49:28 UTC 2017


Hi,

On 02/09/2017 05:27 PM, Tom Rini wrote:
> On Thu, Feb 09, 2017 at 02:35:30PM +0100, Marek Vasut wrote:
>> On 02/09/2017 12:36 PM, Uri Mashiach wrote:
>>> Hello Marek,
>>
>>
>> Hi!
>>
>> [...]
>>
>>>>> diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
>>>>> index b881b19..ceee12a 100644
>>>>> --- a/drivers/usb/host/xhci-omap.c
>>>>> +++ b/drivers/usb/host/xhci-omap.c
>>>>> @@ -27,12 +27,31 @@ DECLARE_GLOBAL_DATA_PTR;
>>>>>
>>>>>  static struct omap_xhci omap;
>>>>>
>>>>> -__weak int __board_usb_init(int index, enum usb_init_type init)
>>>>> +__weak int __omap_xhci_board_usb_init(int index, enum usb_init_type
>>>>> init)
>>>>>  {
>>>>>      return 0;
>>>>>  }
>>>>> +
>>>>> +int omap_xhci_board_usb_init(int index, enum usb_init_type init)
>>>>> +    __attribute__((weak, alias("__omap_xhci_board_usb_init")));
>>>>
>>>> You can just use __weak instead of this attribute block .
>>>>
>>>
>>> With the attribute block it is possible to call to
>>> __omap_xhci_board_usb_init from the board file.
>>> Do you think it's redundant?
>>
>> Yes, but feel free to prove me wrong, I'm not an omap expert.
>
> This isn't an omap issue, it's a compiler issue.  IFF we need both
> omap_xhci_board_usb_init and __omap_xhci_board_usb_init then we need the
> above declaration as that provides both.  IFF we only need one function,
> name it as needed and use __weak.  __weak just sets the weak attribute
> (and __alias(foo) will just set the alias attribute).
>

Currently only the omap_xhci_board_usb_init function is needed.
I will go for the __weak instead of this attribute block in V2.

-- 
Thanks,
Uri


More information about the U-Boot mailing list