Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6738471imm; Tue, 24 Jul 2018 02:05:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd21p/fySpDu4uMsO+xRqJQE/bq9iVcbW/UzBZJcoO+m4sPCMnu4axaw1fDTns80UJi9N9t X-Received: by 2002:a17:902:7586:: with SMTP id j6-v6mr16281620pll.295.1532423117179; Tue, 24 Jul 2018 02:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532423117; cv=none; d=google.com; s=arc-20160816; b=tuqzDgKEmu/gcKR+G2WPmsLvvKnhMtSEkSQOiolV/F0Ye1TP/u3kg+uJhyrF+KkIIU G5viMW4GQLm2Wrm5NDZ9V+zVkY3hj9SkGACzmTQzu7IkgubMqN9tQ/KTFTkJwx1GMk3q omJmZGDC8an/lgA0Fnhnc3cIulnaDOUptILwrAiiVr0GDTgs6Lrms+UvRXNDsGLCqIWG aKw9AlPE6+u8RySrBxDrpi5BzSyADaAPuh2Ih7qVPTzJOKmiP//Vo6W5Nxx0qC/vevlB YCDKrcEq3h18+SToQ2IApzwcLBqukbPQu7+bWqJLRDQ26qioSKzixmBgNiNGdiwqxDh0 qMkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=76bKq/Rt4J64OL7sdPRiXAnnXI41XRy++gC9P4TX+HE=; b=QJY4+F2FTB+0y4qDHNawOs+MQkF/07m15gT9Zkb4phX7EskR6yDXjUVHrhhJReigVy TxoY//9kdCjn+q+Hg+jTtQYjQNDe8JKAXdNcnNR+0D2WHeRhLTrAn0ADbWd+n+zKOIQ5 OX1gILi2LW/tcaWgG01oa+hXY0MeWAuVoel00JBpl7XCYectZIw47aJ9Vuwoi1Tug1ma dxiU73zqbb7I7ujLdkWLeT7nnQ7HUpYMiAVn98K2VknE7B10Qv1lTjV1fP1/NlUuutdi hsW8d47Ek03VO/dGQnHEr6iAdXPBaYdvdEUe6XaPi4p3iT6f4rc3rqTy4Jt9Uf0sA1+3 g+UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4-v6si9872920plo.235.2018.07.24.02.05.02; Tue, 24 Jul 2018 02:05:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388302AbeGXKJW (ORCPT + 99 others); Tue, 24 Jul 2018 06:09:22 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:56941 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388185AbeGXKJW (ORCPT ); Tue, 24 Jul 2018 06:09:22 -0400 Received: from mail-pl0-f69.google.com ([209.85.160.69]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fhtEX-0000NM-9t for linux-kernel@vger.kernel.org; Tue, 24 Jul 2018 09:03:53 +0000 Received: by mail-pl0-f69.google.com with SMTP id f91-v6so2474318plb.10 for ; Tue, 24 Jul 2018 02:03:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=76bKq/Rt4J64OL7sdPRiXAnnXI41XRy++gC9P4TX+HE=; b=qIEpGeSwv7fq0tmZiJncZ2ONc9RgehR7B0zS2A+ZP38LeRzFrybUOAU46Tu+lL64FH ZY22fhwRgS9+ViV5W2YmBJu70xZfz+Z3mIEflJuIEiF1fktXJOGt7rcUEq6/cLVqQ507 eQHuBv546Cpoc3vxrHFa0O4yofQJiI8h88/9EQuhEfkmMIaFt7GaliMB18yESOhrMhY4 ZA+BQG2XhHeiV0ccsvcIZD1Yosz/Wlgj7WqYLxVwzViAhLNtyiyXIZMk0sRgVPM1/QVQ jAIJenT/P5E7K1nV/Hzdset0GlgyGH+NlqMOxKHwJo4AxmAoOHp+VB/jsfFvLCGEJ4Np hfcg== X-Gm-Message-State: AOUpUlENNoHFT5PXkY1mdzYusp9+ANZwaQdS6XyO6faElQJiDpW4//wG xRB8YRVO37uL54y1w4sEDhlHTDNK0wO4njvywKON2ZsiYqgW0vXO7EQRhQUfZGctODJ7H9NA30M /aPNUSY7qFSD01egWlkx22cybfcsXl1h4hHNCfeWqnA== X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr15191380pgh.369.1532423032019; Tue, 24 Jul 2018 02:03:52 -0700 (PDT) X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr15191367pgh.369.1532423031813; Tue, 24 Jul 2018 02:03:51 -0700 (PDT) Received: from [10.101.46.95] ([175.41.48.77]) by smtp.gmail.com with ESMTPSA id z8-v6sm15944789pfe.163.2018.07.24.02.03.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 02:03:51 -0700 (PDT) Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: [PATCH 1/5] misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection From: Kai Heng Feng In-Reply-To: Date: Tue, 24 Jul 2018 17:03:47 +0800 Cc: arnd@arndb.de, gregkh@linuxfoundation.org, ulf.hansson@linaro.org, bauer.chen@realtek.com, ricky_wu@realtek.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: To: Alan Stern X-Mailer: Apple Mail (2.3445.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 23, 2018, at 10:19 PM, Alan Stern wrote: > > On Mon, 23 Jul 2018, Kai-Heng Feng wrote: > >> Although rtsx_usb doesn't support card removal detection, card insertion >> will resume rtsx_usb by USB remote wakeup signaling. >> >> When rtsx_usb gets resumed, also resumes its child devices, >> rtsx_usb_sdmmc and rtsx_usb_ms, to notify them there's a card in its >> slot. >> >> Signed-off-by: Kai-Heng Feng >> --- >> drivers/misc/cardreader/rtsx_usb.c | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/drivers/misc/cardreader/rtsx_usb.c >> b/drivers/misc/cardreader/rtsx_usb.c >> index b97903ff1a72..fed83453e5c5 100644 >> --- a/drivers/misc/cardreader/rtsx_usb.c >> +++ b/drivers/misc/cardreader/rtsx_usb.c >> @@ -723,8 +723,20 @@ static int rtsx_usb_suspend(struct usb_interface >> *intf, pm_message_t message) >> return 0; >> } >> >> +static int rtsx_usb_resume_child(struct device *dev, void *data) >> +{ >> + /* No need to wake up self again */ >> + if (dev == data) >> + return 0; > > Is this test actually needed? device_for_each_child() won't enumerate > the device it is called for, only that device's children. Ok, I'll update this part. > >> + >> + dev_dbg(dev, "%s called\n", __func__); > > Not necessary. People can use ftrace if they want this information. Sure I'll remove it. This is to make the change more aligned with the original code. It uses similar function on other places too. Kai-Heng > > Alan Stern > >> + pm_request_resume(dev); >> + return 0; >> +} >> + >> static int rtsx_usb_resume(struct usb_interface *intf) >> { >> + device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child); >> return 0; >> } >> >> @@ -734,6 +746,7 @@ static int rtsx_usb_reset_resume(struct >> usb_interface *intf) >> (struct rtsx_ucr *)usb_get_intfdata(intf); >> >> rtsx_usb_reset_chip(ucr); >> + device_for_each_child(&intf->dev, &intf->dev, rtsx_usb_resume_child); >> return 0; >> }