public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ashish Singhal <ashishsingha@nvidia.com>
To: <edk2-devel@lists.01.org>
Cc: <siyuan.fu@intel.com>, <jiaxin.wu@intel.com>,
	Ashish Singhal <ashishsingha@nvidia.com>
Subject: [PATCH] NetworkPkg: Protocol Uninstallation Cleanup
Date: Thu, 10 Jan 2019 12:27:08 -0700	[thread overview]
Message-ID: <2d3d928f7698138685701e6de58c083f65acafa4.1547148192.git.ashishsingha@nvidia.com> (raw)

Use UEFILib provided protocol uninstallation abstraction
instead of direct API for a proper cleanup.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1444

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 NetworkPkg/DnsDxe/DnsDriver.c         | 30 ++++++++++--------------------
 NetworkPkg/HttpBootDxe/HttpBootDxe.c  | 15 +++++----------
 NetworkPkg/HttpDxe/HttpDriver.c       | 15 +++++----------
 NetworkPkg/IpSecDxe/IpSecDriver.c     | 15 +++++----------
 NetworkPkg/TcpDxe/TcpDriver.c         | 15 +++++----------
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 15 +++++----------
 6 files changed, 35 insertions(+), 70 deletions(-)

diff --git a/NetworkPkg/DnsDxe/DnsDriver.c b/NetworkPkg/DnsDxe/DnsDriver.c
index 1f9b924..b74f5ba 100644
--- a/NetworkPkg/DnsDxe/DnsDriver.c
+++ b/NetworkPkg/DnsDxe/DnsDriver.c
@@ -510,28 +510,18 @@ DnsDriverEntryPoint (
     FreePool (mDriverData);
 
   Error2:
-     gBS->UninstallMultipleProtocolInterfaces (
-           gDns6DriverBinding.DriverBindingHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gDns6DriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gDnsComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gDnsComponentName,
-           NULL
-           );
+     EfiLibUninstallDriverBindingComponentName2 (
+       &gDns6DriverBinding,
+       &gDnsComponentName,
+       &gDnsComponentName2
+       );
 
   Error1:
-    gBS->UninstallMultipleProtocolInterfaces (
-           ImageHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gDns4DriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gDnsComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gDnsComponentName,
-           NULL
-           );
+    EfiLibUninstallDriverBindingComponentName2 (
+      &gDns4DriverBinding,
+      &gDnsComponentName,
+      &gDnsComponentName2
+      );
 
   return Status;
 }
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.c b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
index 7ec06f960..0b16f95 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
@@ -1327,16 +1327,11 @@ HttpBootDxeDriverEntryPoint (
              &gHttpBootDxeComponentName2
              );
   if (EFI_ERROR (Status)) {
-    gBS->UninstallMultipleProtocolInterfaces(
-           ImageHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gHttpBootIp4DxeDriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gHttpBootDxeComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gHttpBootDxeComponentName,
-           NULL
-           );
+    EfiLibUninstallDriverBindingComponentName2(
+      &gHttpBootIp4DxeDriverBinding,
+      &gHttpBootDxeComponentName,
+      &gHttpBootDxeComponentName2
+      );
   }
   return Status;
 }
diff --git a/NetworkPkg/HttpDxe/HttpDriver.c b/NetworkPkg/HttpDxe/HttpDriver.c
index 8df984d..979d76d 100644
--- a/NetworkPkg/HttpDxe/HttpDriver.c
+++ b/NetworkPkg/HttpDxe/HttpDriver.c
@@ -230,16 +230,11 @@ HttpDxeDriverEntryPoint (
              &gHttpDxeComponentName2
              );
   if (EFI_ERROR (Status)) {
-    gBS->UninstallMultipleProtocolInterfaces (
-           ImageHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gHttpDxeIp4DriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gHttpDxeComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gHttpDxeComponentName,
-           NULL
-           );
+    EfiLibUninstallDriverBindingComponentName2 (
+      &gHttpDxeIp4DriverBinding,
+      &gHttpDxeComponentName,
+      &gHttpDxeComponentName2
+      );
   }
   return Status;
 }
diff --git a/NetworkPkg/IpSecDxe/IpSecDriver.c b/NetworkPkg/IpSecDxe/IpSecDriver.c
index f66f89a..3082d99 100644
--- a/NetworkPkg/IpSecDxe/IpSecDriver.c
+++ b/NetworkPkg/IpSecDxe/IpSecDriver.c
@@ -631,16 +631,11 @@ IpSecDriverEntryPoint (
   return Status;
 
 ON_UNINSTALL_IPSEC4_DB:
-  gBS->UninstallMultipleProtocolInterfaces (
-         ImageHandle,
-         &gEfiDriverBindingProtocolGuid,
-         &gIpSec4DriverBinding,
-         &gEfiComponentName2ProtocolGuid,
-         &gIpSecComponentName2,
-         &gEfiComponentNameProtocolGuid,
-         &gIpSecComponentName,
-         NULL
-         );
+  EfiLibUninstallDriverBindingComponentName2 (
+    &gIpSec4DriverBinding,
+    &gIpSecComponentName,
+    &gIpSecComponentName2
+    );
 
 ON_UNINSTALL_IPSEC:
   gBS->UninstallProtocolInterface (
diff --git a/NetworkPkg/TcpDxe/TcpDriver.c b/NetworkPkg/TcpDxe/TcpDriver.c
index 2d4b16c..00d172b 100644
--- a/NetworkPkg/TcpDxe/TcpDriver.c
+++ b/NetworkPkg/TcpDxe/TcpDriver.c
@@ -202,16 +202,11 @@ TcpDriverEntryPoint (
              &gTcpComponentName2
              );
   if (EFI_ERROR (Status)) {
-    gBS->UninstallMultipleProtocolInterfaces (
-           ImageHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gTcp4DriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gTcpComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gTcpComponentName,
-           NULL
-           );
+    EfiLibUninstallDriverBindingComponentName2 (
+      &gTcp4DriverBinding,
+      &gTcpComponentName,
+      &gTcpComponentName2
+      );
     return Status;
   }
 
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index 0ab640b..f25c27a 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -1269,16 +1269,11 @@ PxeBcDriverEntryPoint (
              &gPxeBcComponentName2
              );
   if (EFI_ERROR (Status)) {
-    gBS->UninstallMultipleProtocolInterfaces (
-           ImageHandle,
-           &gEfiDriverBindingProtocolGuid,
-           &gPxeBcIp4DriverBinding,
-           &gEfiComponentName2ProtocolGuid,
-           &gPxeBcComponentName2,
-           &gEfiComponentNameProtocolGuid,
-           &gPxeBcComponentName,
-           NULL
-           );
+    EfiLibUninstallDriverBindingComponentName2 (
+      &gPxeBcIp4DriverBinding,
+      &gPxeBcComponentName,
+      &gPxeBcComponentName2
+      );
   }
 
   return Status;
-- 
2.7.4



             reply	other threads:[~2019-01-10 19:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 19:27 Ashish Singhal [this message]
2019-01-11  1:00 ` [PATCH] NetworkPkg: Protocol Uninstallation Cleanup Wu, Jiaxin
2019-01-14  4:57   ` Ashish Singhal
2019-01-14  6:12     ` Wu, Jiaxin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d3d928f7698138685701e6de58c083f65acafa4.1547148192.git.ashishsingha@nvidia.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox