diff options
author | Sang-Hun Lee <sanlee@nvidia.com> | 2014-06-09 17:48:18 -0400 |
---|---|---|
committer | Riham Haidar <rhaidar@nvidia.com> | 2014-06-13 11:54:50 -0700 |
commit | 91597a6a376f7cc6a69b447c69e168581142b41c (patch) | |
tree | 7be71035e1c8ad7487283378572a91cfa1cf0fe8 /drivers/staging | |
parent | 855e9f43a7ea58540859998a01c9c2d0a38a3f63 (diff) |
staging: iio: light: add shutdown
- Depending on the platform, i2c bus may be shutdown
as we shutdown the systme
- In such a case, any lingering workqueue would slowdown
the system, as the access will be made to the i2c bus
which has been shutdown
- To mitigate the above, cancel all workqueue jobs as we shutdown
Bug 1522172
Change-Id: Idebab822c0ef8ddad7352ef25a546acb3f3e5870
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/420889
(cherry picked from commit 8b39b8db93e5b34672b7cbcf9f6c5ec40398ca83)
Reviewed-on: http://git-master/r/422775
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Kerwin Wan <kerwinw@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/iio/light/cm3217.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/iio/light/cm3217.c b/drivers/staging/iio/light/cm3217.c index a955bb255d7e..4b2e34a5d4d7 100644 --- a/drivers/staging/iio/light/cm3217.c +++ b/drivers/staging/iio/light/cm3217.c @@ -516,6 +516,16 @@ static const struct i2c_device_id cm3217_i2c_device_id[] = { MODULE_DEVICE_TABLE(i2c, cm3217_i2c_device_id); +static void cm3217_shutdown(struct i2c_client *client) +{ + struct iio_dev *indio_dev = i2c_get_clientdata(client); + struct cm3217_inf *inf = iio_priv(indio_dev); + inf->als_state = CHIP_POWER_OFF; + smp_wmb(); + cancel_delayed_work_sync(&inf->dw); + cm3217_vreg_exit(inf); +} + #ifdef CONFIG_OF static const struct of_device_id cm3217_of_match[] = { { .compatible = "capella,cm3217", }, @@ -534,6 +544,7 @@ static struct i2c_driver cm3217_driver = { .of_match_table = of_match_ptr(cm3217_of_match), .pm = CM3217_PM_OPS, }, + .shutdown = cm3217_shutdown, }; module_i2c_driver(cm3217_driver); |