Received: by 10.213.65.68 with SMTP id h4csp262767imn; Fri, 23 Mar 2018 04:12:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELtjJvWYzYi9DqUAFRN0VpIUdqRo804W3NWyJ7J189Q3oTLTLXVoGlm0wkDzEoLkJLNOLtsT X-Received: by 10.99.127.91 with SMTP id p27mr20588783pgn.28.1521803564986; Fri, 23 Mar 2018 04:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521803564; cv=none; d=google.com; s=arc-20160816; b=SrdfjqA5WZ0NFH97XNRKKdfMoTf2jdgxMDqD4d2XcFQrrSVzER+aSqin8La5M2Wtg9 Brxttyal9QXQKmHwV0coz5cYG50vII57aSyUWSPGsmGh4Nc30i9yA07xJdqYYeXe0Koa HlYw/7y+IPG3kFDVZNWT1VygohCu/W4HoXQP4nwWB0SvVnHJBD09L5XJe6fS6NEAzjT9 jCDpsxytNpLE1vhiljsH1VH1+4kS6qdQwUGitgKvHjMkyuMvBjZV1MfdfXvcjlkvz853 1lJNRCTHbpOk4mmUdoPUhJa8zLCt0OUvMIVCPVvbO42yd8rNaapszu1Ayd8oo80+vaaG dJwA== 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=DDf/hZ6Yvm0qOEM1GaRfRApEGO3r1bdwZMdHbXktoDQ=; b=XbIyQEQ9NQeX/SyAcxzlSLf24X/CfQ7ou70wxdvAX10LVnwEqiZEe5b5u4LQE9xNI2 V5SjhGLEiTG/GwQC8xeXAQdM4M9RgBje6hfhmr5PxI44bf4lOsVZN86czVtmrcLOEaGS fTMUbQDS8eoxGolO9AZWZrry+N2Z7QjPj3bE8hZxBURio/Ez6b/v7mO8UGDp+BSLHWwQ I8PGu6aJXIL0O6RxlwRyLruaHLX5nwUHWcKyNLIBLtge3qXIbYda48H+drZCXjWnljEu 3RP/IRJtip9iXQCZPcCF4+7mZPG/D5adTnreWst93QnIi/s8Z8b9lfziFgGk1RI1B4dZ QwQA== 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 z1-v6si3314873plb.101.2018.03.23.04.12.30; Fri, 23 Mar 2018 04:12:44 -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 S932933AbeCWKLQ (ORCPT + 99 others); Fri, 23 Mar 2018 06:11:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43726 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932899AbeCWKLI (ORCPT ); Fri, 23 Mar 2018 06:11:08 -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 92E7BE19; Fri, 23 Mar 2018 10:11:07 +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.9 150/177] mmc: avoid removing non-removable hosts during suspend Date: Fri, 23 Mar 2018 10:54:38 +0100 Message-Id: <20180323094211.807167997@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094205.090519271@linuxfoundation.org> References: <20180323094205.090519271@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.9-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 @@ -2974,6 +2974,14 @@ static int mmc_pm_notify(struct notifier 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);