Received: by 10.213.65.68 with SMTP id h4csp226761imn; Fri, 23 Mar 2018 03:21:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELtc1hgf3PG8aOgL2glMCh8342QMu36jj+NlmJqazrDahNK7tRSfBf3ZuEABoVpXKSsLQ1FM X-Received: by 10.101.88.196 with SMTP id e4mr20244692pgu.162.1521800460731; Fri, 23 Mar 2018 03:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800460; cv=none; d=google.com; s=arc-20160816; b=NKsZ0ux934wnFY+wuB5Nx/s9g2lg3Ya9ShGh6pycyUm26SkBpZGKVP+F7AHhZeMXSZ Ii00E2ls709uXMrN7nAEVkGu/znE+7Y9/PZLp85aUTXG03oNihdAPJgsSe4eJOS+pNjI VANgTw0mCUEvqs1aKwiZgYnhoduNqdAkfRlInD45nhx2tESGeM/SL9pnd4/IAG6uJASn Bc1HbKNemJfRIVrg75fA7aEumR9pBEgBUsrhqDq7AooLd9kgL0m0ObvMHUSE2WdbuybG RJkrVEzxZ/MV3o6+q7hpMBvrm6n3oXenS5IhSGR+Vj9sUrqjYluC5NUGfaEIT9Ge4i4R cvkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+wjdX+L1JfxMA6j+CMSiFmsyp0EXSHY8eGnV28IIRvM=; b=Tpm/jT9Hw6LMToIXUocKZgnb0BLyM74+O8FhDjRueY+9GApMhIqSwtpWKEOHuWr3ts P+A8ruP/vG684nInlmUuw4PTxOG60BWlUq745vDVBleHBnpiObpXX/nwDJEp5ozdQIbg nl3fVidHtcnP7yWswZ4/sR80Wtc9kOPT00ViQD2WW4G7koKymg+EouMNYy1wbRgkzB77 zsQq5klf8cvG1xv3YV9vo3A2bXYguqovmjl+pPhM8m/n1tWClV3QhP3RyF8DR9pd94Vm YwipQ0Nc0wgfp8yolh1QKXTakj2t7hfRvUNnXszt41JChrTT3cGz8O8xmVq/2aQowDnZ L9LA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si8169172ply.528.2018.03.23.03.20.46; Fri, 23 Mar 2018 03:21:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933822AbeCWKUC (ORCPT + 99 others); Fri, 23 Mar 2018 06:20:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48298 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934081AbeCWKT6 (ORCPT ); Fri, 23 Mar 2018 06:19:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 54D3BFC5; Fri, 23 Mar 2018 10:19:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Drake , Ulf Hansson , Sasha Levin Subject: [PATCH 3.18 40/47] mmc: avoid removing non-removable hosts during suspend Date: Fri, 23 Mar 2018 10:55:31 +0100 Message-Id: <20180323094249.825988801@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094248.117679641@linuxfoundation.org> References: <20180323094248.117679641@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Drake [ Upstream commit de8dcc3d2c0e08e5068ee1e26fc46415c15e3637 ] The Weibu F3C MiniPC has an onboard AP6255 module, presenting two SDIO functions on a single MMC host (Bluetooth/btsdio and WiFi/brcmfmac), and the mmc layer correctly detects this as non-removable. After suspend/resume, the wifi and bluetooth interfaces disappear and do not get probed again. The conditions here are: 1. During suspend, we reach mmc_pm_notify() 2. mmc_pm_notify() calls mmc_sdio_pre_suspend() to see if we can suspend the SDIO host. However, mmc_sdio_pre_suspend() returns -ENOSYS because btsdio_driver does not have a suspend method. 3. mmc_pm_notify() proceeds to remove the card 4. Upon resume, mmc_rescan() does nothing with this host, because of the rescan_entered check which aims to only scan a non-removable device a single time (i.e. during boot). Fix the loss of functionality by detecting that we are unable to suspend a non-removable host, so avoid the forced removal in that case. The comment above this function already indicates that this code was only intended for removable devices. Signed-off-by: Daniel Drake Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2656,6 +2656,14 @@ int mmc_pm_notify(struct notifier_block if (!err) break; + if (!mmc_card_is_removable(host)) { + dev_warn(mmc_dev(host), + "pre_suspend failed for non-removable host: " + "%d\n", err); + /* Avoid removing non-removable hosts */ + break; + } + /* Calling bus_ops->remove() with a claimed host can deadlock */ host->bus_ops->remove(host); mmc_claim_host(host);