diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-08-29 05:41:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-09-01 06:29:02 -0400 |
commit | 35f2d4136477ce2cd684b03e7f1b802963750394 (patch) | |
tree | 04fcc75573a20d5dc529c514a3507d5355dcddaf | |
parent | ceb86de9d6dae58b66ae10e7533ff2d3d8c7bbae (diff) |
spi: dw-pci: convert to use dev_pm_ops
Convert system PM callbacks to use dev_pm_ops. In addition remove the PCI calls
related to a power state since the bus code cares about this already.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-dw-pci.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c index e203d8fc0ce6..9e8d18cac03f 100644 --- a/drivers/spi/spi-dw-pci.c +++ b/drivers/spi/spi-dw-pci.c | |||
@@ -93,38 +93,26 @@ static void spi_pci_remove(struct pci_dev *pdev) | |||
93 | dw_spi_remove_host(&dwpci->dws); | 93 | dw_spi_remove_host(&dwpci->dws); |
94 | } | 94 | } |
95 | 95 | ||
96 | #ifdef CONFIG_PM | 96 | #ifdef CONFIG_PM_SLEEP |
97 | static int spi_suspend(struct pci_dev *pdev, pm_message_t state) | 97 | static int spi_suspend(struct device *dev) |
98 | { | 98 | { |
99 | struct pci_dev *pdev = to_pci_dev(dev); | ||
99 | struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); | 100 | struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); |
100 | int ret; | ||
101 | 101 | ||
102 | ret = dw_spi_suspend_host(&dwpci->dws); | 102 | return dw_spi_suspend_host(&dwpci->dws); |
103 | if (ret) | ||
104 | return ret; | ||
105 | pci_save_state(pdev); | ||
106 | pci_disable_device(pdev); | ||
107 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
108 | return ret; | ||
109 | } | 103 | } |
110 | 104 | ||
111 | static int spi_resume(struct pci_dev *pdev) | 105 | static int spi_resume(struct device *dev) |
112 | { | 106 | { |
107 | struct pci_dev *pdev = to_pci_dev(dev); | ||
113 | struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); | 108 | struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); |
114 | int ret; | ||
115 | 109 | ||
116 | pci_set_power_state(pdev, PCI_D0); | ||
117 | pci_restore_state(pdev); | ||
118 | ret = pci_enable_device(pdev); | ||
119 | if (ret) | ||
120 | return ret; | ||
121 | return dw_spi_resume_host(&dwpci->dws); | 110 | return dw_spi_resume_host(&dwpci->dws); |
122 | } | 111 | } |
123 | #else | ||
124 | #define spi_suspend NULL | ||
125 | #define spi_resume NULL | ||
126 | #endif | 112 | #endif |
127 | 113 | ||
114 | static SIMPLE_DEV_PM_OPS(dw_spi_pm_ops, spi_suspend, spi_resume); | ||
115 | |||
128 | static const struct pci_device_id pci_ids[] = { | 116 | static const struct pci_device_id pci_ids[] = { |
129 | /* Intel MID platform SPI controller 0 */ | 117 | /* Intel MID platform SPI controller 0 */ |
130 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) }, | 118 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0800) }, |
@@ -136,8 +124,9 @@ static struct pci_driver dw_spi_driver = { | |||
136 | .id_table = pci_ids, | 124 | .id_table = pci_ids, |
137 | .probe = spi_pci_probe, | 125 | .probe = spi_pci_probe, |
138 | .remove = spi_pci_remove, | 126 | .remove = spi_pci_remove, |
139 | .suspend = spi_suspend, | 127 | .driver = { |
140 | .resume = spi_resume, | 128 | .pm = &dw_spi_pm_ops, |
129 | }, | ||
141 | }; | 130 | }; |
142 | 131 | ||
143 | module_pci_driver(dw_spi_driver); | 132 | module_pci_driver(dw_spi_driver); |