From: Shawn Guo <shawn.guo@freescale.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Shawn Guo <shawn.guo@linaro.org>, <linaro-dev@lists.linaro.org>,
<sameo@linux.intel.com>, <patches@linaro.org>,
<devicetree-discuss@lists.ozlabs.org>,
<linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] mmc: sdhci: make sdhci-pltfm device drivers self registered
Date: Fri, 1 Apr 2011 14:10:21 +0800 [thread overview]
Message-ID: <20110401061020.GF25866@S2100-06.ap.freescale.net> (raw)
In-Reply-To: <20110331153322.GA26612@ponder.secretlab.ca>
On Thu, Mar 31, 2011 at 09:33:22AM -0600, Grant Likely wrote:
> On Fri, Mar 25, 2011 at 04:48:47PM +0800, Shawn Guo wrote:
> > The patch turns the common stuff in sdhci-pltfm.c into functions, and
> > add device drivers their own .probe and .remove which in turn call
> > into the common functions, so that those sdhci-pltfm device drivers
> > register itself and keep all device specific things away from common
> > sdhci-pltfm file.
> >
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>
> Looks really good. Relatively minor comments below, but you can add
> this to the next version:
>
> Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
>
Thanks for the review.
[...]
> > +
> > +static int __devinit sdhci_cns3xxx_probe(struct platform_device *pdev)
> > +{
> > + struct sdhci_host *host;
> > + int ret;
> > +
> > + host = sdhci_pltfm_init(pdev, &sdhci_cns3xxx_pdata);
> > + if (!host)
> > + return -ENOMEM;
> > +
> > + ret = sdhci_add_host(host);
> > + if (ret)
> > + goto err_add_host;
> > +
> > + return 0;
> > +
> > +err_add_host:
> > + sdhci_pltfm_free(pdev);
> > + return ret;
> > +}
>
> This pattern in this function is used by 2 drivers in this patch, and
> 2 more users (with the addition of an sdhci_get_of_property() call) in
> the 3rd patch. An sdchi_pltfm_register(pdev, &pdata) that does the
> whole sequence would probably be valuable. Same for the _remove hook.
>
OK, one more pair of helper function will be added.
> Drivers that still need 2 stage registration, like the tegra driver,
> would still be able to call sdhci_pltfm_init() and sdhci_add_host()
> directly.
>
> > +
> > +static int __devexit sdhci_cns3xxx_remove(struct platform_device *pdev)
> > +{
> > + struct sdhci_host *host = platform_get_drvdata(pdev);
> > + int dead = 0;
> > + u32 scratch;
> > +
> > + scratch = readl(host->ioaddr + SDHCI_INT_STATUS);
> > + if (scratch == (u32)-1)
> > + dead = 1;
> > +
> > + sdhci_remove_host(host, dead);
>
> The following would be equivalent to the above three lines:
>
> sdhci_remove_host(host, scratch == (u32)-1);
>
OK.
[...]
> > @@ -3,7 +3,7 @@
> > *
> > * Author: Saeed Bishara <saeed@marvell.com>
> > * Mike Rapoport <mike@compulab.co.il>
> > - * Based on sdhci-cns3xxx.c
> > + * Based on sdhci-dove.c
>
> This file *is* sdhci-dove.c. Did you intend this change? :-)
>
My bad.
[...]
> > +#ifdef CONFIG_OF
> > + plat = kzalloc(sizeof(*plat), GFP_KERNEL);
> > + if (!plat) {
> > + rc = -ENOMEM;
> > + goto err_no_plat;
> > + }
> > + pdev->dev.platform_data = plat;
> > +
> > + plat->cd_gpio = of_get_gpio(pdev->dev.of_node, 0);
> > + plat->wp_gpio = of_get_gpio(pdev->dev.of_node, 1);
> > + plat->power_gpio = of_get_gpio(pdev->dev.of_node, 2);
> > +
> > + dev_info(&pdev->dev, "using gpios cd=%i, wp=%i power=%i\n",
> > + plat->cd_gpio, plat->wp_gpio, plat->power_gpio);
> > +#endif
>
> This will need to be reworked for mainline since the Tegra device tree
> support only exists in my git tree. Basing it on devicetree/arm would
> work.
>
OK. Will against mmc-next and test esdhc dt changes on devicetree/arm.
--
Regards,
Shawn
next prev parent reply other threads:[~2011-04-01 6:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 8:48 [PATCH 0/5] consolidate sdhci pltfm & OF drivers and get them " Shawn Guo
2011-03-25 8:48 ` [PATCH 1/5] mmc: sdhci: make sdhci-pltfm device drivers " Shawn Guo
2011-03-31 15:33 ` Grant Likely
2011-04-01 6:10 ` Shawn Guo [this message]
2011-04-19 10:20 ` Wolfram Sang
2011-04-21 8:03 ` Shawn Guo
2011-04-21 9:57 ` Wolfram Sang
2011-03-25 8:48 ` [PATCH 2/5] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data Shawn Guo
2011-03-31 15:34 ` Grant Likely
2011-04-19 10:20 ` Wolfram Sang
2011-04-21 8:10 ` Shawn Guo
2011-03-25 8:48 ` [PATCH 3/5] mmc: sdhci: make sdhci-of device drivers self registered Shawn Guo
2011-03-31 15:38 ` Grant Likely
2011-04-19 10:21 ` Wolfram Sang
2011-04-21 8:17 ` Shawn Guo
2011-03-25 8:48 ` [PATCH 4/5] mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx Shawn Guo
2011-03-31 15:53 ` Grant Likely
2011-04-01 6:18 ` Shawn Guo
2011-04-19 10:21 ` Wolfram Sang
2011-04-21 8:53 ` Shawn Guo
2011-03-25 8:48 ` [PATCH 5/5] mmc: sdhci: merge two sdhci-pltfm.h into one Shawn Guo
2011-03-31 15:54 ` Grant Likely
2011-04-19 10:21 ` Wolfram Sang
2011-03-31 4:25 ` [PATCH 0/5] consolidate sdhci pltfm & OF drivers and get them self registered Shawn Guo
2011-03-31 16:36 ` Chris Ball
2011-04-13 6:26 ` Shawn Guo
2011-04-19 10:20 ` Wolfram Sang
2011-04-19 12:47 ` Kyungmin Park
2011-04-19 17:47 ` Wolfram Sang
2011-04-20 4:23 ` Kyungmin Park
2011-04-21 7:48 ` Shawn Guo
2011-04-26 13:20 ` Wolfram Sang
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=20110401061020.GF25866@S2100-06.ap.freescale.net \
--to=shawn.guo@freescale.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=patches@linaro.org \
--cc=sameo@linux.intel.com \
--cc=shawn.guo@linaro.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
all inboxes | Powered by JetHome®