[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061223113752.GA28306@flint.arm.linux.org.uk>
Date: Sat, 23 Dec 2006 11:37:52 +0000
From: Russell King <rmk+lkml@....linux.org.uk>
To: David Brownell <david-b@...bell.net>
Cc: Linux Kernel list <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>,
Andrew Victor <andrew@...people.com>,
Bill Gatliff <bgat@...lgatliff.com>,
Haavard Skinnemoen <hskinnemoen@...el.com>, jamey.hicks@...com,
Kevin Hilman <khilman@...sta.com>,
Nicolas Pitre <nico@....org>, Tony Lindgren <tony@...mide.com>,
pHilipp Zabel <philipp.zabel@...il.com>
Subject: Re: [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@...il.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists