Author: vmikayelyan Date: Fri Aug 19 16:29:16 2016 New Revision: 72382
URL: http://svn.reactos.org/svn/reactos?rev=72382&view=rev Log: usb: hub: FDO: Removed dublicated functions and fields
FDO_QueryInterface() is unuseful beacuse we have more generic QueryInterface() function which is able to replace all functionality which provides FDO_QueryInterface().
Also we do not need to have two "USB_BUS_INTERFACE_USBDI_V2" fields in "HUB_DEVICE_EXTENSION".
FDO_QueryInterface() was added in svn-rev 55983, and on review of that commit I have found some copypasta issues and also tricks which was not documented and marked by me as wrong. For example changing if buscontext which was fixed in previous commits of this commit set.
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c branches/GSoC_2016/USB/drivers/usb/usbhub/misc.c branches/GSoC_2016/USB/drivers/usb/usbhub/usbhub.h
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhub... ============================================================================== --- branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c [iso-8859-1] (original) +++ branches/GSoC_2016/USB/drivers/usb/usbhub/fdo.c [iso-8859-1] Fri Aug 19 16:29:16 2016 @@ -1889,8 +1889,6 @@ HubDeviceExtension->ConfigurationHandle = ConfigUrb->UrbSelectConfiguration.ConfigurationHandle; HubDeviceExtension->PipeHandle = ConfigUrb->UrbSelectConfiguration.Interface.Pipes[0].PipeHandle; DPRINT("Configuration Handle %x\n", HubDeviceExtension->ConfigurationHandle); - - FDO_QueryInterface(DeviceObject, &HubDeviceExtension->DeviceInterface);
// check if function is available if (HubDeviceExtension->UsbDInterface.IsDeviceHighSpeed)
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/misc.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhub... ============================================================================== --- branches/GSoC_2016/USB/drivers/usb/usbhub/misc.c [iso-8859-1] (original) +++ branches/GSoC_2016/USB/drivers/usb/usbhub/misc.c [iso-8859-1] Fri Aug 19 16:29:16 2016 @@ -211,84 +211,3 @@
return Status; } - -NTSTATUS -NTAPI -FDO_QueryInterfaceCompletionRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PVOID Context) -{ - /* Set event */ - KeSetEvent((PRKEVENT)Context, 0, FALSE); - - /* Completion is done in the HidClassFDO_QueryCapabilities routine */ - return STATUS_MORE_PROCESSING_REQUIRED; -} - -NTSTATUS -FDO_QueryInterface( - IN PDEVICE_OBJECT DeviceObject, - IN OUT PUSB_BUS_INTERFACE_USBDI_V2 Interface) -{ - PIRP Irp; - KEVENT Event; - NTSTATUS Status; - PIO_STACK_LOCATION IoStack; - PHUB_DEVICE_EXTENSION HubDeviceExtension; - - /* Get device extension */ - HubDeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - ASSERT(HubDeviceExtension->Common.IsFDO); - - /* Init event */ - KeInitializeEvent(&Event, NotificationEvent, FALSE); - - /* Now allocte the irp */ - Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); - if (!Irp) - { - /* No memory */ - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Get next stack location */ - IoStack = IoGetNextIrpStackLocation(Irp); - - /* Init stack location */ - IoStack->MajorFunction = IRP_MJ_PNP; - IoStack->MinorFunction = IRP_MN_QUERY_INTERFACE; - IoStack->Parameters.QueryInterface.Interface = (PINTERFACE)Interface; - IoStack->Parameters.QueryInterface.InterfaceType = &USB_BUS_INTERFACE_USBDI_GUID; - IoStack->Parameters.QueryInterface.Version = USB_BUSIF_USBDI_VERSION_2; - IoStack->Parameters.QueryInterface.Size = sizeof(USB_BUS_INTERFACE_USBDI_V2); - - - /* Set completion routine */ - IoSetCompletionRoutine(Irp, - FDO_QueryInterfaceCompletionRoutine, - (PVOID)&Event, - TRUE, - TRUE, - TRUE); - - /* Pnp irps have default completion code */ - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - - /* Call lower device */ - Status = IoCallDriver(HubDeviceExtension->LowerDeviceObject, Irp); - if (Status == STATUS_PENDING) - { - /* Wait for completion */ - KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); - } - - /* Get status */ - Status = Irp->IoStatus.Status; - - /* Complete request */ - IoFreeIrp(Irp); - - /* Done */ - return Status; -}
Modified: branches/GSoC_2016/USB/drivers/usb/usbhub/usbhub.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2016/USB/drivers/usb/usbhub... ============================================================================== --- branches/GSoC_2016/USB/drivers/usb/usbhub/usbhub.h [iso-8859-1] (original) +++ branches/GSoC_2016/USB/drivers/usb/usbhub/usbhub.h [iso-8859-1] Fri Aug 19 16:29:16 2016 @@ -95,7 +95,6 @@ USBD_CONFIGURATION_HANDLE ConfigurationHandle; USBD_PIPE_HANDLE PipeHandle; PVOID RootHubHandle; - USB_BUS_INTERFACE_USBDI_V2 DeviceInterface;
UNICODE_STRING SymbolicLinkName; ULONG InstanceCount;