public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] MdeModulePkg/UfsPciHc: Code refinements
@ 2017-04-24  5:45 Hao Wu
  2017-04-24  5:45 ` [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct Hao Wu
  2017-04-24  5:45 ` [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart Hao Wu
  0 siblings, 2 replies; 5+ messages in thread
From: Hao Wu @ 2017-04-24  5:45 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Star Zeng

1. Remove unused field in UfsHc private struct
2. Avoid overriding return value in BindingStart

Cc: Star Zeng <star.zeng@intel.com>

Hao Wu (2):
  MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct
  MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart

 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 16 +++++++---------
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h |  5 ++---
 2 files changed, 9 insertions(+), 12 deletions(-)

-- 
2.12.0.windows.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct
  2017-04-24  5:45 [PATCH 0/2] MdeModulePkg/UfsPciHc: Code refinements Hao Wu
@ 2017-04-24  5:45 ` Hao Wu
  2017-04-24  5:51   ` Zeng, Star
  2017-04-24  5:45 ` [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart Hao Wu
  1 sibling, 1 reply; 5+ messages in thread
From: Hao Wu @ 2017-04-24  5:45 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Star Zeng

The commit removes the unused field 'EFI_HANDLE  Handle' in Ufs host
controller private data structure 'UFS_HOST_CONTROLLER_PRIVATE_DATA'.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 3 +--
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 23ebbf108f..373e55b4c2 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -2,7 +2,7 @@
   UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
   MMIO base, to upper layer UFS drivers.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -32,7 +32,6 @@ EFI_DRIVER_BINDING_PROTOCOL gUfsHcDriverBinding = {
 //
 UFS_HOST_CONTROLLER_PRIVATE_DATA gUfsHcTemplate = {
   UFS_HC_PRIVATE_DATA_SIGNATURE,  // Signature
-  NULL,                           // Handle
   {                               // UfsHcProtocol
     UfsHcGetMmioBar,
     UfsHcAllocateBuffer,
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
index 89f19feb7a..d9d977a5c9 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
@@ -2,7 +2,7 @@
   UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
   MMIO base, to upper layer UFS drivers.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -49,11 +49,10 @@ extern EFI_COMPONENT_NAME2_PROTOCOL               gUfsHcComponentName2;
 typedef struct _UFS_HOST_CONTROLLER_PRIVATE_DATA  UFS_HOST_CONTROLLER_PRIVATE_DATA;
 
 //
-// Nvme private data structure.
+// Ufs host controller private data structure.
 //
 struct _UFS_HOST_CONTROLLER_PRIVATE_DATA {
   UINT32                             Signature;
-  EFI_HANDLE                         Handle;
 
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL UfsHc;
   EFI_PCI_IO_PROTOCOL                *PciIo;  
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
  2017-04-24  5:45 [PATCH 0/2] MdeModulePkg/UfsPciHc: Code refinements Hao Wu
  2017-04-24  5:45 ` [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct Hao Wu
@ 2017-04-24  5:45 ` Hao Wu
  2017-04-24  5:50   ` Zeng, Star
  1 sibling, 1 reply; 5+ messages in thread
From: Hao Wu @ 2017-04-24  5:45 UTC (permalink / raw)
  To: edk2-devel; +Cc: Hao Wu, Star Zeng

In function UfsHcDriverBindingStart(), the return value 'Status' may be
overriden during the original PCI attributes restore process.

This commit refines the logics to avoid such override.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 373e55b4c2..241d9bac9f 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -671,13 +671,12 @@ Done:
       //
       // Restore original PCI attributes
       //
-      Status = PciIo->Attributes (
-                        PciIo,
-                        EfiPciIoAttributeOperationSet,
-                        Private->PciAttributes,
-                        NULL
-                        );
-      ASSERT_EFI_ERROR (Status);
+      ASSERT_EFI_ERROR (PciIo->Attributes (
+                                 PciIo,
+                                 EfiPciIoAttributeOperationSet,
+                                 Private->PciAttributes,
+                                 NULL
+                                 ));
     }
     gBS->CloseProtocol (
           Controller,
-- 
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
  2017-04-24  5:45 ` [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart Hao Wu
@ 2017-04-24  5:50   ` Zeng, Star
  0 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2017-04-24  5:50 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Zeng, Star

Hao,

ASSERT_EFI_ERROR will be null macro in release mode, but the code still needs to be run in release mode.
I recommend to just remove the Status assignment and ASSERT_EFI_ERROR in the original PCI attributes restore code.

Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao Wu
Sent: Monday, April 24, 2017 1:46 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart

In function UfsHcDriverBindingStart(), the return value 'Status' may be overriden during the original PCI attributes restore process.

This commit refines the logics to avoid such override.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 373e55b4c2..241d9bac9f 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -671,13 +671,12 @@ Done:
       //
       // Restore original PCI attributes
       //
-      Status = PciIo->Attributes (
-                        PciIo,
-                        EfiPciIoAttributeOperationSet,
-                        Private->PciAttributes,
-                        NULL
-                        );
-      ASSERT_EFI_ERROR (Status);
+      ASSERT_EFI_ERROR (PciIo->Attributes (
+                                 PciIo,
+                                 EfiPciIoAttributeOperationSet,
+                                 Private->PciAttributes,
+                                 NULL
+                                 ));
     }
     gBS->CloseProtocol (
           Controller,
--
2.12.0.windows.1

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct
  2017-04-24  5:45 ` [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct Hao Wu
@ 2017-04-24  5:51   ` Zeng, Star
  0 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2017-04-24  5:51 UTC (permalink / raw)
  To: Wu, Hao A, edk2-devel@lists.01.org; +Cc: Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Wu, Hao A 
Sent: Monday, April 24, 2017 1:46 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct

The commit removes the unused field 'EFI_HANDLE  Handle' in Ufs host controller private data structure 'UFS_HOST_CONTROLLER_PRIVATE_DATA'.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c | 3 +--  MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
index 23ebbf108f..373e55b4c2 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.c
@@ -2,7 +2,7 @@
   UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
   MMIO base, to upper layer UFS drivers.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at @@ -32,7 +32,6 @@ EFI_DRIVER_BINDING_PROTOCOL gUfsHcDriverBinding = {  //  UFS_HOST_CONTROLLER_PRIVATE_DATA gUfsHcTemplate = {
   UFS_HC_PRIVATE_DATA_SIGNATURE,  // Signature
-  NULL,                           // Handle
   {                               // UfsHcProtocol
     UfsHcGetMmioBar,
     UfsHcAllocateBuffer,
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
index 89f19feb7a..d9d977a5c9 100644
--- a/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
+++ b/MdeModulePkg/Bus/Pci/UfsPciHcDxe/UfsPciHcDxe.h
@@ -2,7 +2,7 @@
   UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
   MMIO base, to upper layer UFS drivers.
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -49,11 +49,10 @@ extern EFI_COMPONENT_NAME2_PROTOCOL               gUfsHcComponentName2;
 typedef struct _UFS_HOST_CONTROLLER_PRIVATE_DATA  UFS_HOST_CONTROLLER_PRIVATE_DATA;
 
 //
-// Nvme private data structure.
+// Ufs host controller private data structure.
 //
 struct _UFS_HOST_CONTROLLER_PRIVATE_DATA {
   UINT32                             Signature;
-  EFI_HANDLE                         Handle;
 
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL UfsHc;
   EFI_PCI_IO_PROTOCOL                *PciIo;  
--
2.12.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-24  5:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24  5:45 [PATCH 0/2] MdeModulePkg/UfsPciHc: Code refinements Hao Wu
2017-04-24  5:45 ` [PATCH 1/2] MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct Hao Wu
2017-04-24  5:51   ` Zeng, Star
2017-04-24  5:45 ` [PATCH 2/2] MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart Hao Wu
2017-04-24  5:50   ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox