2013-08-10 15:22:33

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] isa: Change driver to use dev_pm_ops infrastructure

Change isa bus to register dev_pm_ops via bus_type.pm. Add freeze ops for
PM_EVENT_FREEZE handling.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/base/isa.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index 91dba65..0f5943f 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -63,7 +63,7 @@ static void isa_bus_shutdown(struct device *dev)
isa_driver->shutdown(dev, to_isa_dev(dev)->id);
}

-static int isa_bus_suspend(struct device *dev, pm_message_t state)
+static int __isa_bus_suspend(struct device *dev, pm_message_t state)
{
struct isa_driver *isa_driver = dev->platform_data;

@@ -73,6 +73,16 @@ static int isa_bus_suspend(struct device *dev, pm_message_t state)
return 0;
}

+static int isa_bus_suspend(struct device *dev)
+{
+ return __isa_bus_suspend(dev, PMSG_SUSPEND);
+}
+
+static int isa_bus_freeze(struct device *dev)
+{
+ return __isa_bus_suspend(dev, PMSG_FREEZE);
+}
+
static int isa_bus_resume(struct device *dev)
{
struct isa_driver *isa_driver = dev->platform_data;
@@ -83,14 +93,19 @@ static int isa_bus_resume(struct device *dev)
return 0;
}

+static const struct dev_pm_ops isa_bus_dev_pm_ops = {
+ .suspend = isa_bus_suspend,
+ .freeze = isa_bus_freeze,
+ .resume = isa_bus_resume,
+};
+
static struct bus_type isa_bus_type = {
.name = "isa",
.match = isa_bus_match,
.probe = isa_bus_probe,
.remove = isa_bus_remove,
.shutdown = isa_bus_shutdown,
- .suspend = isa_bus_suspend,
- .resume = isa_bus_resume
+ .pm = &isa_bus_dev_pm_ops,
};

static void isa_dev_release(struct device *dev)
--
1.7.10.4


2013-08-10 15:22:41

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:au1xmmc change driver to use dev_pm_ops infrastructure

Change au1xmmc platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/au1xmmc.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index df9becd..0bafd7f 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -1154,11 +1154,12 @@ static int au1xmmc_remove(struct platform_device *pdev)
}

#ifdef CONFIG_PM
-static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
+static int au1xmmc_suspend(struct device *dev)
{
- struct au1xmmc_host *host = platform_get_drvdata(pdev);
+ struct au1xmmc_host *host;
int ret;

+ host = platform_get_drvdata(to_platform_device(dev));
ret = mmc_suspend_host(host->mmc);
if (ret)
return ret;
@@ -1172,10 +1173,11 @@ static int au1xmmc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}

-static int au1xmmc_resume(struct platform_device *pdev)
+static int au1xmmc_resume(struct device *dev)
{
- struct au1xmmc_host *host = platform_get_drvdata(pdev);
+ struct au1xmmc_host *host;

+ host = platform_get_drvdata(to_platform_device(dev));
au1xmmc_reset_controller(host);

return mmc_resume_host(host->mmc);
@@ -1185,14 +1187,15 @@ static int au1xmmc_resume(struct platform_device *pdev)
#define au1xmmc_resume NULL
#endif

+static SIMPLE_DEV_PM_OPS(au1xmmc_dev_pm_ops, au1xmmc_suspend, au1xmmc_resume);
+
static struct platform_driver au1xmmc_driver = {
.probe = au1xmmc_probe,
.remove = au1xmmc_remove,
- .suspend = au1xmmc_suspend,
- .resume = au1xmmc_resume,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
+ .pm = &au1xmmc_dev_pm_ops,
},
};

--
1.7.10.4

2013-08-10 15:22:49

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:cb710_mmc change driver to use dev_pm_ops infrastructure

Change cb710_mmc platform driver register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/cb710-mmc.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 9d6e2b8..e79ac0d 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -664,8 +664,9 @@ static const struct mmc_host_ops cb710_mmc_host = {

#ifdef CONFIG_PM

-static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
+static int cb710_mmc_suspend(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
struct mmc_host *mmc = cb710_slot_to_mmc(slot);
int err;
@@ -678,8 +679,9 @@ static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state)
return 0;
}

-static int cb710_mmc_resume(struct platform_device *pdev)
+static int cb710_mmc_resume(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
struct mmc_host *mmc = cb710_slot_to_mmc(slot);

@@ -688,6 +690,8 @@ static int cb710_mmc_resume(struct platform_device *pdev)
return mmc_resume_host(mmc);
}

