aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-04-11 05:24:39 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 15:39:02 -0400
commit1c9354b0973a59a0292ec64e0b4dde7b9462931a (patch)
treeebe40d8459363ae6692ef73ce6bf2f6f4f8abf0a /drivers
parenta42f82f57a6411c89538a8c0a44150f67e449a4a (diff)
misc: apds9802als: Fix suspend/resume
The apds9802als driver implements runtime pm and at the same time uses the legacy pm callbacks for suspend and resume. This does not work since the i2c core wont look at the legacy pm callbacks if a driver has the 'pm' field set. This patch fixes it by moving over to dev_pm_ops for suspend/resume as well. Since both runtime pm and suspend/resume behave the same way this can easily be done using the UNIVERSAL_DEV_PM_OPS macro. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Hong Liu <hong.liu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/apds9802als.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index d648b0893027..5b5fd8416b3e 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -272,19 +272,8 @@ static int apds9802als_remove(struct i2c_client *client)
272} 272}
273 273
274#ifdef CONFIG_PM 274#ifdef CONFIG_PM
275static int apds9802als_suspend(struct i2c_client *client, pm_message_t mesg)
276{
277 als_set_power_state(client, false);
278 return 0;
279}
280
281static int apds9802als_resume(struct i2c_client *client)
282{
283 als_set_default_config(client);
284 return 0;
285}
286 275
287static int apds9802als_runtime_suspend(struct device *dev) 276static int apds9802als_suspend(struct device *dev)
288{ 277{
289 struct i2c_client *client = to_i2c_client(dev); 278 struct i2c_client *client = to_i2c_client(dev);
290 279
@@ -292,7 +281,7 @@ static int apds9802als_runtime_suspend(struct device *dev)
292 return 0; 281 return 0;
293} 282}
294 283
295static int apds9802als_runtime_resume(struct device *dev) 284static int apds9802als_resume(struct device *dev)
296{ 285{
297 struct i2c_client *client = to_i2c_client(dev); 286 struct i2c_client *client = to_i2c_client(dev);
298 287
@@ -300,16 +289,12 @@ static int apds9802als_runtime_resume(struct device *dev)
300 return 0; 289 return 0;
301} 290}
302 291
303static const struct dev_pm_ops apds9802als_pm_ops = { 292static UNIVERSAL_DEV_PM_OPS(apds9802als_pm_ops, apds9802als_suspend,
304 .runtime_suspend = apds9802als_runtime_suspend, 293 apds9802als_resume, NULL);
305 .runtime_resume = apds9802als_runtime_resume,
306};
307 294
308#define APDS9802ALS_PM_OPS (&apds9802als_pm_ops) 295#define APDS9802ALS_PM_OPS (&apds9802als_pm_ops)
309 296
310#else /* CONFIG_PM */ 297#else /* CONFIG_PM */
311#define apds9802als_suspend NULL
312#define apds9802als_resume NULL
313#define APDS9802ALS_PM_OPS NULL 298#define APDS9802ALS_PM_OPS NULL
314#endif /* CONFIG_PM */ 299#endif /* CONFIG_PM */
315 300
@@ -327,8 +312,6 @@ static struct i2c_driver apds9802als_driver = {
327 }, 312 },
328 .probe = apds9802als_probe, 313 .probe = apds9802als_probe,
329 .remove = apds9802als_remove, 314 .remove = apds9802als_remove,
330 .suspend = apds9802als_suspend,
331 .resume = apds9802als_resume,
332 .id_table = apds9802als_id, 315 .id_table = apds9802als_id,
333}; 316};
334 317