diff options
-rw-r--r-- | drivers/hwmon/applesmc.c | 38 |
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 | */ |
454 | static int applesmc_device_init(void) | 453 | static 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 | ||
491 | out: | 475 | out: |
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 */ |
517 | static int applesmc_probe(struct platform_device *dev) | 500 | static 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 */ |
540 | static int applesmc_pm_restore(struct device *dev) | 518 | static 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 | ||