aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/abituguru.c
diff options
context:
space:
mode:
authorHans de Goede <j.w.r.degoede@hhs.nl>2006-08-28 08:42:24 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:31:14 -0400
commit360b9ab220aedaf346380fc2344729d9acc3b075 (patch)
treead843d0f33fe396c6d0ae22e93b151a5386de40c /drivers/hwmon/abituguru.c
parentb17ebc9402040959690b5a2c4e1cfb1e6d4fb206 (diff)
abituguru: Add suspend/resume support
This patch contains rudimentary suspend / resume support for the uguru, this protects the uguru and the driver against suspend / resume cycles, so there is no reason to unload the driver in your suspend / resume scripts. Only include suspend / resume functions when CONFIG_PM is set. Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/abituguru.c')
-rw-r--r--drivers/hwmon/abituguru.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index 35ad1b032726..e5cb0fdab9b1 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1354,13 +1354,39 @@ LEAVE_UPDATE:
1354 return NULL; 1354 return NULL;
1355} 1355}
1356 1356
1357#ifdef CONFIG_PM
1358static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
1359{
1360 struct abituguru_data *data = platform_get_drvdata(pdev);
1361 /* make sure all communications with the uguru are done and no new
1362 ones are started */
1363 mutex_lock(&data->update_lock);
1364 return 0;
1365}
1366
1367static int abituguru_resume(struct platform_device *pdev)
1368{
1369 struct abituguru_data *data = platform_get_drvdata(pdev);
1370 /* See if the uGuru is still ready */
1371 if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
1372 data->uguru_ready = 0;
1373 mutex_unlock(&data->update_lock);
1374 return 0;
1375}
1376#else
1377#define abituguru_suspend NULL
1378#define abituguru_resume NULL
1379#endif /* CONFIG_PM */
1380
1357static struct platform_driver abituguru_driver = { 1381static struct platform_driver abituguru_driver = {
1358 .driver = { 1382 .driver = {
1359 .owner = THIS_MODULE, 1383 .owner = THIS_MODULE,
1360 .name = ABIT_UGURU_NAME, 1384 .name = ABIT_UGURU_NAME,
1361 }, 1385 },
1362 .probe = abituguru_probe, 1386 .probe = abituguru_probe,
1363 .remove = __devexit_p(abituguru_remove), 1387 .remove = __devexit_p(abituguru_remove),
1388 .suspend = abituguru_suspend,
1389 .resume = abituguru_resume,
1364}; 1390};
1365 1391
1366static int __init abituguru_detect(void) 1392static int __init abituguru_detect(void)