diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-28 01:17:49 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-28 01:17:49 +0100 |
commit | dd6c26be3bb3e98d4811780f831bbc246dae54c8 (patch) | |
tree | 5b0cce644ee725386b2c4539afc91459e1913cd9 /drivers/spi | |
parent | c0ced86d38f418448dce1ca8a825dfd16ee9a23a (diff) | |
parent | 33cf00e5708290f7e57d949219ef443a2aef34e0 (diff) |
Merge branch 'acpi-pm'
* acpi-pm:
spi: attach/detach SPI device to the ACPI power domain
i2c: attach/detach I2C client device to the ACPI power domain
ACPI / PM: allow child devices to ignore parent power state
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9e039c60c068..740f9ddda227 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -240,15 +240,27 @@ EXPORT_SYMBOL_GPL(spi_bus_type); static int spi_drv_probe(struct device *dev) { const struct spi_driver *sdrv = to_spi_driver(dev->driver); + struct spi_device *spi = to_spi_device(dev); + int ret; + + acpi_dev_pm_attach(&spi->dev, true); + ret = sdrv->probe(spi); + if (ret) + acpi_dev_pm_detach(&spi->dev, true); - return sdrv->probe(to_spi_device(dev)); + return ret; } static int spi_drv_remove(struct device *dev) { const struct spi_driver *sdrv = to_spi_driver(dev->driver); + struct spi_device *spi = to_spi_device(dev); + int ret; + + ret = sdrv->remove(spi); + acpi_dev_pm_detach(&spi->dev, true); - return sdrv->remove(to_spi_device(dev)); + return ret; } static void spi_drv_shutdown(struct device *dev) @@ -1025,8 +1037,10 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, return AE_OK; } + adev->power.flags.ignore_parent = true; strlcpy(spi->modalias, dev_name(&adev->dev), sizeof(spi->modalias)); if (spi_add_device(spi)) { + adev->power.flags.ignore_parent = false; dev_err(&master->dev, "failed to add SPI device %s from ACPI\n", dev_name(&adev->dev)); spi_dev_put(spi); |