+static SIMPLE_DEV_PM_OPS(cb710_mmc_dev_pm_ops, cb710_mmc_suspend,
+ cb710_mmc_resume);
#endif /* CONFIG_PM */

static int cb710_mmc_init(struct platform_device *pdev)
@@ -775,8 +779,7 @@ static struct platform_driver cb710_mmc_driver = {
.probe = cb710_mmc_init,
.remove = cb710_mmc_exit,
#ifdef CONFIG_PM
- .suspend = cb710_mmc_suspend,
- .resume = cb710_mmc_resume,
+ .driver.pm = &cb710_mmc_dev_pm_ops,
#endif
};

--
1.7.10.4

2013-08-10 15:22:44

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:bfin_sdh change driver to use dev_pm_ops infrastructure

Change bfin sdh platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/bfin_sdh.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index 94fae2f..7b3e12f 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -638,10 +638,11 @@ static int sdh_remove(struct platform_device *pdev)
}

#ifdef CONFIG_PM
-static int sdh_suspend(struct platform_device *dev, pm_message_t state)
+static int sdh_suspend(struct device *dev)
{
- struct mmc_host *mmc = platform_get_drvdata(dev);
- struct bfin_sd_host *drv_data = get_sdh_data(dev);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct mmc_host *mmc = platform_get_drvdata(pdev);
+ struct bfin_sd_host *drv_data = get_sdh_data(pdev);
int ret = 0;

if (mmc)
@@ -652,15 +653,16 @@ static int sdh_suspend(struct platform_device *dev, pm_message_t state)
return ret;
}

-static int sdh_resume(struct platform_device *dev)
+static int sdh_resume(struct device *dev)
{
- struct mmc_host *mmc = platform_get_drvdata(dev);
- struct bfin_sd_host *drv_data = get_sdh_data(dev);
+ struct platform_device *pdev = to_platform_device(dev);
+ struct mmc_host *mmc = platform_get_drvdata(pdev);
+ struct bfin_sd_host *drv_data = get_sdh_data(pdev);
int ret = 0;

ret = peripheral_request_list(drv_data->pin_req, DRIVER_NAME);
if (ret) {
- dev_err(&dev->dev, "unable to request peripheral pins\n");
+ dev_err(dev, "unable to request peripheral pins\n");
return ret;
}

@@ -676,13 +678,14 @@ static int sdh_resume(struct platform_device *dev)
# define sdh_resume NULL
#endif

+static SIMPLE_DEV_PM_OPS(sdh_dev_pm_ops, sdh_suspend, sdh_resume);
+
static struct platform_driver sdh_driver = {
.probe = sdh_probe,
.remove = sdh_remove,
- .suspend = sdh_suspend,
- .resume = sdh_resume,
.driver = {
.name = DRIVER_NAME,
+ .pm = &sdh_dev_pm_ops,
},
};

--
1.7.10.4

2013-08-10 15:22:55

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:mvsdio change driver to use dev_pm_ops infrastructure

Change mvsd platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/mvsdio.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 4ddd83f..800a7fd 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -838,9 +838,9 @@ static int __exit mvsd_remove(struct platform_device *pdev)
}

#ifdef CONFIG_PM
-static int mvsd_suspend(struct platform_device *dev, pm_message_t state)
+static int mvsd_suspend(struct device *dev)
{
- struct mmc_host *mmc = platform_get_drvdata(dev);
+ struct mmc_host *mmc = platform_get_drvdata(to_platform_device(dev));
int ret = 0;

if (mmc)
@@ -849,9 +849,9 @@ static int mvsd_suspend(struct platform_device *dev, pm_message_t state)
return ret;
}

-static int mvsd_resume(struct platform_device *dev)
+static int mvsd_resume(struct device *dev)
{
- struct mmc_host *mmc = platform_get_drvdata(dev);
+ struct mmc_host *mmc = platform_get_drvdata(to_platform_device(dev));
int ret = 0;

if (mmc)
@@ -870,13 +870,14 @@ static const struct of_device_id mvsdio_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, mvsdio_dt_ids);

+static SIMPLE_DEV_PM_OPS(mvsd_dev_pm_ops, mvsd_suspend, mvsd_resume);
+
static struct platform_driver mvsd_driver = {
.remove = __exit_p(mvsd_remove),
- .suspend = mvsd_suspend,
- .resume = mvsd_resume,
.driver = {
.name = DRIVER_NAME,
.of_match_table = mvsdio_dt_ids,
+ .pm = &mvsd_dev_pm_ops,
},
};

--
1.7.10.4

2013-08-10 15:23:09

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:tmio_mmc change driver to use dev_pm_ops infrastructure

Change tmio_mmc platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/tmio_mmc.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 8860d4d..3e3c730 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -24,31 +24,33 @@
#include "tmio_mmc.h"

#ifdef CONFIG_PM
-static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
+static int tmio_mmc_suspend(struct device *dev)
{
- const struct mfd_cell *cell = mfd_get_cell(dev);
+ struct platform_device *pdev = to_platform_device(dev);
+ const struct mfd_cell *cell = mfd_get_cell(pdev);
int ret;

- ret = tmio_mmc_host_suspend(&dev->dev);
+ ret = tmio_mmc_host_suspend(dev);

/* Tell MFD core it can disable us now.*/
if (!ret && cell->disable)
- cell->disable(dev);
+ cell->disable(pdev);

return ret;
}

-static int tmio_mmc_resume(struct platform_device *dev)
+static int tmio_mmc_resume(struct device *dev)
{
- const struct mfd_cell *cell = mfd_get_cell(dev);
+ struct platform_device *pdev = to_platform_device(dev);
+ const struct mfd_cell *cell = mfd_get_cell(pdev);
int ret = 0;

/* Tell the MFD core we are ready to be enabled */
if (cell->resume)
- ret = cell->resume(dev);
+ ret = cell->resume(pdev);

if (!ret)
- ret = tmio_mmc_host_resume(&dev->dev);
+ ret = tmio_mmc_host_resume(dev);

return ret;
}
@@ -123,17 +125,19 @@ static int tmio_mmc_remove(struct platform_device *pdev)
return 0;
}

+static SIMPLE_DEV_PM_OPS(tmio_mmc_dev_pm_ops, tmio_mmc_suspend,
+ tmio_mmc_resume);
+
/* ------------------- device registration ----------------------- */

static struct platform_driver tmio_mmc_driver = {
.driver = {
.name = "tmio-mmc",
.owner = THIS_MODULE,
+ .pm = &tmio_mmc_dev_pm_ops,
},
.probe = tmio_mmc_probe,
.remove = tmio_mmc_remove,
- .suspend = tmio_mmc_suspend,
- .resume = tmio_mmc_resume,
};

module_platform_driver(tmio_mmc_driver);
--
1.7.10.4

2013-08-10 15:22:58

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:rtsx_pci_sdmmc change driver to use dev_pm_ops infrastructure

Change rtsx_pci_sdmmc platform driver to register pm ops using dev_pm_ops
instead of legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/rtsx_pci_sdmmc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 82a35b9..fc52f28 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1166,9 +1166,9 @@ static const struct mmc_host_ops realtek_pci_sdmmc_ops = {
};

#ifdef CONFIG_PM
-static int rtsx_pci_sdmmc_suspend(struct platform_device *pdev,
- pm_message_t state)
+static int rtsx_pci_sdmmc_suspend(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev);
struct mmc_host *mmc = host->mmc;
int err;
@@ -1182,8 +1182,9 @@ static int rtsx_pci_sdmmc_suspend(struct platform_device *pdev,
return 0;
}

-static int rtsx_pci_sdmmc_resume(struct platform_device *pdev)
+static int rtsx_pci_sdmmc_resume(struct device *dev)
{
+ struct platform_device *pdev = to_platform_device(dev);
struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev);
struct mmc_host *mmc = host->mmc;

@@ -1331,15 +1332,17 @@ static struct platform_device_id rtsx_pci_sdmmc_ids[] = {
};
MODULE_DEVICE_TABLE(platform, rtsx_pci_sdmmc_ids);

+static SIMPLE_DEV_PM_OPS(rtsx_pci_sdmmc_dev_pm_ops, rtsx_pci_sdmmc_suspend,
+ rtsx_pci_sdmmc_resume);
+
static struct platform_driver rtsx_pci_sdmmc_driver = {
.probe = rtsx_pci_sdmmc_drv_probe,
.remove = rtsx_pci_sdmmc_drv_remove,
.id_table = rtsx_pci_sdmmc_ids,
- .suspend = rtsx_pci_sdmmc_suspend,
- .resume = rtsx_pci_sdmmc_resume,
.driver = {
.owner = THIS_MODULE,
.name = DRV_NAME_RTSX_PCI_SDMMC,
+ .pm = &rtsx_pci_sdmmc_dev_pm_ops,
},
};
module_platform_driver(rtsx_pci_sdmmc_driver);
--
1.7.10.4

2013-08-10 15:23:49

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:msmsdcc change driver to use dev_pm_ops infrastructure

Change msmsdcc platform driver to register pm ops using dev_pm_ops instead of
legacy pm_ops infrastructure.

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/msm_sdcc.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index b900de4..017c9d7 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1434,9 +1434,9 @@ do_resume_work(struct work_struct *work)


static int
-msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
+msmsdcc_suspend(struct device *dev)
{
- struct mmc_host *mmc = mmc_get_drvdata(dev);
+ struct mmc_host *mmc = mmc_get_drvdata(to_platform_device(dev));
int rc = 0;

if (mmc) {
@@ -1456,9 +1456,9 @@ msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
}

static int
-msmsdcc_resume(struct platform_device *dev)
+msmsdcc_resume(struct device *dev)
{
- struct mmc_host *mmc = mmc_get_drvdata(dev);
+ struct mmc_host *mmc = mmc_get_drvdata(to_platform_device(dev));

if (mmc) {
struct msmsdcc_host *host = mmc_priv(mmc);
@@ -1482,12 +1482,13 @@ msmsdcc_resume(struct platform_device *dev)
#define msmsdcc_resume 0
#endif

+static SIMPLE_DEV_PM_OPS(msmdcc_dev_pm_ops, msmsdcc_suspend, msmsdcc_resume);
+
static struct platform_driver msmsdcc_driver = {
.probe = msmsdcc_probe,
- .suspend = msmsdcc_suspend,
- .resume = msmsdcc_resume,
.driver = {
.name = "msm_sdcc",
+ .pm = &msmdcc_dev_pm_ops,
},
};

--
1.7.10.4

2013-08-10 15:24:09

by Shuah Khan

[permalink] [raw]
Subject: [PATCH] mmc:bfin_sdh fix build warning in sdh_dma_irq()

Fix the following build warning in sdh_dma_irq()
drivers/mmc/host/bfin_sdh.c:466:2: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘int’ [-Wformat]
dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04x\n", __func__,
get_dma_curr_irqstat(host->dma_ch));

Signed-off-by: Shuah Khan <[email protected]>
---
drivers/mmc/host/bfin_sdh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c
index 7b3e12f..61157c4 100644
--- a/drivers/mmc/host/bfin_sdh.c
+++ b/drivers/mmc/host/bfin_sdh.c
@@ -463,7 +463,7 @@ static irqreturn_t sdh_dma_irq(int irq, void *devid)
{
struct sdh_host *host = devid;

- dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04lx\n", __func__,
+ dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04x\n", __func__,
get_dma_curr_irqstat(host->dma_ch));
clear_dma_irqstat(host->dma_ch);
SSYNC();
--
1.7.10.4

2013-08-10 18:51:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] isa: Change driver to use dev_pm_ops infrastructure

On Sat, Aug 10, 2013 at 09:20:46AM -0600, Shuah Khan wrote:
> Change isa bus to register dev_pm_ops via bus_type.pm. Add freeze ops for
> PM_EVENT_FREEZE handling.

why?

2013-08-12 02:34:28

by Zhang, Sonic

[permalink] [raw]
Subject: RE: [PATCH] mmc:bfin_sdh fix build warning in sdh_dma_irq()

Acked-by: Sonic Zhang<[email protected]>

>-----Original Message-----
>From: Shuah Khan [mailto:[email protected]]
>Sent: Saturday, August 10, 2013 11:21 PM
>To: Zhang, Sonic; [email protected]
>Cc: Shuah Khan; [email protected]; [email protected];
>[email protected]; [email protected]
>Subject: [PATCH] mmc:bfin_sdh fix build warning in sdh_dma_irq()
>
>Fix the following build warning in sdh_dma_irq()
>drivers/mmc/host/bfin_sdh.c:466:2: warning: format %lx expects argument of type
>long unsigned int , but argument 5 has type int [-Wformat]
> dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04x\n", __func__,
> get_dma_curr_irqstat(host->dma_ch));
>
>Signed-off-by: Shuah Khan <[email protected]>
>---
> drivers/mmc/host/bfin_sdh.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index
>7b3e12f..61157c4 100644
>--- a/drivers/mmc/host/bfin_sdh.c
>+++ b/drivers/mmc/host/bfin_sdh.c
>@@ -463,7 +463,7 @@ static irqreturn_t sdh_dma_irq(int irq, void *devid) {
> struct sdh_host *host = devid;
>
>- dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04lx\n", __func__,
>+ dev_dbg(mmc_dev(host->mmc), "%s enter, irq_stat: 0x%04x\n", __func__,
> get_dma_curr_irqstat(host->dma_ch));
> clear_dma_irqstat(host->dma_ch);
> SSYNC();
>--
>1.7.10.4
>

????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2013-08-12 02:35:49

by Zhang, Sonic

[permalink] [raw]
Subject: RE: [PATCH] mmc:bfin_sdh change driver to use dev_pm_ops infrastructure

Acked-by: Sonic Zhang<[email protected]>

>-----Original Message-----
>From: Shuah Khan [mailto:[email protected]]
>Sent: Saturday, August 10, 2013 11:21 PM
>To: Zhang, Sonic; [email protected]
>Cc: Shuah Khan; [email protected]; [email protected];
>[email protected]; [email protected]
>Subject: [PATCH] mmc:bfin_sdh change driver to use dev_pm_ops infrastructure
>
>Change bfin sdh platform driver to register pm ops using dev_pm_ops instead of
>legacy pm_ops infrastructure.
>
>Signed-off-by: Shuah Khan <[email protected]>
>---
> drivers/mmc/host/bfin_sdh.c | 21 ++++++++++++---------
> 1 file changed, 12 insertions(+), 9 deletions(-)
>
>diff --git a/drivers/mmc/host/bfin_sdh.c b/drivers/mmc/host/bfin_sdh.c index
>94fae2f..7b3e12f 100644
>--- a/drivers/mmc/host/bfin_sdh.c
>+++ b/drivers/mmc/host/bfin_sdh.c
>@@ -638,10 +638,11 @@ static int sdh_remove(struct platform_device *pdev) }
>
> #ifdef CONFIG_PM
>-static int sdh_suspend(struct platform_device *dev, pm_message_t state)
>+static int sdh_suspend(struct device *dev)
> {
>- struct mmc_host *mmc = platform_get_drvdata(dev);
>- struct bfin_sd_host *drv_data = get_sdh_data(dev);
>+ struct platform_device *pdev = to_platform_device(dev);
>+ struct mmc_host *mmc = platform_get_drvdata(pdev);
>+ struct bfin_sd_host *drv_data = get_sdh_data(pdev);
> int ret = 0;
>
> if (mmc)
>@@ -652,15 +653,16 @@ static int sdh_suspend(struct platform_device *dev,
>pm_message_t state)
> return ret;
> }
>
>-static int sdh_resume(struct platform_device *dev)
>+static int sdh_resume(struct device *dev)
> {
>- struct mmc_host *mmc = platform_get_drvdata(dev);
>- struct bfin_sd_host *drv_data = get_sdh_data(dev);
>+ struct platform_device *pdev = to_platform_device(dev);
>+ struct mmc_host *mmc = platform_get_drvdata(pdev);
>+ struct bfin_sd_host *drv_data = get_sdh_data(pdev);
> int ret = 0;
>
> ret = peripheral_request_list(drv_data->pin_req, DRIVER_NAME);
> if (ret) {
>- dev_err(&dev->dev, "unable to request peripheral pins\n");
>+ dev_err(dev, "unable to request peripheral pins\n");
> return ret;
> }
>
>@@ -676,13 +678,14 @@ static int sdh_resume(struct platform_device *dev) #
>define sdh_resume NULL #endif
>
>+static SIMPLE_DEV_PM_OPS(sdh_dev_pm_ops, sdh_suspend, sdh_resume);
>+
> static struct platform_driver sdh_driver = {
> .probe = sdh_probe,
> .remove = sdh_remove,
>- .suspend = sdh_suspend,
>- .resume = sdh_resume,
> .driver = {
> .name = DRIVER_NAME,
>+ .pm = &sdh_dev_pm_ops,
> },
> };
>
>--
>1.7.10.4
>

2013-08-12 17:02:15

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH] isa: Change driver to use dev_pm_ops infrastructure

