1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

staging: mt7621-mmc: Refactor suspend, resume

Refactor msdc_drv_{suspend, resume} by adding a new function
msdc_drv_pm, that cleans up the code and removes double code.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Christian Lütke-Stetzkamp 2018-04-04 22:15:32 +02:00 committed by Greg Kroah-Hartman
parent d364f14bbe
commit 9673d9f6f4

View file

@ -2907,34 +2907,30 @@ static int msdc_drv_remove(struct platform_device *pdev)
/* Fix me: Power Flow */ /* Fix me: Power Flow */
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state)
static void msdc_drv_pm(struct platform_device *pdev, pm_message state)
{ {
int ret = 0;
struct mmc_host *mmc = platform_get_drvdata(pdev); struct mmc_host *mmc = platform_get_drvdata(pdev);
struct msdc_host *host = mmc_priv(mmc); struct msdc_host *host = mmc_priv(mmc);
if (mmc && state.event == PM_EVENT_SUSPEND && (host->hw->flags & MSDC_SYS_SUSPEND)) { /* will set for card */ if (mmc && (host->hw->flags & MSDC_SYS_SUSPEND))
msdc_pm(state, (void *)host); msdc_pm(state, (void *)host);
} }
return ret; static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state)
{
if (state.event == PM_EVENT_SUSPEND)
msdc_drv_pm(pdev, state);
return 0;
} }
static int msdc_drv_resume(struct platform_device *pdev) static int msdc_drv_resume(struct platform_device *pdev)
{ {
int ret = 0;
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct msdc_host *host = mmc_priv(mmc);
struct pm_message state; struct pm_message state;
state.event = PM_EVENT_RESUME; state.event = PM_EVENT_RESUME;
if (mmc && (host->hw->flags & MSDC_SYS_SUSPEND)) {/* will set for card */ msdc_drv_pm(pdev, state);
msdc_pm(state, (void *)host); return 0;
}
/* This mean WIFI not controller by PM */
return ret;
} }
#endif #endif