linux-mips
[Top] [All Lists]

Re: [PATCH 3/7] au1xmmc: remove db1x00 board-specific functions from dri

To: Manuel Lauss <mano@roarinelk.homelinux.net>
Subject: Re: [PATCH 3/7] au1xmmc: remove db1x00 board-specific functions from driver
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Date: Tue, 13 May 2008 13:27:24 +0400
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org
In-reply-to: <20080508080301.GD24383@roarinelk.homelinux.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20080508080040.GA24383@roarinelk.homelinux.net> <20080508080301.GD24383@roarinelk.homelinux.net>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 1.5.0.14 (Windows/20071210)
Hello.

Manuel Lauss wrote:
Remove the DB1200 board-specific functions (card present, read-only
methods) and instead add platform data which is passed to the driver.
This allows for platforms to implement other carddetect schemes
(e.g. dedicated irq) without having to pollute the driver code.
The poll timer (used for pb1200) is kept for compatibility.

With the board-specific stuff gone, the driver no longer needs to know
how many physical controllers the silicon actually has; every device
can be registered as needed, update the code to reflect that.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
[...]
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index cc5f7bc..8660f86 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
[...]
+static int __devinit au1xmmc_probe(struct platform_device *pdev)
+{
+       struct mmc_host *mmc;
+       struct au1xmmc_host *host;
+       struct resource *r;
+       int ret;
+
+       mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
+       if (!mmc) {
+               dev_err(&pdev->dev, "no memory for mmc host\n");
+               ret = -ENOMEM;
+               goto out0;
+       }
- if (!mmc) {
-                       printk(DRIVER_NAME "ERROR: no mem for host %d\n", i);
-                       au1xmmc_hosts[i] = 0;
-                       continue;
-               }
+       host = mmc_priv(mmc);
+       host->mmc = mmc;
+       host->platdata = pdev->dev.platform_data;
+       host->pdev = pdev;
- mmc->ops = &au1xmmc_ops;
+       ret = -ENODEV;
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!r) {
+               dev_err(&pdev->dev, "no mmio defined\n");
+               goto out1;
+       }

I forgot to mention that the driver should be calling request_mem_region() here...

WBR, Sergei



<Prev in Thread] Current Thread [Next in Thread>