diff mbox

[v2,1/4] gpio/tegra: Remove use of irq_to_gpio

Message ID 1313095404-27858-1-git-send-email-swarren@nvidia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stephen Warren Aug. 11, 2011, 8:43 p.m. UTC
irq_to_gpio is being removed. Replace the only use of that API by
the ARM Tegra sub-architecture.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This series is the irq_to_gpio patches I posted last week, rebased to ToT,
plus removing Tegra's custom gpio_to_irq.

This series was tested against next-20110811 on Harmony, by playing audio
and plugging/unplugging headphones. Headphone detection relies on using a
GPIO as an IRQ, and hence on gpio_to_irq.

 drivers/gpio/gpio-tegra.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

Comments

Colin Cross Aug. 11, 2011, 8:54 p.m. UTC | #1
On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> irq_to_gpio is being removed. Replace the only use of that API by
> the ARM Tegra sub-architecture.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> plus removing Tegra's custom gpio_to_irq.
>
> This series was tested against next-20110811 on Harmony, by playing audio
> and plugging/unplugging headphones. Headphone detection relies on using a
> GPIO as an IRQ, and hence on gpio_to_irq.

This whole series looks good to me:
Acked-by: Colin Cross <ccross@android.com>
Stephen Warren Aug. 12, 2011, 4:07 p.m. UTC | #2
Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
> On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> > irq_to_gpio is being removed. Replace the only use of that API by
> > the ARM Tegra sub-architecture.
> >
> > Signed-off-by: Stephen Warren <swarren@nvidia.com>
> > ---
> > This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> > plus removing Tegra's custom gpio_to_irq.
> >
> > This series was tested against next-20110811 on Harmony, by playing audio
> > and plugging/unplugging headphones. Headphone detection relies on using a
> > GPIO as an IRQ, and hence on gpio_to_irq.
> 
> This whole series looks good to me:
> Acked-by: Colin Cross <ccross@android.com>

Grant, Does this series look OK to you? Russell asked me to add it to the
ARM patch system once you'd Ack'd it.

Thanks.
Stephen Warren Aug. 22, 2011, 11:44 p.m. UTC | #3
Stephen Warren wrote at Friday, August 12, 2011 10:07 AM:
> Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
> > On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> > > irq_to_gpio is being removed. Replace the only use of that API by
> > > the ARM Tegra sub-architecture.
> > >
> > > Signed-off-by: Stephen Warren <swarren@nvidia.com>
> > > ---
> > > This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> > > plus removing Tegra's custom gpio_to_irq.
> > >
> > > This series was tested against next-20110811 on Harmony, by playing audio
> > > and plugging/unplugging headphones. Headphone detection relies on using a
> > > GPIO as an IRQ, and hence on gpio_to_irq.
> >
> > This whole series looks good to me:
> > Acked-by: Colin Cross <ccross@android.com>
> 
> Grant, Does this series look OK to you? Russell asked me to add it to the
> ARM patch system once you'd Ack'd it.
> 
> Thanks.

Russell, I've uploaded these to the ARM patch system as 7052..7055.

Note that I didn't wait for Grant's Ack, since Colin Ack'd them, and
Grant said in another thread that he's being very liberal in allowing
GPIO rework changes; I hope this is OK!
diff mbox

Patch

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 747eb40..ecade29 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -331,6 +331,7 @@  static struct lock_class_key gpio_lock_class;
 static int __init tegra_gpio_init(void)
 {
 	struct tegra_gpio_bank *bank;
+	int gpio;
 	int i;
 	int j;
 
@@ -352,14 +353,17 @@  static int __init tegra_gpio_init(void)
 
 	gpiochip_add(&tegra_gpio_chip);
 
-	for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {
-		bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))];
+	for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
+		int irq = TEGRA_GPIO_TO_IRQ(gpio);
+		/* No validity check; all Tegra GPIOs are valid IRQs */
 
-		irq_set_lockdep_class(i, &gpio_lock_class);
-		irq_set_chip_data(i, bank);
-		irq_set_chip_and_handler(i, &tegra_gpio_irq_chip,
+		bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
+
+		irq_set_lockdep_class(irq, &gpio_lock_class);
+		irq_set_chip_data(irq, bank);
+		irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
 					 handle_simple_irq);
-		set_irq_flags(i, IRQF_VALID);
+		set_irq_flags(irq, IRQF_VALID);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {