Skip to content

Commit 966c5cd

Browse files
Ricky Wugregkh
authored andcommitted
misc: rtsx: usb: Ensure mmc child device is active when card is present
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: 883a87d ("misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection") Cc: stable@vger.kernel.org Signed-off-by: Ricky Wu <ricky_wu@realtek.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250711140143.2105224-1-ricky_wu@realtek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 29f4103 commit 966c5cd

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

drivers/misc/cardreader/rtsx_usb.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,12 @@ static void rtsx_usb_disconnect(struct usb_interface *intf)
698698
}
699699

700700
#ifdef CONFIG_PM
701+
static int rtsx_usb_resume_child(struct device *dev, void *data)
702+
{
703+
pm_request_resume(dev);
704+
return 0;
705+
}
706+
701707
static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
702708
{
703709
struct rtsx_ucr *ucr =
@@ -713,8 +719,10 @@ static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
713719
mutex_unlock(&ucr->dev_mutex);
714720

715721
/* Defer the autosuspend if card exists */
716-
if (val & (SD_CD | MS_CD))
722+
if (val & (SD_CD | MS_CD)) {
723+
device_for_each_child(&intf->dev, NULL, rtsx_usb_resume_child);
717724
return -EAGAIN;
725+
}
718726
} else {
719727
/* There is an ongoing operation*/
720728
return -EAGAIN;
@@ -724,12 +732,6 @@ static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message)
724732
return 0;
725733
}
726734

727-
static int rtsx_usb_resume_child(struct device *dev, void *data)
728-
{
729-
pm_request_resume(dev);
730-
return 0;
731-
}
732-
733735
static int rtsx_usb_resume(struct usb_interface *intf)
734736
{
735737
device_for_each_child(&intf->dev, NULL, rtsx_usb_resume_child);

0 commit comments

Comments
 (0)