Skip to content

Commit a0b1bf2

Browse files
committed
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. svn path=/branches/GSoC_2016/USB/; revision=72382
1 parent c1fb2cc commit a0b1bf2

File tree

3 files changed

+0
-84
lines changed

3 files changed

+0
-84
lines changed

drivers/usb/usbhub/fdo.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,8 +1890,6 @@ USBHUB_FdoStartDevice(
18901890
HubDeviceExtension->PipeHandle = ConfigUrb->UrbSelectConfiguration.Interface.Pipes[0].PipeHandle;
18911891
DPRINT("Configuration Handle %x\n", HubDeviceExtension->ConfigurationHandle);
18921892

1893-
FDO_QueryInterface(DeviceObject, &HubDeviceExtension->DeviceInterface);
1894-
18951893
// check if function is available
18961894
if (HubDeviceExtension->UsbDInterface.IsDeviceHighSpeed)
18971895
{

drivers/usb/usbhub/misc.c

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -211,84 +211,3 @@ SubmitRequestToRootHub(
211211

212212
return Status;
213213
}
214-
215-
NTSTATUS
216-
NTAPI
217-
FDO_QueryInterfaceCompletionRoutine(
218-
IN PDEVICE_OBJECT DeviceObject,
219-
IN PIRP Irp,
220-
IN PVOID Context)
221-
{
222-
/* Set event */
223-
KeSetEvent((PRKEVENT)Context, 0, FALSE);
224-
225-
/* Completion is done in the HidClassFDO_QueryCapabilities routine */
226-
return STATUS_MORE_PROCESSING_REQUIRED;
227-
}
228-
229-
NTSTATUS
230-
FDO_QueryInterface(
231-
IN PDEVICE_OBJECT DeviceObject,
232-
IN OUT PUSB_BUS_INTERFACE_USBDI_V2 Interface)
233-
{
234-
PIRP Irp;
235-
KEVENT Event;
236-
NTSTATUS Status;
237-
PIO_STACK_LOCATION IoStack;
238-
PHUB_DEVICE_EXTENSION HubDeviceExtension;
239-
240-
/* Get device extension */
241-
HubDeviceExtension = (PHUB_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
242-
ASSERT(HubDeviceExtension->Common.IsFDO);
243-
244-
/* Init event */
245-
KeInitializeEvent(&Event, NotificationEvent, FALSE);
246-
247-
/* Now allocte the irp */
248-
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
249-
if (!Irp)
250-
{
251-
/* No memory */
252-
return STATUS_INSUFFICIENT_RESOURCES;
253-
}
254-
255-
/* Get next stack location */
256-
IoStack = IoGetNextIrpStackLocation(Irp);
257-
258-
/* Init stack location */
259-
IoStack->MajorFunction = IRP_MJ_PNP;
260-
IoStack->MinorFunction = IRP_MN_QUERY_INTERFACE;
261-
IoStack->Parameters.QueryInterface.Interface = (PINTERFACE)Interface;
262-
IoStack->Parameters.QueryInterface.InterfaceType = &USB_BUS_INTERFACE_USBDI_GUID;
263-
IoStack->Parameters.QueryInterface.Version = USB_BUSIF_USBDI_VERSION_2;
264-
IoStack->Parameters.QueryInterface.Size = sizeof(USB_BUS_INTERFACE_USBDI_V2);
265-
266-
267-
/* Set completion routine */
268-
IoSetCompletionRoutine(Irp,
269-
FDO_QueryInterfaceCompletionRoutine,
270-
(PVOID)&Event,
271-
TRUE,
272-
TRUE,
273-
TRUE);
274-
275-
/* Pnp irps have default completion code */
276-
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
277-
278-
/* Call lower device */
279-
Status = IoCallDriver(HubDeviceExtension->LowerDeviceObject, Irp);
280-
if (Status == STATUS_PENDING)
281-
{
282-
/* Wait for completion */
283-
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
284-
}
285-
286-
/* Get status */
287-
Status = Irp->IoStatus.Status;
288-
289-
/* Complete request */
290-
IoFreeIrp(Irp);
291-
292-
/* Done */
293-
return Status;
294-
}

drivers/usb/usbhub/usbhub.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ typedef struct _HUB_DEVICE_EXTENSION
9595
USBD_CONFIGURATION_HANDLE ConfigurationHandle;
9696
USBD_PIPE_HANDLE PipeHandle;
9797
PVOID RootHubHandle;
98-
USB_BUS_INTERFACE_USBDI_V2 DeviceInterface;
9998

10099
UNICODE_STRING SymbolicLinkName;
101100
ULONG InstanceCount;

0 commit comments

Comments
 (0)