git: 4b1712817e56 - main - hid: Add child device parameter to HID methods

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Thu, 03 Aug 2023 16:12:03 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b1712817e56840acc5e9fd59028ef79007ff579

commit 4b1712817e56840acc5e9fd59028ef79007ff579
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-08-03 16:10:50 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2023-08-03 16:10:50 +0000

    hid: Add child device parameter to HID methods
    
    Some devices like Apple HID-over-SPI may contain more than one report
    descriptors necessitating creation of multiple hidbus children.
    Add indentificator of child devices to distinct them.
    No functional changes intended.
    
    Differential Revision:  https://reviews.freebsd.org/D41246
---
 sys/dev/hid/hid.c             | 19 ++++++-----
 sys/dev/hid/hid_if.m          | 13 ++++++++
 sys/dev/hid/hidbus.c          | 78 +++++++++++++++++++++++++++++++++++--------
 sys/dev/hyperv/input/hv_hid.c | 13 ++++----
 sys/dev/iicbus/iichid.c       | 37 +++++++++++---------
 sys/dev/usb/input/usbhid.c    | 37 +++++++++++---------
 6 files changed, 136 insertions(+), 61 deletions(-)

diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c
index cd7fb6bf8778..7fa6e34be22a 100644
--- a/sys/dev/hid/hid.c
+++ b/sys/dev/hid/hid.c
@@ -1031,52 +1031,53 @@ hid_quirk_unload(void *arg)
 int
 hid_get_rdesc(device_t dev, void *data, hid_size_t len)
 {
-	return (HID_GET_RDESC(device_get_parent(dev), data, len));
+	return (HID_GET_RDESC(device_get_parent(dev), dev, data, len));
 }
 
 int
 hid_read(device_t dev, void *data, hid_size_t maxlen, hid_size_t *actlen)
 {
-	return (HID_READ(device_get_parent(dev), data, maxlen, actlen));
+	return (HID_READ(device_get_parent(dev), dev, data, maxlen, actlen));
 }
 
 int
 hid_write(device_t dev, const void *data, hid_size_t len)
 {
-	return (HID_WRITE(device_get_parent(dev), data, len));
+	return (HID_WRITE(device_get_parent(dev), dev, data, len));
 }
 
 int
 hid_get_report(device_t dev, void *data, hid_size_t maxlen, hid_size_t *actlen,
     uint8_t type, uint8_t id)
 {
-	return (HID_GET_REPORT(device_get_parent(dev), data, maxlen, actlen,
-	    type, id));
+	return (HID_GET_REPORT(device_get_parent(dev), dev, data, maxlen,
+	    actlen, type, id));
 }
 
 int
 hid_set_report(device_t dev, const void *data, hid_size_t len, uint8_t type,
     uint8_t id)
 {
-	return (HID_SET_REPORT(device_get_parent(dev), data, len, type, id));
+	return (HID_SET_REPORT(device_get_parent(dev), dev, data, len, type,
+	    id));
 }
 
 int
 hid_set_idle(device_t dev, uint16_t duration, uint8_t id)
 {
-	return (HID_SET_IDLE(device_get_parent(dev), duration, id));
+	return (HID_SET_IDLE(device_get_parent(dev), dev, duration, id));
 }
 
 int
 hid_set_protocol(device_t dev, uint16_t protocol)
 {
-	return (HID_SET_PROTOCOL(device_get_parent(dev), protocol));
+	return (HID_SET_PROTOCOL(device_get_parent(dev), dev, protocol));
 }
 
 int
 hid_ioctl(device_t dev, unsigned long cmd, uintptr_t data)
 {
-	return (HID_IOCTL(device_get_parent(dev), cmd, data));
+	return (HID_IOCTL(device_get_parent(dev), dev, cmd, data));
 }
 
 MODULE_VERSION(hid, 1);
