[hid:for-5.13/upstream-fixes 3/17] undefined reference to `usb_hid_driver'

Started by kernel test robot on May 26, 2021 · 3 messages from 2 authors · Last reply May 26, 2021

open the first message on its own page

Message details and related content
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-5.13/upstream-fixes
head:   624d8a18c8cd62e7613a9b2b6850205e0b6b9c7d
commit: 2d21c6e884482b01b3878be220c51368a442bcc6 [3/17] HID: core: Add a hid_is_usb_device() helper function
config: nios2-randconfig-c003-20210526 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?id=2d21c6e884482b01b3878be220c51368a442bcc6
        git remote add hid https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
        git fetch --no-tags hid for-5.13/upstream-fixes
        git checkout 2d21c6e884482b01b3878be220c51368a442bcc6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All errors (new ones prefixed by >>):

   nios2-linux-ld: drivers/hid/hid-core.o: in function `hid_is_usb_device':
quoted
(.text+0x298): undefined reference to `usb_hid_driver'
nios2-linux-ld: (.text+0x29c): undefined reference to `usb_hid_driver'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Message details and related content
Hi,

On 5/26/21 5:51 PM, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-5.13/upstream-fixes
head:   624d8a18c8cd62e7613a9b2b6850205e0b6b9c7d
commit: 2d21c6e884482b01b3878be220c51368a442bcc6 [3/17] HID: core: Add a hid_is_usb_device() helper function
config: nios2-randconfig-c003-20210526 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?id=2d21c6e884482b01b3878be220c51368a442bcc6
        git remote add hid https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
        git fetch --no-tags hid for-5.13/upstream-fixes
        git checkout 2d21c6e884482b01b3878be220c51368a442bcc6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
Ugh, this is caused by:

CONFIG_HID=y
CONFIG_USB_HID=m

I expected this to never happen because CONFIG_USB_HID does "select CONFIG_HID"
but CONFIG_HID is also selected by CONFIG_I2C_HID_CORE which is:

CONFIG_I2C_HID_CORE=y

in the .config triggering this error; and I see that:

drivers/hid/intel-ish-hid/Kconfig
drivers/hid/surface-hid/Kconfig

both also do a "select HID", where as drivers/hid/amd-sfh-hid/Kconfig
interestingly enough uses "depends on HID", so that can only be build of
one of the other HID ll-driver providers are enabled.

So I see 3 possible fixes:

1. Use IS_REACHABLE instead of IS_ENABLED inside hid_is_usb_device,
which means that hid_is_usb_device will always return false when
CONFIG_HID=y && CONFIG_USB_HID=m which is wrong.

2. Add a name field to struct hid_ll_driver, or maybe an enum
   and use strcmp (or == in case of an enum)

3. Talking about using an enum another fix would be to check that
   hid_dev->bus == BUS_USB

Actually I now see that there are already various drivers doing 3,
including hid-core.c (to decided to remove HID_CONNECT_HIDDEV from the
connect_mask), instead of the hid_is_using_ll_driver() check,
so 3 is probably best.

One issue with 3 though is that we also have the special hid-logitech-dj
code which acts as a hid_ll_driver for devices behind logitech wireless
receivers and which uses BUS_USB for those devices behind the

46 more lines

All errors (new ones prefixed by >>):

   nios2-linux-ld: drivers/hid/hid-core.o: in function `hid_is_usb_device':
quoted
quoted
(.text+0x298): undefined reference to `usb_hid_driver'
nios2-linux-ld: (.text+0x29c): undefined reference to `usb_hid_driver'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Message details and related content
Hi,

On 5/26/21 5:51 PM, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-5.13/upstream-fixes
head:   624d8a18c8cd62e7613a9b2b6850205e0b6b9c7d
commit: 2d21c6e884482b01b3878be220c51368a442bcc6 [3/17] HID: core: Add a hid_is_usb_device() helper function
config: nios2-randconfig-c003-20210526 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/commit/?id=2d21c6e884482b01b3878be220c51368a442bcc6
        git remote add hid https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
        git fetch --no-tags hid for-5.13/upstream-fixes
        git checkout 2d21c6e884482b01b3878be220c51368a442bcc6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
Ugh, this is caused by:

CONFIG_HID=y
CONFIG_USB_HID=m

I expected this to never happen because CONFIG_USB_HID does "select CONFIG_HID"
but CONFIG_HID is also selected by CONFIG_I2C_HID_CORE which is:

CONFIG_I2C_HID_CORE=y

in the .config triggering this error; and I see that:

drivers/hid/intel-ish-hid/Kconfig
drivers/hid/surface-hid/Kconfig

both also do a "select HID", where as drivers/hid/amd-sfh-hid/Kconfig
interestingly enough uses "depends on HID", so that can only be build of
one of the other HID ll-driver providers are enabled.

So I see 3 possible fixes:

1. Use IS_REACHABLE instead of IS_ENABLED inside hid_is_usb_device,
which means that hid_is_usb_device will always return false when
CONFIG_HID=y && CONFIG_USB_HID=m which is wrong.

2. Add a name field to struct hid_ll_driver, or maybe an enum
   and use strcmp (or == in case of an enum)

3. Talking about using an enum another fix would be to check that
   hid_dev->bus == BUS_USB

Actually I now see that there are already various drivers doing 3,
including hid-core.c (to decided to remove HID_CONNECT_HIDDEV from the
connect_mask), instead of the hid_is_using_ll_driver() check,
so 3 is probably best.

One issue with 3 though is that we also have the special hid-logitech-dj
code which acts as a hid_ll_driver for devices behind logitech wireless
receivers and which uses BUS_USB for those devices behind the

46 more lines

All errors (new ones prefixed by >>):

   nios2-linux-ld: drivers/hid/hid-core.o: in function `hid_is_usb_device':
quoted
quoted
(.text+0x298): undefined reference to `usb_hid_driver'
nios2-linux-ld: (.text+0x29c): undefined reference to `usb_hid_driver'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help