* [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence
@ 2013-06-03 22:02 Arnd Bergmann
2013-06-04 3:01 ` Barry Song
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2013-06-03 22:02 UTC (permalink / raw)
To: linux-arm-kernel
Patch "mmc: sdhci: Add size for caller in init+register" changed the
interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc
host sdhci-pltfm based driver for SiRF SoCs" added a new driver
with the old interface.
This changes the sirf driver to use the new interface, avoiding
one warning, and simplifying the init sequence. Since we're here
already, this also adds an error path for failed clk_prepare_enable.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Daudt <csd@broadcom.com>
Cc: Barry Song <Baohua.Song@csr.com>
Cc: Chris Ball <cjb@laptop.org>
----
This needs an Ack from Barry before it can get applied.
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index 09805af..cc80f26 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -24,7 +24,7 @@ struct sdhci_sirf_priv {
static unsigned int sdhci_sirf_get_max_clk(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_sirf_priv *priv = pltfm_host->priv;
+ struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
return clk_get_rate(priv->clk);
}
@@ -47,6 +47,8 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_sirf_priv *priv;
struct pinctrl *pinctrl;
+ struct clk *clk;
+ int gpio_cd;
int ret;
pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
@@ -55,38 +57,31 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
return PTR_ERR(pinctrl);
}
- priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_sirf_priv),
- GFP_KERNEL);
- if (!priv) {
- dev_err(&pdev->dev, "unable to allocate private data");
- return -ENOMEM;
- }
-
- priv->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(priv->clk)) {
+ clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(clk)) {
dev_err(&pdev->dev, "unable to get clock");
- return PTR_ERR(priv->clk);
+ return PTR_ERR(clk);
}
- if (pdev->dev.of_node) {
- priv->gpio_cd = of_get_named_gpio(pdev->dev.of_node,
- "cd-gpios", 0);
- } else {
- priv->gpio_cd = -EINVAL;
- }
+ if (pdev->dev.of_node)
+ gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0);
+ else
+ gpio_cd = -EINVAL;
- host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata);
- if (IS_ERR(host)) {
- ret = PTR_ERR(host);
- goto err_sdhci_pltfm_init;
- }
+ host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv));
+ if (IS_ERR(host))
+ return PTR_ERR(host);
pltfm_host = sdhci_priv(host);
- pltfm_host->priv = priv;
+ priv = sdhci_pltfm_priv(pltfm_host);
+ priv->clk = clk;
+ priv->gpio_cd = gpio_cd;
sdhci_get_of_property(pdev);
- clk_prepare_enable(priv->clk);
+ ret = clk_prepare_enable(priv->clk);
+ if (ret)
+ goto err_clk_prepare;
ret = sdhci_add_host(host);
if (ret)
@@ -111,8 +106,8 @@ err_request_cd:
sdhci_remove_host(host, 0);
err_sdhci_add:
clk_disable_unprepare(priv->clk);
+err_clk_prepare:
sdhci_pltfm_free(pdev);
-err_sdhci_pltfm_init:
return ret;
}
@@ -120,7 +115,7 @@ static int sdhci_sirf_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_sirf_priv *priv = pltfm_host->priv;
+ struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
sdhci_pltfm_unregister(pdev);
@@ -136,7 +131,7 @@ static int sdhci_sirf_suspend(struct device *dev)
{
struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_sirf_priv *priv = pltfm_host->priv;
+ struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
int ret;
ret = sdhci_suspend_host(host);
@@ -152,7 +147,7 @@ static int sdhci_sirf_resume(struct device *dev)
{
struct sdhci_host *host = dev_get_drvdata(dev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_sirf_priv *priv = pltfm_host->priv;
+ struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
int ret;
ret = clk_enable(priv->clk);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence
2013-06-03 22:02 [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence Arnd Bergmann
@ 2013-06-04 3:01 ` Barry Song
2013-06-11 22:39 ` Christian Daudt
2013-06-27 15:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Barry Song @ 2013-06-04 3:01 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnd,
2013/6/4 Arnd Bergmann <arnd@arndb.de>:
> Patch "mmc: sdhci: Add size for caller in init+register" changed the
> interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc
> host sdhci-pltfm based driver for SiRF SoCs" added a new driver
> with the old interface.
>
> This changes the sirf driver to use the new interface, avoiding
> one warning, and simplifying the init sequence. Since we're here
> already, this also adds an error path for failed clk_prepare_enable.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Christian Daudt <csd@broadcom.com>
> Cc: Barry Song <Baohua.Song@csr.com>
> Cc: Chris Ball <cjb@laptop.org>
> ----
> This needs an Ack from Barry before it can get applied.
would this patch be rebased againest "[PATCH v2] mmc: sdhci-sirf: let
device core setup the default pin configuration" at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-May/168073.html
i hope Chris apply that one at first, then handle this one.
>
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index 09805af..cc80f26 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -24,7 +24,7 @@ struct sdhci_sirf_priv {
> static unsigned int sdhci_sirf_get_max_clk(struct sdhci_host *host)
> {
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> return clk_get_rate(priv->clk);
> }
>
> @@ -47,6 +47,8 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_sirf_priv *priv;
> struct pinctrl *pinctrl;
> + struct clk *clk;
> + int gpio_cd;
> int ret;
>
> pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> @@ -55,38 +57,31 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
> return PTR_ERR(pinctrl);
> }
>
> - priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_sirf_priv),
> - GFP_KERNEL);
> - if (!priv) {
> - dev_err(&pdev->dev, "unable to allocate private data");
> - return -ENOMEM;
> - }
> -
> - priv->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(priv->clk)) {
> + clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(clk)) {
> dev_err(&pdev->dev, "unable to get clock");
> - return PTR_ERR(priv->clk);
> + return PTR_ERR(clk);
> }
>
> - if (pdev->dev.of_node) {
> - priv->gpio_cd = of_get_named_gpio(pdev->dev.of_node,
> - "cd-gpios", 0);
> - } else {
> - priv->gpio_cd = -EINVAL;
> - }
> + if (pdev->dev.of_node)
> + gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0);
> + else
> + gpio_cd = -EINVAL;
>
> - host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata);
> - if (IS_ERR(host)) {
> - ret = PTR_ERR(host);
> - goto err_sdhci_pltfm_init;
> - }
> + host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv));
> + if (IS_ERR(host))
> + return PTR_ERR(host);
>
> pltfm_host = sdhci_priv(host);
> - pltfm_host->priv = priv;
> + priv = sdhci_pltfm_priv(pltfm_host);
> + priv->clk = clk;
> + priv->gpio_cd = gpio_cd;
>
> sdhci_get_of_property(pdev);
>
> - clk_prepare_enable(priv->clk);
> + ret = clk_prepare_enable(priv->clk);
> + if (ret)
> + goto err_clk_prepare;
>
> ret = sdhci_add_host(host);
> if (ret)
> @@ -111,8 +106,8 @@ err_request_cd:
> sdhci_remove_host(host, 0);
> err_sdhci_add:
> clk_disable_unprepare(priv->clk);
> +err_clk_prepare:
> sdhci_pltfm_free(pdev);
> -err_sdhci_pltfm_init:
> return ret;
> }
>
> @@ -120,7 +115,7 @@ static int sdhci_sirf_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
>
> sdhci_pltfm_unregister(pdev);
>
> @@ -136,7 +131,7 @@ static int sdhci_sirf_suspend(struct device *dev)
> {
> struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> int ret;
>
> ret = sdhci_suspend_host(host);
> @@ -152,7 +147,7 @@ static int sdhci_sirf_resume(struct device *dev)
> {
> struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> int ret;
>
> ret = clk_enable(priv->clk);
-barry
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence
2013-06-03 22:02 [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence Arnd Bergmann
2013-06-04 3:01 ` Barry Song
@ 2013-06-11 22:39 ` Christian Daudt
2013-06-27 15:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Christian Daudt @ 2013-06-11 22:39 UTC (permalink / raw)
To: linux-arm-kernel
On 13-06-03 03:02 PM, Arnd Bergmann wrote:
> Patch "mmc: sdhci: Add size for caller in init+register" changed the
> interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc
> host sdhci-pltfm based driver for SiRF SoCs" added a new driver
> with the old interface.
>
> This changes the sirf driver to use the new interface, avoiding
> one warning, and simplifying the init sequence. Since we're here
> already, this also adds an error path for failed clk_prepare_enable.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Christian Daudt <csd@broadcom.com>
> Cc: Barry Song <Baohua.Song@csr.com>
> Cc: Chris Ball <cjb@laptop.org>
> ----
> This needs an Ack from Barry before it can get applied.
>
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index 09805af..cc80f26 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -24,7 +24,7 @@ struct sdhci_sirf_priv {
> static unsigned int sdhci_sirf_get_max_clk(struct sdhci_host *host)
> {
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> return clk_get_rate(priv->clk);
> }
>
> @@ -47,6 +47,8 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_sirf_priv *priv;
> struct pinctrl *pinctrl;
> + struct clk *clk;
> + int gpio_cd;
> int ret;
>
> pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> @@ -55,38 +57,31 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
> return PTR_ERR(pinctrl);
> }
>
> - priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_sirf_priv),
> - GFP_KERNEL);
> - if (!priv) {
> - dev_err(&pdev->dev, "unable to allocate private data");
> - return -ENOMEM;
> - }
> -
> - priv->clk = devm_clk_get(&pdev->dev, NULL);
> - if (IS_ERR(priv->clk)) {
> + clk = devm_clk_get(&pdev->dev, NULL);
> + if (IS_ERR(clk)) {
> dev_err(&pdev->dev, "unable to get clock");
> - return PTR_ERR(priv->clk);
> + return PTR_ERR(clk);
> }
>
> - if (pdev->dev.of_node) {
> - priv->gpio_cd = of_get_named_gpio(pdev->dev.of_node,
> - "cd-gpios", 0);
> - } else {
> - priv->gpio_cd = -EINVAL;
> - }
> + if (pdev->dev.of_node)
> + gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0);
> + else
> + gpio_cd = -EINVAL;
>
> - host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata);
> - if (IS_ERR(host)) {
> - ret = PTR_ERR(host);
> - goto err_sdhci_pltfm_init;
> - }
> + host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv));
> + if (IS_ERR(host))
> + return PTR_ERR(host);
>
> pltfm_host = sdhci_priv(host);
> - pltfm_host->priv = priv;
> + priv = sdhci_pltfm_priv(pltfm_host);
> + priv->clk = clk;
> + priv->gpio_cd = gpio_cd;
>
> sdhci_get_of_property(pdev);
>
> - clk_prepare_enable(priv->clk);
> + ret = clk_prepare_enable(priv->clk);
> + if (ret)
> + goto err_clk_prepare;
>
> ret = sdhci_add_host(host);
> if (ret)
> @@ -111,8 +106,8 @@ err_request_cd:
> sdhci_remove_host(host, 0);
> err_sdhci_add:
> clk_disable_unprepare(priv->clk);
> +err_clk_prepare:
> sdhci_pltfm_free(pdev);
> -err_sdhci_pltfm_init:
> return ret;
> }
>
> @@ -120,7 +115,7 @@ static int sdhci_sirf_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
>
> sdhci_pltfm_unregister(pdev);
>
> @@ -136,7 +131,7 @@ static int sdhci_sirf_suspend(struct device *dev)
> {
> struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> int ret;
>
> ret = sdhci_suspend_host(host);
> @@ -152,7 +147,7 @@ static int sdhci_sirf_resume(struct device *dev)
> {
> struct sdhci_host *host = dev_get_drvdata(dev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> - struct sdhci_sirf_priv *priv = pltfm_host->priv;
> + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
> int ret;
>
> ret = clk_enable(priv->clk);
>
>
Acked-by: Christian Daudt <csd@broadcom.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence
2013-06-03 22:02 [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence Arnd Bergmann
2013-06-04 3:01 ` Barry Song
2013-06-11 22:39 ` Christian Daudt
@ 2013-06-27 15:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-06-27 15:18 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnd,
On Mon, Jun 03 2013, Arnd Bergmann wrote:
> Patch "mmc: sdhci: Add size for caller in init+register" changed the
> interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc
> host sdhci-pltfm based driver for SiRF SoCs" added a new driver
> with the old interface.
>
> This changes the sirf driver to use the new interface, avoiding
> one warning, and simplifying the init sequence. Since we're here
> already, this also adds an error path for failed clk_prepare_enable.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Cc: Christian Daudt <csd@broadcom.com>
> Cc: Barry Song <Baohua.Song@csr.com>
> Cc: Chris Ball <cjb@laptop.org>
Thanks, fixed the conflict and pushed to mmc-next for 3.11; sorry for
the delay.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-27 15:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 22:02 [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence Arnd Bergmann
2013-06-04 3:01 ` Barry Song
2013-06-11 22:39 ` Christian Daudt
2013-06-27 15:18 ` Chris Ball
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).