diff options
author | Hong Liu <hong.liu@intel.com> | 2011-03-22 19:33:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:10 -0400 |
commit | 4e6735992392ecd393674119aef9ec7bff9be5b0 (patch) | |
tree | 555ff9df99dcea4db2b82a8d3718475be1626f11 /drivers/misc | |
parent | b9500546d5f85b56359657e1f78334db8de851fd (diff) |
drivers/misc/apds9802als.c: put the device into runtime suspend after resume()/probe() is handled
Put the device into runtime suspend after resume()/probe() is handled by
the PM core and the device core code. No need to manually add them in
each single driver. And correct the runtime state in remove().
Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/apds9802als.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c index 644d4cd071cc..81db7811cf68 100644 --- a/drivers/misc/apds9802als.c +++ b/drivers/misc/apds9802als.c | |||
@@ -245,9 +245,8 @@ static int apds9802als_probe(struct i2c_client *client, | |||
245 | als_set_default_config(client); | 245 | als_set_default_config(client); |
246 | mutex_init(&data->mutex); | 246 | mutex_init(&data->mutex); |
247 | 247 | ||
248 | pm_runtime_set_active(&client->dev); | ||
248 | pm_runtime_enable(&client->dev); | 249 | pm_runtime_enable(&client->dev); |
249 | pm_runtime_get(&client->dev); | ||
250 | pm_runtime_put(&client->dev); | ||
251 | 250 | ||
252 | return res; | 251 | return res; |
253 | als_error1: | 252 | als_error1: |
@@ -255,12 +254,19 @@ als_error1: | |||
255 | return res; | 254 | return res; |
256 | } | 255 | } |
257 | 256 | ||
258 | static int apds9802als_remove(struct i2c_client *client) | 257 | static int __devexit apds9802als_remove(struct i2c_client *client) |
259 | { | 258 | { |
260 | struct als_data *data = i2c_get_clientdata(client); | 259 | struct als_data *data = i2c_get_clientdata(client); |
261 | 260 | ||
261 | pm_runtime_get_sync(&client->dev); | ||
262 | |||
262 | als_set_power_state(client, false); | 263 | als_set_power_state(client, false); |
263 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); | 264 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); |
265 | |||
266 | pm_runtime_disable(&client->dev); | ||
267 | pm_runtime_set_suspended(&client->dev); | ||
268 | pm_runtime_put_noidle(&client->dev); | ||
269 | |||
264 | kfree(data); | 270 | kfree(data); |
265 | return 0; | 271 | return 0; |
266 | } | 272 | } |
@@ -275,9 +281,6 @@ static int apds9802als_suspend(struct i2c_client *client, pm_message_t mesg) | |||
275 | static int apds9802als_resume(struct i2c_client *client) | 281 | static int apds9802als_resume(struct i2c_client *client) |
276 | { | 282 | { |
277 | als_set_default_config(client); | 283 | als_set_default_config(client); |
278 | |||
279 | pm_runtime_get(&client->dev); | ||
280 | pm_runtime_put(&client->dev); | ||
281 | return 0; | 284 | return 0; |
282 | } | 285 | } |
283 | 286 | ||
@@ -323,7 +326,7 @@ static struct i2c_driver apds9802als_driver = { | |||
323 | .pm = APDS9802ALS_PM_OPS, | 326 | .pm = APDS9802ALS_PM_OPS, |
324 | }, | 327 | }, |
325 | .probe = apds9802als_probe, | 328 | .probe = apds9802als_probe, |
326 | .remove = apds9802als_remove, | 329 | .remove = __devexit_p(apds9802als_remove), |
327 | .suspend = apds9802als_suspend, | 330 | .suspend = apds9802als_suspend, |
328 | .resume = apds9802als_resume, | 331 | .resume = apds9802als_resume, |
329 | .id_table = apds9802als_id, | 332 | .id_table = apds9802als_id, |