Commit aec35f4e authored by Jean Delvare's avatar Jean Delvare Committed by Mark Brown

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: default avatarJean Delvare <jdelvare@suse.de>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 38dbfb59
...@@ -255,13 +255,12 @@ EXPORT_SYMBOL_GPL(spi_bus_type); ...@@ -255,13 +255,12 @@ EXPORT_SYMBOL_GPL(spi_bus_type);
static int spi_drv_probe(struct device *dev) static int spi_drv_probe(struct device *dev)
{ {
const struct spi_driver *sdrv = to_spi_driver(dev->driver); const struct spi_driver *sdrv = to_spi_driver(dev->driver);
struct spi_device *spi = to_spi_device(dev);
int ret; int ret;
acpi_dev_pm_attach(&spi->dev, true); acpi_dev_pm_attach(dev, true);
ret = sdrv->probe(spi); ret = sdrv->probe(to_spi_device(dev));
if (ret) if (ret)
acpi_dev_pm_detach(&spi->dev, true); acpi_dev_pm_detach(dev, true);
return ret; return ret;
} }
...@@ -269,11 +268,10 @@ static int spi_drv_probe(struct device *dev) ...@@ -269,11 +268,10 @@ static int spi_drv_probe(struct device *dev)
static int spi_drv_remove(struct device *dev) static int spi_drv_remove(struct device *dev)
{ {
const struct spi_driver *sdrv = to_spi_driver(dev->driver); const struct spi_driver *sdrv = to_spi_driver(dev->driver);
struct spi_device *spi = to_spi_device(dev);
int ret; int ret;
ret = sdrv->remove(spi); ret = sdrv->remove(to_spi_device(dev));
acpi_dev_pm_detach(&spi->dev, true); acpi_dev_pm_detach(dev, true);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment