summaryrefslogtreecommitdiffstats
path: root/drivers/memstick/core/memstick.c
diff options
context:
space:
mode:
authorAlex Dubov2008-07-26 04:45:01 +0200
committerLinus Torvalds2008-07-26 21:00:04 +0200
commit17017d8d2c005734d7088d8281ce2daab8fcb097 (patch)
treedf689658df7d342143ad399bddf0df7257e8ec20 /drivers/memstick/core/memstick.c
parentmemstick: allow "set_param" method to return an error code (diff)
downloadkernel-qcow2-linux-17017d8d2c005734d7088d8281ce2daab8fcb097.tar.gz
kernel-qcow2-linux-17017d8d2c005734d7088d8281ce2daab8fcb097.tar.xz
kernel-qcow2-linux-17017d8d2c005734d7088d8281ce2daab8fcb097.zip
memstick: add "start" and "stop" methods to memstick device
In some cases it may be desirable to ensure that associated driver is not going to access the media in some period of time. "start" and "stop" methods are provided therefore to allow it. 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/memstick.c')
-rw-r--r--drivers/memstick/core/memstick.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index 3c7d9a79c1ea..7162f772bbfb 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -433,8 +433,11 @@ static void memstick_check(struct work_struct *work)
dev_dbg(&host->dev, "memstick_check started\n");
mutex_lock(&host->lock);
- if (!host->card)
- memstick_power_on(host);
+ if (!host->card) {
+ if (memstick_power_on(host))
+ goto out_power_off;
+ } else
+ host->card->stop(host->card);
card = memstick_alloc_card(host);
@@ -452,7 +455,8 @@ static void memstick_check(struct work_struct *work)
|| !(host->card->check(host->card))) {
device_unregister(&host->card->dev);
host->card = NULL;
- }
+ } else
+ host->card->start(host->card);
}
if (!host->card) {
@@ -465,6 +469,7 @@ static void memstick_check(struct work_struct *work)
kfree(card);
}
+out_power_off:
if (!host->card)
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);