Received: by 10.213.65.68 with SMTP id h4csp225567imn; Fri, 23 Mar 2018 03:19:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELvCv4qkSS405spS63cCUz8CuXPx94eIoHVkw4zdqAv94IHuszMHAzZmanTHnP6O84XrczaJ X-Received: by 10.99.115.84 with SMTP id d20mr20676707pgn.362.1521800355419; Fri, 23 Mar 2018 03:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800355; cv=none; d=google.com; s=arc-20160816; b=dkdCgZ6xhrb5KotbKlJ8ikF3VohKFIVYkzYGsbsa9h84ILFrAq1LMaK5RNg9Jw1+Sa eyxW5p6Eapy2+S8ss9BMpiPmsF8HV795FSzzIeE+4x2NZnFVZjc/ZoeRs132NQcjlC6o +SckL0sxZTx9YZsZ8PF7T6DeIAisv46ijhEBghsyGtGsGHvWBBIOxVVjL3cBOr9mAnE+ NQT+IveEQlvD5DZCF/XX/VPhs2qru9ULFn+cgWeBT/vOnfCHMlL/xesbn/FPN2nFZjTm oA69jAJf6fX2lPXAYE3Xzfu5roBOuSR7X6cYOTpjhFneuHaD6LKtULB3pMfUVyJ99p3z q4qg== 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=Vlzol39d+O9aMF9F8XY03DsiM2Fnsx54KnYLVg22cik=; b=A/8fXzUVIo5u0wRpFM5HzXaHYfycIYm0HSHw/60/EvjCKuUFULZrW1azDhZ44xi51S 3YQ3OnMj383Td8mzrp8Ci7T80OhpMAnKqo11M1mtqPOUokPdwHu1uK0FfQC16UiHf0uW Lfj1amdmJaS8R5tXNPF/HaxsVlKgBwCdpXcloSPpZDFqjw9QPRTIo6yqoSqKU43CF2K6 WWHZqjm6RnJrNLXqpU5mB+WT0kzFKwSrQbuITa28U1h/eADYsNkGhalFcIptUxHgj8Az qzR8YzkkSAnDk3WGDxTedJNNugNDtB82doqVM6ge8DADyhDYgl0FU0KQ3rpdZW/Sdz2q i/xA== 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 c10-v6si8468618pla.602.2018.03.23.03.19.00; Fri, 23 Mar 2018 03:19:15 -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 S933860AbeCWKRu (ORCPT + 99 others); Fri, 23 Mar 2018 06:17:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47342 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756000AbeCWKRq (ORCPT ); Fri, 23 Mar 2018 06:17:46 -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 97FE8EF1; Fri, 23 Mar 2018 10:17:45 +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 4.4 82/97] mmc: avoid removing non-removable hosts during suspend Date: Fri, 23 Mar 2018 10:55:09 +0100 Message-Id: <20180323094202.121320977@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@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 4.4-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 @@ -2791,6 +2791,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);