On Fri, 2010-12-17 at 20:53 +0800, Yunpeng Gao wrote:
> >From 277ffbe2b37467db52fea9e5b0ebb05cdb26cddf Mon Sep 17 00:00:00 2001
> From: Yunpeng Gao <[email protected]>
> Date: Thu, 16 Dec 2010 19:58:43 +0800
> Subject: [PATCH] Do some changes in mmc core layer to enable mmc card runtime 
> pm
> 
> Seems current runtime PM support in mmc core layer has some problems:
> 
> 1. If host controller is PCI device, then it's possibly that the PCI
> host controller will be runtime suspended immediately after its PCI
> probe. Then it will have trouble when do the following mmc_rescan
> since at that time the function driver (mmc block driver or sdio
> function driver) has not been called and there's no chance to execute
> pm_runtime_get().
> 
> 2. Currently mmc_host_class (defined in drivers/mmc/core/host.c) is
> parent of mmc_card and child of host controller. But mmc_host_class
> has not implemented the runtime pm APIs of itself. So seems it'll
> cause the mmc runtime PM chain disconnect here.
> 
> This patch tries to fix above 2 problems.
> For 1, it adds pm_runtime_get/put at the begging/end of function
> mmc_rescan().
> For2, it implements a set of dummy runtime PM API for the
> mmc_host_class.
> 
> Signed-off-by: Yunpeng Gao <[email protected]>
> ---
>  drivers/mmc/core/bus.c  |    2 +-
>  drivers/mmc/core/core.c |    4 ++++
>  drivers/mmc/core/host.c |   36 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 41 insertions(+), 1 deletions(-)
> 
>  }
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 10b8af2..82baa02 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -18,6 +18,7 @@
>  #include <linux/leds.h>
>  #include <linux/slab.h>
>  #include <linux/suspend.h>
> +#include <linux/pm_runtime.h>
>  
>  #include <linux/mmc/host.h>
>  
> @@ -26,6 +27,34 @@
>  
>  #define cls_dev_to_mmc_host(d)       container_of(d, struct mmc_host, 
> class_dev)
>  
> +#ifdef CONFIG_PM_RUNTIME
> +static int mmc_host_runtime_suspend(struct device *dev)
> +{
> +     return 0;
> +}
> +
> +static int mmc_host_runtime_resume(struct device *dev)
> +{
> +     return 0;
> +}
> +
> +static int mmc_host_runtime_idle(struct device *dev)
> +{
> +     return pm_runtime_suspend(dev);
> +}
> +
> +#else
> +#define mmc_host_runtime_suspend        NULL
> +#define mmc_host_runtime_resume         NULL
> +#define mmc_host_runtime_idle           NULL
Suggest to define 0 as their original functions return int.


_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to