diff --git a/sys/dev/hid/hid_if.m b/sys/dev/hid/hid_if.m
index 38a053b8744e..9050620ccea6 100644
--- a/sys/dev/hid/hid_if.m
+++ b/sys/dev/hid/hid_if.m
@@ -49,6 +49,7 @@ INTERFACE hid;
 #
 METHOD void intr_setup {
 	device_t dev;
+	device_t child;
 	hid_intr_t intr;
 	void *context;
 	struct hid_rdesc_info *rdesc;
@@ -59,6 +60,7 @@ METHOD void intr_setup {
 #
 METHOD void intr_unsetup {
 	device_t dev;
+	device_t child;
 };
 
 #
@@ -66,6 +68,7 @@ METHOD void intr_unsetup {
 #
 METHOD int intr_start {
 	device_t dev;
+	device_t child;
 };
 
 #
@@ -73,6 +76,7 @@ METHOD int intr_start {
 #
 METHOD int intr_stop {
 	device_t dev;
+	device_t child;
 };
 
 #
@@ -82,6 +86,7 @@ METHOD int intr_stop {
 #
 METHOD void intr_poll {
 	device_t dev;
+	device_t child;
 };
 
 # HID interface
@@ -91,6 +96,7 @@ METHOD void intr_poll {
 #
 METHOD int get_rdesc {
 	device_t dev;
+	device_t child;
 	void *data;
 	hid_size_t len;
 };
@@ -102,6 +108,7 @@ METHOD int get_rdesc {
 #
 METHOD int read {
 	device_t dev;
+	device_t child;
 	void *data;
 	hid_size_t maxlen;
 	hid_size_t *actlen;
@@ -113,6 +120,7 @@ METHOD int read {
 #
 METHOD int write {
 	device_t dev;
+	device_t child;
 	const void *data;
 	hid_size_t len;
 };
@@ -127,6 +135,7 @@ METHOD int write {
 #
 METHOD int get_report {
 	device_t dev;
+	device_t child;
 	void *data;
 	hid_size_t maxlen;
 	hid_size_t *actlen;
@@ -142,6 +151,7 @@ METHOD int get_report {
 #
 METHOD int set_report {
 	device_t dev;
+	device_t child;
 	const void *data;
 	hid_size_t len;
 	uint8_t type;
@@ -153,6 +163,7 @@ METHOD int set_report {
 #
 METHOD int set_idle {
 	device_t dev;
+	device_t child;
 	uint16_t duration;
 	uint8_t id;
 };
@@ -162,6 +173,7 @@ METHOD int set_idle {
 #
 METHOD int set_protocol {
 	device_t dev;
+	device_t child;
 	uint16_t protocol;
 };
 
@@ -171,6 +183,7 @@ METHOD int set_protocol {
 #
 METHOD int ioctl {
 	device_t dev;
+	device_t child;
 	unsigned long cmd;
 	uintptr_t data;
 };
diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
index 6ecc7455cc5d..fe6c4df060a3 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -257,7 +257,8 @@ hidbus_attach_children(device_t dev)
 	struct hidbus_softc *sc = device_get_softc(dev);
 	int error;
 
-	HID_INTR_SETUP(device_get_parent(dev), hidbus_intr, sc, &sc->rdesc);
+	HID_INTR_SETUP(device_get_parent(dev), dev, hidbus_intr, sc,
+	    &sc->rdesc);
 
 	error = hidbus_enumerate_children(dev, sc->rdesc.data, sc->rdesc.len);
 	if (error != 0)
@@ -327,7 +328,7 @@ hidbus_detach_children(device_t dev)
 		free(children, M_TEMP);
 	}
 
-	HID_INTR_UNSETUP(device_get_parent(bus));
+	HID_INTR_UNSETUP(device_get_parent(bus), bus);
 
 	return (error);
 }
@@ -479,7 +480,7 @@ hidbus_write_ivar(device_t bus, device_t child, int which, uintptr_t value)
 		tlc->flags = value;
 		if ((value & HIDBUS_FLAG_CAN_POLL) != 0)
 			HID_INTR_SETUP(
-			    device_get_parent(bus), NULL, NULL, NULL);
+			    device_get_parent(bus), bus, NULL, NULL, NULL);
 		break;
 	case HIDBUS_IVAR_DRIVER_INFO:
 		tlc->driver_info = value;
@@ -623,7 +624,7 @@ hidbus_intr_start(device_t child)
 			mtx_unlock(tlc->mtx);
 		}
 	}
-	error = refcnted ? 0 : HID_INTR_START(device_get_parent(bus));
+	error = refcnted ? 0 : HID_INTR_START(device_get_parent(bus), bus);
 	sx_unlock(&sc->sx);
 
 	return (error);
@@ -650,7 +651,7 @@ hidbus_intr_stop(device_t child)
 		}
 		refcnted |= (tlc->refcnt != 0);
 	}
-	error = refcnted ? 0 : HID_INTR_STOP(device_get_parent(bus));
+	error = refcnted ? 0 : HID_INTR_STOP(device_get_parent(bus), bus);
 	sx_unlock(&sc->sx);
 
 	return (error);
@@ -661,7 +662,7 @@ hidbus_intr_poll(device_t child)
 {
 	device_t bus = device_get_parent(child);
 
-	HID_INTR_POLL(device_get_parent(bus));
+	HID_INTR_POLL(device_get_parent(bus), bus);
 }
 
 struct hid_rdesc_info *
@@ -761,7 +762,22 @@ hid_set_report_descr(device_t dev, const void *data, hid_size_t len)
 }
 
 static int
-hidbus_write(device_t dev, const void *data, hid_size_t len)
+hidbus_get_rdesc(device_t dev, device_t child __unused, void *data,
+    hid_size_t len)
+{
+	return (hid_get_rdesc(dev, data, len));
+}
+
+static int
+hidbus_read(device_t dev, device_t child __unused, void *data,
+    hid_size_t maxlen, hid_size_t *actlen)
+{
+	return (hid_read(dev, data, maxlen, actlen));
+}
+
+static int
+hidbus_write(device_t dev, device_t child __unused, const void *data,
+    hid_size_t len)
 {
 	struct hidbus_softc *sc;
 	uint8_t id;
@@ -780,6 +796,40 @@ hidbus_write(device_t dev, const void *data, hid_size_t len)
 	return (hid_write(dev, data, len));
 }
 
+static int
+hidbus_get_report(device_t dev, device_t child __unused, void *data,
+    hid_size_t maxlen, hid_size_t *actlen, uint8_t type, uint8_t id)
+{
+	return (hid_get_report(dev, data, maxlen, actlen, type, id));
+}
+
+static int
+hidbus_set_report(device_t dev, device_t child __unused, const void *data,
+    hid_size_t len, uint8_t type, uint8_t id)
+{
+	return (hid_set_report(dev, data, len, type, id));
+}
+
+static int
+hidbus_set_idle(device_t dev, device_t child __unused, uint16_t duration,
+    uint8_t id)
+{
+	return (hid_set_idle(dev, duration, id));
+}
+
+static int
+hidbus_set_protocol(device_t dev, device_t child __unused, uint16_t protocol)
+{
+	return (hid_set_protocol(dev, protocol));
+}
+
+static int
+hidbus_ioctl(device_t dev, device_t child __unused, unsigned long cmd,
+    uintptr_t data)
+{
+	return (hid_ioctl(dev, cmd, data));
+}
+
 /*------------------------------------------------------------------------*
  *	hidbus_lookup_id
  *
@@ -904,14 +954,14 @@ static device_method_t hidbus_methods[] = {
 	DEVMETHOD(bus_child_location,	hidbus_child_location),
 
 	/* hid interface */
-	DEVMETHOD(hid_get_rdesc,	hid_get_rdesc),
-	DEVMETHOD(hid_read,		hid_read),
+	DEVMETHOD(hid_get_rdesc,	hidbus_get_rdesc),
+	DEVMETHOD(hid_read,		hidbus_read),
 	DEVMETHOD(hid_write,		hidbus_write),
-	DEVMETHOD(hid_get_report,	hid_get_report),
-	DEVMETHOD(hid_set_report,	hid_set_report),
-	DEVMETHOD(hid_set_idle,		hid_set_idle),
-	DEVMETHOD(hid_set_protocol,	hid_set_protocol),
-	DEVMETHOD(hid_ioctl,		hid_ioctl),
+	DEVMETHOD(hid_get_report,	hidbus_get_report),
+	DEVMETHOD(hid_set_report,	hidbus_set_report),
+	DEVMETHOD(hid_set_idle,		hidbus_set_idle),
+	DEVMETHOD(hid_set_protocol,	hidbus_set_protocol),
+	DEVMETHOD(hid_ioctl,		hidbus_ioctl),
 
 	DEVMETHOD_END
 };
diff --git a/sys/dev/hyperv/input/hv_hid.c b/sys/dev/hyperv/input/hv_hid.c
index d576b292e12e..b8fc9605bf67 100644
--- a/sys/dev/hyperv/input/hv_hid.c
+++ b/sys/dev/hyperv/input/hv_hid.c
@@ -473,8 +473,8 @@ hv_hid_detach(device_t dev)
 }
 
 static void
-hv_hid_intr_setup(device_t dev, hid_intr_t intr, void *ctx,
-    struct hid_rdesc_info *rdesc)
+hv_hid_intr_setup(device_t dev, device_t child __unused, hid_intr_t intr,
+    void *ctx, struct hid_rdesc_info *rdesc)
 {
 	hv_hid_sc	*sc;
 
@@ -489,7 +489,7 @@ hv_hid_intr_setup(device_t dev, hid_intr_t intr, void *ctx,
 }
 
 static void
-hv_hid_intr_unsetup(device_t dev)
+hv_hid_intr_unsetup(device_t dev, device_t child __unused)
 {
 	hv_hid_sc	*sc;
 
@@ -500,7 +500,7 @@ hv_hid_intr_unsetup(device_t dev)
 }
 
 static int
-hv_hid_intr_start(device_t dev)
+hv_hid_intr_start(device_t dev, device_t child __unused)
 {
 	hv_hid_sc	*sc;
 
@@ -512,7 +512,7 @@ hv_hid_intr_start(device_t dev)
 }
 
 static int
-hv_hid_intr_stop(device_t dev)
+hv_hid_intr_stop(device_t dev, device_t child __unused)
 {
 	hv_hid_sc	*sc;
 
@@ -524,7 +524,8 @@ hv_hid_intr_stop(device_t dev)
 }
 
 static int
-hv_hid_get_rdesc(device_t dev, void *buf, hid_size_t len)
+hv_hid_get_rdesc(device_t dev, device_t child __unused, void *buf,
+    hid_size_t len)
 {
 	hv_hid_sc	*sc;
 
diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c
index 3e481ccd4417..a5da6df5eba3 100644
--- a/sys/dev/iicbus/iichid.c
+++ b/sys/dev/iicbus/iichid.c
@@ -791,8 +791,8 @@ iichid_sysctl_sampling_rate_handler(SYSCTL_HANDLER_ARGS)
 #endif /* IICHID_SAMPLING */
 
 static void
-iichid_intr_setup(device_t dev, hid_intr_t intr, void *context,
-    struct hid_rdesc_info *rdesc)
+iichid_intr_setup(device_t dev, device_t child __unused, hid_intr_t intr,
+    void *context, struct hid_rdesc_info *rdesc)
 {
 	struct iichid_softc *sc;
 
@@ -820,7 +820,7 @@ iichid_intr_setup(device_t dev, hid_intr_t intr, void *context,
 }
 
 static void
-iichid_intr_unsetup(device_t dev)
+iichid_intr_unsetup(device_t dev, device_t child __unused)
 {
 	struct iichid_softc *sc;
 
@@ -832,7 +832,7 @@ iichid_intr_unsetup(device_t dev)
 }
 
 static int
-iichid_intr_start(device_t dev)
+iichid_intr_start(device_t dev, device_t child __unused)
 {
 	struct iichid_softc *sc;
 
@@ -844,7 +844,7 @@ iichid_intr_start(device_t dev)
 }
 
 static int
-iichid_intr_stop(device_t dev)
+iichid_intr_stop(device_t dev, device_t child __unused)
 {
 	struct iichid_softc *sc;
 
@@ -862,7 +862,7 @@ iichid_intr_stop(device_t dev)
 }
 
 static void
-iichid_intr_poll(device_t dev)
+iichid_intr_poll(device_t dev, device_t child __unused)
 {
 	struct iichid_softc *sc;
 	iichid_size_t actual;
@@ -878,7 +878,8 @@ iichid_intr_poll(device_t dev)
  * HID interface
  */
 static int
-iichid_get_rdesc(device_t dev, void *buf, hid_size_t len)
+iichid_get_rdesc(device_t dev, device_t child __unused, void *buf,
+    hid_size_t len)
 {
 	struct iichid_softc *sc;
 	int error;
@@ -892,7 +893,8 @@ iichid_get_rdesc(device_t dev, void *buf, hid_size_t len)
 }
 
 static int
-iichid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen)
+iichid_read(device_t dev, device_t child __unused, void *buf,
+    hid_size_t maxlen, hid_size_t *actlen)
 {
 	struct iichid_softc *sc;
 	device_t parent;
@@ -911,7 +913,8 @@ iichid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen)
 }
 
 static int
-iichid_write(device_t dev, const void *buf, hid_size_t len)
+iichid_write(device_t dev, device_t child __unused, const void *buf,
+    hid_size_t len)
 {
 	struct iichid_softc *sc;
 
@@ -922,8 +925,8 @@ iichid_write(device_t dev, const void *buf, hid_size_t len)
 }
 
 static int
-iichid_get_report(device_t dev, void *buf, hid_size_t maxlen,
-    hid_size_t *actlen, uint8_t type, uint8_t id)
+iichid_get_report(device_t dev, device_t child __unused, void *buf,
+    hid_size_t maxlen, hid_size_t *actlen, uint8_t type, uint8_t id)
 {
 	struct iichid_softc *sc;
 
@@ -935,8 +938,8 @@ iichid_get_report(device_t dev, void *buf, hid_size_t maxlen,
 }
 
 static int
-iichid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type,
-    uint8_t id)
+iichid_set_report(device_t dev, device_t child __unused, const void *buf,
+    hid_size_t len, uint8_t type, uint8_t id)
 {
 	struct iichid_softc *sc;
 
@@ -947,19 +950,21 @@ iichid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type,
 }
 
 static int
-iichid_set_idle(device_t dev, uint16_t duration, uint8_t id)
+iichid_set_idle(device_t dev, device_t child __unused,
+    uint16_t duration, uint8_t id)
 {
 	return (ENOTSUP);
 }
 
 static int
-iichid_set_protocol(device_t dev, uint16_t protocol)
+iichid_set_protocol(device_t dev, device_t child __unused, uint16_t protocol)
 {
 	return (ENOTSUP);
 }
 
 static int
-iichid_ioctl(device_t dev, unsigned long cmd, uintptr_t data)
+iichid_ioctl(device_t dev, device_t child __unused, unsigned long cmd,
+    uintptr_t data)
 {
 	int error;
 
diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c
index 95be0b647da9..a88d2cfac1c2 100644
--- a/sys/dev/usb/input/usbhid.c
+++ b/sys/dev/usb/input/usbhid.c
@@ -333,8 +333,8 @@ usbhid_xfer_check_len(struct usbhid_softc* sc, int xfer_idx, hid_size_t len)
 }
 
 static void
-usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context,
-    struct hid_rdesc_info *rdesc)
+usbhid_intr_setup(device_t dev, device_t child __unused, hid_intr_t intr,
+    void *context, struct hid_rdesc_info *rdesc)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	uint16_t n;
@@ -406,7 +406,7 @@ usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context,
 }
 
 static void
-usbhid_intr_unsetup(device_t dev)
+usbhid_intr_unsetup(device_t dev, device_t child __unused)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 
@@ -419,7 +419,7 @@ usbhid_intr_unsetup(device_t dev)
 }
 
 static int
-usbhid_intr_start(device_t dev)
+usbhid_intr_start(device_t dev, device_t child __unused)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 
@@ -450,7 +450,7 @@ usbhid_intr_start(device_t dev)
 }
 
 static int
-usbhid_intr_stop(device_t dev)
+usbhid_intr_stop(device_t dev, device_t child __unused)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 
@@ -463,7 +463,7 @@ usbhid_intr_stop(device_t dev)
 }
 
 static void
-usbhid_intr_poll(device_t dev)
+usbhid_intr_poll(device_t dev, device_t child __unused)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 
@@ -538,7 +538,8 @@ usbhid_sync_xfer(struct usbhid_softc* sc, int xfer_idx,
 }
 
 static int
-usbhid_get_rdesc(device_t dev, void *buf, hid_size_t len)
+usbhid_get_rdesc(device_t dev, device_t child __unused, void *buf,
+    hid_size_t len)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	int error;
@@ -553,8 +554,8 @@ usbhid_get_rdesc(device_t dev, void *buf, hid_size_t len)
 }
 
 static int
-usbhid_get_report(device_t dev, void *buf, hid_size_t maxlen,
-    hid_size_t *actlen, uint8_t type, uint8_t id)
+usbhid_get_report(device_t dev, device_t child __unused, void *buf,
+    hid_size_t maxlen, hid_size_t *actlen, uint8_t type, uint8_t id)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -579,8 +580,8 @@ usbhid_get_report(device_t dev, void *buf, hid_size_t maxlen,
 }
 
 static int
-usbhid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type,
-    uint8_t id)
+usbhid_set_report(device_t dev, device_t child __unused, const void *buf,
+    hid_size_t len, uint8_t type, uint8_t id)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -602,7 +603,8 @@ usbhid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type,
 }
 
 static int
