lkml.org 
[lkml]   [2006]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2.6.20-rc1 5/6] SA1100 GPIO wrappers
On Wed, Dec 20, 2006 at 01:13:21PM -0800, David Brownell wrote:
> Arch-neutral GPIO calls for SA-1100.
>
> From: Philipp Zabel <philipp.zabel@gmail.com>
>
> +static inline unsigned gpio_to_irq(unsigned gpio)
> +{
> + if (gpio < 11)
> + return IRQ_GPIO0 + gpio;
> + else
> + return IRQ_GPIO11 - 11 + gpio;
> +}
> +
> +static inline unsigned irq_to_gpio(unsigned irq)
> +{
> + if (irq < IRQ_GPIO11_27)
> + return irq - IRQ_GPIO0;
> + else
> + return irq - IRQ_GPIO11 + 11;
> +}

Why do we need to convert between IRQ and PGIO numbers? This is NOT
something that drivers should even care about - it's something that the
interrupt subsystem should know when being asked to claim an GPIO-based
IRQ.

That's something I worked hard to eliminate from the SA1100 drivers,
please don't reintroduce this silly idea again.

When the interrupt system is asked to claim a IRQ corresponding to a
GPIO, it should deal with all the stuff necessary to ensure that the
GPIO is in the required state. Drivers should not be considering
converting IRQ numbers to GPIOs or vice versa.

Doing otherwise is just plain silly - are we expecting to add GPIO
support to all Linux drivers which could possibly be used on ARM, just
because their interrupt pin might possibly be connected to a GPIO?

Get real - if you're dealing with IRQs use _only_ IRQ numbers. Don't
even think that drivers should be able to convert between IRQ and GPIO
numbers.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-23 12:43    [W:0.198 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site