diff mbox

mmc: bus: check suspend/resume hooks for bus_ops before calling

Message ID 1436517526-19392-1-git-send-email-yangbo.lu@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

yangbo lu July 10, 2015, 8:38 a.m. UTC
It needs to check suspend/resume hooks before calling them to avoid
call trace during hibernation.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
---
 drivers/mmc/core/bus.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Ulf Hansson July 21, 2015, 11:09 a.m. UTC | #1
On 10 July 2015 at 10:38, Yangbo Lu <yangbo.lu@freescale.com> wrote:
> It needs to check suspend/resume hooks before calling them to avoid
> call trace during hibernation.

Could you elaborate more exactly what happens here, how do you trigger
this error.

Is this a bug fix?

>
> Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
> ---
>  drivers/mmc/core/bus.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 972ff84..fc6b5e5 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -154,7 +154,8 @@ static int mmc_bus_suspend(struct device *dev)
>         if (ret)
>                 return ret;
>
> -       ret = host->bus_ops->suspend(host);
> +       if (host->bus_ops->suspend)
> +               ret = host->bus_ops->suspend(host);
>         return ret;
>  }
>
> @@ -164,10 +165,12 @@ static int mmc_bus_resume(struct device *dev)
>         struct mmc_host *host = card->host;
>         int ret;
>
> -       ret = host->bus_ops->resume(host);
> -       if (ret)
> -               pr_warn("%s: error %d during resume (card was removed?)\n",
> -                       mmc_hostname(host), ret);
> +       if (host->bus_ops->resume) {
> +               ret = host->bus_ops->resume(host);
> +               if (ret)
> +                       pr_warn("%s: error %d during resume (card was removed?)\n",
> +                               mmc_hostname(host), ret);
> +       }
>
>         ret = pm_generic_resume(dev);
>         return ret;
> --
> 2.1.0.27.g96db324
>

Kind regards
Uffe
--
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/core/bus.c b/drivers/mmc/core/bus.c
index 972ff84..fc6b5e5 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -154,7 +154,8 @@  static int mmc_bus_suspend(struct device *dev)
 	if (ret)
 		return ret;
 
-	ret = host->bus_ops->suspend(host);
+	if (host->bus_ops->suspend)
+		ret = host->bus_ops->suspend(host);
 	return ret;
 }
 
@@ -164,10 +165,12 @@  static int mmc_bus_resume(struct device *dev)
 	struct mmc_host *host = card->host;
 	int ret;
 
-	ret = host->bus_ops->resume(host);
-	if (ret)
-		pr_warn("%s: error %d during resume (card was removed?)\n",
-			mmc_hostname(host), ret);
+	if (host->bus_ops->resume) {
+		ret = host->bus_ops->resume(host);
+		if (ret)
+			pr_warn("%s: error %d during resume (card was removed?)\n",
+				mmc_hostname(host), ret);
+	}
 
 	ret = pm_generic_resume(dev);
 	return ret;