[edk2] [PATCH 4/5] MdeModulePkg/UsbMass: remove unnecessary RestoreTPL() call

Ruiyu Ni posted 5 patches 6 years, 9 months ago
[edk2] [PATCH 4/5] MdeModulePkg/UsbMass: remove unnecessary RestoreTPL() call
Posted by Ruiyu Ni 6 years, 9 months ago
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
index d212960bbc..dd4b3a5f0a 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
@@ -691,7 +691,6 @@ UsbBootDetectMedia (
   EFI_BLOCK_IO_MEDIA        OldMedia;
   EFI_BLOCK_IO_MEDIA        *Media;
   UINT8                     CmdSet;
-  EFI_TPL                   OldTpl;
   EFI_STATUS                Status;
 
   Media    = &UsbMass->BlockIoMedia;
@@ -740,11 +739,10 @@ ON_ERROR:
       (Media->LastBlock != OldMedia.LastBlock)) {
 
     //
-    // This function is called by Block I/O Protocol APIs, which run at TPL_NOTIFY.
-    // Here we temporarily restore TPL to TPL_CALLBACK to invoke ReinstallProtocolInterface().
-    //
-    OldTpl = EfiGetCurrentTpl ();
-    gBS->RestoreTPL (TPL_CALLBACK);
+    // This function is called from:
+    //   Block I/O Protocol APIs, which run at TPL_CALLBACK.
+    //   DriverBindingStart(), which raises to TPL_CALLBACK.
+    ASSERT (EfiGetCurrentTpl () == TPL_CALLBACK);
 
     gBS->ReinstallProtocolInterface (
            UsbMass->Controller,
@@ -753,9 +751,6 @@ ON_ERROR:
            &UsbMass->BlockIo
            );
 
-    ASSERT (EfiGetCurrentTpl () == TPL_CALLBACK);
-    gBS->RaiseTPL (OldTpl);
-
     //
     // Update MediaId after reinstalling Block I/O Protocol.
     //
-- 
2.16.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel