diff mbox series

[edk2,1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG

Message ID 1486972380-24255-1-git-send-email-haojian.zhuang@linaro.org
State Accepted
Commit d164a0e31bf8aa5bc8f9a184a02648585ff4f0d7
Headers show
Series [edk2,1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG | expand

Commit Message

Haojian Zhuang Feb. 13, 2017, 7:52 a.m. UTC
PL061_GPIO_DATA_REG offset is referenced in PL061EffectiveAddress ()
already. So remove the duplicated reference when invoke PL061GetPins ()
or PL061SetPins ().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

---
 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.7.4

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

Comments

Haojian Zhuang Feb. 13, 2017, 12:59 p.m. UTC | #1
On 13 February 2017 at 15:52, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> PL061_GPIO_DATA_REG offset is referenced in PL061EffectiveAddress ()

> already. So remove the duplicated reference when invoke PL061GetPins ()

> or PL061SetPins ().

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

> ---

>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)

>

> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> index 0e2ea61..ff8bb3b 100644

> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> @@ -186,7 +186,7 @@ Get (

>      return EFI_INVALID_PARAMETER;

>    }

>

> -  if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, Offset)) {

> +  if (PL061GetPins (RegisterBase, Offset)) {

>      *Value = 1;

>    } else {

>      *Value = 0;

> @@ -239,14 +239,14 @@ Set (

>        // Set the corresponding direction bit to HIGH for output

>        MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));

>        // Set the corresponding data bit to LOW for 0

> -      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0);

> +      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0);

>        break;

>

>      case GPIO_MODE_OUTPUT_1:

>        // Set the corresponding direction bit to HIGH for output

>        MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));

>        // Set the corresponding data bit to HIGH for 1

> -      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0xff);

> +      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0xff);

>        break;

>

>      default:

> @@ -297,7 +297,7 @@ GetMode (

>    // Check if it is input or output

>    if (MmioRead8 (RegisterBase + PL061_GPIO_DIR_REG) & GPIO_PIN_MASK(Offset)) {

>      // Pin set to output

> -    if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset))) {

> +    if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {

>        *Mode = GPIO_MODE_OUTPUT_1;

>      } else {

>        *Mode = GPIO_MODE_OUTPUT_0;

> --

> 2.7.4

>


Correct Ard's email address.

Regards
Haojian
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Feb. 16, 2017, 11:23 a.m. UTC | #2
On 13 February 2017 at 07:52, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> PL061_GPIO_DATA_REG offset is referenced in PL061EffectiveAddress ()

> already. So remove the duplicated reference when invoke PL061GetPins ()

> or PL061SetPins ().

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>


Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


> ---

>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)

>

> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> index 0e2ea61..ff8bb3b 100644

> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c

> @@ -186,7 +186,7 @@ Get (

>      return EFI_INVALID_PARAMETER;

>    }

>

> -  if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, Offset)) {

> +  if (PL061GetPins (RegisterBase, Offset)) {

>      *Value = 1;

>    } else {

>      *Value = 0;

> @@ -239,14 +239,14 @@ Set (

>        // Set the corresponding direction bit to HIGH for output

>        MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));

>        // Set the corresponding data bit to LOW for 0

> -      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0);

> +      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0);

>        break;

>

>      case GPIO_MODE_OUTPUT_1:

>        // Set the corresponding direction bit to HIGH for output

>        MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));

>        // Set the corresponding data bit to HIGH for 1

> -      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0xff);

> +      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0xff);

>        break;

>

>      default:

> @@ -297,7 +297,7 @@ GetMode (

>    // Check if it is input or output

>    if (MmioRead8 (RegisterBase + PL061_GPIO_DIR_REG) & GPIO_PIN_MASK(Offset)) {

>      // Pin set to output

> -    if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset))) {

> +    if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {

>        *Mode = GPIO_MODE_OUTPUT_1;

>      } else {

>        *Mode = GPIO_MODE_OUTPUT_0;

> --

> 2.7.4

>

> _______________________________________________

> edk2-devel mailing list

> edk2-devel@lists.01.org

> https://lists.01.org/mailman/listinfo/edk2-devel

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

Patch

diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
index 0e2ea61..ff8bb3b 100644
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
+++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
@@ -186,7 +186,7 @@  Get (
     return EFI_INVALID_PARAMETER;
   }
 
-  if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, Offset)) {
+  if (PL061GetPins (RegisterBase, Offset)) {
     *Value = 1;
   } else {
     *Value = 0;
@@ -239,14 +239,14 @@  Set (
       // Set the corresponding direction bit to HIGH for output
       MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));
       // Set the corresponding data bit to LOW for 0
-      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0);
+      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0);
       break;
 
     case GPIO_MODE_OUTPUT_1:
       // Set the corresponding direction bit to HIGH for output
       MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));
       // Set the corresponding data bit to HIGH for 1
-      PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0xff);
+      PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0xff);
       break;
 
     default:
@@ -297,7 +297,7 @@  GetMode (
   // Check if it is input or output
   if (MmioRead8 (RegisterBase + PL061_GPIO_DIR_REG) & GPIO_PIN_MASK(Offset)) {
     // Pin set to output
-    if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset))) {
+    if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
       *Mode = GPIO_MODE_OUTPUT_1;
     } else {
       *Mode = GPIO_MODE_OUTPUT_0;