From patchwork Wed May 16 10:57:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 10403599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46391602C2 for ; Wed, 16 May 2018 10:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 354DD287D4 for ; Wed, 16 May 2018 10:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29C56287F3; Wed, 16 May 2018 10:58:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE69B287D3 for ; Wed, 16 May 2018 10:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbeEPK6Y (ORCPT ); Wed, 16 May 2018 06:58:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:25816 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbeEPK6X (ORCPT ); Wed, 16 May 2018 06:58:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 03:58:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,390,1520924400"; d="scan'208";a="199806476" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by orsmga004.jf.intel.com with ESMTP; 16 May 2018 03:58:19 -0700 Subject: Re: [PATCH] mmc: core: Set card as removed in mmc_remove_card() To: Shawn Lin Cc: Ulf Hansson , linux-mmc@vger.kernel.org References: <1523431471-204238-1-git-send-email-shawn.lin@rock-chips.com> <97f9b7a2-5d94-9695-eb4c-cb11d3ed4e9f@intel.com> <8325e600-b3fd-5bbf-51cf-c1964cf2bfd3@intel.com> <7956dabb-1463-8db4-1162-c1de86fb8eda@rock-chips.com> <7b03d345-e9da-cf06-adea-6f5f9fcfa5b8@intel.com> <3f4e3adf-2235-6fbb-c7c1-293480c4a11f@rock-chips.com> <6788b543-ddb7-ed0a-8c97-4993e1f22042@intel.com> <2685b56e-053f-5ecf-6751-0460930f58e6@rock-chips.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <9674ff5c-ac9a-6f76-0e60-be2fe70784bb@intel.com> Date: Wed, 16 May 2018 13:57:09 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <2685b56e-053f-5ecf-6751-0460930f58e6@rock-chips.com> Content-Language: en-US Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 26/04/18 14:28, Shawn Lin wrote: > On 2018/4/26 18:09, Adrian Hunter wrote: >> On 24/04/18 12:13, Shawn Lin wrote: >>> >>> On 2018/4/13 15:55, Adrian Hunter wrote: >>>> On 13/04/18 10:21, Shawn Lin wrote: >>> >>>> >>>> No we always remove children (card) before the parent (host controller). >>>> >>> >>> Ok, I agree with this. One thing now come to my mind is could we allow >>> mmc_remove_host() to help remove children in advance or is it okay to >>> add a new helper for host drivers to remove children in their >>> ->remove()? >> >> Lets' step back a bit.  At what point does the remove end up waiting?  Does >> it get to mmc_blk_remove()? > > I guess the remove might get to mmc_blk_remove for sd/(e)MMC cards. Yes, this works for me: --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 03e3d48b083e..54457d8745cd 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2968,9 +2968,11 @@ static void mmc_blk_remove(struct mmc_card *card) mmc_blk_remove_debugfs(card, md); mmc_blk_remove_parts(card, md); pm_runtime_get_sync(&card->dev); - mmc_claim_host(card->host); - mmc_blk_part_switch(card, md->part_type); - mmc_release_host(card->host); + if (md->part_curr != md->part_type) { + mmc_claim_host(card->host); + mmc_blk_part_switch(card, md->part_type); + mmc_release_host(card->host); + } if (card->type != MMC_TYPE_SD_COMBO) pm_runtime_disable(&card->dev); pm_runtime_put_noidle(&card->dev);