diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-03 09:10:26 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-06-03 09:10:26 +0000 |
commit | e8e95df41d44e4c49adcc1503e1e53e2dcab5733 (patch) | |
tree | b95ef24b582898f5108e81fd2814ead8b05c1622 /EmbeddedPkg/Universal/MmcDxe/Mmc.c | |
parent | b9d5fe03e660b6b3c423d9ceefd10864cbfcdc6c (diff) | |
download | edk2-platforms-e8e95df41d44e4c49adcc1503e1e53e2dcab5733.tar.xz |
EmbeddedPkg/MmcDxe: Fix coding style
Make the coding style more compliant with the EDK2 coding convention.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11727 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Universal/MmcDxe/Mmc.c')
-rw-r--r-- | EmbeddedPkg/Universal/MmcDxe/Mmc.c | 424 |
1 files changed, 212 insertions, 212 deletions
diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.c b/EmbeddedPkg/Universal/MmcDxe/Mmc.c index 9c67867aa3..468bb1dae6 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.c +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.c @@ -52,7 +52,7 @@ InitializeMmcHostPool ( VOID
)
{
- InitializeListHead (&mMmcHostPool);
+ InitializeListHead (&mMmcHostPool);
}
/**
@@ -63,7 +63,7 @@ InsertMmcHost ( IN MMC_HOST_INSTANCE *MmcHostInstance
)
{
- InsertTailList (&mMmcHostPool, &(MmcHostInstance->Link));
+ InsertTailList (&mMmcHostPool, &(MmcHostInstance->Link));
}
/*
@@ -74,101 +74,101 @@ RemoveMmcHost ( IN MMC_HOST_INSTANCE *MmcHostInstance
)
{
- RemoveEntryList (&(MmcHostInstance->Link));
+ RemoveEntryList (&(MmcHostInstance->Link));
}
-MMC_HOST_INSTANCE* CreateMmcHostInstance(
+MMC_HOST_INSTANCE* CreateMmcHostInstance (
IN EFI_MMC_HOST_PROTOCOL* MmcHost
)
{
- EFI_STATUS Status;
- MMC_HOST_INSTANCE* MmcHostInstance;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-
- MmcHostInstance = AllocateZeroPool (sizeof (MMC_HOST_INSTANCE));
- if (MmcHostInstance == NULL) {
- return NULL;
- }
+ EFI_STATUS Status;
+ MMC_HOST_INSTANCE* MmcHostInstance;
+ EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- MmcHostInstance->Signature = MMC_HOST_INSTANCE_SIGNATURE;
+ MmcHostInstance = AllocateZeroPool (sizeof (MMC_HOST_INSTANCE));
+ if (MmcHostInstance == NULL) {
+ return NULL;
+ }
- MmcHostInstance->State = MmcHwInitializationState;
-
- MmcHostInstance->BlockIo.Media = AllocateCopyPool (sizeof(EFI_BLOCK_IO_MEDIA), &mMmcMediaTemplate);
- if (MmcHostInstance->BlockIo.Media == NULL) {
- goto FREE_INSTANCE;
- }
+ MmcHostInstance->Signature = MMC_HOST_INSTANCE_SIGNATURE;
- MmcHostInstance->BlockIo.Revision = EFI_BLOCK_IO_INTERFACE_REVISION;
- MmcHostInstance->BlockIo.Reset = MmcReset;
- MmcHostInstance->BlockIo.ReadBlocks = MmcReadBlocks;
- MmcHostInstance->BlockIo.WriteBlocks = MmcWriteBlocks;
- MmcHostInstance->BlockIo.FlushBlocks = MmcFlushBlocks;
+ MmcHostInstance->State = MmcHwInitializationState;
- MmcHostInstance->MmcHost = MmcHost;
+ MmcHostInstance->BlockIo.Media = AllocateCopyPool (sizeof(EFI_BLOCK_IO_MEDIA), &mMmcMediaTemplate);
+ if (MmcHostInstance->BlockIo.Media == NULL) {
+ goto FREE_INSTANCE;
+ }
- // Create DevicePath for the new MMC Host
- Status = MmcHost->BuildDevicePath(&NewDevicePathNode);
- if (EFI_ERROR (Status)) {
- goto FREE_MEDIA;
- }
+ MmcHostInstance->BlockIo.Revision = EFI_BLOCK_IO_INTERFACE_REVISION;
+ MmcHostInstance->BlockIo.Reset = MmcReset;
+ MmcHostInstance->BlockIo.ReadBlocks = MmcReadBlocks;
+ MmcHostInstance->BlockIo.WriteBlocks = MmcWriteBlocks;
+ MmcHostInstance->BlockIo.FlushBlocks = MmcFlushBlocks;
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
- if (DevicePath == NULL) {
- goto FREE_MEDIA;
- }
-
- SetDevicePathEndNode (DevicePath);
- MmcHostInstance->DevicePath = AppendDevicePathNode (DevicePath, NewDevicePathNode);
-
- // Publish BlockIO protocol interface
- Status = gBS->InstallMultipleProtocolInterfaces (
- &MmcHostInstance->MmcHandle,
- &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),
- &gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,
- NULL
- );
- if (EFI_ERROR(Status)) {
- goto FREE_DEVICE_PATH;
- }
+ MmcHostInstance->MmcHost = MmcHost;
+
+ // Create DevicePath for the new MMC Host
+ Status = MmcHost->BuildDevicePath(&NewDevicePathNode);
+ if (EFI_ERROR (Status)) {
+ goto FREE_MEDIA;
+ }
- return MmcHostInstance;
+ DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
+ if (DevicePath == NULL) {
+ goto FREE_MEDIA;
+ }
+
+ SetDevicePathEndNode (DevicePath);
+ MmcHostInstance->DevicePath = AppendDevicePathNode (DevicePath, NewDevicePathNode);
+
+ // Publish BlockIO protocol interface
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &MmcHostInstance->MmcHandle,
+ &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),
+ &gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,
+ NULL
+ );
+ if (EFI_ERROR(Status)) {
+ goto FREE_DEVICE_PATH;
+ }
+
+ return MmcHostInstance;
FREE_DEVICE_PATH:
- FreePool(DevicePath);
+ FreePool(DevicePath);
FREE_MEDIA:
- FreePool(MmcHostInstance->BlockIo.Media);
+ FreePool(MmcHostInstance->BlockIo.Media);
FREE_INSTANCE:
- FreePool(MmcHostInstance);
+ FreePool(MmcHostInstance);
- return NULL;
+ return NULL;
}
-EFI_STATUS DestroyMmcHostInstance(
+EFI_STATUS DestroyMmcHostInstance (
IN MMC_HOST_INSTANCE* MmcHostInstance
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- // Uninstall Protocol Interfaces
- Status = gBS->UninstallMultipleProtocolInterfaces(
+ // Uninstall Protocol Interfaces
+ Status = gBS->UninstallMultipleProtocolInterfaces (
MmcHostInstance->MmcHandle,
- &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),
+ &gEfiBlockIoProtocolGuid,&(MmcHostInstance->BlockIo),
&gEfiDevicePathProtocolGuid,MmcHostInstance->DevicePath,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- // Free Memory allocated for the instance
- if (MmcHostInstance->BlockIo.Media) {
- FreePool(MmcHostInstance->BlockIo.Media);
- }
- FreePool (MmcHostInstance);
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
- return Status;
+ // Free Memory allocated for the instance
+ if (MmcHostInstance->BlockIo.Media) {
+ FreePool(MmcHostInstance->BlockIo.Media);
+ }
+ FreePool (MmcHostInstance);
+
+ return Status;
}
/**
@@ -182,62 +182,62 @@ MmcDriverBindingSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- //EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
- EFI_MMC_HOST_PROTOCOL *MmcHost;
- EFI_DEV_PATH_PTR Node;
-
+ EFI_STATUS Status;
+ //EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
+ EFI_MMC_HOST_PROTOCOL *MmcHost;
+ EFI_DEV_PATH_PTR Node;
+
+ //
+ // Check RemainingDevicePath validation
+ //
+ if (RemainingDevicePath != NULL) {
//
- // Check RemainingDevicePath validation
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, go on checking other conditions
//
- if (RemainingDevicePath != NULL) {
- //
- // Check if RemainingDevicePath is the End of Device Path Node,
- // if yes, go on checking other conditions
- //
- if (!IsDevicePathEnd (RemainingDevicePath)) {
- //
- // If RemainingDevicePath isn't the End of Device Path Node,
- // check its validation
- //
- Node.DevPath = RemainingDevicePath;
- if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
- Node.DevPath->SubType != HW_VENDOR_DP ||
- DevicePathNodeLength(Node.DevPath) != sizeof(VENDOR_DEVICE_PATH)) {
- return EFI_UNSUPPORTED;
- }
- }
+ if (!IsDevicePathEnd (RemainingDevicePath)) {
+ //
+ // If RemainingDevicePath isn't the End of Device Path Node,
+ // check its validation
+ //
+ Node.DevPath = RemainingDevicePath;
+ if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||
+ Node.DevPath->SubType != HW_VENDOR_DP ||
+ DevicePathNodeLength(Node.DevPath) != sizeof(VENDOR_DEVICE_PATH)) {
+ return EFI_UNSUPPORTED;
+ }
}
-
- //
- // Check if Mmc Host protocol is installed by platform
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiMmcHostProtocolGuid,
- (VOID **) &MmcHost,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Close the Mmc Host used to perform the supported test
- //
- gBS->CloseProtocol (
- Controller,
- &gEfiMmcHostProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
-
+ }
+
+ //
+ // Check if Mmc Host protocol is installed by platform
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiMmcHostProtocolGuid,
+ (VOID **) &MmcHost,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (Status == EFI_ALREADY_STARTED) {
return EFI_SUCCESS;
+ }
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Close the Mmc Host used to perform the supported test
+ //
+ gBS->CloseProtocol (
+ Controller,
+ &gEfiMmcHostProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
+
+ return EFI_SUCCESS;
}
/**
@@ -251,48 +251,48 @@ MmcDriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- MMC_HOST_INSTANCE *MmcHostInstance;
- EFI_MMC_HOST_PROTOCOL *MmcHost;
-
+ EFI_STATUS Status;
+ MMC_HOST_INSTANCE *MmcHostInstance;
+ EFI_MMC_HOST_PROTOCOL *MmcHost;
+
+ //
+ // Check RemainingDevicePath validation
+ //
+ if (RemainingDevicePath != NULL) {
//
- // Check RemainingDevicePath validation
+ // Check if RemainingDevicePath is the End of Device Path Node,
+ // if yes, return EFI_SUCCESS
//
- if (RemainingDevicePath != NULL) {
- //
- // Check if RemainingDevicePath is the End of Device Path Node,
- // if yes, return EFI_SUCCESS
- //
- if (IsDevicePathEnd (RemainingDevicePath)) {
- return EFI_SUCCESS;
- }
+ if (IsDevicePathEnd (RemainingDevicePath)) {
+ return EFI_SUCCESS;
}
-
- //
- // Get the Mmc Host protocol
- //
- Status = gBS->OpenProtocol (
- Controller,
- &gEfiMmcHostProtocolGuid,
- (VOID **) &MmcHost,
- This->DriverBindingHandle,
- Controller,
- EFI_OPEN_PROTOCOL_BY_DRIVER
- );
- if (EFI_ERROR (Status)) {
- if (Status == EFI_ALREADY_STARTED) {
- return EFI_SUCCESS;
- }
- return Status;
+ }
+
+ //
+ // Get the Mmc Host protocol
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiMmcHostProtocolGuid,
+ (VOID **) &MmcHost,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_ALREADY_STARTED) {
+ return EFI_SUCCESS;
}
+ return Status;
+ }
- MmcHostInstance = CreateMmcHostInstance(MmcHost);
- if (MmcHostInstance != NULL) {
- // Add the handle to the pool
- InsertMmcHost (MmcHostInstance);
- }
+ MmcHostInstance = CreateMmcHostInstance(MmcHost);
+ if (MmcHostInstance != NULL) {
+ // Add the handle to the pool
+ InsertMmcHost (MmcHostInstance);
+ }
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
}
/**
@@ -307,33 +307,33 @@ MmcDriverBindingStop ( IN EFI_HANDLE *ChildHandleBuffer
)
{
- EFI_STATUS Status = EFI_SUCCESS;
- LIST_ENTRY *CurrentLink;
- MMC_HOST_INSTANCE *MmcHostInstance;
-
- MMC_TRACE("MmcDriverBindingStop()");
-
- // For each MMC instance
- CurrentLink = mMmcHostPool.ForwardLink;
- while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {
- MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);
- ASSERT(MmcHostInstance != NULL);
-
- // Close gEfiMmcHostProtocolGuid
- Status = gBS->CloseProtocol (
- Controller,
- &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost,
- This->DriverBindingHandle
- );
-
- // Remove MMC Host Instance from the pool
- RemoveMmcHost (MmcHostInstance);
-
- // Destroy MmcHostInstance
- DestroyMmcHostInstance (MmcHostInstance);
- }
+ EFI_STATUS Status = EFI_SUCCESS;
+ LIST_ENTRY *CurrentLink;
+ MMC_HOST_INSTANCE *MmcHostInstance;
- return Status;
+ MMC_TRACE("MmcDriverBindingStop()");
+
+ // For each MMC instance
+ CurrentLink = mMmcHostPool.ForwardLink;
+ while (CurrentLink != NULL && CurrentLink != &mMmcHostPool && (Status == EFI_SUCCESS)) {
+ MmcHostInstance = MMC_HOST_INSTANCE_FROM_LINK(CurrentLink);
+ ASSERT(MmcHostInstance != NULL);
+
+ // Close gEfiMmcHostProtocolGuid
+ Status = gBS->CloseProtocol (
+ Controller,
+ &gEfiMmcHostProtocolGuid,(VOID **) &MmcHostInstance->MmcHost,
+ This->DriverBindingHandle
+ );
+
+ // Remove MMC Host Instance from the pool
+ RemoveMmcHost (MmcHostInstance);
+
+ // Destroy MmcHostInstance
+ DestroyMmcHostInstance (MmcHostInstance);
+ }
+
+ return Status;
}
EFI_DRIVER_BINDING_PROTOCOL gMmcDriverBinding = {
@@ -355,33 +355,33 @@ MmcDxeInitialize ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
-
- //
- // Initializes MMC Host pool
- //
- InitializeMmcHostPool ();
-
- //
- // Install driver model protocol(s).
- //
- Status = EfiLibInstallDriverBindingComponentName2 (
- ImageHandle,
- SystemTable,
- &gMmcDriverBinding,
- ImageHandle,
- &gMmcComponentName,
- &gMmcComponentName2
- );
- ASSERT_EFI_ERROR (Status);
-
- // Install driver diagnostics
- Status = gBS->InstallMultipleProtocolInterfaces (
- &ImageHandle,
- &gEfiDriverDiagnostics2ProtocolGuid,&gMmcDriverDiagnostics2,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
+ EFI_STATUS Status;
+
+ //
+ // Initializes MMC Host pool
+ //
+ InitializeMmcHostPool ();
+
+ //
+ // Install driver model protocol(s).
+ //
+ Status = EfiLibInstallDriverBindingComponentName2 (
+ ImageHandle,
+ SystemTable,
+ &gMmcDriverBinding,
+ ImageHandle,
+ &gMmcComponentName,
+ &gMmcComponentName2
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ // Install driver diagnostics
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gEfiDriverDiagnostics2ProtocolGuid,&gMmcDriverDiagnostics2,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
}
|