From 1a4b004293077c0c7e525809b7dd8b2d9e1d7d6e Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 27 Apr 2014 13:33:42 +0000 Subject: [PATCH] [I8042PRT] - Fix WDK warnings and remove some unnecessary casts svn path=/trunk/; revision=63019 --- reactos/drivers/input/i8042prt/i8042prt.c | 2 ++ reactos/drivers/input/i8042prt/i8042prt.h | 4 ++++ reactos/drivers/input/i8042prt/keyboard.c | 19 ++++++++++--------- reactos/drivers/input/i8042prt/misc.c | 3 ++- reactos/drivers/input/i8042prt/mouse.c | 12 +++++++++--- reactos/drivers/input/i8042prt/pnp.c | 10 ++++++---- 6 files changed, 33 insertions(+), 17 deletions(-) diff --git a/reactos/drivers/input/i8042prt/i8042prt.c b/reactos/drivers/input/i8042prt/i8042prt.c index d9c792b2d90..1fc55e84511 100644 --- a/reactos/drivers/input/i8042prt/i8042prt.c +++ b/reactos/drivers/input/i8042prt/i8042prt.c @@ -19,7 +19,9 @@ static DRIVER_STARTIO i8042StartIo; static DRIVER_DISPATCH IrpStub; +_Dispatch_type_(IRP_MJ_DEVICE_CONTROL) static DRIVER_DISPATCH i8042DeviceControl; +_Dispatch_type_(IRP_MJ_INTERNAL_DEVICE_CONTROL) static DRIVER_DISPATCH i8042InternalDeviceControl; DRIVER_INITIALIZE DriverEntry; diff --git a/reactos/drivers/input/i8042prt/i8042prt.h b/reactos/drivers/input/i8042prt/i8042prt.h index 92478010e6c..6c60ae3bc10 100644 --- a/reactos/drivers/input/i8042prt/i8042prt.h +++ b/reactos/drivers/input/i8042prt/i8042prt.h @@ -292,10 +292,13 @@ typedef struct _I8042_HOOK_WORKITEM IO_WORKITEM_ROUTINE i8042SendHookWorkItem; +_Dispatch_type_(IRP_MJ_CREATE) DRIVER_DISPATCH i8042Create; +_Dispatch_type_(IRP_MJ_CLEANUP) DRIVER_DISPATCH i8042Cleanup; +_Dispatch_type_(IRP_MJ_CLOSE) DRIVER_DISPATCH i8042Close; /* keyboard.c */ @@ -371,6 +374,7 @@ i8042ChangeMode( IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable); +_Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH i8042Pnp; /* ps2pp.c */ diff --git a/reactos/drivers/input/i8042prt/keyboard.c b/reactos/drivers/input/i8042prt/keyboard.c index e59af0955a6..0827a2f5b56 100644 --- a/reactos/drivers/input/i8042prt/keyboard.c +++ b/reactos/drivers/input/i8042prt/keyboard.c @@ -21,6 +21,7 @@ /* GLOBALS *******************************************************************/ static IO_WORKITEM_ROUTINE i8042PowerWorkItem; +static KDEFERRED_ROUTINE i8042KbdDpcRoutine; /* This structure starts with the same layout as KEYBOARD_INDICATOR_TRANSLATION */ typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION { @@ -196,10 +197,11 @@ i8042PowerWorkItem( PIRP WaitingIrp; NTSTATUS Status; - DeviceExtension = (PI8042_KEYBOARD_EXTENSION)Context; - UNREFERENCED_PARAMETER(DeviceObject); + __analysis_assume(Context != NULL); + DeviceExtension = Context; + /* See http://blogs.msdn.com/doronh/archive/2006/09/08/746961.aspx */ /* Register GUID_DEVICE_SYS_BUTTON interface and report capability */ @@ -331,7 +333,8 @@ i8042KbdDpcRoutine( UNREFERENCED_PARAMETER(SystemArgument1); UNREFERENCED_PARAMETER(SystemArgument2); - DeviceExtension = (PI8042_KEYBOARD_EXTENSION)DeferredContext; + __analysis_assume(DeferredContext != NULL); + DeviceExtension = DeferredContext; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; if (HandlePowerKeys(DeviceExtension)) @@ -652,9 +655,6 @@ cleanup: Irp->IoStatus.Information = sizeof(KEYBOARD_ATTRIBUTES); Status = STATUS_SUCCESS; break; - - Status = STATUS_NOT_IMPLEMENTED; - break; } case IOCTL_KEYBOARD_QUERY_TYPEMATIC: { @@ -745,9 +745,9 @@ cleanup: } /* - * Call the customization hook. The ToReturn parameter is about wether + * Call the customization hook. The ToReturn parameter is about whether * we should go on with the interrupt. The return value is what - * we should return (indicating to the system wether someone else + * we should return (indicating to the system whether someone else * should try to handle the interrupt) */ static BOOLEAN @@ -796,7 +796,8 @@ i8042KbdInterruptService( UNREFERENCED_PARAMETER(Interrupt); - DeviceExtension = (PI8042_KEYBOARD_EXTENSION)Context; + __analysis_assume(Context != NULL); + DeviceExtension = Context; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; InputData = DeviceExtension->KeyboardBuffer + DeviceExtension->KeysInBuffer; Counter = PortDeviceExtension->Settings.PollStatusIterations; diff --git a/reactos/drivers/input/i8042prt/misc.c b/reactos/drivers/input/i8042prt/misc.c index 6b6ad572e89..3adb2d48782 100644 --- a/reactos/drivers/input/i8042prt/misc.c +++ b/reactos/drivers/input/i8042prt/misc.c @@ -23,8 +23,9 @@ ForwardIrpAndWaitCompletion( IN PVOID Context) { UNREFERENCED_PARAMETER(DeviceObject); + __analysis_assume(Context != NULL); if (Irp->PendingReturned) - KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE); + KeSetEvent(Context, IO_NO_INCREMENT, FALSE); return STATUS_MORE_PROCESSING_REQUIRED; } diff --git a/reactos/drivers/input/i8042prt/mouse.c b/reactos/drivers/input/i8042prt/mouse.c index cb66c353ada..c12a0e9a56a 100644 --- a/reactos/drivers/input/i8042prt/mouse.c +++ b/reactos/drivers/input/i8042prt/mouse.c @@ -18,6 +18,8 @@ /* FUNCTIONS *****************************************************************/ +static KDEFERRED_ROUTINE i8042MouDpcRoutine; + /* * These functions are callbacks for filter driver custom interrupt * service routines. @@ -269,7 +271,8 @@ i8042MouDpcRoutine( UNREFERENCED_PARAMETER(SystemArgument1); UNREFERENCED_PARAMETER(SystemArgument2); - DeviceExtension = (PI8042_MOUSE_EXTENSION)DeferredContext; + __analysis_assume(DeferredContext != NULL); + DeviceExtension = DeferredContext; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; switch (DeviceExtension->MouseTimeoutState) @@ -343,6 +346,7 @@ i8042MouDpcRoutine( * I'll just send the 'disable mouse port' command to the controller * and say the mouse doesn't exist. */ +static KDEFERRED_ROUTINE i8042DpcRoutineMouseTimeout; static VOID NTAPI i8042DpcRoutineMouseTimeout( IN PKDPC Dpc, @@ -358,7 +362,8 @@ i8042DpcRoutineMouseTimeout( UNREFERENCED_PARAMETER(SystemArgument1); UNREFERENCED_PARAMETER(SystemArgument2); - DeviceExtension = (PI8042_MOUSE_EXTENSION)DeferredContext; + __analysis_assume(DeferredContext != NULL); + DeviceExtension = DeferredContext; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; Irql = KeAcquireInterruptSpinLock(PortDeviceExtension->HighestDIRQLInterrupt); @@ -906,7 +911,8 @@ i8042MouInterruptService( UNREFERENCED_PARAMETER(Interrupt); - DeviceExtension = (PI8042_MOUSE_EXTENSION)Context; + __analysis_assume(Context != NULL); + DeviceExtension = Context; PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; Counter = PortDeviceExtension->Settings.PollStatusIterations; diff --git a/reactos/drivers/input/i8042prt/pnp.c b/reactos/drivers/input/i8042prt/pnp.c index 3cb70cab767..8dd6f1ba642 100644 --- a/reactos/drivers/input/i8042prt/pnp.c +++ b/reactos/drivers/input/i8042prt/pnp.c @@ -112,7 +112,7 @@ i8042BasicDetect( } else if (Value == KBD_RESEND) { - TRACE_(I8042PRT, "Resending...\n", Value); + TRACE_(I8042PRT, "Resending...\n"); KeStallExecutionProcessor(50); } else @@ -390,7 +390,7 @@ static NTSTATUS StartProcedure( IN PPORT_DEVICE_EXTENSION DeviceExtension) { - NTSTATUS Status; + NTSTATUS Status = STATUS_UNSUCCESSFUL; UCHAR FlagsToDisable = 0; UCHAR FlagsToEnable = 0; KIRQL Irql; @@ -495,7 +495,7 @@ i8042PnpStartDevice( PFDO_DEVICE_EXTENSION DeviceExtension; PPORT_DEVICE_EXTENSION PortDeviceExtension; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor, ResourceDescriptorTranslated; - INTERRUPT_DATA InterruptData; + INTERRUPT_DATA InterruptData = { NULL }; BOOLEAN FoundDataPort = FALSE; BOOLEAN FoundControlPort = FALSE; BOOLEAN FoundIrq = FALSE; @@ -685,7 +685,9 @@ i8042Pnp( PDEVICE_RELATIONS DeviceRelations; TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); - DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS)); + DeviceRelations = ExAllocatePoolWithTag(PagedPool, + sizeof(DEVICE_RELATIONS), + I8042PRT_TAG); if (DeviceRelations) { DeviceRelations->Count = 0; -- 2.17.1