aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/applesmc.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-11-09 10:15:02 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-01-08 13:55:35 -0500
commit2344cd0c2e9ea8f3037be11fb997ddbeda0237ca (patch)
treee88fb8b86375a8ba56e59bec73d2d85fba958ef3 /drivers/hwmon/applesmc.c
parent132af03233b493101a53010383b5abb5b9ff1e51 (diff)
hwmon: (applesmc) Relax the severity of device init failure
The device init is used to reset the accelerometer. Failure to reset is not severe enough to stop loading the module or to resume from hibernation. This patch relaxes failure to a warning and drops output in case of success. Cc: stable@kernel.org Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/applesmc.c')
-rw-r--r--drivers/hwmon/applesmc.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index d616174807a1..87a5fd51dd5e 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -448,38 +448,22 @@ static int applesmc_read_motion_sensor(int index, s16* value)
448} 448}
449 449
450/* 450/*
451 * applesmc_device_init - initialize the accelerometer. Returns zero on success 451 * applesmc_device_init - initialize the accelerometer. Can sleep.
452 * and negative error code on failure. Can sleep.
453 */ 452 */
454static int applesmc_device_init(void) 453static void applesmc_device_init(void)
455{ 454{
456 int total, ret = -ENXIO; 455 int total;
457 u8 buffer[2]; 456 u8 buffer[2];
458 457
459 if (!applesmc_accelerometer) 458 if (!applesmc_accelerometer)
460 return 0; 459 return;
461 460
462 mutex_lock(&applesmc_lock); 461 mutex_lock(&applesmc_lock);
463 462
464 for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) { 463 for (total = INIT_TIMEOUT_MSECS; total > 0; total -= INIT_WAIT_MSECS) {
465 if (debug)
466 printk(KERN_DEBUG "applesmc try %d\n", total);
467 if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) && 464 if (!applesmc_read_key(MOTION_SENSOR_KEY, buffer, 2) &&
468 (buffer[0] != 0x00 || buffer[1] != 0x00)) { 465 (buffer[0] != 0x00 || buffer[1] != 0x00))
469 if (total == INIT_TIMEOUT_MSECS) {
470 printk(KERN_DEBUG "applesmc: device has"
471 " already been initialized"
472 " (0x%02x, 0x%02x).\n",
473 buffer[0], buffer[1]);
474 } else {
475 printk(KERN_DEBUG "applesmc: device"
476 " successfully initialized"
477 " (0x%02x, 0x%02x).\n",
478 buffer[0], buffer[1]);
479 }
480 ret = 0;
481 goto out; 466 goto out;
482 }
483 buffer[0] = 0xe0; 467 buffer[0] = 0xe0;
484 buffer[1] = 0x00; 468 buffer[1] = 0x00;
485 applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2); 469 applesmc_write_key(MOTION_SENSOR_KEY, buffer, 2);
@@ -490,7 +474,6 @@ static int applesmc_device_init(void)
490 474
491out: 475out:
492 mutex_unlock(&applesmc_lock); 476 mutex_unlock(&applesmc_lock);
493 return ret;
494} 477}
495 478
496/* 479/*
@@ -516,13 +499,8 @@ static int applesmc_get_fan_count(void)
516/* Device model stuff */ 499/* Device model stuff */
517static int applesmc_probe(struct platform_device *dev) 500static int applesmc_probe(struct platform_device *dev)
518{ 501{
519 int ret; 502 applesmc_device_init();
520 503
521 ret = applesmc_device_init();
522 if (ret)
523 return ret;
524
525 printk(KERN_INFO "applesmc: device successfully initialized.\n");
526 return 0; 504 return 0;
527} 505}
528 506
@@ -539,9 +517,7 @@ static int applesmc_pm_resume(struct device *dev)
539/* Reinitialize device on resume from hibernation */ 517/* Reinitialize device on resume from hibernation */
540static int applesmc_pm_restore(struct device *dev) 518static int applesmc_pm_restore(struct device *dev)
541{ 519{
542 int ret = applesmc_device_init(); 520 applesmc_device_init();
543 if (ret)
544 return ret;
545 return applesmc_pm_resume(dev); 521 return applesmc_pm_resume(dev);
546} 522}
547 523