From patchwork Mon Feb 13 07:52:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 93839 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp979539qgi; Sun, 12 Feb 2017 23:53:10 -0800 (PST) X-Received: by 10.98.56.196 with SMTP id f187mr24730844pfa.131.1486972390869; Sun, 12 Feb 2017 23:53:10 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id v13si9362385plk.227.2017.02.12.23.53.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Feb 2017 23:53:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2B5078210E; Sun, 12 Feb 2017 23:53:10 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pg0-x234.google.com (mail-pg0-x234.google.com [IPv6:2607:f8b0:400e:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C17318210A for ; Sun, 12 Feb 2017 23:53:08 -0800 (PST) Received: by mail-pg0-x234.google.com with SMTP id v184so30513043pgv.3 for ; Sun, 12 Feb 2017 23:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=oFRgFQBv8Sf8mzFs4/ZB9PY4Nsyo/glEMuWph19l5So=; b=fItIpKez0M9u+TPnjxGs88F4X3aYsLXisRmhJsLWd/7SaIn4YJQZH1ab/7rPYHXtht 7GMl720d7VZii9L5wxVor3qYNbu15hYflI2mDzV3ynjrsj6aMoxXxeXZlfQN4OvvoQYj ZsXm67/RihV9zHGJD94iyp3WtwrlXsWRffJEU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oFRgFQBv8Sf8mzFs4/ZB9PY4Nsyo/glEMuWph19l5So=; b=Ap75B5Gstw5Bar3ongiHXRjOkEeDy614YB7svonqvgyKozA7S2KlMwK36rmp6ySueW tkse8OwX2DZfPFtcKBo+vltdEN14Cq9jzCNyke/BvG6HkHvJYax4uEvbuzN2VlDeZUZs LBSZufzNlHERQvPIlyjiBBTa9rTKELWUqUPdkrnTF448dwWtIh0vy2dbFK60FeURbyPJ z+ph5t0QF3umocMITpZDuDWdNyvEIiRV3xHqlMYHN83/FeuZmo51Vrxm7YLFYRwvmx8a Tz6EAvjCJ2djaK73IYRm11upd3GCspy3q9JO5QYkzgfaoJn/gADXRGdSEF+u7BKiHUxY 0YZw== X-Gm-Message-State: AMke39nWI/7IyIWjtpmeY5qxMNAQCLV+VLDNwtOzUEVbczRx3+SgTpc35kTLb0Sx9yP516jk X-Received: by 10.84.217.68 with SMTP id e4mr27859705plj.99.1486972388408; Sun, 12 Feb 2017 23:53:08 -0800 (PST) Received: from localhost.localdomain ([45.56.159.191]) by smtp.gmail.com with ESMTPSA id m29sm18896624pfi.54.2017.02.12.23.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Feb 2017 23:53:07 -0800 (PST) From: Haojian Zhuang To: leif.lindholm@linaro.org, ard.biesheuvel@linaro.o, edk2-devel@lists.01.org Date: Mon, 13 Feb 2017 15:52:59 +0800 Message-Id: <1486972380-24255-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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 Reviewed-by: Ard Biesheuvel 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;