diff mbox

mmc: sunxi: Use devm_reset_control_get_optional() for reset control

Message ID 1425347080-1789-1-git-send-email-wens@csie.org (mailing list archive)
State New, archived
Headers show

Commit Message

Chen-Yu Tsai March 3, 2015, 1:44 a.m. UTC
The reset control for the sunxi mmc controller is optional. Some
newer platforms (sun6i, sun8i, sun9i) have it, while older ones
(sun4i, sun5i, sun7i) don't.

Use the properly stubbed _optional version so the driver does not
fail to compile when RESET_CONTROLLER=n.

This patch also adds a check for deferred probing on the reset
control.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Cc: <stable@vger.kernel.org> # 3.16+
---

Arnd had some proposals about the reset control API.
Not sure if the sunxi-mmc driver was on that list.

---
 drivers/mmc/host/sunxi-mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Lanzendörfer March 3, 2015, 10:06 a.m. UTC | #1
Acked-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>

> The reset control for the sunxi mmc controller is optional. Some
> newer platforms (sun6i, sun8i, sun9i) have it, while older ones
> (sun4i, sun5i, sun7i) don't.
> 
> Use the properly stubbed _optional version so the driver does not
> fail to compile when RESET_CONTROLLER=n.
> 
> This patch also adds a check for deferred probing on the reset
> control.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: <stable@vger.kernel.org> # 3.16+
> ---
> 
> Arnd had some proposals about the reset control API.
> Not sure if the sunxi-mmc driver was on that list.
> 
> ---
>  drivers/mmc/host/sunxi-mmc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index e8a4218b5726..459ed1b601db 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -930,7 +930,9 @@ static int sunxi_mmc_resource_request(struct
> sunxi_mmc_host *host, return PTR_ERR(host->clk_sample);
>  	}
> 
> -	host->reset = devm_reset_control_get(&pdev->dev, "ahb");
> +	host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
> +	if (PTR_ERR(host->reset) == -EPROBE_DEFER)
> +		return PTR_ERR(host->reset);
> 
>  	ret = clk_prepare_enable(host->clk_ahb);
>  	if (ret) {
Ulf Hansson March 5, 2015, 1:45 p.m. UTC | #2
On 3 March 2015 at 02:44, Chen-Yu Tsai <wens@csie.org> wrote:
> The reset control for the sunxi mmc controller is optional. Some
> newer platforms (sun6i, sun8i, sun9i) have it, while older ones
> (sun4i, sun5i, sun7i) don't.
>
> Use the properly stubbed _optional version so the driver does not
> fail to compile when RESET_CONTROLLER=n.
>
> This patch also adds a check for deferred probing on the reset
> control.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> Cc: <stable@vger.kernel.org> # 3.16+

Applied, thanks!

Kind regards
Uffe


> ---
>
> Arnd had some proposals about the reset control API.
> Not sure if the sunxi-mmc driver was on that list.
>
> ---
>  drivers/mmc/host/sunxi-mmc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index e8a4218b5726..459ed1b601db 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -930,7 +930,9 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
>                 return PTR_ERR(host->clk_sample);
>         }
>
> -       host->reset = devm_reset_control_get(&pdev->dev, "ahb");
> +       host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
> +       if (PTR_ERR(host->reset) == -EPROBE_DEFER)
> +               return PTR_ERR(host->reset);
>
>         ret = clk_prepare_enable(host->clk_ahb);
>         if (ret) {
> --
> 2.1.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index e8a4218b5726..459ed1b601db 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -930,7 +930,9 @@  static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
 		return PTR_ERR(host->clk_sample);
 	}
 
-	host->reset = devm_reset_control_get(&pdev->dev, "ahb");
+	host->reset = devm_reset_control_get_optional(&pdev->dev, "ahb");
+	if (PTR_ERR(host->reset) == -EPROBE_DEFER)
+		return PTR_ERR(host->reset);
 
 	ret = clk_prepare_enable(host->clk_ahb);
 	if (ret) {