public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/1] Coding style violation fix
@ 2022-06-23 22:58 Paweł Poławski
  2022-06-23 22:58 ` [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix Paweł Poławski
  0 siblings, 1 reply; 4+ messages in thread
From: Paweł Poławski @ 2022-06-23 22:58 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Rahul Kumar

Hello edk2-devel list,

This is my first contribution to the EDK2 project. I was following
upstream howto creating this email / patch. Please let me know
in case I did something the wrong way.

Laszlo Ersek in his email to edk2-devel related to
"CPU count limitation in CpuMpPei BIST processing"
pointed out coding style violation related to local variable
and function name overlap.

This patch addresses mentioned issue.

Best regards,
Pawel

Reference branch: https://github.com/elkoniu/edk2/tree/coding-style-fix

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>

Paweł Poławski (1):
  UefiCpuPkg: Coding style bug fix

 UefiCpuPkg/CpuMpPei/CpuBist.c | 40 ++++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)

-- 
2.34.3


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

* [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix
  2022-06-23 22:58 [PATCH v1 0/1] Coding style violation fix Paweł Poławski
@ 2022-06-23 22:58 ` Paweł Poławski
  2022-06-24  9:22   ` Ni, Ray
  0 siblings, 1 reply; 4+ messages in thread
From: Paweł Poławski @ 2022-06-23 22:58 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Rahul Kumar

Local variable name overlaped with function name.
Variable name has been updated to remove name duplication.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>

Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
---
 UefiCpuPkg/CpuMpPei/CpuBist.c | 40 ++++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuBist.c b/UefiCpuPkg/CpuMpPei/CpuBist.c
index 7dc93cd784d4..179063e0d105 100644
--- a/UefiCpuPkg/CpuMpPei/CpuBist.c
+++ b/UefiCpuPkg/CpuMpPei/CpuBist.c
@@ -91,7 +91,7 @@ GetBistInfoFromPpi (
 {
   EFI_STATUS                            Status;
   EFI_SEC_PLATFORM_INFORMATION2_PPI     *SecPlatformInformation2Ppi;
-  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
+  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
   UINT64                                InformationSize;
 
   Status = PeiServicesLocatePpi (
@@ -108,17 +108,17 @@ GetBistInfoFromPpi (
     //
     // Get the size of the sec platform information2(BSP/APs' BIST data)
     //
-    InformationSize         = 0;
-    SecPlatformInformation2 = NULL;
-    Status                  = SecPlatformInformation2Ppi->PlatformInformation2 (
-                                                            PeiServices,
-                                                            &InformationSize,
-                                                            SecPlatformInformation2
-                                                            );
+    InformationSize             = 0;
+    SecPlatformInformation2Rec2 = NULL;
+    Status                      = SecPlatformInformation2Ppi->PlatformInformation2 (
+                                                                PeiServices,
+                                                                &InformationSize,
+                                                                SecPlatformInformation2Rec2
+                                                                );
     if (Status == EFI_BUFFER_TOO_SMALL) {
       Status = PeiServicesAllocatePool (
                  (UINTN)InformationSize,
-                 (VOID **)&SecPlatformInformation2
+                 (VOID **)&SecPlatformInformation2Rec2
                  );
       if (Status == EFI_SUCCESS) {
         //
@@ -127,10 +127,10 @@ GetBistInfoFromPpi (
         Status = SecPlatformInformation2Ppi->PlatformInformation2 (
                                                PeiServices,
                                                &InformationSize,
-                                               SecPlatformInformation2
+                                               SecPlatformInformation2Rec2
                                                );
         if (Status == EFI_SUCCESS) {
-          *BistInformationData = SecPlatformInformation2;
+          *BistInformationData = SecPlatformInformation2Rec2;
           if (BistInformationSize != NULL) {
             *BistInformationSize = InformationSize;
           }
@@ -160,7 +160,7 @@ CollectBistDataFromPpi (
 {
   EFI_STATUS                            Status;
   EFI_PEI_PPI_DESCRIPTOR                *SecInformationDescriptor;
-  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
+  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
   EFI_SEC_PLATFORM_INFORMATION_RECORD   *SecPlatformInformation;
   UINTN                                 NumberOfData;
   EFI_SEC_PLATFORM_INFORMATION_CPU      *CpuInstance;
@@ -186,10 +186,10 @@ CollectBistDataFromPpi (
   ASSERT_EFI_ERROR (Status);
   PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;
 
-  SecPlatformInformation2 = NULL;
-  SecPlatformInformation  = NULL;
-  NumberOfData            = 0;
-  CpuInstance             = NULL;
+  SecPlatformInformation2Rec2 = NULL;
+  SecPlatformInformation      = NULL;
+  NumberOfData                = 0;
+  CpuInstance                 = NULL;
   //
   // Get BIST information from Sec Platform Information2 Ppi firstly
   //
@@ -197,15 +197,15 @@ CollectBistDataFromPpi (
              PeiServices,
              &gEfiSecPlatformInformation2PpiGuid,
              &SecInformationDescriptor,
-             (VOID *)&SecPlatformInformation2,
+             (VOID *)&SecPlatformInformation2Rec2,
              NULL
              );
   if (Status == EFI_SUCCESS) {
     //
     // Sec Platform Information2 PPI includes BSP/APs' BIST information
     //
-    NumberOfData = SecPlatformInformation2->NumberOfCpus;
-    CpuInstance  = SecPlatformInformation2->CpuInstance;
+    NumberOfData = SecPlatformInformation2Rec2->NumberOfCpus;
+    CpuInstance  = SecPlatformInformation2Rec2->CpuInstance;
   } else {
     //
     // Otherwise, get BIST information from Sec Platform Information Ppi
@@ -274,7 +274,7 @@ CollectBistDataFromPpi (
     (UINTN)BistInformationSize
     );
 
-  if (SecPlatformInformation2 != NULL) {
+  if (SecPlatformInformation2Rec2 != NULL) {
     if (NumberOfData < NumberOfProcessors) {
       //
       // Reinstall SecPlatformInformation2 PPI to include new BIST information
-- 
2.34.3


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

* Re: [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix
  2022-06-23 22:58 ` [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix Paweł Poławski
@ 2022-06-24  9:22   ` Ni, Ray
  2022-07-04 23:53     ` Paweł Poławski
  0 siblings, 1 reply; 4+ messages in thread
From: Ni, Ray @ 2022-06-24  9:22 UTC (permalink / raw)
  To: Paweł Poławski, devel@edk2.groups.io; +Cc: Dong, Eric, Kumar, Rahul1

How about PlatformInformationRecord2? It also matches to the parameter used in PPI header file.

> -----Original Message-----
> From: Paweł Poławski <ppolawsk@redhat.com>
> Sent: Friday, June 24, 2022 6:58 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
> Subject: [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix
> 
> Local variable name overlaped with function name.
> Variable name has been updated to remove name duplication.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> 
> Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
> ---
>  UefiCpuPkg/CpuMpPei/CpuBist.c | 40 ++++++++++----------
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuMpPei/CpuBist.c b/UefiCpuPkg/CpuMpPei/CpuBist.c
> index 7dc93cd784d4..179063e0d105 100644
> --- a/UefiCpuPkg/CpuMpPei/CpuBist.c
> +++ b/UefiCpuPkg/CpuMpPei/CpuBist.c
> @@ -91,7 +91,7 @@ GetBistInfoFromPpi (
>  {
> 
>    EFI_STATUS                            Status;
> 
>    EFI_SEC_PLATFORM_INFORMATION2_PPI     *SecPlatformInformation2Ppi;
> 
> -  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
> 
> +  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
> 
>    UINT64                                InformationSize;
> 
> 
> 
>    Status = PeiServicesLocatePpi (
> 
> @@ -108,17 +108,17 @@ GetBistInfoFromPpi (
>      //
> 
>      // Get the size of the sec platform information2(BSP/APs' BIST data)
> 
>      //
> 
> -    InformationSize         = 0;
> 
> -    SecPlatformInformation2 = NULL;
> 
> -    Status                  = SecPlatformInformation2Ppi->PlatformInformation2 (
> 
> -                                                            PeiServices,
> 
> -                                                            &InformationSize,
> 
> -                                                            SecPlatformInformation2
> 
> -                                                            );
> 
> +    InformationSize             = 0;
> 
> +    SecPlatformInformation2Rec2 = NULL;
> 
> +    Status                      = SecPlatformInformation2Ppi->PlatformInformation2 (
> 
> +                                                                PeiServices,
> 
> +                                                                &InformationSize,
> 
> +                                                                SecPlatformInformation2Rec2
> 
> +                                                                );
> 
>      if (Status == EFI_BUFFER_TOO_SMALL) {
> 
>        Status = PeiServicesAllocatePool (
> 
>                   (UINTN)InformationSize,
> 
> -                 (VOID **)&SecPlatformInformation2
> 
> +                 (VOID **)&SecPlatformInformation2Rec2
> 
>                   );
> 
>        if (Status == EFI_SUCCESS) {
> 
>          //
> 
> @@ -127,10 +127,10 @@ GetBistInfoFromPpi (
>          Status = SecPlatformInformation2Ppi->PlatformInformation2 (
> 
>                                                 PeiServices,
> 
>                                                 &InformationSize,
> 
> -                                               SecPlatformInformation2
> 
> +                                               SecPlatformInformation2Rec2
> 
>                                                 );
> 
>          if (Status == EFI_SUCCESS) {
> 
> -          *BistInformationData = SecPlatformInformation2;
> 
> +          *BistInformationData = SecPlatformInformation2Rec2;
> 
>            if (BistInformationSize != NULL) {
> 
>              *BistInformationSize = InformationSize;
> 
>            }
> 
> @@ -160,7 +160,7 @@ CollectBistDataFromPpi (
>  {
> 
>    EFI_STATUS                            Status;
> 
>    EFI_PEI_PPI_DESCRIPTOR                *SecInformationDescriptor;
> 
> -  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
> 
> +  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
> 
>    EFI_SEC_PLATFORM_INFORMATION_RECORD   *SecPlatformInformation;
> 
>    UINTN                                 NumberOfData;
> 
>    EFI_SEC_PLATFORM_INFORMATION_CPU      *CpuInstance;
> 
> @@ -186,10 +186,10 @@ CollectBistDataFromPpi (
>    ASSERT_EFI_ERROR (Status);
> 
>    PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;
> 
> 
> 
> -  SecPlatformInformation2 = NULL;
> 
> -  SecPlatformInformation  = NULL;
> 
> -  NumberOfData            = 0;
> 
> -  CpuInstance             = NULL;
> 
> +  SecPlatformInformation2Rec2 = NULL;
> 
> +  SecPlatformInformation      = NULL;
> 
> +  NumberOfData                = 0;
> 
> +  CpuInstance                 = NULL;
> 
>    //
> 
>    // Get BIST information from Sec Platform Information2 Ppi firstly
> 
>    //
> 
> @@ -197,15 +197,15 @@ CollectBistDataFromPpi (
>               PeiServices,
> 
>               &gEfiSecPlatformInformation2PpiGuid,
> 
>               &SecInformationDescriptor,
> 
> -             (VOID *)&SecPlatformInformation2,
> 
> +             (VOID *)&SecPlatformInformation2Rec2,
> 
>               NULL
> 
>               );
> 
>    if (Status == EFI_SUCCESS) {
> 
>      //
> 
>      // Sec Platform Information2 PPI includes BSP/APs' BIST information
> 
>      //
> 
> -    NumberOfData = SecPlatformInformation2->NumberOfCpus;
> 
> -    CpuInstance  = SecPlatformInformation2->CpuInstance;
> 
> +    NumberOfData = SecPlatformInformation2Rec2->NumberOfCpus;
> 
> +    CpuInstance  = SecPlatformInformation2Rec2->CpuInstance;
> 
>    } else {
> 
>      //
> 
>      // Otherwise, get BIST information from Sec Platform Information Ppi
> 
> @@ -274,7 +274,7 @@ CollectBistDataFromPpi (
>      (UINTN)BistInformationSize
> 
>      );
> 
> 
> 
> -  if (SecPlatformInformation2 != NULL) {
> 
> +  if (SecPlatformInformation2Rec2 != NULL) {
> 
>      if (NumberOfData < NumberOfProcessors) {
> 
>        //
> 
>        // Reinstall SecPlatformInformation2 PPI to include new BIST information
> 
> --
> 2.34.3


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

* Re: [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix
  2022-06-24  9:22   ` Ni, Ray
@ 2022-07-04 23:53     ` Paweł Poławski
  0 siblings, 0 replies; 4+ messages in thread
From: Paweł Poławski @ 2022-07-04 23:53 UTC (permalink / raw)
  To: Ni, Ray; +Cc: devel@edk2.groups.io, Dong, Eric, Kumar, Rahul1

[-- Attachment #1: Type: text/plain, Size: 6761 bytes --]

Hi Ray,

Thank you for the suggestion.
I will update the patchset and send version 2 soon.

Best regards,
Pawel

On Fri, Jun 24, 2022 at 11:22 AM Ni, Ray <ray.ni@intel.com> wrote:

> How about PlatformInformationRecord2? It also matches to the parameter
> used in PPI header file.
>
> > -----Original Message-----
> > From: Paweł Poławski <ppolawsk@redhat.com>
> > Sent: Friday, June 24, 2022 6:58 AM
> > To: devel@edk2.groups.io
> > Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Kumar, Rahul1 <rahul1.kumar@intel.com>
> > Subject: [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix
> >
> > Local variable name overlaped with function name.
> > Variable name has been updated to remove name duplication.
> >
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Rahul Kumar <rahul1.kumar@intel.com>
> >
> > Signed-off-by: Paweł Poławski <ppolawsk@redhat.com>
> > ---
> >  UefiCpuPkg/CpuMpPei/CpuBist.c | 40 ++++++++++----------
> >  1 file changed, 20 insertions(+), 20 deletions(-)
> >
> > diff --git a/UefiCpuPkg/CpuMpPei/CpuBist.c
> b/UefiCpuPkg/CpuMpPei/CpuBist.c
> > index 7dc93cd784d4..179063e0d105 100644
> > --- a/UefiCpuPkg/CpuMpPei/CpuBist.c
> > +++ b/UefiCpuPkg/CpuMpPei/CpuBist.c
> > @@ -91,7 +91,7 @@ GetBistInfoFromPpi (
> >  {
> >
> >    EFI_STATUS                            Status;
> >
> >    EFI_SEC_PLATFORM_INFORMATION2_PPI     *SecPlatformInformation2Ppi;
> >
> > -  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
> >
> > +  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
> >
> >    UINT64                                InformationSize;
> >
> >
> >
> >    Status = PeiServicesLocatePpi (
> >
> > @@ -108,17 +108,17 @@ GetBistInfoFromPpi (
> >      //
> >
> >      // Get the size of the sec platform information2(BSP/APs' BIST data)
> >
> >      //
> >
> > -    InformationSize         = 0;
> >
> > -    SecPlatformInformation2 = NULL;
> >
> > -    Status                  =
> SecPlatformInformation2Ppi->PlatformInformation2 (
> >
> > -                                                            PeiServices,
> >
> > -
> &InformationSize,
> >
> > -
> SecPlatformInformation2
> >
> > -                                                            );
> >
> > +    InformationSize             = 0;
> >
> > +    SecPlatformInformation2Rec2 = NULL;
> >
> > +    Status                      =
> SecPlatformInformation2Ppi->PlatformInformation2 (
> >
> > +
> PeiServices,
> >
> > +
> &InformationSize,
> >
> > +
> SecPlatformInformation2Rec2
> >
> > +                                                                );
> >
> >      if (Status == EFI_BUFFER_TOO_SMALL) {
> >
> >        Status = PeiServicesAllocatePool (
> >
> >                   (UINTN)InformationSize,
> >
> > -                 (VOID **)&SecPlatformInformation2
> >
> > +                 (VOID **)&SecPlatformInformation2Rec2
> >
> >                   );
> >
> >        if (Status == EFI_SUCCESS) {
> >
> >          //
> >
> > @@ -127,10 +127,10 @@ GetBistInfoFromPpi (
> >          Status = SecPlatformInformation2Ppi->PlatformInformation2 (
> >
> >                                                 PeiServices,
> >
> >                                                 &InformationSize,
> >
> > -                                               SecPlatformInformation2
> >
> > +
>  SecPlatformInformation2Rec2
> >
> >                                                 );
> >
> >          if (Status == EFI_SUCCESS) {
> >
> > -          *BistInformationData = SecPlatformInformation2;
> >
> > +          *BistInformationData = SecPlatformInformation2Rec2;
> >
> >            if (BistInformationSize != NULL) {
> >
> >              *BistInformationSize = InformationSize;
> >
> >            }
> >
> > @@ -160,7 +160,7 @@ CollectBistDataFromPpi (
> >  {
> >
> >    EFI_STATUS                            Status;
> >
> >    EFI_PEI_PPI_DESCRIPTOR                *SecInformationDescriptor;
> >
> > -  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2;
> >
> > +  EFI_SEC_PLATFORM_INFORMATION_RECORD2  *SecPlatformInformation2Rec2;
> >
> >    EFI_SEC_PLATFORM_INFORMATION_RECORD   *SecPlatformInformation;
> >
> >    UINTN                                 NumberOfData;
> >
> >    EFI_SEC_PLATFORM_INFORMATION_CPU      *CpuInstance;
> >
> > @@ -186,10 +186,10 @@ CollectBistDataFromPpi (
> >    ASSERT_EFI_ERROR (Status);
> >
> >    PlatformInformationRecord2->NumberOfCpus = (UINT32)NumberOfProcessors;
> >
> >
> >
> > -  SecPlatformInformation2 = NULL;
> >
> > -  SecPlatformInformation  = NULL;
> >
> > -  NumberOfData            = 0;
> >
> > -  CpuInstance             = NULL;
> >
> > +  SecPlatformInformation2Rec2 = NULL;
> >
> > +  SecPlatformInformation      = NULL;
> >
> > +  NumberOfData                = 0;
> >
> > +  CpuInstance                 = NULL;
> >
> >    //
> >
> >    // Get BIST information from Sec Platform Information2 Ppi firstly
> >
> >    //
> >
> > @@ -197,15 +197,15 @@ CollectBistDataFromPpi (
> >               PeiServices,
> >
> >               &gEfiSecPlatformInformation2PpiGuid,
> >
> >               &SecInformationDescriptor,
> >
> > -             (VOID *)&SecPlatformInformation2,
> >
> > +             (VOID *)&SecPlatformInformation2Rec2,
> >
> >               NULL
> >
> >               );
> >
> >    if (Status == EFI_SUCCESS) {
> >
> >      //
> >
> >      // Sec Platform Information2 PPI includes BSP/APs' BIST information
> >
> >      //
> >
> > -    NumberOfData = SecPlatformInformation2->NumberOfCpus;
> >
> > -    CpuInstance  = SecPlatformInformation2->CpuInstance;
> >
> > +    NumberOfData = SecPlatformInformation2Rec2->NumberOfCpus;
> >
> > +    CpuInstance  = SecPlatformInformation2Rec2->CpuInstance;
> >
> >    } else {
> >
> >      //
> >
> >      // Otherwise, get BIST information from Sec Platform Information Ppi
> >
> > @@ -274,7 +274,7 @@ CollectBistDataFromPpi (
> >      (UINTN)BistInformationSize
> >
> >      );
> >
> >
> >
> > -  if (SecPlatformInformation2 != NULL) {
> >
> > +  if (SecPlatformInformation2Rec2 != NULL) {
> >
> >      if (NumberOfData < NumberOfProcessors) {
> >
> >        //
> >
> >        // Reinstall SecPlatformInformation2 PPI to include new BIST
> information
> >
> > --
> > 2.34.3
>
>

-- 

Paweł Poławski

Red Hat <https://www.redhat.com/> Virtualization

ppolawsk@redhat.com
@RedHat <https://twitter.com/redhat>   Red Hat
<https://www.linkedin.com/company/red-hat>  Red Hat
<https://www.facebook.com/RedHatInc>
<https://red.ht/sig>

[-- Attachment #2: Type: text/html, Size: 12110 bytes --]

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

end of thread, other threads:[~2022-07-04 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 22:58 [PATCH v1 0/1] Coding style violation fix Paweł Poławski
2022-06-23 22:58 ` [PATCH v1 1/1] UefiCpuPkg: Coding style bug fix Paweł Poławski
2022-06-24  9:22   ` Ni, Ray
2022-07-04 23:53     ` Paweł Poławski

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