aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/mfld-sensors/apds9802ps.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/staging/mfld-sensors/apds9802ps.c b/drivers/staging/mfld-sensors/apds9802ps.c
index 39c55a6ca37..2bd3fb36d6e 100644
--- a/drivers/staging/mfld-sensors/apds9802ps.c
+++ b/drivers/staging/mfld-sensors/apds9802ps.c
@@ -158,11 +158,9 @@ static int apds9802ps_probe(struct i2c_client *client,
dev_info(&client->dev, "proximity sensor chip found\n");
ps_set_default_config(client);
- pm_runtime_enable(&client->dev);
- /* toggle the power state */
- pm_runtime_get(&client->dev);
- pm_runtime_put(&client->dev);
+ pm_runtime_set_active(&client->dev);
+ pm_runtime_enable(&client->dev);
mutex_init(&data->lock);
return res;
@@ -173,12 +171,19 @@ ps_error1:
return res;
}
-static int apds9802ps_remove(struct i2c_client *client)
+static int __devexit apds9802ps_remove(struct i2c_client *client)
{
struct ps_data *data = i2c_get_clientdata(client);
+ pm_runtime_get_sync(&client->dev);
+
ps_set_power_state(client, false);
sysfs_remove_group(&client->dev.kobj, &m_ps_gr);
+
+ pm_runtime_disable(&client->dev);
+ pm_runtime_set_suspended(&client->dev);
+ pm_runtime_put_noidle(&client->dev);
+
kfree(data);
return 0;
}
@@ -191,7 +196,7 @@ static int apds9802ps_suspend(struct i2c_client *client, pm_message_t mesg)
static int apds9802ps_resume(struct i2c_client *client)
{
- ps_set_power_state(client, true);
+ ps_set_default_config(client);
return 0;
}
@@ -228,7 +233,7 @@ static struct i2c_driver apds9802ps_driver = {
.pm = &apds9802ps_pm_ops,
},
.probe = apds9802ps_probe,
- .remove = apds9802ps_remove,
+ .remove = __devexit_p(apds9802ps_remove),
.suspend = apds9802ps_suspend,
.resume = apds9802ps_resume,
.id_table = apds9802ps_id,