Linux Input/HID development
 help / color / mirror / Atom feed
* [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb'
@ 2026-10-17  7:25 kernel test robot
  2026-10-17 13:12 ` Silvan Jegen
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2026-10-17  7:25 UTC (permalink / raw)
  To: Vicki Pfau; +Cc: oe-kbuild-all, linux-input, Jiri Kosina, Silvan Jegen

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.4/nintendo
head:   77c7155e2707ba5b1d56f3dc1acead48cf17f98d
commit: 9417132df63e5cd7230433af05198538e759f3ae [2/5] HID: nintendo: Add preliminary Switch 2 controller driver
config: i386-randconfig-1001-20261016 (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610171559.gZ0QBMFv-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: drivers/hid/hid-nintendo.o: in function `switch2_probe':
>> drivers/hid/hid-nintendo.c:3993:(.text+0x6cd7): undefined reference to `hid_is_usb'


vim +3993 drivers/hid/hid-nintendo.c

  3985	
  3986	static int switch2_probe(struct hid_device *hdev, const struct hid_device_id *id)
  3987	{
  3988		struct switch2_controller *ns2;
  3989		struct usb_device *udev;
  3990		char phys[64];
  3991		int ret;
  3992	
> 3993		if (!hid_is_usb(hdev))
  3994			return -ENODEV;
  3995	
  3996		udev = hid_to_usb_dev(hdev);
  3997		if (usb_make_path(udev, phys, sizeof(phys)) < 0)
  3998			return -EINVAL;
  3999	
  4000		ret = hid_parse(hdev);
  4001		if (ret) {
  4002			hid_err(hdev, "parse failed %d\n", ret);
  4003			return ret;
  4004		}
  4005	
  4006		ns2 = switch2_get_controller(phys);
  4007		if (IS_ERR(ns2))
  4008			return PTR_ERR(ns2);
  4009	
  4010		mutex_lock(&ns2->lock);
  4011		if (ns2->hdev) {
  4012			mutex_unlock(&ns2->lock);
  4013			hid_err(hdev,
  4014				"Second hdev tried to claim same controller, first=%p vs second=%p\n",
  4015				ns2->hdev, hdev);
  4016			kref_put(&ns2->refcount, switch2_kref_put);
  4017			return -EBUSY;
  4018		}
  4019		ns2->hdev = hdev;
  4020		hid_set_drvdata(hdev, ns2);
  4021	
  4022		switch (hdev->product | (hdev->vendor << 16)) {
  4023		default:
  4024			strscpy(ns2->name, hdev->name, sizeof(ns2->name));
  4025			break;
  4026		/* Some controllers have slightly wrong names so we override them */
  4027		case USB_DEVICE_ID_NINTENDO_NS2_JOYCONR | (USB_VENDOR_ID_NINTENDO << 16):
  4028			/* Missing the "2" in the name */
  4029			strscpy(ns2->name, "Nintendo Joy-Con 2 (R)", sizeof(ns2->name));
  4030			break;
  4031		case USB_DEVICE_ID_NINTENDO_NS2_GCCON | (USB_VENDOR_ID_NINTENDO << 16):
  4032			/* Has "Nintendo" in the name twice */
  4033			strscpy(ns2->name, "Nintendo GameCube Controller", sizeof(ns2->name));
  4034			break;
  4035		}
  4036	
  4037		ns2->player_id = U32_MAX;
  4038		ret = ida_alloc(&nintendo_player_id_allocator, GFP_KERNEL);
  4039		if (ret < 0)
  4040			hid_warn(hdev, "Failed to allocate player ID, skipping; ret=%d\n", ret);
  4041		else
  4042			ns2->player_id = ret;
  4043	
  4044		ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
  4045		if (ret) {
  4046			hid_err(hdev, "hw_start failed %d\n", ret);
  4047			goto err_cleanup;
  4048		}
  4049	
  4050		ret = hid_hw_open(hdev);
  4051		if (ret) {
  4052			hid_err(hdev, "hw_open failed %d\n", ret);
  4053			goto err_stop;
  4054		}
  4055	
  4056		ret = 0;
  4057		if (ns2->cfg)
  4058			ret = switch2_init_controller(ns2);
  4059	
  4060		if (!ret) {
  4061			mutex_unlock(&ns2->lock);
  4062			return 0;
  4063		}
  4064	
  4065		hid_hw_close(hdev);
  4066	err_stop:
  4067		hid_hw_stop(hdev);
  4068	err_cleanup:
  4069		ida_free(&nintendo_player_id_allocator, ns2->player_id);
  4070		ns2->hdev = NULL;
  4071		mutex_unlock(&ns2->lock);
  4072		switch2_controller_put(ns2);
  4073		kref_put(&ns2->refcount, switch2_kref_put);
  4074	
  4075		return ret;
  4076	}
  4077	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb'
  2026-10-17  7:25 [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb' kernel test robot
@ 2026-10-17 13:12 ` Silvan Jegen
  2026-10-17 13:24   ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Silvan Jegen @ 2026-10-17 13:12 UTC (permalink / raw)
  To: kernel test robot; +Cc: Vicki Pfau, oe-kbuild-all, linux-input, Jiri Kosina

Heyhey!

kernel test robot <lkp@intel.com> wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.4/nintendo
> head:   77c7155e2707ba5b1d56f3dc1acead48cf17f98d
> commit: 9417132df63e5cd7230433af05198538e759f3ae [2/5] HID: nintendo: Add preliminary Switch 2 controller driver
> config: i386-randconfig-1001-20261016 (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config)
> compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202610171559.gZ0QBMFv-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    ld: drivers/hid/hid-nintendo.o: in function `switch2_probe':
> >> drivers/hid/hid-nintendo.c:3993:(.text+0x6cd7): undefined reference to `hid_is_usb'

I might be doing something wrong but I have checked out "for-7.4/nintendo"
from the https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
remote and my build finished without errors ...

So I'm not able to reproduce this issue locally.

Cheers,
Silvan


> 
> 
> vim +3993 drivers/hid/hid-nintendo.c
> 
>   3985	
>   3986	static int switch2_probe(struct hid_device *hdev, const struct hid_device_id *id)
>   3987	{
>   3988		struct switch2_controller *ns2;
>   3989		struct usb_device *udev;
>   3990		char phys[64];
>   3991		int ret;
>   3992	
> > 3993		if (!hid_is_usb(hdev))
>   3994			return -ENODEV;
>   3995	
>   3996		udev = hid_to_usb_dev(hdev);
>   3997		if (usb_make_path(udev, phys, sizeof(phys)) < 0)
>   3998			return -EINVAL;
>   3999	
>   4000		ret = hid_parse(hdev);
>   4001		if (ret) {
>   4002			hid_err(hdev, "parse failed %d\n", ret);
>   4003			return ret;
>   4004		}
>   4005	
>   4006		ns2 = switch2_get_controller(phys);
>   4007		if (IS_ERR(ns2))
>   4008			return PTR_ERR(ns2);
>   4009	
>   4010		mutex_lock(&ns2->lock);
>   4011		if (ns2->hdev) {
>   4012			mutex_unlock(&ns2->lock);
>   4013			hid_err(hdev,
>   4014				"Second hdev tried to claim same controller, first=%p vs second=%p\n",
>   4015				ns2->hdev, hdev);
>   4016			kref_put(&ns2->refcount, switch2_kref_put);
>   4017			return -EBUSY;
>   4018		}
>   4019		ns2->hdev = hdev;
>   4020		hid_set_drvdata(hdev, ns2);
>   4021	
>   4022		switch (hdev->product | (hdev->vendor << 16)) {
>   4023		default:
>   4024			strscpy(ns2->name, hdev->name, sizeof(ns2->name));
>   4025			break;
>   4026		/* Some controllers have slightly wrong names so we override them */
>   4027		case USB_DEVICE_ID_NINTENDO_NS2_JOYCONR | (USB_VENDOR_ID_NINTENDO << 16):
>   4028			/* Missing the "2" in the name */
>   4029			strscpy(ns2->name, "Nintendo Joy-Con 2 (R)", sizeof(ns2->name));
>   4030			break;
>   4031		case USB_DEVICE_ID_NINTENDO_NS2_GCCON | (USB_VENDOR_ID_NINTENDO << 16):
>   4032			/* Has "Nintendo" in the name twice */
>   4033			strscpy(ns2->name, "Nintendo GameCube Controller", sizeof(ns2->name));
>   4034			break;
>   4035		}
>   4036	
>   4037		ns2->player_id = U32_MAX;
>   4038		ret = ida_alloc(&nintendo_player_id_allocator, GFP_KERNEL);
>   4039		if (ret < 0)
>   4040			hid_warn(hdev, "Failed to allocate player ID, skipping; ret=%d\n", ret);
>   4041		else
>   4042			ns2->player_id = ret;
>   4043	
>   4044		ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
>   4045		if (ret) {
>   4046			hid_err(hdev, "hw_start failed %d\n", ret);
>   4047			goto err_cleanup;
>   4048		}
>   4049	
>   4050		ret = hid_hw_open(hdev);
>   4051		if (ret) {
>   4052			hid_err(hdev, "hw_open failed %d\n", ret);
>   4053			goto err_stop;
>   4054		}
>   4055	
>   4056		ret = 0;
>   4057		if (ns2->cfg)
>   4058			ret = switch2_init_controller(ns2);
>   4059	
>   4060		if (!ret) {
>   4061			mutex_unlock(&ns2->lock);
>   4062			return 0;
>   4063		}
>   4064	
>   4065		hid_hw_close(hdev);
>   4066	err_stop:
>   4067		hid_hw_stop(hdev);
>   4068	err_cleanup:
>   4069		ida_free(&nintendo_player_id_allocator, ns2->player_id);
>   4070		ns2->hdev = NULL;
>   4071		mutex_unlock(&ns2->lock);
>   4072		switch2_controller_put(ns2);
>   4073		kref_put(&ns2->refcount, switch2_kref_put);
>   4074	
>   4075		return ret;
>   4076	}
>   4077	
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb'
  2026-10-17 13:12 ` Silvan Jegen
@ 2026-10-17 13:24   ` Jiri Kosina
  2026-10-17 13:55     ` [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb Silvan Jegen
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2026-10-17 13:24 UTC (permalink / raw)
  To: Silvan Jegen; +Cc: kernel test robot, Vicki Pfau, oe-kbuild-all, linux-input

On Sat, 17 Oct 2026, Silvan Jegen wrote:

> Heyhey!
> 
> kernel test robot <lkp@intel.com> wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.4/nintendo
> > head:   77c7155e2707ba5b1d56f3dc1acead48cf17f98d
> > commit: 9417132df63e5cd7230433af05198538e759f3ae [2/5] HID: nintendo: Add preliminary Switch 2 controller driver
> > config: i386-randconfig-1001-20261016 (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config)
> > compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202610171559.gZ0QBMFv-lkp@intel.com/
> > 
> > All errors (new ones prefixed by >>):
> > 
> >    ld: drivers/hid/hid-nintendo.o: in function `switch2_probe':
> > >> drivers/hid/hid-nintendo.c:3993:(.text+0x6cd7): undefined reference to `hid_is_usb'
> 
> I might be doing something wrong but I have checked out "for-7.4/nintendo"
> from the https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
> remote and my build finished without errors ...
> 
> So I'm not able to reproduce this issue locally.

Did you use config from

	https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config

? I am pretty sure the culprit is that USB_HID is unset. 

We'd need 'depends on USB_HID' for CONFIG_HID_NINTENDO.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb
  2026-10-17 13:24   ` Jiri Kosina
@ 2026-10-17 13:55     ` Silvan Jegen
  0 siblings, 0 replies; 4+ messages in thread
From: Silvan Jegen @ 2026-10-17 13:55 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: kernel test robot, Vicki Pfau, oe-kbuild-all, linux-input

Jiri Kosina <jikos@kernel.org> wrote:
> On Sat, 17 Oct 2026, Silvan Jegen wrote:
> 
> > Heyhey!
> > 
> > kernel test robot <lkp@intel.com> wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.4/nintendo
> > > head:   77c7155e2707ba5b1d56f3dc1acead48cf17f98d
> > > commit: 9417132df63e5cd7230433af05198538e759f3ae [2/5] HID: nintendo: Add preliminary Switch 2 controller driver
> > > config: i386-randconfig-1001-20261016 (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config)
> > > compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
> > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/reproduce)
> > > 
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/202610171559.gZ0QBMFv-lkp@intel.com/
> > > 
> > > All errors (new ones prefixed by >>):
> > > 
> > >    ld: drivers/hid/hid-nintendo.o: in function `switch2_probe':
> > > >> drivers/hid/hid-nintendo.c:3993:(.text+0x6cd7): undefined reference to `hid_is_usb'
> > 
> > I might be doing something wrong but I have checked out "for-7.4/nintendo"
> > from the https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git
> > remote and my build finished without errors ...
> > 
> > So I'm not able to reproduce this issue locally.
> 
> Did you use config from
> 
> 	https://download.01.org/0day-ci/archive/20261017/202610171559.gZ0QBMFv-lkp@intel.com/config
> 
> ? I am pretty sure the culprit is that USB_HID is unset. 

Ah, I missed that this config was used.

USB_HID is indeed unset in this config.


> 
> We'd need 'depends on USB_HID' for CONFIG_HID_NINTENDO.

Yes, that makes sense!

I'm not familiar with the correct process in this case. Should Vickie
write a patch based on the

https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-7.4/nintendo

branch or will you fix it up on your side?

Cheers,
Silvan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-17 13:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17  7:25 [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb' kernel test robot
2026-10-17 13:12 ` Silvan Jegen
2026-10-17 13:24   ` Jiri Kosina
2026-10-17 13:55     ` [hid:for-7.4/nintendo 2/5] drivers/hid/hid-nintendo.c:3993:undefined reference to `hid_is_usb Silvan Jegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox