aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-02-13 09:28:41 -0500
committerMark Brown <broonie@linaro.org>2014-02-14 09:59:45 -0500
commitaec35f4ee6eefba616065547e6882c084cc7f5cb (patch)
tree5a71454cba1892491c9ab02a9e1d091fefe67747
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
spi: Clean up probe and remove functions
While backporting 33cf00e5 ("spi: attach/detach SPI device to the ACPI power domain"), I noticed that the code changes were suboptimal: * Why use &spi->dev when we have dev at hand? * After fixing the above, spi is used only once, so we don't really need a local variable for it. This results in the following clean-up. Signed-off-by: Jean Delvare <jdelvare@suse.de> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/spi/spi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 23756b0f9036..bb660145d19e 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -255,13 +255,12 @@ EXPORT_SYMBOL_GPL(spi_bus_type);
255static int spi_drv_probe(struct device *dev) 255static int spi_drv_probe(struct device *dev)
256{ 256{
257 const struct spi_driver *sdrv = to_spi_driver(dev->driver); 257 const struct spi_driver *sdrv = to_spi_driver(dev->driver);
258 struct spi_device *spi = to_spi_device(dev);
259 int ret; 258 int ret;
260 259
261 acpi_dev_pm_attach(&spi->dev, true); 260 acpi_dev_pm_attach(dev, true);
262 ret = sdrv->probe(spi); 261 ret = sdrv->probe(to_spi_device(dev));
263 if (ret) 262 if (ret)
264 acpi_dev_pm_detach(&spi->dev, true); 263 acpi_dev_pm_detach(dev, true);
265 264
266 return ret; 265 return ret;
267} 266}
@@ -269,11 +268,10 @@ static int spi_drv_probe(struct device *dev)
269static int spi_drv_remove(struct device *dev) 268static int spi_drv_remove(struct device *dev)
270{ 269{
271 const struct spi_driver *sdrv = to_spi_driver(dev->driver); 270 const struct spi_driver *sdrv = to_spi_driver(dev->driver);
272 struct spi_device *spi = to_spi_device(dev);
273 int ret; 271 int ret;
274 272
275 ret = sdrv->remove(spi); 273 ret = sdrv->remove(to_spi_device(dev));
276 acpi_dev_pm_detach(&spi->dev, true); 274 acpi_dev_pm_detach(dev, true);
277 275
278 return ret; 276 return ret;
279} 277}