Received: by 10.223.185.116 with SMTP id b49csp5965724wrg; Wed, 7 Mar 2018 22:49:36 -0800 (PST) X-Google-Smtp-Source: AG47ELvkCfNQk5W0ensZOscQQi4jtQVxTwsHBMIebJyx7XyBn+rsiasL5vWVWUM8sgSjxZcnJWx8 X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr23289760plb.280.1520491775974; Wed, 07 Mar 2018 22:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491775; cv=none; d=google.com; s=arc-20160816; b=Pg6pwfg4EGriapkULSTce6jq06hHus1Pudt8WINt4yXno5P2UNKqMqEhkEQOszL6SI 2MCfgp/ncrn6CUdI+kOf42sNVVOhKziflip0OPTVCOs0tKuhY95EJJYg1ywTOItr8Mw5 1iqi3zTYer6tVi3FxuFwpiTtLe+mnCILg5EEOefb/ulb3uA9DZD5FZTu6rjbW9i0G5bw QJYhUMtK8VI62p+bgyF8DZ1qi8Tt9VUwovZzwjTlvYV7194v4fP8/NE31zia4jqcNA8H jiAU+vLtg4YKpwBTAiJeGZJynDs4X8TtOwvdMnwON2uIxKKIoQ0quxqkRMa7ONRJrl8S vG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=E/OMy+9WnUASCdu6J7ZMVqtMR2FSl1MLVJn7w8GvDX8=; b=y+JM44nfVtowg0PiYh1ekhyvJboUgqW34u1rIFt70vbPpXk/wisjPQJIA9P0MiBoKo FRyZaCxkk9vuu+CFqDE40Qjj5LuH3VZGV4n6enctZckfNMNuxIoj1kuRuoyOiB2rOk5P U891kW5OiHmFD3fF73h3IPFkweHv0tccwMsFtsQYgvPVRgee0C9Aj3FTU2CnHPjOtqK4 TQWzKB2/IENyQwpauF+zaJkXwGStQHry/P29JIJM/G+DImMxn1muxxMdfmwMEMa9NLly un7zjcuOBhFytinsF/QG7YJfOC4S/Lx4d74gMTaJGC7Ad2BDMZM3Xkg2AkjNe5yeaNWP YyFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZvaAJtWi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si14118842pld.545.2018.03.07.22.49.21; Wed, 07 Mar 2018 22:49:35 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZvaAJtWi; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965303AbeCHGrT (ORCPT + 99 others); Thu, 8 Mar 2018 01:47:19 -0500 Received: from mail-by2nam03on0121.outbound.protection.outlook.com ([104.47.42.121]:43475 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965103AbeCHE6V (ORCPT ); Wed, 7 Mar 2018 23:58:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=E/OMy+9WnUASCdu6J7ZMVqtMR2FSl1MLVJn7w8GvDX8=; b=ZvaAJtWi1RQG4hg45d7YxYEJwvKWiGg5+HDYOfTAuarfGZ54cR3nlJHCqOVt4pWwOMSzL8tjyn8RHhj6GibsUzPnqqCGjaiuwTpTlZiBp2hU3bDuqfQ0V3by4uCKz04mtQWTT3bE4qKwcOpabX1MOUMtOSa1UzrxZfwbVC4GJrA= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0885.namprd21.prod.outlook.com (52.132.132.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:58:17 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:58:17 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Daniel Drake , Ulf Hansson , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 28/67] mmc: avoid removing non-removable hosts during suspend Thread-Topic: [PATCH AUTOSEL for 4.14 28/67] mmc: avoid removing non-removable hosts during suspend Thread-Index: AQHTtpn+Fl0M8yDXhU+ejPYG93PVig== Date: Thu, 8 Mar 2018 04:57:43 +0000 Message-ID: <20180308045641.7814-28-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0885;7:zuqU/DoFZzjo83xnsnO/vPYGAGjYhnetaTTEyr0Hefh2Y7LP0zdowgKTX437AJQrTV+EuAbxB6/UKpNG1q21Zwi9+IBftLHdG7n1VIqrmvFwtsakalz32A097ipYVO6LuOji0iAqorL3CGqU0EouP5sNCQEFXLlRBEeeak+zbqctmfWaiIhqvR+zP2+Wm030BAP8ywRleT95vmg1yRxTCIGreObuDc9P/8MHyz49KaGf3s0c4EAfw+iXda9V0BQP;20:rxQPZtfQkecu3H8E2xYaL3JqXQpJf4f0DeNEA1AlnKx1p4ZUzFRI4hFmKxr9UWuqtlgQH/DehFlQf4jZG/6VjeInMCCxW1ywTczv+i5KbfMVtjUPizP7GzuB3mafErkHXMc8P0IPvBIuWaE3J2HeQA3rriU0V1EuEbQppPK2c8U= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5cc70b80-b60e-4434-8bd2-08d584b13502 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0885; x-ms-traffictypediagnostic: DM5PR2101MB0885: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231220)(944501244)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0885;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0885; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(346002)(39860400002)(39380400002)(189003)(199004)(305945005)(10290500003)(14454004)(2906002)(6116002)(6512007)(3280700002)(1076002)(7736002)(86612001)(2501003)(99286004)(5250100002)(186003)(3846002)(6436002)(59450400001)(22452003)(6486002)(26005)(53936002)(102836004)(76176011)(72206003)(478600001)(36756003)(81156014)(54906003)(25786009)(97736004)(105586002)(10090500001)(316002)(107886003)(15650500001)(110136005)(4326008)(575784001)(6666003)(6506007)(81166006)(8936002)(8676002)(68736007)(3660700001)(86362001)(5660300001)(106356001)(2900100001)(66066001)(2950100002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0885;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: dFkJ1YNIueR1nX5QvIY6U7fhyVGsj/e5uWhrRGGbCm8oLqV0gGnWvubU/mQq2SCZPEugtXyy0siHmTYO6WepmjijzYP1B3rLhVO7s2SUfIbBL5HxtBLPVShrENGrSq5kVYoYgQavT/ELiXM70tOea/03MOOzb66r7n0d9U+Pgy2xbs4l6+VfZLkF1M1yzrBz7MzRBk7rZZol+sCkCmxw6WuFn2THK/xykgHNqHyZtTWBGlg7WDhIozOAecJkukYTqWizP8c1s5bUmYx94m+eyQRtaJDUbeKcgJkt/mol+bUxQwCvAqrGZ1Hf6oAjCZl9bL/sDF/okTYfLB4VSDuxyg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cc70b80-b60e-4434-8bd2-08d584b13502 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:43.8774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0885 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/mmc/core/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 66c9cf49ad2f..29bfff2ed4d3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2751,6 +2751,14 @@ static int mmc_pm_notify(struct notifier_block *noti= fy_block, if (!err) break; =20 + 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); --=20 2.14.1