[PATCH] avoid using irq_desc in glamo-mci.c

Werner Almesberger werner at openmoko.org
Thu Jan 15 14:43:07 CET 2009

When building the MMC subsystem as modules,
drivers/mfd/glamo/glamo-mci.ko cannot access irq_desc, because it
isn't exported by kernel/irq/handle.c All the functions that
indirectly access irq_desc are inlined, so they cannot be used to
avoid having to resolve irq_desc.

Fortunately, we can solve the problem locally: we don't really need
to access irq_desc anyway. This patch splits glamo_mci_irq into a
small wrapper that implements the IRQ handler interface and the main
code that doesn't need to know about the semantics of the latter.
Then we simply call the main code with the information we already

Signed-off-by: Werner Almesberger <werner at openmoko.org>
Tested-by: Rafael Ignacio Zurita <rizurita at yahoo.com>


diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
index 778e47c..e836913 100644
--- a/drivers/mfd/glamo/glamo-mci.c
+++ b/drivers/mfd/glamo/glamo-mci.c
@@ -331,17 +331,12 @@ static int __glamo_mci_set_card_clock(struct glamo_mci_host *host, int freq,
 	return real_rate;
-static void glamo_mci_irq(unsigned int irq, struct irq_desc *desc)
+static void glamo_mci_irq_host(struct glamo_mci_host *host)
-	struct glamo_mci_host *host = (struct glamo_mci_host *)
-				      desc->handler_data;
 	u16 status;
 	struct mmc_command *cmd;
 	unsigned long iflags;
-	if (!host)
-		return;
 	if (host->suspending) { /* bad news, dangerous time */
 		dev_err(&host->pdev->dev, "****glamo_mci_irq before resumed\n");
@@ -405,6 +400,16 @@ done:
 	spin_unlock_irqrestore(&host->complete_lock, iflags);
+static void glamo_mci_irq(unsigned int irq, struct irq_desc *desc)
+	struct glamo_mci_host *host = (struct glamo_mci_host *)
+				      desc->handler_data;
+	if (host)
+		glamo_mci_irq_host(host);
 static int glamo_mci_send_command(struct glamo_mci_host *host,
 				  struct mmc_command *cmd)
@@ -718,8 +723,7 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
 		/* yay we are an interrupt controller! -- call the ISR
 		 * it will stop clock to card
-		glamo_mci_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC),
-			      irq_desc + IRQ_GLAMO(GLAMO_IRQIDX_MMC));
+		glamo_mci_irq_host(host);

More information about the openmoko-kernel mailing list