Rémi Bernon : hidclass.sys: Remove unnecessary poll_interval == 0 cases.
Alexandre Julliard
julliard at winehq.org
Mon Aug 16 18:07:25 CDT 2021
Module: wine
Branch: master
Commit: 6f9bec436cde6c45ee23fc09b54053b9f2fb1f49
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6f9bec436cde6c45ee23fc09b54053b9f2fb1f49
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Mon Aug 16 10:07:49 2021 +0200
hidclass.sys: Remove unnecessary poll_interval == 0 cases.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hidclass.sys/device.c | 57 +++++++++++-----------------------------------
1 file changed, 13 insertions(+), 44 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index ed59a7794a3..006b19ffa32 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -32,7 +32,6 @@
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(hid);
-WINE_DECLARE_DEBUG_CHANNEL(hid_report);
IRP *pop_irp_from_queue(BASE_DEVICE_EXTENSION *ext)
{
@@ -282,8 +281,7 @@ static DWORD CALLBACK hid_device_thread(void *args)
hid_device_queue_input( device, packet );
}
- rc = WaitForSingleObject(ext->u.pdo.halt_event,
- ext->u.pdo.poll_interval ? ext->u.pdo.poll_interval : DEFAULT_POLL_INTERVAL);
+ rc = WaitForSingleObject(ext->u.pdo.halt_event, ext->u.pdo.poll_interval);
if (rc == WAIT_OBJECT_0)
break;
@@ -616,7 +614,6 @@ NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp)
BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
struct hid_preparsed_data *preparsed = ext->u.pdo.preparsed_data;
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
- BYTE report_id = HID_INPUT_VALUE_CAPS( preparsed )->report_id;
struct hid_report *report;
NTSTATUS status;
BOOL removed;
@@ -650,50 +647,22 @@ NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp)
}
else
{
- if (ext->u.pdo.poll_interval)
- {
- KIRQL old_irql;
- TRACE_(hid_report)("Queue irp\n");
-
- KeAcquireSpinLock(&ext->u.pdo.irp_queue_lock, &old_irql);
-
- IoSetCancelRoutine(irp, read_cancel_routine);
- if (irp->Cancel && !IoSetCancelRoutine(irp, NULL))
- {
- /* IRP was canceled before we set cancel routine */
- InitializeListHead(&irp->Tail.Overlay.ListEntry);
- KeReleaseSpinLock(&ext->u.pdo.irp_queue_lock, old_irql);
- return STATUS_CANCELLED;
- }
+ KeAcquireSpinLock(&ext->u.pdo.irp_queue_lock, &irql);
- InsertTailList(&ext->u.pdo.irp_queue, &irp->Tail.Overlay.ListEntry);
- irp->IoStatus.Status = STATUS_PENDING;
- IoMarkIrpPending(irp);
-
- KeReleaseSpinLock(&ext->u.pdo.irp_queue_lock, old_irql);
- }
- else
+ IoSetCancelRoutine(irp, read_cancel_routine);
+ if (irp->Cancel && !IoSetCancelRoutine(irp, NULL))
{
- HID_XFER_PACKET packet;
- BYTE *buffer = irp->AssociatedIrp.SystemBuffer;
- ULONG buffer_len = irpsp->Parameters.Read.Length;
-
- TRACE("No packet, but opportunistic reads enabled\n");
-
- packet.reportId = buffer[0];
- packet.reportBuffer = buffer;
- packet.reportBufferLen = buffer_len;
+ /* IRP was canceled before we set cancel routine */
+ InitializeListHead(&irp->Tail.Overlay.ListEntry);
+ KeReleaseSpinLock(&ext->u.pdo.irp_queue_lock, irql);
+ return STATUS_CANCELLED;
+ }
- if (!report_id)
- {
- packet.reportId = 0;
- packet.reportBuffer++;
- packet.reportBufferLen--;
- }
+ InsertTailList(&ext->u.pdo.irp_queue, &irp->Tail.Overlay.ListEntry);
+ irp->IoStatus.Status = STATUS_PENDING;
+ IoMarkIrpPending(irp);
- call_minidriver( IOCTL_HID_GET_INPUT_REPORT, ext->u.pdo.parent_fdo, NULL, 0, &packet,
- sizeof(packet), &irp->IoStatus );
- }
+ KeReleaseSpinLock(&ext->u.pdo.irp_queue_lock, irql);
}
status = irp->IoStatus.Status;
More information about the wine-cvs
mailing list