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

Tom Rini trini at konsulko.com
Thu Feb 9 15:27:53 UTC 2017


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).

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170209/6d621736/attachment.sig>


More information about the U-Boot mailing list