linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Bean <gbean@codeaurora.org>
To: dwalker@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Gregory Bean <gbean@codeaurora.org>
Subject: [PATCH] msm: complete implementation of gpio utility functions.
Date: Mon, 26 Jul 2010 13:37:58 -0700	[thread overview]
Message-ID: <1280176678-18855-1-git-send-email-gbean@codeaurora.org> (raw)

Implement the second half of the gpio_request_enable and
gpio_disable_free gpio/tlmm utility functions, now that gpiolib
has found its way to the MSM/QSD.  Now these functions
actually request and free, like they claim to.

Signed-off-by: Gregory Bean <gbean@codeaurora.org>
---
 arch/arm/mach-msm/gpio.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
index bc32c84..796990f 100644
--- a/arch/arm/mach-msm/gpio.c
+++ b/arch/arm/mach-msm/gpio.c
@@ -71,15 +71,47 @@ void msm_gpios_disable(const struct msm_gpio *table, int size)
 }
 EXPORT_SYMBOL(msm_gpios_disable);
 
+int msm_gpios_request(const struct msm_gpio *table, int size)
+{
+	int i, result;
+
+	for (i = 0; i < size; ++i) {
+		result = gpio_request(GPIO_PIN(table[i].gpio_cfg),
+				      table[i].label);
+		if (result < 0)
+			goto err;
+	}
+
+	return 0;
+err:
+	msm_gpios_free(table, i);
+	return result;
+}
+EXPORT_SYMBOL(msm_gpios_request);
+
+void msm_gpios_free(const struct msm_gpio *table, int size)
+{
+	int i;
+
+	for (i = 0; i < size; ++i)
+		gpio_free(GPIO_PIN(table[i].gpio_cfg));
+}
+EXPORT_SYMBOL(msm_gpios_free);
+
 int msm_gpios_request_enable(const struct msm_gpio *table, int size)
 {
 	int rc = msm_gpios_enable(table, size);
+
+	if (rc == 0)
+		rc = msm_gpios_request(table, size);
+
 	return rc;
 }
 EXPORT_SYMBOL(msm_gpios_request_enable);
 
 void msm_gpios_disable_free(const struct msm_gpio *table, int size)
 {
+	msm_gpios_free(table, size);
 	msm_gpios_disable(table, size);
 }
 EXPORT_SYMBOL(msm_gpios_disable_free);
-- 
1.7.0.4

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

                 reply	other threads:[~2010-07-26 20:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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-all 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=1280176678-18855-1-git-send-email-gbean@codeaurora.org \
    --to=gbean@codeaurora.org \
    --cc=dwalker@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).