aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memstick
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2016-09-28 14:33:28 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2016-10-17 09:43:05 -0400
commit9158cb29e7c2f10dd325eb1589f0fe745a271257 (patch)
tree0e2f95e5c6323a1453b7270bc11602f779b5920f /drivers/memstick
parent796aa46adf1d90eab36ae06a42e6d3f10b28a75c (diff)
memstick: rtsx_usb_ms: Manage runtime PM when accessing the device
Accesses to the rtsx usb device, which is the parent of the rtsx memstick device, must not be done unless it's runtime resumed. This is currently not the case and it could trigger various errors. Fix this by properly deal with runtime PM in this regards. This means making sure the device is runtime resumed, when serving requests via the ->request() callback or changing settings via the ->set_param() callbacks. Cc: <stable@vger.kernel.org> Cc: Ritesh Raj Sarraf <rrs@researchut.com> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/memstick')
-rw-r--r--drivers/memstick/host/rtsx_usb_ms.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/memstick/host/rtsx_usb_ms.c b/drivers/memstick/host/rtsx_usb_ms.c
index 1b994897f0ff..2e3cf012ef48 100644
--- a/drivers/memstick/host/rtsx_usb_ms.c
+++ b/drivers/memstick/host/rtsx_usb_ms.c
@@ -524,6 +524,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work)
524 int rc; 524 int rc;
525 525
526 if (!host->req) { 526 if (!host->req) {
527 pm_runtime_get_sync(ms_dev(host));
527 do { 528 do {
528 rc = memstick_next_req(msh, &host->req); 529 rc = memstick_next_req(msh, &host->req);
529 dev_dbg(ms_dev(host), "next req %d\n", rc); 530 dev_dbg(ms_dev(host), "next req %d\n", rc);
@@ -544,6 +545,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work)
544 host->req->error); 545 host->req->error);
545 } 546 }
546 } while (!rc); 547 } while (!rc);
548 pm_runtime_put(ms_dev(host));
547 } 549 }
548 550
549} 551}
@@ -570,6 +572,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh,
570 dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n", 572 dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n",
571 __func__, param, value); 573 __func__, param, value);
572 574
575 pm_runtime_get_sync(ms_dev(host));
573 mutex_lock(&ucr->dev_mutex); 576 mutex_lock(&ucr->dev_mutex);
574 577
575 err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD); 578 err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD);
@@ -635,6 +638,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh,
635 } 638 }
636out: 639out:
637 mutex_unlock(&ucr->dev_mutex); 640 mutex_unlock(&ucr->dev_mutex);
641 pm_runtime_put(ms_dev(host));
638 642
639 /* power-on delay */ 643 /* power-on delay */
640 if (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON) 644 if (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON)