spi: bfin5xx: convert from legacy pm ops to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer dev_pm_ops structure allows better control over power management. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
@@ -1410,10 +1410,10 @@ static int bfin_spi_remove(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state)
|
static int bfin_spi_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev);
|
struct bfin_spi_master_data *drv_data = dev_get_drvdata(dev);
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
status = bfin_spi_stop_queue(drv_data);
|
status = bfin_spi_stop_queue(drv_data);
|
||||||
@@ -1432,9 +1432,9 @@ static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bfin_spi_resume(struct platform_device *pdev)
|
static int bfin_spi_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev);
|
struct bfin_spi_master_data *drv_data = dev_get_drvdata(dev);
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
bfin_write(&drv_data->regs->ctl, drv_data->ctrl_reg);
|
bfin_write(&drv_data->regs->ctl, drv_data->ctrl_reg);
|
||||||
@@ -1443,25 +1443,27 @@ static int bfin_spi_resume(struct platform_device *pdev)
|
|||||||
/* Start the queue running */
|
/* Start the queue running */
|
||||||
status = bfin_spi_start_queue(drv_data);
|
status = bfin_spi_start_queue(drv_data);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
dev_err(&pdev->dev, "problem starting queue (%d)\n", status);
|
dev_err(dev, "problem starting queue (%d)\n", status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(bfin_spi_pm_ops, bfin_spi_suspend, bfin_spi_resume);
|
||||||
|
|
||||||
|
#define BFIN_SPI_PM_OPS (&bfin_spi_pm_ops)
|
||||||
#else
|
#else
|
||||||
#define bfin_spi_suspend NULL
|
#define BFIN_SPI_PM_OPS NULL
|
||||||
#define bfin_spi_resume NULL
|
#endif
|
||||||
#endif /* CONFIG_PM */
|
|
||||||
|
|
||||||
MODULE_ALIAS("platform:bfin-spi");
|
MODULE_ALIAS("platform:bfin-spi");
|
||||||
static struct platform_driver bfin_spi_driver = {
|
static struct platform_driver bfin_spi_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = BFIN_SPI_PM_OPS,
|
||||||
},
|
},
|
||||||
.suspend = bfin_spi_suspend,
|
|
||||||
.resume = bfin_spi_resume,
|
|
||||||
.remove = bfin_spi_remove,
|
.remove = bfin_spi_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user