From d9339f35de9b9de8f1c1e94b72ffddcf5636c1ca Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 18 Aug 2025 12:06:57 +0200 Subject: [PATCH] 5.4-stable patches added patches: misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch --- ...gpu-fix-incorrect-vm-flags-to-map-bo.patch | 9 +-- ...evice-is-active-when-card-is-present.patch | 69 +++++++++++++++++++ queue-5.4/series | 1 + 3 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 queue-5.4/misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch diff --git a/queue-5.4/drm-amdgpu-fix-incorrect-vm-flags-to-map-bo.patch b/queue-5.4/drm-amdgpu-fix-incorrect-vm-flags-to-map-bo.patch index 815eaf3de7..9887f73e90 100644 --- a/queue-5.4/drm-amdgpu-fix-incorrect-vm-flags-to-map-bo.patch +++ b/queue-5.4/drm-amdgpu-fix-incorrect-vm-flags-to-map-bo.patch @@ -17,14 +17,12 @@ Signed-off-by: Alex Deucher (cherry picked from commit b08425fa77ad2f305fe57a33dceb456be03b653f) Signed-off-by: Sasha Levin --- - drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++-- + drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c -index 35a8d3c96fc9..2e811e963e35 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c -@@ -94,8 +94,8 @@ int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm, +@@ -94,8 +94,8 @@ int amdgpu_map_static_csa(struct amdgpu_ } r = amdgpu_vm_bo_map(adev, *bo_va, csa_addr, 0, size, @@ -35,6 +33,3 @@ index 35a8d3c96fc9..2e811e963e35 100644 if (r) { DRM_ERROR("failed to do bo_map on static CSA, err=%d\n", r); --- -2.50.1 - diff --git a/queue-5.4/misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch b/queue-5.4/misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch new file mode 100644 index 0000000000..39fa304eca --- /dev/null +++ b/queue-5.4/misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch @@ -0,0 +1,69 @@ +From 966c5cd72be8989c8a559ddef8e8ff07a37c5eb0 Mon Sep 17 00:00:00 2001 +From: Ricky Wu +Date: Fri, 11 Jul 2025 22:01:43 +0800 +Subject: misc: rtsx: usb: Ensure mmc child device is active when card is present + +From: Ricky Wu + +commit 966c5cd72be8989c8a559ddef8e8ff07a37c5eb0 upstream. + +When a card is present in the reader, the driver currently defers +autosuspend by returning -EAGAIN during the suspend callback to +trigger USB remote wakeup signaling. However, this does not guarantee +that the mmc child device has been resumed, which may cause issues if +it remains suspended while the card is accessible. +This patch ensures that all child devices, including the mmc host +controller, are explicitly resumed before returning -EAGAIN. This +fixes a corner case introduced by earlier remote wakeup handling, +improving reliability of runtime PM when a card is inserted. + +Fixes: 883a87ddf2f1 ("misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection") +Cc: stable@vger.kernel.org +Signed-off-by: Ricky Wu +Reviewed-by: Ulf Hansson +Link: https://lore.kernel.org/r/20250711140143.2105224-1-ricky_wu@realtek.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/cardreader/rtsx_usb.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/misc/cardreader/rtsx_usb.c ++++ b/drivers/misc/cardreader/rtsx_usb.c +@@ -698,6 +698,12 @@ static void rtsx_usb_disconnect(struct u + } + + #ifdef CONFIG_PM ++static int rtsx_usb_resume_child(struct device *dev, void *data) ++{ ++ pm_request_resume(dev); ++ return 0; ++} ++ + static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) + { + struct rtsx_ucr *ucr = +@@ -713,8 +719,10 @@ static int rtsx_usb_suspend(struct usb_i + mutex_unlock(&ucr->dev_mutex); + + /* Defer the autosuspend if card exists */ +- if (val & (SD_CD | MS_CD)) ++ if (val & (SD_CD | MS_CD)) { ++ device_for_each_child(&intf->dev, NULL, rtsx_usb_resume_child); + return -EAGAIN; ++ } + } else { + /* There is an ongoing operation*/ + return -EAGAIN; +@@ -724,12 +732,6 @@ static int rtsx_usb_suspend(struct usb_i + return 0; + } + +-static int rtsx_usb_resume_child(struct device *dev, void *data) +-{ +- pm_request_resume(dev); +- return 0; +-} +- + static int rtsx_usb_resume(struct usb_interface *intf) + { + device_for_each_child(&intf->dev, NULL, rtsx_usb_resume_child); diff --git a/queue-5.4/series b/queue-5.4/series index 90d09ceb94..0dacf2231a 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -272,3 +272,4 @@ pnfs-fix-uninited-ptr-deref-in-block-scsi-layout.patch rtc-ds1307-remove-clear-of-oscillator-stop-flag-osf-.patch scsi-lpfc-remove-redundant-assignment-to-avoid-memor.patch drm-amdgpu-fix-incorrect-vm-flags-to-map-bo.patch +misc-rtsx-usb-ensure-mmc-child-device-is-active-when-card-is-present.patch -- 2.47.3