Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Convert WM831x SPI to use dev_pm_ops

There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitiate updates to the PM core. Do this move for
the WM831x SPI driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Mark Brown and committed by
Samuel Ortiz
87d1906d 6f9f13bf

+15 -9
+15 -9
drivers/mfd/wm831x-spi.c
··· 14 14 15 15 #include <linux/kernel.h> 16 16 #include <linux/module.h> 17 + #include <linux/pm.h> 17 18 #include <linux/spi/spi.h> 18 19 19 20 #include <linux/mfd/wm831x/core.h> ··· 114 113 return 0; 115 114 } 116 115 117 - static int wm831x_spi_suspend(struct spi_device *spi, pm_message_t m) 116 + static int wm831x_spi_suspend(struct device *dev) 118 117 { 119 - struct wm831x *wm831x = dev_get_drvdata(&spi->dev); 118 + struct wm831x *wm831x = dev_get_drvdata(dev); 120 119 121 120 return wm831x_device_suspend(wm831x); 122 121 } 122 + 123 + static const struct dev_pm_ops wm831x_spi_pm = { 124 + .freeze = wm831x_spi_suspend, 125 + .suspend = wm831x_spi_suspend, 126 + }; 123 127 124 128 static struct spi_driver wm8310_spi_driver = { 125 129 .driver = { 126 130 .name = "wm8310", 127 131 .bus = &spi_bus_type, 128 132 .owner = THIS_MODULE, 133 + .pm = &wm831x_spi_pm, 129 134 }, 130 135 .probe = wm831x_spi_probe, 131 136 .remove = __devexit_p(wm831x_spi_remove), 132 - .suspend = wm831x_spi_suspend, 133 137 }; 134 138 135 139 static struct spi_driver wm8311_spi_driver = { ··· 142 136 .name = "wm8311", 143 137 .bus = &spi_bus_type, 144 138 .owner = THIS_MODULE, 139 + .pm = &wm831x_spi_pm, 145 140 }, 146 141 .probe = wm831x_spi_probe, 147 142 .remove = __devexit_p(wm831x_spi_remove), 148 - .suspend = wm831x_spi_suspend, 149 143 }; 150 144 151 145 static struct spi_driver wm8312_spi_driver = { ··· 153 147 .name = "wm8312", 154 148 .bus = &spi_bus_type, 155 149 .owner = THIS_MODULE, 150 + .pm = &wm831x_spi_pm, 156 151 }, 157 152 .probe = wm831x_spi_probe, 158 153 .remove = __devexit_p(wm831x_spi_remove), 159 - .suspend = wm831x_spi_suspend, 160 154 }; 161 155 162 156 static struct spi_driver wm8320_spi_driver = { ··· 164 158 .name = "wm8320", 165 159 .bus = &spi_bus_type, 166 160 .owner = THIS_MODULE, 161 + .pm = &wm831x_spi_pm, 167 162 }, 168 163 .probe = wm831x_spi_probe, 169 164 .remove = __devexit_p(wm831x_spi_remove), 170 - .suspend = wm831x_spi_suspend, 171 165 }; 172 166 173 167 static struct spi_driver wm8321_spi_driver = { ··· 175 169 .name = "wm8321", 176 170 .bus = &spi_bus_type, 177 171 .owner = THIS_MODULE, 172 + .pm = &wm831x_spi_pm, 178 173 }, 179 174 .probe = wm831x_spi_probe, 180 175 .remove = __devexit_p(wm831x_spi_remove), 181 - .suspend = wm831x_spi_suspend, 182 176 }; 183 177 184 178 static struct spi_driver wm8325_spi_driver = { ··· 186 180 .name = "wm8325", 187 181 .bus = &spi_bus_type, 188 182 .owner = THIS_MODULE, 183 + .pm = &wm831x_spi_pm, 189 184 }, 190 185 .probe = wm831x_spi_probe, 191 186 .remove = __devexit_p(wm831x_spi_remove), 192 - .suspend = wm831x_spi_suspend, 193 187 }; 194 188 195 189 static struct spi_driver wm8326_spi_driver = { ··· 197 191 .name = "wm8326", 198 192 .bus = &spi_bus_type, 199 193 .owner = THIS_MODULE, 194 + .pm = &wm831x_spi_pm, 200 195 }, 201 196 .probe = wm831x_spi_probe, 202 197 .remove = __devexit_p(wm831x_spi_remove), 203 - .suspend = wm831x_spi_suspend, 204 198 }; 205 199 206 200 static int __init wm831x_spi_init(void)