From: olof@lixom.net (Olof Johansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] ARM: OMAP1: boards: Fix OMAP_GPIO_IRQ usage with gpio_to_irq()
Date: Wed, 28 Mar 2012 21:58:07 -0700 [thread overview]
Message-ID: <CAOesGMg0eZAGdnU4A6Ubbyrn-zZAK4xvBVqoPkhhVReoHTAfaQ@mail.gmail.com> (raw)
In-Reply-To: <1332158817-26311-2-git-send-email-tarun.kanti@ti.com>
Hi,
Sorry for the slow reply, I noticed this when dealing with merge
conflicts pulling in this patch and others from Tony.
On Mon, Mar 19, 2012 at 5:06 AM, Tarun Kanti DebBarma
<tarun.kanti@ti.com> wrote:
> With dynamic allocation of IRQ the usage of OMAP_GPIO_IRQ
> is no longer valid. We should be using gpio_to_irq() instead.
>
> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> ---
> ?arch/arm/mach-omap1/board-h2.c ? ? ? ?| ? ?8 ++++----
> ?arch/arm/mach-omap1/board-h3.c ? ? ? ?| ? ?9 ++++-----
> ?arch/arm/mach-omap1/board-htcherald.c | ? ?6 +++---
> ?arch/arm/mach-omap1/board-innovator.c | ? ?4 ++--
> ?arch/arm/mach-omap1/board-nokia770.c ?| ? ?2 +-
> ?arch/arm/mach-omap1/board-osk.c ? ? ? | ? 12 ++++++------
> ?arch/arm/mach-omap1/board-palmte.c ? ?| ? ?2 +-
> ?arch/arm/mach-omap1/board-palmtt.c ? ?| ? ?2 +-
> ?arch/arm/mach-omap1/board-palmz71.c ? | ? ?2 +-
> ?arch/arm/mach-omap1/board-voiceblue.c | ? 16 +++++++---------
> ?10 files changed, 30 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
> index 00ad6b2..ad0eece 100644
> --- a/arch/arm/mach-omap1/board-h2.c
> +++ b/arch/arm/mach-omap1/board-h2.c
> @@ -244,8 +244,6 @@ static struct resource h2_smc91x_resources[] = {
> ? ? ? ? ? ? ? ?.flags ?= IORESOURCE_MEM,
> ? ? ? ?},
> ? ? ? ?[1] = {
> - ? ? ? ? ? ? ? .start ?= OMAP_GPIO_IRQ(0),
> - ? ? ? ? ? ? ? .end ? ?= OMAP_GPIO_IRQ(0),
> ? ? ? ? ? ? ? ?.flags ?= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
> ? ? ? ?},
> ?};
> @@ -364,11 +362,9 @@ static struct tps65010_board tps_board = {
> ?static struct i2c_board_info __initdata h2_i2c_board_info[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?I2C_BOARD_INFO("tps65010", 0x48),
> - ? ? ? ? ? ? ? .irq ? ? ? ? ? ?= OMAP_GPIO_IRQ(58),
> ? ? ? ? ? ? ? ?.platform_data ?= &tps_board,
> ? ? ? ?}, {
> ? ? ? ? ? ? ? ?I2C_BOARD_INFO("isp1301_omap", 0x2d),
> - ? ? ? ? ? ? ? .irq ? ? ? ? ? ?= OMAP_GPIO_IRQ(2),
> ? ? ? ?},
> ?};
>
> @@ -437,10 +433,14 @@ static void __init h2_init(void)
> ? ? ? ?omap_cfg_reg(E19_1610_KBR4);
> ? ? ? ?omap_cfg_reg(N19_1610_KBR5);
>
> + ? ? ? h2_devices[2]->resource[1].start = gpio_to_irq(0);
> + ? ? ? h2_devices[2]->resource[1].end = gpio_to_irq(0);
Never, ever, ever do this. What happens here when someone else adds
another device to the h2_devices array before the smc91x one? Booom.
Extremely fragile code.
There's already a named resource struct you can use for this
(h2_smc91x_resources). Use it.
Same comments go for the other locations in this file as well as the
other OMAP2+ patch, where appropriate.
-Olof
next prev parent reply other threads:[~2012-03-29 4:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 12:06 [PATCH v2 0/4] ARM: OMAP: boards: changes to support dynamic irq alloc Tarun Kanti DebBarma
2012-03-19 12:06 ` [PATCH v2 1/4] ARM: OMAP1: boards: Fix OMAP_GPIO_IRQ usage with gpio_to_irq() Tarun Kanti DebBarma
2012-03-29 4:58 ` Olof Johansson [this message]
2012-03-29 5:34 ` DebBarma, Tarun Kanti
2012-03-19 12:06 ` [PATCH v2 2/4] ARM: OMAP2+: " Tarun Kanti DebBarma
2012-03-19 12:06 ` [PATCH v2 3/4] drivers: input: Fix OMAP_GPIO_IRQ with gpio_to_irq() in ams_delta_serio_exit() Tarun Kanti DebBarma
2012-03-20 16:52 ` Tony Lindgren
2012-03-20 17:36 ` Dmitry Torokhov
2012-03-19 12:06 ` [PATCH v2 4/4] ARM: OMAP: Remove OMAP_GPIO_IRQ macro definition Tarun Kanti DebBarma
2012-03-19 12:17 ` [PATCH v2 0/4] ARM: OMAP: boards: changes to support dynamic irq alloc Shilimkar, Santosh
2012-03-19 12:30 ` DebBarma, Tarun Kanti
2012-03-19 19:17 ` Tony Lindgren
2012-03-19 22:58 ` Cousson, Benoit
2012-03-19 23:39 ` Tony Lindgren
2012-03-20 9:00 ` Cousson, Benoit
2012-03-20 10:59 ` DebBarma, Tarun Kanti
2012-03-20 16:51 ` Tony Lindgren
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=CAOesGMg0eZAGdnU4A6Ubbyrn-zZAK4xvBVqoPkhhVReoHTAfaQ@mail.gmail.com \
--to=olof@lixom.net \
--cc=linux-arm-kernel@lists.infradead.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).