From patchwork Wed Oct 30 00:36:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21272 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5FD9820354 for ; Wed, 30 Oct 2013 00:36:49 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id qd12sf1888857ieb.10 for ; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=zvEUx15ta9Sk3G1+s0aDT1vST3ZQvPlLENkdTkWTqXA=; b=jYA4zi0wV3QHW65qQXUqU38JSmaq3sbne+RIzUOTFjYgov3ePerSwvUeBoHAXO/nLO eyA4ig/vAs7jJD9ggDY0ubqr30npR+TqqCljl7f4fja/Y4kktnh1x7XimON7rkGZAxRq vDPQi7njuAZMJh92oIEFsGfinruH3j7x3yuHLGyU3jKFNCGn1oKc0LRT53B9kEDQfbC0 agoanin+xh4948uNrTlD3dSf4YeYA4mAdyKehlhHS4SpcIWUCSUdlvSQOH40Gsng/ezD nVLX/9+v3EOLQaEAxM+zylfAXgqqOufR1OJZ86lAvVgDE1s11Qm57aRiYm/AB0YzkTY8 MmYQ== X-Gm-Message-State: ALoCoQnmE1XphjD+5QxcWZVXNjePnF/tVVLE/YmRoytVJ5UZYnD8+dw88ScmaX8TQV3iJ9QXlmRT X-Received: by 10.50.82.103 with SMTP id h7mr227507igy.5.1383093408684; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.5 with SMTP id hw5ls296503qeb.56.gmail; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) X-Received: by 10.221.51.5 with SMTP id vg5mr42624vcb.40.1383093408476; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id uw4si7356237vec.1.2013.10.29.17.36.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 17:36:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id lh4so446748vcb.18 for ; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) X-Received: by 10.220.146.77 with SMTP id g13mr1202243vcv.2.1383093408368; Tue, 29 Oct 2013 17:36:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp244003vcz; Tue, 29 Oct 2013 17:36:47 -0700 (PDT) X-Received: by 10.182.84.132 with SMTP id z4mr1873119oby.49.1383093407509; Tue, 29 Oct 2013 17:36:47 -0700 (PDT) Received: from mail-oa0-f51.google.com (mail-oa0-f51.google.com [209.85.219.51]) by mx.google.com with ESMTPS id u3si453573oev.146.2013.10.29.17.36.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 17:36:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.51 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.219.51; Received: by mail-oa0-f51.google.com with SMTP id h1so750137oag.24 for ; Tue, 29 Oct 2013 17:36:47 -0700 (PDT) X-Received: by 10.182.131.196 with SMTP id oo4mr1941818obb.50.1383093407147; Tue, 29 Oct 2013 17:36:47 -0700 (PDT) Received: from linaro-ulf.smartcity.com (50-201-74-207-static.hfc.comcastbusiness.net. [50.201.74.207]) by mx.google.com with ESMTPSA id xx9sm39780297obc.6.2013.10.29.17.36.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 17:36:46 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson Subject: [PATCH] mmc: core: Use MMC_UNSAFE_RESUME as default behavior Date: Wed, 30 Oct 2013 01:36:43 +0100 Message-Id: <1383093403-4508-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The reason for inventing MMC_UNSAFE_RESUME does not stand any more. Entering suspend without using MMC_UNSAFE_RESUME triggered an ungraceful power cut of the card. For no reason the card device and the block device queue was then also removed from the system. To improve the situation, it is better to suspend by gracefully trying to cut the power to the card and to keep the card device. So in the end there are no reason for actually keeping the option to enable MMC_UNSAFE_RESUME so we remove it. Signed-off-by: Ulf Hansson --- drivers/mmc/core/Kconfig | 15 --------------- drivers/mmc/core/core.c | 17 ----------------- drivers/mmc/core/mmc.c | 18 +----------------- drivers/mmc/core/sd.c | 18 +----------------- include/linux/mmc/host.h | 5 +---- 5 files changed, 3 insertions(+), 70 deletions(-) diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig index 269d072..9ebee72 100644 --- a/drivers/mmc/core/Kconfig +++ b/drivers/mmc/core/Kconfig @@ -2,21 +2,6 @@ # MMC core configuration # -config MMC_UNSAFE_RESUME - bool "Assume MMC/SD cards are non-removable (DANGEROUS)" - help - If you say Y here, the MMC layer will assume that all cards - stayed in their respective slots during the suspend. The - normal behaviour is to remove them at suspend and - redetecting them at resume. Breaking this assumption will - in most cases result in data corruption. - - This option is usually just for embedded systems which use - a MMC/SD card for rootfs. Most people should say N here. - - This option sets a default which can be overridden by the - module parameter "removable=0" or "removable=1". - config MMC_CLKGATE bool "MMC host clock gating" help diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 57a2b40..704fc81 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -65,23 +65,6 @@ bool use_spi_crc = 1; module_param(use_spi_crc, bool, 0); /* - * We normally treat cards as removed during suspend if they are not - * known to be on a non-removable bus, to avoid the risk of writing - * back data to a different card after resume. Allow this to be - * overridden if necessary. - */ -#ifdef CONFIG_MMC_UNSAFE_RESUME -bool mmc_assume_removable; -#else -bool mmc_assume_removable = 1; -#endif -EXPORT_SYMBOL(mmc_assume_removable); -module_param_named(removable, mmc_assume_removable, bool, 0644); -MODULE_PARM_DESC( - removable, - "MMC/SD cards are removable and may be removed during suspend"); - -/* * Internal function. Schedule delayed work in the MMC work queue. */ static int mmc_schedule_delayed_work(struct delayed_work *work, diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f631f5a..afa9c1e 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1640,16 +1640,6 @@ static int mmc_power_restore(struct mmc_host *host) static const struct mmc_bus_ops mmc_ops = { .remove = mmc_remove, .detect = mmc_detect, - .suspend = NULL, - .resume = NULL, - .power_restore = mmc_power_restore, - .alive = mmc_alive, - .shutdown = mmc_shutdown, -}; - -static const struct mmc_bus_ops mmc_ops_unsafe = { - .remove = mmc_remove, - .detect = mmc_detect, .suspend = mmc_suspend, .resume = mmc_resume, .runtime_suspend = mmc_runtime_suspend, @@ -1661,13 +1651,7 @@ static const struct mmc_bus_ops mmc_ops_unsafe = { static void mmc_attach_bus_ops(struct mmc_host *host) { - const struct mmc_bus_ops *bus_ops; - - if (!mmc_card_is_removable(host)) - bus_ops = &mmc_ops_unsafe; - else - bus_ops = &mmc_ops; - mmc_attach_bus(host, bus_ops); + mmc_attach_bus(host, &mmc_ops); } /* diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 6f42050..7346337 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1202,16 +1202,6 @@ static int mmc_sd_power_restore(struct mmc_host *host) static const struct mmc_bus_ops mmc_sd_ops = { .remove = mmc_sd_remove, .detect = mmc_sd_detect, - .suspend = NULL, - .resume = NULL, - .power_restore = mmc_sd_power_restore, - .alive = mmc_sd_alive, - .shutdown = mmc_sd_suspend, -}; - -static const struct mmc_bus_ops mmc_sd_ops_unsafe = { - .remove = mmc_sd_remove, - .detect = mmc_sd_detect, .runtime_suspend = mmc_sd_runtime_suspend, .runtime_resume = mmc_sd_runtime_resume, .suspend = mmc_sd_suspend, @@ -1223,13 +1213,7 @@ static const struct mmc_bus_ops mmc_sd_ops_unsafe = { static void mmc_sd_attach_bus_ops(struct mmc_host *host) { - const struct mmc_bus_ops *bus_ops; - - if (!mmc_card_is_removable(host)) - bus_ops = &mmc_sd_ops_unsafe; - else - bus_ops = &mmc_sd_ops; - mmc_attach_bus(host, bus_ops); + mmc_attach_bus(host, &mmc_sd_ops); } /* diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 99f5709..2a139b2 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -424,12 +424,9 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc) int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); -/* Module parameter */ -extern bool mmc_assume_removable; - static inline int mmc_card_is_removable(struct mmc_host *host) { - return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; + return !(host->caps & MMC_CAP_NONREMOVABLE); } static inline int mmc_card_keep_power(struct mmc_host *host)