Author: janderwald
Date: Sat Feb 25 00:35:40 2012
New Revision: 55847
URL:
http://svn.reactos.org/svn/reactos?rev=55847&view=rev
Log:
[USBCCGP]
- Formatting, no code changes
Modified:
trunk/reactos/drivers/usb/usbccgp/fdo.c
trunk/reactos/drivers/usb/usbccgp/function.c
trunk/reactos/drivers/usb/usbccgp/misc.c
trunk/reactos/drivers/usb/usbccgp/usbccgp.c
trunk/reactos/drivers/usb/usbccgp/usbccgp.h
Modified: trunk/reactos/drivers/usb/usbccgp/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/fdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/fdo.c [iso-8859-1] Sat Feb 25 00:35:40 2012
@@ -18,14 +18,10 @@
IN PIRP Irp,
IN PVOID Context)
{
- //
- // set event
- //
+ /* Set event */
KeSetEvent((PRKEVENT)Context, 0, FALSE);
- //
- // completion is done in the HidClassFDO_QueryCapabilities routine
- //
+ /* Completion is done in the HidClassFDO_QueryCapabilities routine */
return STATUS_MORE_PROCESSING_REQUIRED;
}
@@ -40,85 +36,62 @@
PIO_STACK_LOCATION IoStack;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- //
- // get device extension
- //
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- //
- // init event
- //
+ /* Init event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
- //
- // now allocte the irp
- //
+ /* Now allocte the irp */
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
if (!Irp)
{
- //
- // no memory
- //
+ /* No memory */
return STATUS_INSUFFICIENT_RESOURCES;
}
- //
- // get next stack location
- //
+ /* Get next stack location */
IoStack = IoGetNextIrpStackLocation(Irp);
- //
- // init stack location
- //
+ /* Init stack location */
IoStack->MajorFunction = IRP_MJ_PNP;
IoStack->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
IoStack->Parameters.DeviceCapabilities.Capabilities = Capabilities;
- //
- // set completion routine
- //
- IoSetCompletionRoutine(Irp, FDO_QueryCapabilitiesCompletionRoutine,
(PVOID)&Event, TRUE, TRUE, TRUE);
-
- //
- // init capabilities
- //
+ /* Set completion routine */
+ IoSetCompletionRoutine(Irp,
+ FDO_QueryCapabilitiesCompletionRoutine,
+ (PVOID)&Event,
+ TRUE,
+ TRUE,
+ TRUE);
+
+ /* Init capabilities */
RtlZeroMemory(Capabilities, sizeof(DEVICE_CAPABILITIES));
Capabilities->Size = sizeof(DEVICE_CAPABILITIES);
Capabilities->Version = 1; // FIXME hardcoded constant
Capabilities->Address = MAXULONG;
Capabilities->UINumber = MAXULONG;
- //
- // pnp irps have default completion code
- //
+ /* Pnp irps have default completion code */
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
- //
- // call lower device
- //
+ /* Call lower device */
Status = IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
if (Status == STATUS_PENDING)
{
- //
- // wait for completion
- //
+ /* Wait for completion */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
}
- //
- // get status
- //
+ /* Get status */
Status = Irp->IoStatus.Status;
- //
- // complete request
- //
+ /* Complete request */
IoFreeIrp(Irp);
- //
- // done
- //
+ /* Done */
return Status;
}
@@ -133,85 +106,58 @@
PIO_STACK_LOCATION IoStack;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- //
- // get device extension
- //
- FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
- //
- // get current irp stack location
- //
+ /* Get device extension */
+ FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+
+ /* Get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
- //
- // check if relation type is BusRelations
- //
+ /* Check if relation type is BusRelations */
if (IoStack->Parameters.QueryDeviceRelations.Type != BusRelations)
{
- //
- // FDO always only handles bus relations
- //
+ /* FDO always only handles bus relations */
return USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
}
- //
- // go through array and count device objects
- //
+ /* Go through array and count device objects */
for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
{
if (FDODeviceExtension->ChildPDO[Index])
{
- //
- // child pdo
- //
+ /* Child pdo */
DeviceCount++;
}
}
- //
- // allocate device relations
- //
- DeviceRelations = (PDEVICE_RELATIONS)AllocateItem(PagedPool, sizeof(DEVICE_RELATIONS)
+ (DeviceCount > 1 ? (DeviceCount-1) * sizeof(PDEVICE_OBJECT) : 0));
+ /* Allocate device relations */
+ DeviceRelations = (PDEVICE_RELATIONS)AllocateItem(PagedPool,
+ sizeof(DEVICE_RELATIONS) +
(DeviceCount > 1 ? (DeviceCount-1) * sizeof(PDEVICE_OBJECT) : 0));
if (!DeviceRelations)
{
- //
- // no memory
- //
+ /* No memory */
return STATUS_INSUFFICIENT_RESOURCES;
}
- //
- // add device objects
- //
+ /* Add device objects */
for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
{
if (FDODeviceExtension->ChildPDO[Index])
{
- //
- // store child pdo
- //
+ /* Store child pdo */
DeviceRelations->Objects[DeviceRelations->Count] =
FDODeviceExtension->ChildPDO[Index];
- //
- // add reference
- //
+ /* Add reference */
ObReferenceObject(FDODeviceExtension->ChildPDO[Index]);
- //
- // increment count
- //
+ /* Increment count */
DeviceRelations->Count++;
}
}
- //
- // store result
- //
+ /* Store result */
Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
- //
- // request completed successfully
- //
+ /* Request completed successfully */
return STATUS_SUCCESS;
}
@@ -225,56 +171,45 @@
PFDO_DEVICE_EXTENSION FDODeviceExtension;
ULONG Index;
- //
- // get device extension
- //
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- //
- // lets create array for the child PDO
- //
- FDODeviceExtension->ChildPDO = AllocateItem(NonPagedPool, sizeof(PDEVICE_OBJECT) *
FDODeviceExtension->FunctionDescriptorCount);
+ /* Lets create array for the child PDO */
+ FDODeviceExtension->ChildPDO = AllocateItem(NonPagedPool,
+ sizeof(PDEVICE_OBJECT) *
FDODeviceExtension->FunctionDescriptorCount);
if (!FDODeviceExtension->ChildPDO)
{
- //
- // no memory
- //
+ /* No memory */
return STATUS_INSUFFICIENT_RESOURCES;
}
- //
- // create pdo for each function
- //
+ /* Create pdo for each function */
for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
{
- //
- // create the PDO
- //
- Status = IoCreateDevice(FDODeviceExtension->DriverObject,
sizeof(PDO_DEVICE_EXTENSION), NULL, FILE_DEVICE_USB, FILE_AUTOGENERATED_DEVICE_NAME,
FALSE, &PDODeviceObject);
+ /* Create the PDO */
+ Status = IoCreateDevice(FDODeviceExtension->DriverObject,
+ sizeof(PDO_DEVICE_EXTENSION),
+ NULL,
+ FILE_DEVICE_USB,
+ FILE_AUTOGENERATED_DEVICE_NAME,
+ FALSE,
+ &PDODeviceObject);
if (!NT_SUCCESS(Status))
{
- //
- // failed to create device object
- //
+ /* Failed to create device object */
DPRINT1("IoCreateDevice failed with %x\n", Status);
return Status;
}
- //
- // store in array
- //
+ /* Store in array */
FDODeviceExtension->ChildPDO[Index] = PDODeviceObject;
- //
- // get device extension
- //
+ /* Get device extension */
PDODeviceExtension = (PPDO_DEVICE_EXTENSION)PDODeviceObject->DeviceExtension;
RtlZeroMemory(PDODeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
- //
- // init device extension
- //
+ /* Init device extension */
PDODeviceExtension->Common.IsFDO = FALSE;
PDODeviceExtension->FunctionDescriptor =
&FDODeviceExtension->FunctionDescriptor[Index];
PDODeviceExtension->NextDeviceObject = DeviceObject;
@@ -287,25 +222,17 @@
RtlCopyMemory(&PDODeviceExtension->Capabilities,
&FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
RtlCopyMemory(&PDODeviceExtension->DeviceDescriptor,
&FDODeviceExtension->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
- //
- // patch the stack size
- //
+ /* Patch the stack size */
PDODeviceObject->StackSize = DeviceObject->StackSize + 1;
- //
- // set device flags
- //
+ /* Set device flags */
PDODeviceObject->Flags |= DO_DIRECT_IO | DO_MAP_IO_BUFFER;
- //
- // device is initialized
- //
+ /* Device is initialized */
PDODeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
}
- //
- // done
- //
+ /* Done */
return STATUS_SUCCESS;
}
@@ -317,93 +244,81 @@
NTSTATUS Status;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- //
- // get device extension
- //
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- //
- // first start lower device
- //
+ /* First start lower device */
Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
if (!NT_SUCCESS(Status))
{
- //
- // failed to start lower device
- //
+ /* Failed to start lower device */
DPRINT1("FDO_StartDevice lower device failed to start with %x\n",
Status);
return Status;
}
- // get descriptors
+ /* Get descriptors */
Status = USBCCGP_GetDescriptors(DeviceObject);
if (!NT_SUCCESS(Status))
{
- // failed to start lower device
+ /* Failed to start lower device */
DPRINT1("FDO_StartDevice failed to get descriptors with %x\n",
Status);
return Status;
}
- // get capabilities
- Status = FDO_QueryCapabilities(DeviceObject,
&FDODeviceExtension->Capabilities);
+ /* Get capabilities */
+ Status = FDO_QueryCapabilities(DeviceObject,
+ &FDODeviceExtension->Capabilities);
if (!NT_SUCCESS(Status))
{
- // failed to start lower device
+ /* Failed to start lower device */
DPRINT1("FDO_StartDevice failed to get capabilities with %x\n",
Status);
return Status;
}
- // now select the configuration
+ /* Now select the configuration */
Status = USBCCGP_SelectConfiguration(DeviceObject, FDODeviceExtension);
if (!NT_SUCCESS(Status))
{
- // failed to select interface
+ /* Failed to select interface */
DPRINT1("FDO_StartDevice failed to get capabilities with %x\n",
Status);
return Status;
}
- // query bus interface
- USBCCGP_QueryInterface(FDODeviceExtension->NextDeviceObject,
&FDODeviceExtension->BusInterface);
-
- // now enumerate the functions
+ /* Query bus interface */
+ USBCCGP_QueryInterface(FDODeviceExtension->NextDeviceObject,
+ &FDODeviceExtension->BusInterface);
+
+ /* Now enumerate the functions */
Status = USBCCGP_EnumerateFunctions(DeviceObject);
if (!NT_SUCCESS(Status))
{
- // failed to enumerate functions
+ /* Failed to enumerate functions */
DPRINT1("Failed to enumerate functions with %x\n", Status);
return Status;
}
- //
- // sanity checks
- //
+ /* Sanity checks */
ASSERT(FDODeviceExtension->FunctionDescriptorCount);
ASSERT(FDODeviceExtension->FunctionDescriptor);
- DumpFunctionDescriptor(FDODeviceExtension->FunctionDescriptor,
FDODeviceExtension->FunctionDescriptorCount);
-
- //
- // now create the pdo
- //
+ DumpFunctionDescriptor(FDODeviceExtension->FunctionDescriptor,
+ FDODeviceExtension->FunctionDescriptorCount);
+
+ /* Now create the pdo */
Status = FDO_CreateChildPdo(DeviceObject);
if (!NT_SUCCESS(Status))
{
- //
- // failed
- //
+ /* Failed */
DPRINT1("FDO_CreateChildPdo failed with %x\n", Status);
return Status;
}
- //
- // inform pnp manager of new device objects
- //
- IoInvalidateDeviceRelations(FDODeviceExtension->PhysicalDeviceObject,
BusRelations);
-
- //
- // done
- //
+ /* Inform pnp manager of new device objects */
+ IoInvalidateDeviceRelations(FDODeviceExtension->PhysicalDeviceObject,
+ BusRelations);
+
+ /* Done */
DPRINT("[USBCCGP] FDO initialized successfully\n");
return Status;
}
@@ -416,36 +331,27 @@
PURB Urb;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- // get device extension
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- //
- // now allocate the urb
- //
- Urb =
USBD_CreateConfigurationRequestEx(FDODeviceExtension->ConfigurationDescriptor,
FDODeviceExtension->InterfaceList);
+ /* Now allocate the urb */
+ Urb =
USBD_CreateConfigurationRequestEx(FDODeviceExtension->ConfigurationDescriptor,
+ FDODeviceExtension->InterfaceList);
if (!Urb)
{
- //
- // no memory
- //
+ /* No memory */
return STATUS_INSUFFICIENT_RESOURCES;
}
- //
- // clear configuration descriptor to make it an unconfigure request
- //
+ /* Clear configuration descriptor to make it an unconfigure request */
Urb->UrbSelectConfiguration.ConfigurationDescriptor = NULL;
- //
- // submit urb
- //
+ /* Submit urb */
Status = USBCCGP_SyncUrbRequest(FDODeviceExtension->NextDeviceObject, Urb);
if (!NT_SUCCESS(Status))
{
- //
- // failed to set configuration
- //
+ /* Failed to set configuration */
DPRINT1("USBCCGP_SyncUrbRequest failed to unconfigure device\n",
Status);
}
@@ -463,72 +369,59 @@
NTSTATUS Status;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- // get device extension
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- // get stack location
+ /* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
DPRINT("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
switch(IoStack->MinorFunction)
{
case IRP_MN_REMOVE_DEVICE:
{
- //
- // unconfigure device
- //
+ // Unconfigure device */
DPRINT1("[USBCCGP] FDO IRP_MN_REMOVE\n");
FDO_CloseConfiguration(DeviceObject);
/* Send the IRP down the stack */
+ Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject,
+ Irp);
+ if (NT_SUCCESS(Status))
+ {
+ /* Detach from the device stack */
+ IoDetachDevice(FDODeviceExtension->NextDeviceObject);
+
+ /* Delete the device object */
+ IoDeleteDevice(DeviceObject);
+ }
+
+ /* Request completed */
+ break;
+ }
+ case IRP_MN_START_DEVICE:
+ {
+ /* Start the device */
+ Status = FDO_StartDevice(DeviceObject, Irp);
+ break;
+ }
+ case IRP_MN_QUERY_DEVICE_RELATIONS:
+ {
+ /* Handle device relations */
+ Status = FDO_DeviceRelations(DeviceObject, Irp);
+ break;
+ }
+ case IRP_MN_QUERY_CAPABILITIES:
+ {
+ /* Copy capabilities */
+ RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
+ &FDODeviceExtension->Capabilities,
+ sizeof(DEVICE_CAPABILITIES));
Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject,
Irp);
if (NT_SUCCESS(Status))
{
- //
- // Detach from the device stack
- //
- IoDetachDevice(FDODeviceExtension->NextDeviceObject);
-
- //
- // Delete the device object
- //
- IoDeleteDevice(DeviceObject);
- }
-
- //
- // request completed
- //
- break;
- }
- case IRP_MN_START_DEVICE:
- {
- //
- // start the device
- //
- Status = FDO_StartDevice(DeviceObject, Irp);
- break;
- }
- case IRP_MN_QUERY_DEVICE_RELATIONS:
- {
- //
- // handle device relations
- //
- Status = FDO_DeviceRelations(DeviceObject, Irp);
- break;
- }
- case IRP_MN_QUERY_CAPABILITIES:
- {
- //
- // copy capabilities
- //
- RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
&FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
- Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject,
Irp);
- if (NT_SUCCESS(Status))
- {
- //
- // surprise removal ok
- //
+ /* Surprise removal ok */
IoStack->Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK = TRUE;
}
break;
@@ -536,31 +429,23 @@
case IRP_MN_QUERY_REMOVE_DEVICE:
case IRP_MN_QUERY_STOP_DEVICE:
{
- //
- // sure
- //
+ /* Sure */
Irp->IoStatus.Status = STATUS_SUCCESS;
- //
- // forward irp to next device object
- //
+ /* Forward irp to next device object */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
default:
{
- //
- // forward irp to next device object
- //
+ /* Forward irp to next device object */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
}
- //
- // complete request
- //
+ /* Complete request */
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
@@ -580,86 +465,60 @@
PIRP ListIrp;
KIRQL OldLevel;
- //
- // get device extension
- //
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- // get stack location
+ /* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
DPRINT("FDO_HandleResetCyclePort IOCTL %x\n",
IoStack->Parameters.DeviceIoControl.IoControlCode);
if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_RESET_PORT)
{
- //
- // use reset port list
- //
+ /* Use reset port list */
ListHead = &FDODeviceExtension->ResetPortListHead;
ResetActive = &FDODeviceExtension->ResetPortActive;
}
else
{
- //
- // use cycle port list
- //
+ /* Use cycle port list */
ListHead = &FDODeviceExtension->CyclePortListHead;
ResetActive = &FDODeviceExtension->CyclePortActive;
}
- //
- // acquire lock
- //
+ /* Acquire lock */
KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
if (*ResetActive)
{
- //
- // insert into pending list
- //
+ /* Insert into pending list */
InsertTailList(ListHead, &Irp->Tail.Overlay.ListEntry);
- //
- // mark irp pending
- //
+ /* Mark irp pending */
IoMarkIrpPending(Irp);
Status = STATUS_PENDING;
- //
- // release lock
- //
+ /* Release lock */
KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
}
else
{
- //
- // mark reset active
- //
+ /* Mark reset active */
*ResetActive = TRUE;
- //
- // release lock
- //
+ /* Release lock */
KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
- //
- // forward request synchronized
- //
+ /* Forward request synchronized */
USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
- //
- // reacquire lock
- //
+ /* Reacquire lock */
KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
- //
- // mark reset as completed
- //
+ /* Mark reset as completed */
*ResetActive = FALSE;
- //
- // move all requests into temporary list
- //
+ /* Move all requests into temporary list */
InitializeListHead(&TempList);
while(!IsListEmpty(ListHead))
{
@@ -667,29 +526,21 @@
InsertTailList(&TempList, Entry);
}
- //
- // release lock
- //
+ /* Release lock */
KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
- //
- // complete pending irps
- //
+ /* Complete pending irps */
while(!IsListEmpty(&TempList))
{
Entry = RemoveHeadList(&TempList);
ListIrp = (PIRP)CONTAINING_RECORD(Entry, IRP, Tail.Overlay.ListEntry);
- //
- // complete request with status success
- //
+ /* Complete request with status success */
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
- //
- // status success
- //
+ /* Status success */
Status = STATUS_SUCCESS;
}
@@ -707,37 +558,29 @@
NTSTATUS Status;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- //
- // get device extension
- //
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(FDODeviceExtension->Common.IsFDO);
- // get stack location
+ /* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
if (IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_RESET_PORT ||
IoStack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_CYCLE_PORT)
{
- //
- // handle reset / cycle ports
- //
+ /* Handle reset / cycle ports */
Status = FDO_HandleResetCyclePort(DeviceObject, Irp);
DPRINT("FDO_HandleResetCyclePort Status %x\n", Status);
if (Status != STATUS_PENDING)
{
- //
- // complete request
- //
+ /* Complete request */
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
return Status;
}
- //
- // forward and forget request
- //
+ /* Forward and forget request */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
@@ -750,7 +593,7 @@
PIO_STACK_LOCATION IoStack;
NTSTATUS Status;
- /* get stack location */
+ /* Get stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
switch(IoStack->MajorFunction)
@@ -768,5 +611,3 @@
}
}
-
-
Modified: trunk/reactos/drivers/usb/usbccgp/function.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/functi…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/function.c [iso-8859-1] Sat Feb 25 00:35:40 2012
@@ -22,26 +22,18 @@
IO_STATUS_BLOCK IoStatus;
PIO_STACK_LOCATION Stack;
- //
- // sanity checks
- //
+ /* Sanity checks */
ASSERT(DeviceObject);
- //
- // initialize event
- //
+ /* Initialize event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
- //
- // init interface
- //
+ /* Init interface */
RtlZeroMemory(BusInterface, sizeof(USBC_DEVICE_CONFIGURATION_INTERFACE_V1));
BusInterface->Version = USBC_DEVICE_CONFIGURATION_INTERFACE_VERSION_1;
BusInterface->Size = sizeof(USBC_DEVICE_CONFIGURATION_INTERFACE_V1);
- //
- // create irp
- //
+ /* Create irp */
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
DeviceObject,
NULL,
@@ -366,10 +358,10 @@
// get interface description
//
Status = USBCCGP_GetStringDescriptor(FDODeviceExtension->NextDeviceObject,
- 100 * sizeof(WCHAR),
- Descriptor->iFunction,
- 0x0409, //FIXME
- (PVOID*)&DescriptionBuffer);
+ 100 * sizeof(WCHAR),
+ Descriptor->iFunction,
+ 0x0409, //FIXME
+ (PVOID*)&DescriptionBuffer);
if (!NT_SUCCESS(Status))
{
//
@@ -530,10 +522,10 @@
// get interface description
//
Status = USBCCGP_GetStringDescriptor(FDODeviceExtension->NextDeviceObject,
- 100 * sizeof(WCHAR),
- Descriptor->iInterface,
- 0x0409, //FIXME
- (PVOID*)&DescriptionBuffer);
+ 100 * sizeof(WCHAR),
+ Descriptor->iInterface,
+ 0x0409, //FIXME
+ (PVOID*)&DescriptionBuffer);
if (!NT_SUCCESS(Status))
{
//
Modified: trunk/reactos/drivers/usb/usbccgp/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/misc.c…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/misc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/misc.c [iso-8859-1] Sat Feb 25 00:35:40 2012
@@ -11,9 +11,7 @@
#include "usbccgp.h"
-//
-// driver verifier
-//
+/* Driver verifier */
IO_COMPLETION_ROUTINE SyncForwardIrpCompletionRoutine;
NTSTATUS
@@ -39,46 +37,34 @@
KEVENT Event;
NTSTATUS Status;
- //
- // initialize event
- //
+ /* Initialize event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
- //
- // copy irp stack location
- //
+ /* Copy irp stack location */
IoCopyCurrentIrpStackLocationToNext(Irp);
- //
- // set completion routine
- //
- IoSetCompletionRoutine(Irp, USBSTOR_SyncForwardIrpCompletionRoutine, &Event,
TRUE, TRUE, TRUE);
+ /* Set completion routine */
+ IoSetCompletionRoutine(Irp,
+ USBSTOR_SyncForwardIrpCompletionRoutine,
+ &Event,
+ TRUE,
+ TRUE,
+ TRUE);
-
- //
- // call driver
- //
+ /* Call driver */
Status = IoCallDriver(DeviceObject, Irp);
- //
- // check if pending
- //
+ /* Check if pending */
if (Status == STATUS_PENDING)
{
- //
- // wait for the request to finish
- //
+ /* Wait for the request to finish */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
- //
- // copy status code
- //
+ /* Copy status code */
Status = Irp->IoStatus.Status;
}
- //
- // done
- //
+ /* Done */
return Status;
}
@@ -92,72 +78,52 @@
KEVENT Event;
NTSTATUS Status;
- //
- // allocate irp
- //
+ /* Allocate irp */
Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
if (!Irp)
{
- //
- // no memory
- //
+ /* No memory */
return STATUS_INSUFFICIENT_RESOURCES;
}
- //
- // initialize event
- //
+ /* Initialize event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
-
- //
- // get next stack location
- //
+ /* Get next stack location */
IoStack = IoGetNextIrpStackLocation(Irp);
- //
- // initialize stack location
- //
+ /* Initialize stack location */
IoStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
IoStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
IoStack->Parameters.Others.Argument1 = (PVOID)UrbRequest;
IoStack->Parameters.DeviceIoControl.InputBufferLength =
UrbRequest->UrbHeader.Length;
Irp->IoStatus.Status = STATUS_SUCCESS;
- //
- // setup completion routine
- //
- IoSetCompletionRoutine(Irp, USBSTOR_SyncForwardIrpCompletionRoutine, &Event,
TRUE, TRUE, TRUE);
+ /* Setup completion routine */
+ IoSetCompletionRoutine(Irp,
+ USBSTOR_SyncForwardIrpCompletionRoutine,
+ &Event,
+ TRUE,
+ TRUE,
+ TRUE);
- //
- // call driver
- //
+ /* Call driver */
Status = IoCallDriver(DeviceObject, Irp);
- //
- // check if request is pending
- //
+ /* Check if request is pending */
if (Status == STATUS_PENDING)
{
- //
- // wait for completion
- //
+ /* Wait for completion */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
- //
- // update status
- //
+ /* Update status */
Status = Irp->IoStatus.Status;
}
- //
- // free irp
- //
+ /* Free irp */
IoFreeIrp(Irp);
- //
- // done
- //
+ /* Done */
return Status;
}
@@ -166,22 +132,16 @@
IN POOL_TYPE PoolType,
IN ULONG ItemSize)
{
- //
- // allocate item
- //
+ /* Allocate item */
PVOID Item = ExAllocatePoolWithTag(PoolType, ItemSize, USBCCPG_TAG);
if (Item)
{
- //
- // zero item
- //
+ /* Zero item */
RtlZeroMemory(Item, ItemSize);
}
- //
- // return element
- //
+ /* Return element */
return Item;
}
@@ -189,9 +149,7 @@
FreeItem(
IN PVOID Item)
{
- //
- // free item
- //
+ /* Free item */
ExFreePoolWithTag(Item, USBCCPG_TAG);
}
Modified: trunk/reactos/drivers/usb/usbccgp/usbccgp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/usbccg…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/usbccgp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/usbccgp.c [iso-8859-1] Sat Feb 25 00:35:40 2012
@@ -11,9 +11,7 @@
#include "usbccgp.h"
-//
-// driver verifier
-//
+/* Driver verifier */
DRIVER_ADD_DEVICE USBCCGP_AddDevice;
NTSTATUS
@@ -26,19 +24,25 @@
PDEVICE_OBJECT DeviceObject;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- // lets create the device
- Status = IoCreateDevice(DriverObject, sizeof(FDO_DEVICE_EXTENSION), NULL,
FILE_DEVICE_USB, FILE_AUTOGENERATED_DEVICE_NAME, FALSE, &DeviceObject);
+ /* Lets create the device */
+ Status = IoCreateDevice(DriverObject,
+ sizeof(FDO_DEVICE_EXTENSION),
+ NULL,
+ FILE_DEVICE_USB,
+ FILE_AUTOGENERATED_DEVICE_NAME,
+ FALSE,
+ &DeviceObject);
if (!NT_SUCCESS(Status))
{
- // failed to create device
+ /* Failed to create device */
DPRINT1("USBCCGP_AddDevice failed to create device with %x\n",
Status);
return Status;
}
- // get device extension
+ /* Get device extension */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- // init device extension
+ /* Init device extension */
RtlZeroMemory(FDODeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
FDODeviceExtension->Common.IsFDO = TRUE;
FDODeviceExtension->DriverObject = DriverObject;
@@ -47,22 +51,23 @@
InitializeListHead(&FDODeviceExtension->CyclePortListHead);
KeInitializeSpinLock(&FDODeviceExtension->Lock);
- FDODeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject,
PhysicalDeviceObject);
+ FDODeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject,
+
PhysicalDeviceObject);
if (!FDODeviceExtension->NextDeviceObject)
{
- // failed to attach
+ /* Failed to attach */
DPRINT1("USBCCGP_AddDevice failed to attach device\n");
IoDeleteDevice(DeviceObject);
return STATUS_DEVICE_REMOVED;
}
- // set device flags
+ /* Set device flags */
DeviceObject->Flags |= DO_BUFFERED_IO | DO_POWER_PAGABLE;
- // device is initialized
+ /* Device is initialized */
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
- // device initialized
+ /* Device initialized */
return Status;
}
@@ -75,24 +80,24 @@
PCOMMON_DEVICE_EXTENSION DeviceExtension;
PFDO_DEVICE_EXTENSION FDODeviceExtension;
- // get common device extension
+ /* Get common device extension */
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- // is it a fdo
+ /* Is it a fdo */
if (DeviceExtension->IsFDO)
{
- // forward and forget
+ /* Forward and forget */
IoSkipCurrentIrpStackLocation(Irp);
- // get fdo
+ /* Get fdo */
FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- // call lower driver
+ /* Call lower driver */
return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
}
else
{
- // pdo not supported
+ /* Pdo not supported */
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NOT_SUPPORTED;
@@ -108,26 +113,26 @@
PCOMMON_DEVICE_EXTENSION DeviceExtension;
PIO_STACK_LOCATION IoStack;
- // get common device extension
+ /* Get common device extension */
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
- // get current stack location
+ /* Get current stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
if (IoStack->MajorFunction == IRP_MJ_CREATE || IoStack->MajorFunction ==
IRP_MJ_CLOSE)
{
- // dispatch to default handler
+ /* Dispatch to default handler */
return USBCCGP_CreateClose(DeviceObject, Irp);
}
if (DeviceExtension->IsFDO)
{
- // handle request for FDO
+ /* Handle request for FDO */
return FDO_Dispatch(DeviceObject, Irp);
}
else
{
- // handle request for PDO
+ /* Handle request for PDO */
return PDO_Dispatch(DeviceObject, Irp);
}
}
@@ -139,7 +144,7 @@
PUNICODE_STRING RegistryPath)
{
- // initialize driver object
+ /* Initialize driver object */
DPRINT("[USBCCGP] DriverEntry\n");
DriverObject->DriverExtension->AddDevice = USBCCGP_AddDevice;
DriverObject->MajorFunction[IRP_MJ_CREATE] = USBCCGP_Dispatch;
@@ -149,7 +154,7 @@
DriverObject->MajorFunction[IRP_MJ_POWER] = USBCCGP_Dispatch;
DriverObject->MajorFunction[IRP_MJ_PNP] = USBCCGP_Dispatch;
- // FIMXE query GenericCompositeUSBDeviceString
+ /* FIMXE query GenericCompositeUSBDeviceString */
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/usb/usbccgp/usbccgp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/usbccg…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/usbccgp.h [iso-8859-1] Sat Feb 25 00:35:40 2012
@@ -10,17 +10,16 @@
#include <usbioctl.h>
#include <usbdlib.h>
-//
-// FIXME:
-// #include <usbprotocoldefs.h>
-//
+/* FIXME:
+#include <usbprotocoldefs.h> */
+
#include <usb.h>
#include <stdio.h>
#include <wdmguid.h>
typedef struct
{
- BOOLEAN IsFDO; // is device a FDO or
PDO
+ BOOLEAN IsFDO; // is device a FDO or PDO
}COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
typedef struct
@@ -60,10 +59,9 @@
USBD_CONFIGURATION_HANDLE ConfigurationHandle; // configuration handle
PUSBD_INTERFACE_LIST_ENTRY InterfaceList; // interface list
ULONG InterfaceListCount; // interface list count
- PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to
fdo's pdo list
+ PFDO_DEVICE_EXTENSION FDODeviceExtension; // pointer to fdo's pdo
list
}PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
-/* descriptor.c */
NTSTATUS
USBCCGP_GetDescriptors(