aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memstick/core/memstick.c
diff options
context:
space:
mode:
authorAlex Dubov <oakad@yahoo.com>2008-07-25 19:45:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 12:00:04 -0700
commit17017d8d2c005734d7088d8281ce2daab8fcb097 (patch)
treedf689658df7d342143ad399bddf0df7257e8ec20 /drivers/memstick/core/memstick.c
parentb77899985bdfd85a8e5a6e485033a9b4713d2471 (diff)
downloadkernel_samsung_crespo-17017d8d2c005734d7088d8281ce2daab8fcb097.zip
kernel_samsung_crespo-17017d8d2c005734d7088d8281ce2daab8fcb097.tar.gz
kernel_samsung_crespo-17017d8d2c005734d7088d8281ce2daab8fcb097.tar.bz2
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 3c7d9a7..7162f77 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);