Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp510232imm; Thu, 13 Sep 2018 03:32:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYoU98bOT6jb/Rb4o90u7i4xa7oFqOFPVUaTPEYpYhzP05IZF4CQdcyyePgxeWCdBQ3zvoQ X-Received: by 2002:a63:9c19:: with SMTP id f25-v6mr6613895pge.447.1536834743692; Thu, 13 Sep 2018 03:32:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536834743; cv=none; d=google.com; s=arc-20160816; b=TBX8viRleOzHjq/Pj43P23b62FTqIkozJgV79S3XqDvWdTcKvp/zhbChH6j6ZK/xk8 SEqYiHlY+27/1jlJL5S1ZqUJ/uauVNOQgZVl6SH/CEHhY9u5j5V8v5bFdGgG0ySnT2/G ZViXOT6Vsa3vOjmiQmSL/y3G7bn2p+U9Q+hGZ5j4eI6wq2nZZyrMCz7cUumReX08YMVy Lst1HnKdztlpC+93AgrNG3vJWx0Z08J35OMBpqelBgmL625L6kjLpZV97e1sXFD2u4f/ fhLYLrGWv6lCOV7ig5vNTL6ythQBdcpFw9An3ciHh+jdExEzjErRYEdVHCSVmhdGoppM DetA== 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; bh=Pb+Q/SiNh8ATEDYxlzjH3k/GhDpgaFnhmPlPrDN/U4U=; b=B1P7JWaX0PIiTVaHrv208qh1cSmIxSS06R7VJ7Q0PJLCe2dPW30VFxTPspeSxdp+Rc yrO31iGBHM5oez/Ko8Rnudk5/IfHQk9x2Zykbo4+EYbCw8suDJWktC1UuQCLaRQzemVD 0ysYnEz6P1Rq7BvO5+QCpcT+m6HydEBEn93sdpfjCplyZHGDM/74fotId3xYNLf2iUUj xdeWNLwIPZ7a62z7VdEytASfGd11vvJIbHtS8o5+uxcBMmLYFiBNTHG67svrhLGDkLzq lHPKRtOhsUL/cfKxBmjgIYl3Jp4RQZ4pDc3rjkZVCVn4pORLK9WomF4X5omzG09EoKnK xxyg== 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 21-v6si3747651pfy.169.2018.09.13.03.32.08; Thu, 13 Sep 2018 03:32:23 -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 S1727127AbeIMPkK (ORCPT + 99 others); Thu, 13 Sep 2018 11:40:10 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:34966 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbeIMPkK (ORCPT ); Thu, 13 Sep 2018 11:40:10 -0400 Received: from mail-pf1-f199.google.com ([209.85.210.199]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1g0Ou6-0005J0-OQ for linux-kernel@vger.kernel.org; Thu, 13 Sep 2018 10:31:18 +0000 Received: by mail-pf1-f199.google.com with SMTP id v9-v6so2732042pff.4 for ; Thu, 13 Sep 2018 03:31:18 -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=Pb+Q/SiNh8ATEDYxlzjH3k/GhDpgaFnhmPlPrDN/U4U=; b=HaCSLWs5ctX3TYSEj+wZTFyby7c0iVBiuHcESIiL1TKdRb5n7wc9KCX8/HUF4nIay4 ggmOgyIdhEk94KgRahju2VS56BKZmSpl3JkXZxUbcFUVAe3pnRGjR2P9Scj4soHOhOhp RDoQfcVyjG6CSXPLNN0B8G9wn0v22KsLb9vW1ckOtltokV7DTFYaMsJoeOOXzF7fG9ZB urOlUVq1/vZ3YmF/Cj5LvKpjoySghyxVzDyRoDOFdoKiij1NS6mIet7cW0qIbdXAzi3t 3ZfAnWZCMZxHGIJhgsHqDe+vrbV+tu9S2vLmnqx6L0pBreuv8B90LETY6HVil06jlWjM oGqA== X-Gm-Message-State: APzg51DXJTjTvqgr5Q7uzveGsBvUTeOVM3efmQJ9+/Dth2JKK9H2WNmH 70a8R/VhoBL7ojv7rRzZh+ig2DGTIHRnoc+RiQ6pEog8DrZU5ca1cUVu0un+ksYoUiX/FBJuaOd nke7b3o8q6H0+GF2PuH/1G4li3cGrKjT7E3KQL5av5g== X-Received: by 2002:a17:902:8a97:: with SMTP id p23-v6mr6550327plo.21.1536834677207; Thu, 13 Sep 2018 03:31:17 -0700 (PDT) X-Received: by 2002:a17:902:8a97:: with SMTP id p23-v6mr6550279plo.21.1536834676596; Thu, 13 Sep 2018 03:31:16 -0700 (PDT) Received: from [192.168.1.206] (220-133-187-190.HINET-IP.hinet.net. [220.133.187.190]) by smtp.gmail.com with ESMTPSA id 3-v6sm6303051pfq.10.2018.09.13.03.31.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 03:31:15 -0700 (PDT) Content-Type: text/plain; charset=us-ascii; delsp=yes; format=flowed Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: [PATCH 1/5] misc: rtsx_usb: Use USB remote wakeup signaling for card insertion detection From: Kai-Heng Feng In-Reply-To: <20180731061721.15831-2-kai.heng.feng@canonical.com> Date: Thu, 13 Sep 2018 18:31:11 +0800 Cc: Linux Kernel Mailing List , Linux USB Mailing List Content-Transfer-Encoding: 7bit Message-Id: <9C387477-5253-497B-8BE2-8245AB88C551@canonical.com> References: <20180731061721.15831-1-kai.heng.feng@canonical.com> <20180731061721.15831-2-kai.heng.feng@canonical.com> To: Alan Stern , Ulf Hansson X-Mailer: Apple Mail (2.3445.9.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alan, Ulf, at 14:17, 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 | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/misc/cardreader/rtsx_usb.c > b/drivers/misc/cardreader/rtsx_usb.c > index b97903ff1a72..f7a66f614085 100644 > --- a/drivers/misc/cardreader/rtsx_usb.c > +++ b/drivers/misc/cardreader/rtsx_usb.c > @@ -723,8 +723,15 @@ 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) > +{ > + 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); > return 0; > } > > @@ -734,6 +741,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, NULL, rtsx_usb_resume_child); > return 0; > } I am working on the next version of this series, and the last missing puzzle is to differentiate system-wide resume from runtime resume in usb_driver's resume() and reset_resume() callback. The parent device, rtsx_usb, has two child devices, rtsx_usb_ms and rtsx_usb_sdmmc. pm_request_resume() is used in rtsx_usb's resume() to facilitate USB remote wakeup signaling, so we don't need to poll the card slot status. But this has a side effect: during system resume the rtsx_usb calls pm_request_resume() in its resume(), so child devices calls their runtime_resume() instead of resume() callback. So, is it reasonable to pass pm_message_t to resume() and reset_resume() callbacks and use PMSG_IS_AUTO() to differentiate them? Kai-Heng > > -- > 2.17.1