mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: oakad@exemail.com.au
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, Alex Dubov <oakad@yahoo.com>
Subject: [PATCH 02/11] memstick: add memstick_suspend/resume_host methods
Date: Wed,  5 Mar 2008 03:02:19 +1100	[thread overview]
Message-ID: <1204646548-27466-3-git-send-email-oakad@exemail.com.au> (raw)
In-Reply-To: <1204646548-27466-2-git-send-email-oakad@exemail.com.au>

From: Alex Dubov <oakad@yahoo.com>

Bus driver may need to be informed that host is being suspended/resumed.

Signed-off-by: Alex Dubov <oakad@yahoo.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


  reply	other threads:[~2008-03-04 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 16:02 MemoryStick driver updates oakad
2008-03-04 16:02 ` [PATCH 01/11] memstick: introduce correct definitions in the header oakad
2008-03-04 16:02   ` oakad [this message]
2008-03-04 16:02     ` [PATCH 03/11] memstick: make sure number of command retries is exactly as specified oakad
2008-03-04 16:02       ` [PATCH 04/11] memstick: drop DRIVER_VERSION numbers as meaningless oakad
2008-03-04 16:02         ` [PATCH 05/11] tifm: fix the MemoryStick host fifo handling code oakad
2008-03-04 16:02           ` [PATCH 06/11] tifm: fix memorystick host initialization code oakad
2008-03-04 16:02             ` [PATCH 07/11] tifm: clear interrupt mask bits before setting them on adapter init oakad
2008-03-04 16:02               ` [PATCH 08/11] memstick: add support for decoding "specfile" media attributes oakad
2008-03-04 16:02                 ` [PATCH 09/11] memstick: fix parsing of "assembly_date" attribute field oakad
2008-03-04 16:02                   ` [PATCH 10/11] memstick: try harder to recover from unsuccessful interface mode switch oakad
2008-03-04 16:02                     ` [PATCH 11/11] memstick: add support for JMicron jmb38x MemoryStick host controller oakad
2008-03-05 23:17                       ` Andrew Morton
2008-03-05 22:59           ` [PATCH 05/11] tifm: fix the MemoryStick host fifo handling code Andrew Morton
2008-03-05 23:21 ` MemoryStick driver updates Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204646548-27466-3-git-send-email-oakad@exemail.com.au \
    --to=oakad@exemail.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oakad@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®