diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -1031,52 +1031,53 @@ 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 --- a/sys/dev/hid/hid_if.m +++ b/sys/dev/hid/hid_if.m @@ -49,6 +49,7 @@ # 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_unsetup { device_t dev; + device_t child; }; # @@ -66,6 +68,7 @@ # METHOD int intr_start { device_t dev; + device_t child; }; # @@ -73,6 +76,7 @@ # METHOD int intr_stop { device_t dev; + device_t child; }; # @@ -82,6 +86,7 @@ # METHOD void intr_poll { device_t dev; + device_t child; }; # HID interface @@ -91,6 +96,7 @@ # METHOD int get_rdesc { device_t dev; + device_t child; void *data; hid_size_t len; }; @@ -102,6 +108,7 @@ # 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 write { device_t dev; + device_t child; const void *data; hid_size_t len; }; @@ -127,6 +135,7 @@ # 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 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_idle { device_t dev; + device_t child; uint16_t duration; uint8_t id; }; @@ -162,6 +173,7 @@ # METHOD int set_protocol { device_t dev; + device_t child; uint16_t protocol; }; @@ -171,6 +183,7 @@ # 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 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -257,7 +257,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ { 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 @@ } 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 @@ 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 @@ 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 --- a/sys/dev/hyperv/input/hv_hid.c +++ b/sys/dev/hyperv/input/hv_hid.c @@ -473,8 +473,8 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -791,8 +791,8 @@ #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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ * 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 --- a/sys/dev/usb/input/usbhid.c +++ b/sys/dev/usb/input/usbhid.c @@ -333,8 +333,8 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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;