On 08/10/2013 12:51 PM, Greg KH wrote:
> On Sat, Aug 10, 2013 at 09:20:46AM -0600, Shuah Khan wrote:
>> Change isa bus to register dev_pm_ops via bus_type.pm. Add freeze ops for
>> PM_EVENT_FREEZE handling.
>
> why?
>

I see that my changelog is very cryptic. Sorry about that.

I have been converting drivers from using legacy pm_ops to dev_pm_ops
which will allow all drivers to use the same infrastructure and overtime
obsolete the legacy usage. With this change I made, __device_suspend()
will find dev->bus->pm->suspend instead of dev->bus->suspend.

isa bus and isa drivers probably will never take advantage of the pm
capabilities dev_pm_ops allow for, the reason to update the isa bus to
use dev_pm_ops is to allow for obsoleting legacy pm_ops handling in pm.

-- Shuah

Shuah Khan, Linux Kernel Developer - Open Source Group Samsung Research
America (Silicon Valley) [email protected] | (970) 672-0658

2013-08-26 08:48:35

by Guennadi Liakhovetski

[permalink] [raw]
Subject: Re: [PATCH] mmc:tmio_mmc change driver to use dev_pm_ops infrastructure

Hi Shuah Khan,

On Sat, 10 Aug 2013, Shuah Khan wrote:

