From patchwork Wed Dec 6 10:57:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 10095491 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 0845660327 for ; Wed, 6 Dec 2017 10:57:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D9F29BE6 for ; Wed, 6 Dec 2017 10:57:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E52A029CAA; Wed, 6 Dec 2017 10:57:31 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 5E93129BE6 for ; Wed, 6 Dec 2017 10:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbdLFK5a (ORCPT ); Wed, 6 Dec 2017 05:57:30 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34769 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbdLFK53 (ORCPT ); Wed, 6 Dec 2017 05:57:29 -0500 Received: by mail-wr0-f196.google.com with SMTP id y21so3429485wrc.1 for ; Wed, 06 Dec 2017 02:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=JQMRw7PIgkU9eAhi3lAQjr8MzScfPF8NwVcnBc3A+LI=; b=lr68ZtYzt17M7fQNbgk0ZBRbx/dvpngaRGvTXpXf4Zc8C33B1Slb1JjDWVT1cl90fY tgBQSfnwUNURMp8yooQy82tXgvGC9MsZIj4bfxfziCWW7uLMfUH5JpYW1ASQVW7g4RCt DN/VscCmZ3iNqgrSQXmaDWE4Q2ZdDuYJczIonYMDIzsOpLWB6gZFzFK4LWlZs/1JHhX8 BMrbmeWU2eelJbM+CUWZoV0K3M6ho2pm1E1Zl5d9lUUQT0mGxD972k4ktSXK1VgDKSFA u5aU+9ALYz4rm6iVIPHeXwvUKctabaBp4jyfTXAfotMWDqaj2cdnFaFRc9BWH9aHnCKJ xnLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=JQMRw7PIgkU9eAhi3lAQjr8MzScfPF8NwVcnBc3A+LI=; b=FrhOt4dELcL79KAQrIO7mcwIU/zqn5Z9enibTr1dgRZso4A4vdHb8LchNgGkkv6L2g n/DqumP4M+CN31SGFqHd5p7VPjI2cXqOBh26aNjjSx17kTVdBqy35yc1TGeLxL0JUbp3 ya5KERbXhur9rFwufGYmj1Zc4D9wFsYnojACjaGAVIc5rM7EDJJa5Tbk3ZcN4BUb6qAf OfBkWBNS599rHAH8DO8gVV5q28FrwP9XOXKcQQfI1xNjpyqBdafedGLfRS1Zm6lpdu5M gA95dOcZu0KddrEhaOvT0aFp40uhxMqvzOIYSwnheIPg+F8sOsbkutFrK2UcUZ2tNK12 bocg== X-Gm-Message-State: AJaThX6GzEvczNOPbI6v80unKRV4HRYD6bVTyVJRPMayc47ecJz8dysJ Xt4tXB2VlPkYb7seX3kaTb+40MLN X-Google-Smtp-Source: AGs4zMb1SJwj1bz2R7GaPrJkUZnDcr7l/v8L4YCHCL6ztqF2ZDQ04yA2Kzk/9Z2R2WldOMUFAvondA== X-Received: by 10.223.186.197 with SMTP id w5mr18074936wrg.201.1512557848532; Wed, 06 Dec 2017 02:57:28 -0800 (PST) Received: from limbo.default ([95.144.108.70]) by smtp.gmail.com with ESMTPSA id w76sm3093660wrc.79.2017.12.06.02.57.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Dec 2017 02:57:27 -0800 (PST) From: Daniel Drake To: ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux@endlessm.com, matthew.leeds@endlessm.com Subject: [PATCH] mmc: allow rescan of non-removable hosts on resume Date: Wed, 6 Dec 2017 10:57:24 +0000 Message-Id: <20171206105724.5603-1-drake@endlessm.com> X-Mailer: git-send-email 2.14.1 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 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 permitting another rescan of non-removable devices when we forcefully remove a card under these conditions. Signed-off-by: Daniel Drake --- drivers/mmc/core/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 1f0f44f4dd5f..e436cde50bc4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2966,6 +2966,10 @@ static int mmc_pm_notify(struct notifier_block *notify_block, mmc_power_off(host); mmc_release_host(host); host->pm_flags = 0; + + /* Force a rescan on resume, even for non-removable cards */ + host->rescan_entered = 0; + break; case PM_POST_SUSPEND: