[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1204646548-27466-3-git-send-email-oakad@exemail.com.au>
Date: Wed, 5 Mar 2008 03:02:19 +1100
From: oakad@...mail.com.au
To: linux-kernel@...r.kernel.org
Cc: akpm@...ux-foundation.org, Alex Dubov <oakad@...oo.com>
Subject: [PATCH 02/11] memstick: add memstick_suspend/resume_host methods
From: Alex Dubov <oakad@...oo.com>
Bus driver may need to be informed that host is being suspended/resumed.
Signed-off-by: Alex Dubov <oakad@...oo.com>
---
drivers/memstick/core/memstick.c | 25 +++++++++++++++++++++++++
drivers/memstick/host/tifm_ms.c | 8 ++++----
include/linux/memstick.h | 2 ++
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index 5e0e960..3c97bac 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -561,6 +561,31 @@ void memstick_free_host(struct memstick_host *host)
}
EXPORT_SYMBOL(memstick_free_host);
+/**
+ * memstick_suspend_host - notify bus driver of host suspension
+ * @host - host to use
+ */
+void memstick_suspend_host(struct memstick_host *host)
+{
+ mutex_lock(&host->lock);
+ host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
+ mutex_unlock(&host->lock);
+}
+EXPORT_SYMBOL(memstick_suspend_host);
+
+/**
+ * memstick_resume_host - notify bus driver of host resumption
+ * @host - host to use
+ */
+void memstick_resume_host(struct memstick_host *host)
+{
+ mutex_lock(&host->lock);
+ host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON);
+ mutex_unlock(&host->lock);
+ memstick_detect_change(host);
+}
+EXPORT_SYMBOL(memstick_resume_host);
+
int memstick_register_driver(struct memstick_driver *drv)
{
drv->driver.bus = &memstick_bus_type;
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index 5b5bd61..8b1c102 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -627,17 +627,17 @@ static void tifm_ms_remove(struct tifm_dev *sock)
static int tifm_ms_suspend(struct tifm_dev *sock, pm_message_t state)
{
+ struct memstick_host *msh = tifm_get_drvdata(sock);
+
+ memstick_suspend_host(msh);
return 0;
}
static int tifm_ms_resume(struct tifm_dev *sock)
{
struct memstick_host *msh = tifm_get_drvdata(sock);
- struct tifm_ms *host = memstick_priv(msh);
-
- tifm_ms_initialize_host(host);
- memstick_detect_change(msh);
+ memstick_resume_host(msh);
return 0;
}
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index c104e72..b7ee258 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -312,6 +312,8 @@ int memstick_add_host(struct memstick_host *host);
void memstick_remove_host(struct memstick_host *host);
void memstick_free_host(struct memstick_host *host);
void memstick_detect_change(struct memstick_host *host);
+void memstick_suspend_host(struct memstick_host *host);
+void memstick_resume_host(struct memstick_host *host);
void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc,
struct scatterlist *sg);
--
1.5.3.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists