So we can stop the device when it's removed from the ntoskrnl.exe device list, and then destroy it only when it's not referenced anymore.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 8 +++++ dlls/winebus.sys/bus_sdl.c | 16 +++++---- dlls/winebus.sys/bus_udev.c | 64 +++++++++++++++++++-------------- dlls/winebus.sys/unix_private.h | 1 + dlls/winebus.sys/unixlib.c | 19 +++++++--- 5 files changed, 72 insertions(+), 36 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 18e318f7789..d362906637a 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -167,6 +167,13 @@ static NTSTATUS iohid_device_start(struct unix_device *iface, DEVICE_OBJECT *dev return STATUS_SUCCESS; }
+static void iohid_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + IOHIDDeviceRegisterInputReportCallback(private->device, NULL, 0, NULL, NULL); +} + static NTSTATUS iohid_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -246,6 +253,7 @@ static const struct unix_device_vtbl iohid_device_vtbl = iohid_device_destroy, iohid_device_compare, iohid_device_start, + iohid_device_stop, iohid_device_get_report_descriptor, iohid_device_set_output_report, iohid_device_get_feature_report, diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 8d6df3e1f13..73562fec14f 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -482,12 +482,6 @@ static void sdl_device_destroy(struct unix_device *iface) { struct platform_private *ext = impl_from_unix_device(iface);
- pSDL_JoystickClose(ext->sdl_joystick); - if (ext->sdl_controller) - pSDL_GameControllerClose(ext->sdl_controller); - if (ext->sdl_haptic) - pSDL_HapticClose(ext->sdl_haptic); - HeapFree(GetProcessHeap(), 0, ext); }
@@ -503,6 +497,15 @@ static NTSTATUS sdl_device_start(struct unix_device *iface, DEVICE_OBJECT *devic return build_report_descriptor(ext); }
+static void sdl_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + pSDL_JoystickClose(private->sdl_joystick); + if (private->sdl_controller) pSDL_GameControllerClose(private->sdl_controller); + if (private->sdl_haptic) pSDL_HapticClose(private->sdl_haptic); +} + static NTSTATUS sdl_device_get_reportdescriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -579,6 +582,7 @@ static const struct unix_device_vtbl sdl_device_vtbl = sdl_device_destroy, sdl_device_compare, sdl_device_start, + sdl_device_stop, sdl_device_get_reportdescriptor, sdl_device_set_output_report, sdl_device_get_feature_report, diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 3010e50ce98..25a408489a4 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -558,19 +558,6 @@ static void hidraw_device_destroy(struct unix_device *iface) { struct platform_private *private = impl_from_unix_device(iface);
- EnterCriticalSection(&udev_cs); - list_remove(&private->unix_device.entry); - LeaveCriticalSection(&udev_cs); - - if (private->report_thread) - { - write(private->control_pipe[1], "q", 1); - WaitForSingleObject(private->report_thread, INFINITE); - close(private->control_pipe[0]); - close(private->control_pipe[1]); - CloseHandle(private->report_thread); - } - close(private->device_fd); udev_device_unref(private->udev_device);
@@ -608,6 +595,24 @@ static NTSTATUS hidraw_device_start(struct unix_device *iface, DEVICE_OBJECT *de return STATUS_SUCCESS; }
+static void hidraw_device_stop(struct unix_device *iface) +{ + struct platform_private *private = impl_from_unix_device(iface); + + EnterCriticalSection(&udev_cs); + list_remove(&private->unix_device.entry); + LeaveCriticalSection(&udev_cs); + + if (private->report_thread) + { + write(private->control_pipe[1], "q", 1); + WaitForSingleObject(private->report_thread, INFINITE); + close(private->control_pipe[0]); + close(private->control_pipe[1]); + CloseHandle(private->report_thread); + } +} + static NTSTATUS hidraw_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -780,6 +785,7 @@ static const struct unix_device_vtbl hidraw_device_vtbl = hidraw_device_destroy, udev_device_compare, hidraw_device_start, + hidraw_device_stop, hidraw_device_get_report_descriptor, hidraw_device_set_output_report, hidraw_device_get_feature_report, @@ -802,19 +808,6 @@ static void lnxev_device_destroy(struct unix_device *iface) { struct wine_input_private *ext = input_impl_from_unix_device(iface);
- EnterCriticalSection(&udev_cs); - list_remove(&ext->base.unix_device.entry); - LeaveCriticalSection(&udev_cs); - - if (ext->base.report_thread) - { - write(ext->base.control_pipe[1], "q", 1); - WaitForSingleObject(ext->base.report_thread, INFINITE); - close(ext->base.control_pipe[0]); - close(ext->base.control_pipe[1]); - CloseHandle(ext->base.report_thread); - } - HeapFree(GetProcessHeap(), 0, ext->current_report_buffer); HeapFree(GetProcessHeap(), 0, ext->last_report_buffer); hid_descriptor_free(&ext->desc); @@ -853,6 +846,24 @@ static NTSTATUS lnxev_device_start(struct unix_device *iface, DEVICE_OBJECT *dev return STATUS_SUCCESS; }
+static void lnxev_device_stop(struct unix_device *iface) +{ + struct wine_input_private *ext = input_impl_from_unix_device(iface); + + EnterCriticalSection(&udev_cs); + list_remove(&ext->base.unix_device.entry); + LeaveCriticalSection(&udev_cs); + + if (ext->base.report_thread) + { + write(ext->base.control_pipe[1], "q", 1); + WaitForSingleObject(ext->base.report_thread, INFINITE); + close(ext->base.control_pipe[0]); + close(ext->base.control_pipe[1]); + CloseHandle(ext->base.report_thread); + } +} + static NTSTATUS lnxev_device_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length) { @@ -920,6 +931,7 @@ static const struct unix_device_vtbl lnxev_device_vtbl = lnxev_device_destroy, udev_device_compare, lnxev_device_start, + lnxev_device_stop, lnxev_device_get_report_descriptor, lnxev_device_set_output_report, lnxev_device_get_feature_report, diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 767c9335114..2a878cdb583 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -34,6 +34,7 @@ struct unix_device_vtbl void (*destroy)(struct unix_device *iface); int (*compare)(struct unix_device *iface, void *platform_dev); NTSTATUS (*start)(struct unix_device *iface, DEVICE_OBJECT *device); + void (*stop)(struct unix_device *iface); NTSTATUS (*get_report_descriptor)(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *out_length); void (*set_output_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); void (*get_feature_report)(struct unix_device *iface, HID_XFER_PACKET *packet, IO_STATUS_BLOCK *io); diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 67efb794e4f..2407a2af468 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay); static struct hid_descriptor mouse_desc; static struct hid_descriptor keyboard_desc;
-static void mouse_remove(struct unix_device *iface) +static void mouse_destroy(struct unix_device *iface) { }
@@ -58,6 +58,10 @@ static NTSTATUS mouse_start(struct unix_device *iface, DEVICE_OBJECT *device) return STATUS_SUCCESS; }
+static void mouse_stop(struct unix_device *iface) +{ +} + static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -92,9 +96,10 @@ static void mouse_set_feature_report(struct unix_device *iface, HID_XFER_PACKET
static const struct unix_device_vtbl mouse_vtbl = { - mouse_remove, + mouse_destroy, mouse_compare, mouse_start, + mouse_stop, mouse_get_report_descriptor, mouse_set_output_report, mouse_get_feature_report, @@ -120,7 +125,7 @@ static NTSTATUS mouse_device_create(void *args) return STATUS_SUCCESS; }
-static void keyboard_remove(struct unix_device *iface) +static void keyboard_destroy(struct unix_device *iface) { }
@@ -141,6 +146,10 @@ static NTSTATUS keyboard_start(struct unix_device *iface, DEVICE_OBJECT *device) return STATUS_SUCCESS; }
+static void keyboard_stop(struct unix_device *iface) +{ +} + static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { TRACE("buffer %p, length %u.\n", buffer, length); @@ -175,9 +184,10 @@ static void keyboard_set_feature_report(struct unix_device *iface, HID_XFER_PACK
static const struct unix_device_vtbl keyboard_vtbl = { - keyboard_remove, + keyboard_destroy, keyboard_compare, keyboard_start, + keyboard_stop, keyboard_get_report_descriptor, keyboard_set_output_report, keyboard_get_feature_report, @@ -206,6 +216,7 @@ static NTSTATUS keyboard_device_create(void *args) static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args; + iface->vtbl->stop(iface); iface->vtbl->destroy(iface); return STATUS_SUCCESS; }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 7 ++----- dlls/winebus.sys/bus_sdl.c | 8 ++------ dlls/winebus.sys/bus_udev.c | 12 ++++-------- dlls/winebus.sys/unix_private.h | 3 +++ dlls/winebus.sys/unixlib.c | 15 +++++++++++++++ 5 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index d362906637a..93b3605f8d2 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -139,8 +139,7 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context,
static void iohid_device_destroy(struct unix_device *iface) { - struct platform_private *private = impl_from_unix_device(iface); - HeapFree(GetProcessHeap(), 0, private); + unix_device_destroy(iface); }
static int iohid_device_compare(struct unix_device *iface, void *context) @@ -337,9 +336,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
TRACE("dev %p, desc %s.\n", IOHIDDevice, debugstr_device_desc(&desc));
- if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) - return; - private->unix_device.vtbl = &iohid_device_vtbl; + if (!(private = unix_device_create(&iohid_device_vtbl, sizeof(struct platform_private)))) return; private->device = IOHIDDevice; private->buffer = NULL;
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 73562fec14f..cda9e9bdcd9 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -480,9 +480,7 @@ failed:
static void sdl_device_destroy(struct unix_device *iface) { - struct platform_private *ext = impl_from_unix_device(iface); - - HeapFree(GetProcessHeap(), 0, ext); + unix_device_destroy(iface); }
static int sdl_device_compare(struct unix_device *iface, void *context) @@ -761,9 +759,7 @@ static void sdl_add_device(unsigned int index)
TRACE("%s id %d, desc %s.\n", controller ? "controller" : "joystick", id, debugstr_device_desc(&desc));
- if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*private)))) - return; - private->unix_device.vtbl = &sdl_device_vtbl; + if (!(private = unix_device_create(&sdl_device_vtbl, sizeof(struct platform_private)))) return; private->sdl_joystick = joystick; private->sdl_controller = controller; private->id = id; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 25a408489a4..004bbb379c4 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -561,7 +561,7 @@ static void hidraw_device_destroy(struct unix_device *iface) close(private->device_fd); udev_device_unref(private->udev_device);
- HeapFree(GetProcessHeap(), 0, private); + unix_device_destroy(iface); }
static int udev_device_compare(struct unix_device *iface, void *platform_dev) @@ -815,7 +815,7 @@ static void lnxev_device_destroy(struct unix_device *iface) close(ext->base.device_fd); udev_device_unref(ext->base.udev_device);
- HeapFree(GetProcessHeap(), 0, ext); + unix_device_destroy(iface); }
static DWORD CALLBACK lnxev_device_report_thread(void *args); @@ -1084,9 +1084,7 @@ static void udev_add_device(struct udev_device *dev)
if (strcmp(subsystem, "hidraw") == 0) { - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct platform_private)))) - return; - private->unix_device.vtbl = &hidraw_device_vtbl; + if (!(private = unix_device_create(&hidraw_device_vtbl, sizeof(struct platform_private)))) return; EnterCriticalSection(&udev_cs); list_add_tail(&device_list, &private->unix_device.entry); LeaveCriticalSection(&udev_cs); @@ -1098,9 +1096,7 @@ static void udev_add_device(struct udev_device *dev) #ifdef HAS_PROPER_INPUT_HEADER else if (strcmp(subsystem, "input") == 0) { - if (!(private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wine_input_private)))) - return; - private->unix_device.vtbl = &lnxev_device_vtbl; + if (!(private = unix_device_create(&lnxev_device_vtbl, sizeof(struct wine_input_private)))) return; EnterCriticalSection(&udev_cs); list_add_tail(&device_list, &private->unix_device.entry); LeaveCriticalSection(&udev_cs); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 2a878cdb583..3b0375bb761 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -47,6 +47,9 @@ struct unix_device struct list entry; };
+extern void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) DECLSPEC_HIDDEN; +extern void unix_device_destroy(struct unix_device *iface) DECLSPEC_HIDDEN; + extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_stop(void *) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index 2407a2af468..b37d9534540 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -213,6 +213,21 @@ static NTSTATUS keyboard_device_create(void *args) return STATUS_SUCCESS; }
+void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) +{ + struct unix_device *iface; + + if (!(iface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size))) return NULL; + iface->vtbl = vtbl; + + return iface; +} + +void unix_device_destroy(struct unix_device *iface) +{ + HeapFree(GetProcessHeap(), 0, iface); +} + static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/unixlib.c | 67 ++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 18 deletions(-)
diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b37d9534540..b433c0dcbdf 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -34,11 +34,22 @@
WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
-static struct hid_descriptor mouse_desc; -static struct hid_descriptor keyboard_desc; +struct mouse_device +{ + struct unix_device unix_device; + struct hid_descriptor desc; +}; + +static inline struct mouse_device *mouse_from_unix_device(struct unix_device *iface) +{ + return CONTAINING_RECORD(iface, struct mouse_device, unix_device); +}
static void mouse_destroy(struct unix_device *iface) { + struct mouse_device *impl = mouse_from_unix_device(iface); + hid_descriptor_free(&impl->desc); + unix_device_destroy(iface); }
static int mouse_compare(struct unix_device *iface, void *context) @@ -48,11 +59,13 @@ static int mouse_compare(struct unix_device *iface, void *context)
static NTSTATUS mouse_start(struct unix_device *iface, DEVICE_OBJECT *device) { - if (!hid_descriptor_begin(&mouse_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) + struct mouse_device *impl = mouse_from_unix_device(iface); + + if (!hid_descriptor_begin(&impl->desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_MOUSE)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&mouse_desc, HID_USAGE_PAGE_BUTTON, 1, 3)) + if (!hid_descriptor_add_buttons(&impl->desc, HID_USAGE_PAGE_BUTTON, 1, 3)) return STATUS_NO_MEMORY; - if (!hid_descriptor_end(&mouse_desc)) + if (!hid_descriptor_end(&impl->desc)) return STATUS_NO_MEMORY;
return STATUS_SUCCESS; @@ -64,12 +77,14 @@ static void mouse_stop(struct unix_device *iface)
static NTSTATUS mouse_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { + struct mouse_device *impl = mouse_from_unix_device(iface); + TRACE("buffer %p, length %u.\n", buffer, length);
- *ret_length = mouse_desc.size; - if (length < mouse_desc.size) return STATUS_BUFFER_TOO_SMALL; + *ret_length = impl->desc.size; + if (length < impl->desc.size) return STATUS_BUFFER_TOO_SMALL;
- memcpy(buffer, mouse_desc.data, mouse_desc.size); + memcpy(buffer, impl->desc.data, impl->desc.size); return STATUS_SUCCESS; }
@@ -115,18 +130,31 @@ static const struct device_desc mouse_device_desc = .product = {"Wine HID mouse"}, .serialnumber = {"0000"}, }; -static struct unix_device mouse_device = {.vtbl = &mouse_vtbl};
static NTSTATUS mouse_device_create(void *args) { struct device_create_params *params = args; params->desc = mouse_device_desc; - params->device = &mouse_device; + params->device = unix_device_create(&mouse_vtbl, sizeof(struct mouse_device)); return STATUS_SUCCESS; }
+struct keyboard_device +{ + struct unix_device unix_device; + struct hid_descriptor desc; +}; + +static inline struct keyboard_device *keyboard_from_unix_device(struct unix_device *iface) +{ + return CONTAINING_RECORD(iface, struct keyboard_device, unix_device); +} + static void keyboard_destroy(struct unix_device *iface) { + struct keyboard_device *impl = keyboard_from_unix_device(iface); + hid_descriptor_free(&impl->desc); + unix_device_destroy(iface); }
static int keyboard_compare(struct unix_device *iface, void *context) @@ -136,11 +164,13 @@ static int keyboard_compare(struct unix_device *iface, void *context)
static NTSTATUS keyboard_start(struct unix_device *iface, DEVICE_OBJECT *device) { - if (!hid_descriptor_begin(&keyboard_desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) + struct keyboard_device *impl = keyboard_from_unix_device(iface); + + if (!hid_descriptor_begin(&impl->desc, HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_KEYBOARD)) return STATUS_NO_MEMORY; - if (!hid_descriptor_add_buttons(&keyboard_desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) + if (!hid_descriptor_add_buttons(&impl->desc, HID_USAGE_PAGE_KEYBOARD, 0, 101)) return STATUS_NO_MEMORY; - if (!hid_descriptor_end(&keyboard_desc)) + if (!hid_descriptor_end(&impl->desc)) return STATUS_NO_MEMORY;
return STATUS_SUCCESS; @@ -152,12 +182,14 @@ static void keyboard_stop(struct unix_device *iface)
static NTSTATUS keyboard_get_report_descriptor(struct unix_device *iface, BYTE *buffer, DWORD length, DWORD *ret_length) { + struct keyboard_device *impl = keyboard_from_unix_device(iface); + TRACE("buffer %p, length %u.\n", buffer, length);
- *ret_length = keyboard_desc.size; - if (length < keyboard_desc.size) return STATUS_BUFFER_TOO_SMALL; + *ret_length = impl->desc.size; + if (length < impl->desc.size) return STATUS_BUFFER_TOO_SMALL;
- memcpy(buffer, keyboard_desc.data, keyboard_desc.size); + memcpy(buffer, impl->desc.data, impl->desc.size); return STATUS_SUCCESS; }
@@ -203,13 +235,12 @@ static const struct device_desc keyboard_device_desc = .product = {"Wine HID keyboard"}, .serialnumber = {"0000"}, }; -static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl};
static NTSTATUS keyboard_device_create(void *args) { struct device_create_params *params = args; params->desc = keyboard_device_desc; - params->device = &keyboard_device; + params->device = unix_device_create(&keyboard_vtbl, sizeof(struct keyboard_device)); return STATUS_SUCCESS; }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/winebus.sys/bus_iohid.c | 1 - dlls/winebus.sys/bus_sdl.c | 1 - dlls/winebus.sys/bus_udev.c | 4 ---- dlls/winebus.sys/unix_private.h | 1 - dlls/winebus.sys/unixlib.c | 8 +------- 5 files changed, 1 insertion(+), 14 deletions(-)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 93b3605f8d2..d9de7059be3 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -139,7 +139,6 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context,
static void iohid_device_destroy(struct unix_device *iface) { - unix_device_destroy(iface); }
static int iohid_device_compare(struct unix_device *iface, void *context) diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index cda9e9bdcd9..a0b44283182 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -480,7 +480,6 @@ failed:
static void sdl_device_destroy(struct unix_device *iface) { - unix_device_destroy(iface); }
static int sdl_device_compare(struct unix_device *iface, void *context) diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 004bbb379c4..e26e11c720d 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -560,8 +560,6 @@ static void hidraw_device_destroy(struct unix_device *iface)
close(private->device_fd); udev_device_unref(private->udev_device); - - unix_device_destroy(iface); }
static int udev_device_compare(struct unix_device *iface, void *platform_dev) @@ -814,8 +812,6 @@ static void lnxev_device_destroy(struct unix_device *iface)
close(ext->base.device_fd); udev_device_unref(ext->base.udev_device); - - unix_device_destroy(iface); }
static DWORD CALLBACK lnxev_device_report_thread(void *args); diff --git a/dlls/winebus.sys/unix_private.h b/dlls/winebus.sys/unix_private.h index 3b0375bb761..6234c2c7bbc 100644 --- a/dlls/winebus.sys/unix_private.h +++ b/dlls/winebus.sys/unix_private.h @@ -48,7 +48,6 @@ struct unix_device };
extern void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) DECLSPEC_HIDDEN; -extern void unix_device_destroy(struct unix_device *iface) DECLSPEC_HIDDEN;
extern NTSTATUS sdl_bus_init(void *) DECLSPEC_HIDDEN; extern NTSTATUS sdl_bus_wait(void *) DECLSPEC_HIDDEN; diff --git a/dlls/winebus.sys/unixlib.c b/dlls/winebus.sys/unixlib.c index b433c0dcbdf..ade38c19854 100644 --- a/dlls/winebus.sys/unixlib.c +++ b/dlls/winebus.sys/unixlib.c @@ -49,7 +49,6 @@ static void mouse_destroy(struct unix_device *iface) { struct mouse_device *impl = mouse_from_unix_device(iface); hid_descriptor_free(&impl->desc); - unix_device_destroy(iface); }
static int mouse_compare(struct unix_device *iface, void *context) @@ -154,7 +153,6 @@ static void keyboard_destroy(struct unix_device *iface) { struct keyboard_device *impl = keyboard_from_unix_device(iface); hid_descriptor_free(&impl->desc); - unix_device_destroy(iface); }
static int keyboard_compare(struct unix_device *iface, void *context) @@ -254,16 +252,12 @@ void *unix_device_create(const struct unix_device_vtbl *vtbl, SIZE_T size) return iface; }
-void unix_device_destroy(struct unix_device *iface) -{ - HeapFree(GetProcessHeap(), 0, iface); -} - static NTSTATUS unix_device_remove(void *args) { struct unix_device *iface = args; iface->vtbl->stop(iface); iface->vtbl->destroy(iface); + HeapFree(GetProcessHeap(), 0, iface); return STATUS_SUCCESS; }