diff options
author | Alex Dubov <oakad@yahoo.com> | 2008-07-25 22:45:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:04 -0400 |
commit | b77899985bdfd85a8e5a6e485033a9b4713d2471 (patch) | |
tree | 5cf53074b73de6fc27d8d8b0ac78fc8d32c0b9df /drivers/memstick/core | |
parent | 0147600172b4a5d261165d1aa5ef818d84da1557 (diff) |
memstick: allow "set_param" method to return an error code
Some controllers (Jmicron, for instance) can report temporal failure
condition during power-on. It is desirable to account for this using a
return value of "set_param" device method. The return value can also be
handy to distinguish between supported and unsupported device parameters
in run time.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/memstick/core')
-rw-r--r-- | drivers/memstick/core/memstick.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index 61b98c333cb0..3c7d9a79c1ea 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
@@ -415,10 +415,14 @@ err_out: | |||
415 | return NULL; | 415 | return NULL; |
416 | } | 416 | } |
417 | 417 | ||
418 | static void memstick_power_on(struct memstick_host *host) | 418 | static int memstick_power_on(struct memstick_host *host) |
419 | { | 419 | { |
420 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 420 | int rc = host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); |
421 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 421 | |
422 | if (!rc) | ||
423 | rc = host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | ||
424 | |||
425 | return rc; | ||
422 | } | 426 | } |
423 | 427 | ||
424 | static void memstick_check(struct work_struct *work) | 428 | static void memstick_check(struct work_struct *work) |
@@ -573,11 +577,15 @@ EXPORT_SYMBOL(memstick_suspend_host); | |||
573 | */ | 577 | */ |
574 | void memstick_resume_host(struct memstick_host *host) | 578 | void memstick_resume_host(struct memstick_host *host) |
575 | { | 579 | { |
580 | int rc = 0; | ||
581 | |||
576 | mutex_lock(&host->lock); | 582 | mutex_lock(&host->lock); |
577 | if (host->card) | 583 | if (host->card) |
578 | memstick_power_on(host); | 584 | rc = memstick_power_on(host); |
579 | mutex_unlock(&host->lock); | 585 | mutex_unlock(&host->lock); |
580 | memstick_detect_change(host); | 586 | |
587 | if (!rc) | ||
588 | memstick_detect_change(host); | ||
581 | } | 589 | } |
582 | EXPORT_SYMBOL(memstick_resume_host); | 590 | EXPORT_SYMBOL(memstick_resume_host); |
583 | 591 | ||