From nobody Tue Oct 7 08:36:28 2025 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400D921FF31; Fri, 11 Jul 2025 14:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752242536; cv=none; b=aHG7teugp2H8M00XBwrXSkRTZfnt3pejeAQpG7hCNpX40SIpvhw5YrH2j/ABjdWUwdV3V2Cn41rTkmJ3R+EbT7dPUsRGXnU5J4k6fFRxII84pq6q9U4ZAH+WidoI2yKNYGHftzGlh9rZzbuF5H+ctEy3KfwvVrf6gczfqLVQwLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752242536; c=relaxed/simple; bh=zLpv4oLVuW84lko7wSNhxAK6YaXlsT14WaWp/vHwevY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=M5LxwWO3T9Us6kIHFD6787ZprIHtZHp0NC5Z/SlNJ6XM0NcuxM7q0VG8b4PO7QD4dmpC9v6k4IUnUTVibprvspuEwBIUvlJttwlF9osedvgTYVL9aoYk7HxBsRxIwMDD9xlIdN/QfdBVK38nYcaSkD0DydvYPoPgDZiBs7JDKzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b=FV+sJ453; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realtek.com header.i=@realtek.com header.b="FV+sJ453" X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 56BE1jXxA1090956, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim; t=1752242505; bh=EfzfrPlclMQlIt/lSv5UuSyWKHG7Q/yxfuyq9e9n65U=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:Content-Type; b=FV+sJ453bku5eLeLme4aa/zxC+/cyIh7WctAUhXo+XayxSUUQOQlR1eYUNlH7PRNZ iowfy3U//fDkv2D2DXbP+v6Y61UDsnXTqgC73OGdscCOA0MHg2ZWp2iFRhGo03iKL1 oCvovdQJdzx4g2S4vnkZm2Y3PJllfqC7AYt97ZIZuRQ++Jy7na4aNQdLX7Vtl+JZel OKlOm1YUfstADe9SK6SfFOUF81kEIE+IA1SZC5WLKIl2/NL/2R+MOPX43x3kv2hB1o PZt7N+7buaE94u8wBIbhq0U9EID7lARq/1BWmYMgauETN8RYB8a//dk6aCeK3f/7Dn JsU7ZhidBGK1Q== Received: from mail.realtek.com (rtkexhmbs03.realtek.com.tw[10.21.1.53]) by rtits2.realtek.com.tw (8.15.2/3.13/5.93) with ESMTPS id 56BE1jXxA1090956 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Jul 2025 22:01:45 +0800 Received: from RTEXMBS02.realtek.com.tw (172.21.6.95) by RTKEXHMBS03.realtek.com.tw (10.21.1.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 11 Jul 2025 22:01:45 +0800 Received: from RTEXH36505.realtek.com.tw (172.21.6.25) by RTEXMBS02.realtek.com.tw (172.21.6.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 11 Jul 2025 22:01:45 +0800 Received: from localhost (172.22.144.1) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 11 Jul 2025 22:01:45 +0800 From: Ricky Wu To: , , , , , , CC: Subject: [PATCH] misc: rtsx: usb: Ensure mmc child device is active when card is present Date: Fri, 11 Jul 2025 22:01:43 +0800 Message-ID: <20250711140143.2105224-1-ricky_wu@realtek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-KSE-ServerInfo: RTEXMBS02.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback Content-Type: text/plain; charset="utf-8" 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 c= ard insertion detection") Cc: stable@vger.kernel.org Signed-off-by: Ricky Wu Reviewed-by: Ulf Hansson --- drivers/misc/cardreader/rtsx_usb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/r= tsx_usb.c index 148107a4547c..d007a4455ce5 100644 --- a/drivers/misc/cardreader/rtsx_usb.c +++ b/drivers/misc/cardreader/rtsx_usb.c @@ -698,6 +698,12 @@ static void rtsx_usb_disconnect(struct usb_interface *= intf) } =20 #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 messa= ge) { struct rtsx_ucr *ucr =3D @@ -713,8 +719,10 @@ static int rtsx_usb_suspend(struct usb_interface *intf= , pm_message_t message) mutex_unlock(&ucr->dev_mutex); =20 /* 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_interface *intf= , pm_message_t message) return 0; } =20 -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); --=20 2.25.1