[balbi-usb:next,38/65] (.text+0x0): multiple definition of `of_usb_get_dr_mode_by_phy'

Message ID 878u4tdqdx.fsf@saruman.tx.rr.com
State New
Headers show

Commit Message

Felipe Balbi Dec. 17, 2015, 3:52 p.m.
Hi,

kbuild test robot <fengguang.wu@intel.com> writes:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next

> head:   b7bd98b7db9fc8fe19da1a5ff0215311c6b95e46

> commit: 98bfb39466954c69d2a448e6ddcab6d91cd48e25 [38/65] usb: of: add an api to get dr_mode by the phy node

> config: x86_64-acpi-redef (attached as .config)

> reproduce:

>         git checkout 98bfb39466954c69d2a448e6ddcab6d91cd48e25

>         # save the attached .config to linux build tree

>         make ARCH=x86_64 

>

> All errors (new ones prefixed by >>):

>

>    drivers/usb/common/built-in.o: In function `of_usb_get_dr_mode_by_phy':

>>> (.text+0x0): multiple definition of `of_usb_get_dr_mode_by_phy'

>    drivers/usb/chipidea/built-in.o:(.text+0xd61): first defined here



seems like a false positive to me. There's only one definition of
of_usb_get_dr_mode_by_phy(). Oh no, wait. Bin missed a static inline.


I'll apply this to my 'next'.

-- 
balbi

Comments

Felipe Balbi Dec. 17, 2015, 4:07 p.m. | #1
Hi,

David Laight <David.Laight@ACULAB.COM> writes:
> From: Bin Liu

>> Sent: 17 December 2015 15:55

> ...

>> >>     drivers/usb/common/built-in.o: In function `of_usb_get_dr_mode_by_phy':

>> >>>> (.text+0x0): multiple definition of `of_usb_get_dr_mode_by_phy'

>> >>     drivers/usb/chipidea/built-in.o:(.text+0xd61): first defined here

>> >

>> >

>> > seems like a false positive to me. There's only one definition of

>> > of_usb_get_dr_mode_by_phy(). Oh no, wait. Bin missed a static inline.

>> >

>> > diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h

>> > index 3805757dcdc2..974bce93aa28 100644

>> > --- a/include/linux/usb/of.h

>> > +++ b/include/linux/usb/of.h

>> > @@ -17,7 +17,8 @@ bool of_usb_host_tpl_support(struct device_node *np);

>> >   int of_usb_update_otg_caps(struct device_node *np,

>> >   			struct usb_otg_caps *otg_caps);

>> >   #else

>> > -enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np)

>> > +static inline enum usb_dr_mode

>> > +of_usb_get_dr_mode_by_phy(struct device_node *phy_np)

>> >   {

>> >   	return USB_DR_MODE_UNKNOWN;

>> >   }

>> >

>> > I'll apply this to my 'next'.

>> >

>> 

>> Thanks for fixing it.

>

> Having static and non-static functions with the same name in

> different drivers seems like a recipe for disaster just waiting to happen.

>

> If nothing else it makes grepping the source tree more painful.


huh ? There's no static vs non-static crap. Just the stub for when OF is
disabled missed a static inline, that's all.

-- 
balbi

Patch

diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
index 3805757dcdc2..974bce93aa28 100644
--- a/include/linux/usb/of.h
+++ b/include/linux/usb/of.h
@@ -17,7 +17,8 @@  bool of_usb_host_tpl_support(struct device_node *np);
 int of_usb_update_otg_caps(struct device_node *np,
 			struct usb_otg_caps *otg_caps);
 #else
-enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *phy_np)
+static inline enum usb_dr_mode
+of_usb_get_dr_mode_by_phy(struct device_node *phy_np)
 {
 	return USB_DR_MODE_UNKNOWN;
 }