Skip to content

Commit

Permalink
memstick: add memstick_suspend/resume_host methods
Browse files Browse the repository at this point in the history
Bus driver may need to be informed that host is being suspended/resumed.

Signed-off-by: Alex Dubov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oakad authored and Linus Torvalds committed Mar 11, 2008
1 parent e1f1999 commit d114ad5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
25 changes: 25 additions & 0 deletions drivers/memstick/core/memstick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions drivers/memstick/host/tifm_ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions include/linux/memstick.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d114ad5

Please sign in to comment.