From 6c4c2278786ef0362933bff2c3e5b6e15aaad87f Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 12 May 2013 17:16:41 +0000 Subject: [PATCH] [HIDCLASS] - Get rid of HidClass_GetSystemAddress - More minor fixes svn path=/trunk/; revision=59008 --- reactos/drivers/hid/hidclass/fdo.c | 6 ++--- reactos/drivers/hid/hidclass/hidclass.c | 35 +++++-------------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/reactos/drivers/hid/hidclass/fdo.c b/reactos/drivers/hid/hidclass/fdo.c index b4e061f5a85..c78478f6117 100644 --- a/reactos/drivers/hid/hidclass/fdo.c +++ b/reactos/drivers/hid/hidclass/fdo.c @@ -20,7 +20,7 @@ HidClassFDO_QueryCapabilitiesCompletionRoutine( // // set event // - KeSetEvent((PRKEVENT)Context, 0, FALSE); + KeSetEvent(Context, 0, FALSE); // // completion is done in the HidClassFDO_QueryCapabilities routine @@ -131,7 +131,7 @@ HidClassFDO_DispatchRequestSynchronousCompletion( // // signal event // - KeSetEvent((PRKEVENT)Context, 0, FALSE); + KeSetEvent(Context, 0, FALSE); // // done @@ -447,7 +447,7 @@ HidClassFDO_CopyDeviceRelations( // allocate result // DeviceRelations = ExAllocatePoolWithTag(NonPagedPool, - sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count-1) * sizeof(PDEVICE_OBJECT), + sizeof(DEVICE_RELATIONS) + (FDODeviceExtension->DeviceRelations->Count - 1) * sizeof(PDEVICE_OBJECT), HIDCLASS_TAG); if (!DeviceRelations) { diff --git a/reactos/drivers/hid/hidclass/hidclass.c b/reactos/drivers/hid/hidclass/hidclass.c index 5a61e0c45f1..99da022236b 100644 --- a/reactos/drivers/hid/hidclass/hidclass.c +++ b/reactos/drivers/hid/hidclass/hidclass.c @@ -354,31 +354,6 @@ HidClass_Close( return STATUS_SUCCESS; } -PVOID -HidClass_GetSystemAddress( - IN PMDL ReportMDL) -{ - // - // sanity check - // - ASSERT(ReportMDL); - - if (ReportMDL->MdlFlags & (MDL_SOURCE_IS_NONPAGED_POOL | MDL_MAPPED_TO_SYSTEM_VA)) - { - // - // buffer is non paged pool - // - return ReportMDL->MappedSystemVa; - } - else - { - // - // map mdl - // - return MmMapLockedPages(ReportMDL, KernelMode); - } -} - NTSTATUS NTAPI HidClass_ReadCompleteIrp( @@ -415,7 +390,7 @@ HidClass_ReadCompleteIrp( // // get address // - Address = HidClass_GetSystemAddress(IrpContext->OriginalIrp->MdlAddress); + Address = MmGetSystemAddressForMdlSafe(IrpContext->OriginalIrp->MdlAddress, NormalPagePriority); if (Address) { // @@ -1061,7 +1036,6 @@ HidClass_DispatchDefault( return IoCallDriver(CommonDeviceExtension->HidDeviceExtension.NextDeviceObject, Irp); } - NTSTATUS NTAPI HidClassDispatch( @@ -1119,7 +1093,10 @@ HidRegisterMinidriver( } /* now allocate the driver object extension */ - Status = IoAllocateDriverObjectExtension(MinidriverRegistration->DriverObject, (PVOID)ClientIdentificationAddress, sizeof(HIDCLASS_DRIVER_EXTENSION), (PVOID*)&DriverExtension); + Status = IoAllocateDriverObjectExtension(MinidriverRegistration->DriverObject, + ClientIdentificationAddress, + sizeof(HIDCLASS_DRIVER_EXTENSION), + (PVOID *)&DriverExtension); if (!NT_SUCCESS(Status)) { /* failed to allocate driver extension */ @@ -1140,7 +1117,7 @@ HidRegisterMinidriver( /* copy driver dispatch routines */ RtlCopyMemory(DriverExtension->MajorFunction, MinidriverRegistration->DriverObject->MajorFunction, - sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION+1)); + sizeof(PDRIVER_DISPATCH) * (IRP_MJ_MAXIMUM_FUNCTION + 1)); /* initialize lock */ KeInitializeSpinLock(&DriverExtension->Lock);