linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/7] [ARM] sa1111: avoid using hardcoded IRQ numbers for PCMCIA driver
Date: Mon, 28 Dec 2009 13:18:06 +0800	[thread overview]
Message-ID: <1261977488-18271-6-git-send-email-eric.y.miao@gmail.com> (raw)
In-Reply-To: <1261977488-18271-1-git-send-email-eric.y.miao@gmail.com>

The IRQs for card detect and status change are currently hardcoded in
SA1111 PCMCIA driver, which can be actually obtained from the .irq[]
from 'struct sa1111_dev' to keep it generic.

Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
---
 drivers/pcmcia/sa1111_generic.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index de6bc33..db79ca6 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -21,11 +21,18 @@
 
 #include "sa1111_generic.h"
 
+#define IDX_IRQ_S0_READY_NINT	(0)
+#define IDX_IRQ_S0_CD_VALID	(1)
+#define IDX_IRQ_S0_BVD1_STSCHG	(2)
+#define IDX_IRQ_S1_READY_NINT	(3)
+#define IDX_IRQ_S1_CD_VALID	(4)
+#define IDX_IRQ_S1_BVD1_STSCHG	(5)
+
 static struct pcmcia_irqs irqs[] = {
-	{ 0, IRQ_S0_CD_VALID,    "SA1111 PCMCIA card detect" },
-	{ 0, IRQ_S0_BVD1_STSCHG, "SA1111 PCMCIA BVD1"        },
-	{ 1, IRQ_S1_CD_VALID,    "SA1111 CF card detect"     },
-	{ 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1"            },
+	{ 0, NO_IRQ, "SA1111 PCMCIA card detect" },
+	{ 0, NO_IRQ, "SA1111 PCMCIA BVD1"        },
+	{ 1, NO_IRQ, "SA1111 CF card detect"     },
+	{ 1, NO_IRQ, "SA1111 CF BVD1"            },
 };
 
 static int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
@@ -136,7 +143,9 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
 		s->soc.ops = ops;
 		s->soc.socket.owner = ops->owner;
 		s->soc.socket.dev.parent = &dev->dev;
-		s->soc.socket.pci_irq = s->soc.nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
+		s->soc.socket.pci_irq = s->soc.nr ?
+				dev->irq[IDX_IRQ_S0_READY_NINT] :
+				dev->irq[IDX_IRQ_S1_READY_NINT];
 		s->dev = dev;
 
 		ret = add(&s->soc);
@@ -162,6 +171,12 @@ static int pcmcia_probe(struct sa1111_dev *dev)
 
 	base = dev->mapbase;
 
+	/* Initialize PCMCIA IRQs */
+	irqs[0].irq = dev->irq[IDX_IRQ_S0_CD_VALID];
+	irqs[1].irq = dev->irq[IDX_IRQ_S0_BVD1_STSCHG];
+	irqs[2].irq = dev->irq[IDX_IRQ_S1_CD_VALID];
+	irqs[3].irq = dev->irq[IDX_IRQ_S1_BVD1_STSCHG];
+
 	/*
 	 * Initialise the suspend state.
 	 */
-- 
1.6.3.3

  parent reply	other threads:[~2009-12-28  5:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28  5:18 [PATCH 0/7] pxa/sa1100: irqs.h cleanup Eric Miao
2009-12-28  5:18 ` [PATCH 1/7] [ARM] sa1100: remove unreferenced IRQ definitions Eric Miao
2009-12-31 13:23   ` Thomas Kunze
2010-01-10 17:04     ` Marek Vasut
2010-01-21 18:01       ` Thomas Kunze
2009-12-28  5:18 ` [PATCH 2/7] [ARM] locomo: avoid the unnecessary cascade of keyboard IRQ Eric Miao
2009-12-31 13:47   ` Thomas Kunze
2010-01-01  3:35     ` Eric Miao
2010-01-02 11:43   ` Russell King - ARM Linux
2010-01-03  8:07     ` Eric Miao
2009-12-28  5:18 ` [PATCH 3/7] [ARM] locomo: remove unused IRQs and avoid unnecessary cascade Eric Miao
2009-12-31 13:42   ` Thomas Kunze
2010-01-01  2:59     ` Eric Miao
2010-01-10 14:31       ` Thomas Kunze
2010-01-02 11:45   ` Russell King - ARM Linux
2009-12-28  5:18 ` [PATCH 4/7] [ARM] locomo: allow cascaded IRQ base to be specified by platforms Eric Miao
2009-12-28 21:14   ` Pavel Machek
2009-12-29  1:07     ` Eric Miao
2009-12-28  5:18 ` Eric Miao [this message]
2009-12-28  5:18 ` [PATCH 6/7] [ARM] sa1111: allow cascaded IRQs to be used " Eric Miao
2009-12-28  5:18 ` [PATCH 7/7] [ARM] pxa: move board board IRQ definitions out of irqs.h Eric Miao

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=1261977488-18271-6-git-send-email-eric.y.miao@gmail.com \
    --to=eric.y.miao@gmail.com \
    --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).