Patch "memstick: rtsx_usb_ms: Manage runtime PM when accessing the device" has been added to the 4.8-stable tree

From: <gregkh@linuxfoundation.org>
Date: 2016-10-26 12:01:41

This is a note to let you know that I've just added the patch titled

    memstick: rtsx_usb_ms: Manage runtime PM when accessing the device

to the 4.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     memstick-rtsx_usb_ms-manage-runtime-pm-when-accessing-the-device.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let [off-list ref] know about it.

From 9158cb29e7c2f10dd325eb1589f0fe745a271257 Mon Sep 17 00:00:00 2001
From: Ulf Hansson <redacted>
Date: Wed, 28 Sep 2016 11:33:28 -0700
Subject: memstick: rtsx_usb_ms: Manage runtime PM when accessing the device

From: Ulf Hansson <redacted>

commit 9158cb29e7c2f10dd325eb1589f0fe745a271257 upstream.

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: Ritesh Raj Sarraf <redacted>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/memstick/host/rtsx_usb_ms.c |    4 ++++
 1 file changed, 4 insertions(+)
--- 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(struc
 	int rc;
 
 	if (!host->req) {
+		pm_runtime_get_sync(ms_dev(host));
 		do {
 			rc = memstick_next_req(msh, &host->req);
 			dev_dbg(ms_dev(host), "next req %d\n", rc);
@@ -544,6 +545,7 @@ static void rtsx_usb_ms_handle_req(struc
 						host->req->error);
 			}
 		} while (!rc);
+		pm_runtime_put(ms_dev(host));
 	}
 
 }
@@ -570,6 +572,7 @@ static int rtsx_usb_ms_set_param(struct
 	dev_dbg(ms_dev(host), "%s: param = %d, value = %d\n",
 			__func__, param, value);
 
+	pm_runtime_get_sync(ms_dev(host));
 	mutex_lock(&ucr->dev_mutex);
 
 	err = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD);
@@ -635,6 +638,7 @@ static int rtsx_usb_ms_set_param(struct
 	}
 out:
 	mutex_unlock(&ucr->dev_mutex);
+	pm_runtime_put(ms_dev(host));
 
 	/* power-on delay */
 	if (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON)

Patches currently in stable-queue which might be from ulf.hansson@linaro.org are

queue-4.8/memstick-rtsx_usb_ms-manage-runtime-pm-when-accessing-the-device.patch
queue-4.8/mmc-sdhci-cast-unsigned-int-to-unsigned-long-long-to-avoid-unexpeted-error.patch
queue-4.8/mmc-core-annotate-cmd_hdr-as-__le32.patch
queue-4.8/mmc-block-don-t-use-cmd23-with-very-old-mmc-cards.patch
queue-4.8/mmc-core-switch-to-1v8-or-1v2-for-hs400es-mode.patch
queue-4.8/memstick-rtsx_usb_ms-runtime-resume-the-device-when-polling-for-cards.patch
queue-4.8/mmc-rtsx_usb_sdmmc-avoid-keeping-the-device-runtime-resumed-when-unused.patch
queue-4.8/mmc-rtsx_usb_sdmmc-handle-runtime-pm-while-changing-the-led.patch
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help