Move lock to FAT driver binding start to prevent interrupt during hot plug event.

(based on FatPkg commit b449ca31443f754ed2e6998ca32f49547dabd615)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Qing Huang
2010-05-07 03:31:16 +00:00
committed by Jordan Justen
parent 6163cc98b6
commit 5251cb9d68
2 changed files with 24 additions and 21 deletions

View File

@@ -51,8 +51,7 @@ Returns:
{
EFI_STATUS Status;
FAT_VOLUME *Volume;
BOOLEAN LockedByMe;
LockedByMe = FALSE;
//
// Allocate a volume structure
//
@@ -60,14 +59,7 @@ Returns:
if (Volume == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Acquire the lock.
// If caller has already acquired the lock, cannot lock it again.
//
Status = FatAcquireLockOrFail ();
if (!EFI_ERROR (Status)) {
LockedByMe = TRUE;
}
//
// Initialize the structure
//
@@ -119,13 +111,6 @@ Returns:
Volume->Valid = TRUE;
Done:
//
// Unlock if locked by myself.
//
if (LockedByMe) {
FatReleaseLock ();
}
if (EFI_ERROR (Status)) {
FatFreeVolume (Volume);
}