From e7cc5153e537b2622d88b516bf146ba1199cb4bf Mon Sep 17 00:00:00 2001 From: Fei Yang Date: Wed, 9 Nov 2011 14:49:34 -0800 Subject: [PATCH] PM: stop using deprecated pm framework BZ: 14180 struct pci_driver->suspend, ->suspend_late, ->resume, and ->resume_early are deprecated. These are being replaced by struct dev_pm_ops->suspend and ->resume. PCI driver would trigger kernel warning and stack dump if the driver is using legacy suspend/resume while struct dev_pm_ops is also defined. Change-Id: Iaac0e0a7b16f5768bec3531d395033b105e04b07 Signed-off-by: Fei Yang Reviewed-on: http://android.intel.com:8080/23784 Reviewed-by: buildbot Reviewed-by: Gross, Mark Tested-by: Gross, Mark --- drivers/dma/intel_mid_dma.c | 14 +++++++++----- drivers/dma/intel_mid_dma_regs.h | 3 --- drivers/spi/dw_spi_pci.c | 12 +++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index f653517..0ddc40b 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c @@ -851,6 +851,8 @@ static void intel_mid_dma_free_chan_resources(struct dma_chan *chan) iowrite32(MASK_INTR_REG(midc->ch_id), mid->dma_base + MASK_ERR); } +static int dma_resume(struct device *dev); + /** * intel_mid_dma_alloc_chan_resources - Allocate dma resources * @chan: chan requiring attention @@ -869,7 +871,7 @@ static int intel_mid_dma_alloc_chan_resources(struct dma_chan *chan) pm_runtime_get_sync(&mid->pdev->dev); if (mid->state == SUSPENDED) { - if (dma_resume(mid->pdev)) { + if (dma_resume(&mid->pdev->dev)) { pr_err("ERR_MDMA: resume failed"); return -EFAULT; } @@ -1340,9 +1342,10 @@ static void __devexit intel_mid_dma_remove(struct pci_dev *pdev) * * This function is called by OS when a power event occurs */ -int dma_suspend(struct pci_dev *pci, pm_message_t state) +static int dma_suspend(struct device *dev) { int i; + struct pci_dev *pci = to_pci_dev(dev); struct middma_device *device = pci_get_drvdata(pci); pr_debug("MDMA: dma_suspend called\n"); @@ -1365,9 +1368,10 @@ int dma_suspend(struct pci_dev *pci, pm_message_t state) * * This function is called by OS when a power event occurs */ -int dma_resume(struct pci_dev *pci) +static int dma_resume(struct device *dev) { int ret; + struct pci_dev *pci = to_pci_dev(dev); struct middma_device *device = pci_get_drvdata(pci); pr_debug("MDMA: dma_resume called\n"); @@ -1430,6 +1434,8 @@ static struct pci_device_id intel_mid_dma_ids[] = { MODULE_DEVICE_TABLE(pci, intel_mid_dma_ids); static const struct dev_pm_ops intel_mid_dma_pm = { + .suspend = dma_suspend, + .resume = dma_resume, .runtime_suspend = dma_runtime_suspend, .runtime_resume = dma_runtime_resume, .runtime_idle = dma_runtime_idle, @@ -1441,8 +1447,6 @@ static struct pci_driver intel_mid_dma_pci_driver = { .probe = intel_mid_dma_probe, .remove = __devexit_p(intel_mid_dma_remove), #ifdef CONFIG_PM - .suspend = dma_suspend, - .resume = dma_resume, .driver = { .pm = &intel_mid_dma_pm, }, diff --git a/drivers/dma/intel_mid_dma_regs.h b/drivers/dma/intel_mid_dma_regs.h index aea5ee8..22acc64 100644 --- a/drivers/dma/intel_mid_dma_regs.h +++ b/drivers/dma/intel_mid_dma_regs.h @@ -295,7 +295,4 @@ static inline struct intel_mid_dma_slave *to_intel_mid_dma_slave return container_of(slave, struct intel_mid_dma_slave, dma_slave); } - -int dma_resume(struct pci_dev *pci); - #endif /*__INTEL_MID_DMAC_REGS_H__*/ diff --git a/drivers/spi/dw_spi_pci.c b/drivers/spi/dw_spi_pci.c index 4940d46..ea0337d 100644 --- a/drivers/spi/dw_spi_pci.c +++ b/drivers/spi/dw_spi_pci.c @@ -126,8 +126,9 @@ static void __devexit spi_pci_remove(struct pci_dev *pdev) } #ifdef CONFIG_PM -static int spi_suspend(struct pci_dev *pdev, pm_message_t state) +static int spi_suspend(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct spi_dw_pci *dwpci = pci_get_drvdata(pdev); int ret; @@ -136,12 +137,13 @@ static int spi_suspend(struct pci_dev *pdev, pm_message_t state) return ret; pci_save_state(pdev); pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + pci_set_power_state(pdev, PCI_D3hot); return ret; } -static int spi_resume(struct pci_dev *pdev) +static int spi_resume(struct device *dev) { + struct pci_dev *pdev = to_pci_dev(dev); struct spi_dw_pci *dwpci = pci_get_drvdata(pdev); int ret; @@ -203,6 +205,8 @@ static const struct pci_device_id pci_ids[] __devinitdata = { {}, }; static const struct dev_pm_ops dw_spi_pm_ops = { + .suspend = spi_suspend, + .resume = spi_resume, .runtime_suspend = spi_dw_pci_runtime_suspend, .runtime_resume = spi_dw_pci_runtime_resume, .runtime_idle = spi_dw_pci_runtime_idle, @@ -213,8 +217,6 @@ static struct pci_driver spi_dw_driver = { .id_table = pci_ids, .probe = spi_pci_probe, .remove = __devexit_p(spi_pci_remove), - .suspend = spi_suspend, - .resume = spi_resume, .driver = { .pm = &dw_spi_pm_ops, }, -- 2.7.4