-usbhid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen)
+usbhid_read(device_t dev, device_t child __unused, void *buf,
+    hid_size_t maxlen, hid_size_t *actlen)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -621,7 +623,8 @@ usbhid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen)
 }
 
 static int
-usbhid_write(device_t dev, const void *buf, hid_size_t len)
+usbhid_write(device_t dev, device_t child __unused, const void *buf,
+    hid_size_t len)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -637,7 +640,8 @@ usbhid_write(device_t dev, const void *buf, hid_size_t len)
 }
 
 static int
-usbhid_set_idle(device_t dev, uint16_t duration, uint8_t id)
+usbhid_set_idle(device_t dev, device_t child __unused, uint16_t duration,
+    uint8_t id)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -659,7 +663,7 @@ usbhid_set_idle(device_t dev, uint16_t duration, uint8_t id)
 }
 
 static int
-usbhid_set_protocol(device_t dev, uint16_t protocol)
+usbhid_set_protocol(device_t dev, device_t child __unused, uint16_t protocol)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	union usbhid_device_request req;
@@ -680,7 +684,8 @@ usbhid_set_protocol(device_t dev, uint16_t protocol)
 }
 
 static int
-usbhid_ioctl(device_t dev, unsigned long cmd, uintptr_t data)
+usbhid_ioctl(device_t dev, device_t child __unused, unsigned long cmd,
+    uintptr_t data)
 {
 	struct usbhid_softc* sc = device_get_softc(dev);
 	struct usb_ctl_request *ucr;