> Change tmio_mmc platform driver to register pm ops using dev_pm_ops instead of
> legacy pm_ops infrastructure.
>
> Signed-off-by: Shuah Khan <[email protected]>

This looks good to me, although I don't have access to any MFD-based TMIO
MMC systems, so, cannot test. In fact that code hasn't been touched for a
while now, so, I don't even know if anyone is still using it. With that in
mind

Acked-by: Guennadi Liakhovetski <[email protected]>

Thanks
Guennadi

> ---
> drivers/mmc/host/tmio_mmc.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> index 8860d4d..3e3c730 100644
> --- a/drivers/mmc/host/tmio_mmc.c
> +++ b/drivers/mmc/host/tmio_mmc.c
> @@ -24,31 +24,33 @@
> #include "tmio_mmc.h"
>
> #ifdef CONFIG_PM
> -static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
> +static int tmio_mmc_suspend(struct device *dev)
> {
> - const struct mfd_cell *cell = mfd_get_cell(dev);
> + struct platform_device *pdev = to_platform_device(dev);
> + const struct mfd_cell *cell = mfd_get_cell(pdev);
> int ret;
>
> - ret = tmio_mmc_host_suspend(&dev->dev);
> + ret = tmio_mmc_host_suspend(dev);
>
> /* Tell MFD core it can disable us now.*/
> if (!ret && cell->disable)
> - cell->disable(dev);
> + cell->disable(pdev);
>
> return ret;
> }
>
> -static int tmio_mmc_resume(struct platform_device *dev)
> +static int tmio_mmc_resume(struct device *dev)
> {
> - const struct mfd_cell *cell = mfd_get_cell(dev);
> + struct platform_device *pdev = to_platform_device(dev);
> + const struct mfd_cell *cell = mfd_get_cell(pdev);
> int ret = 0;
>
> /* Tell the MFD core we are ready to be enabled */
> if (cell->resume)
> - ret = cell->resume(dev);
> + ret = cell->resume(pdev);
>
> if (!ret)
> - ret = tmio_mmc_host_resume(&dev->dev);
> + ret = tmio_mmc_host_resume(dev);
>
> return ret;
> }
> @@ -123,17 +125,19 @@ static int tmio_mmc_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static SIMPLE_DEV_PM_OPS(tmio_mmc_dev_pm_ops, tmio_mmc_suspend,
> + tmio_mmc_resume);
> +
> /* ------------------- device registration ----------------------- */
>
> static struct platform_driver tmio_mmc_driver = {
> .driver = {
> .name = "tmio-mmc",
> .owner = THIS_MODULE,
> + .pm = &tmio_mmc_dev_pm_ops,
> },
> .probe = tmio_mmc_probe,
> .remove = tmio_mmc_remove,
> - .suspend = tmio_mmc_suspend,
> - .resume = tmio_mmc_resume,
> };
>
> module_platform_driver(tmio_mmc_driver);
> --
> 1.7.10.4
>

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/