From patchwork Mon Jun 10 15:03:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 17738 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E6E2E2397B for ; Mon, 10 Jun 2013 15:04:21 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id q12sf2370969vbe.9 for ; Mon, 10 Jun 2013 08:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=WsiBazzakmwuiECkch2KDZQS3atBr+Prmf+6bb3sDkw=; b=adbm8PpvaVQWkVI8Ws6O8u9nB4phV3rBORuRMB2jwdi/BVEuyi5Nl89ixy889uaP3g n/AKe7esv/FyekCbwhYVBm9L2ICvk4UP1Trqja8/yV8nQxwMhiXw9/CzHP0LpQnrOCUC NI+arAweuTw0RBog1DcSsIXvwj1u6JVRkCyMD3bs82Mydosm9YJtLzYp9kqRvOlWfeog ovX6+6sZNHMuWzOsgMLEA2ph4tZEwiYh1wMdUnJnvTf8wEf5BgqiibKuB3crsT9Wpqt7 ZqXodKfDColDS3/tDuD2NevgguUdealmIWMeYI4Fp+h9bV06Ji+hIxZAA/6GlFq8M01b hZkQ== X-Received: by 10.58.118.7 with SMTP id ki7mr1431736veb.5.1370876661680; Mon, 10 Jun 2013 08:04:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.74 with SMTP id g10ls1418316qey.60.gmail; Mon, 10 Jun 2013 08:04:21 -0700 (PDT) X-Received: by 10.220.170.72 with SMTP id c8mr5905594vcz.14.1370876661441; Mon, 10 Jun 2013 08:04:21 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id xb6si5046966vdb.120.2013.06.10.08.04.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:21 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id m1so4820559ves.14 for ; Mon, 10 Jun 2013 08:04:21 -0700 (PDT) X-Received: by 10.52.170.148 with SMTP id am20mr4964176vdc.75.1370876661272; Mon, 10 Jun 2013 08:04:21 -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.221.10.206 with SMTP id pb14csp71490vcb; Mon, 10 Jun 2013 08:04:20 -0700 (PDT) X-Received: by 10.14.4.130 with SMTP id 2mr992036eej.96.1370876660078; Mon, 10 Jun 2013 08:04:20 -0700 (PDT) Received: from eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by mx.google.com with SMTP id n7si8547558eey.117.2013.06.10.08.04.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:20 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.139 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.139; Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKUbXq7u2AxgtF+fS2U0aYeWJs/CzuMLeW@postini.com; Mon, 10 Jun 2013 15:04:19 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 86659C7; Mon, 10 Jun 2013 15:04:11 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id EFDBA9C0; Mon, 10 Jun 2013 15:04:10 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 30A15A8065; Mon, 10 Jun 2013 17:04:04 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Mon, 10 Jun 2013 17:04:09 +0200 From: Ulf Hansson To: , Chris Ball Cc: Ulf Hansson Subject: [PATCH 05/12] mmc: core: Handle card shutdown from mmc_bus Date: Mon, 10 Jun 2013 17:03:40 +0200 Message-ID: <1370876627-13439-6-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> References: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmmMwSMhNhfx+nGnw3fsK7y058HbhQxnONSm514szrH1cjeYZPOE7KWgdVJSyMiJt7w3Uyr X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 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: , From: Ulf Hansson Considering shutdown of the card, the responsibility to initate this sequence shall be driven from the mmc_bus. This patch enables the mmc_bus to handle this sequence properly. A new .shutdown callback is added in the mmc_driver struct which is used to shutdown the blk device. Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 15 +++++++++++++-- drivers/mmc/card/mmc_test.c | 5 +++++ drivers/mmc/core/bus.c | 9 +++++++++ include/linux/mmc/card.h | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index c900d28..d91507f 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2400,8 +2400,7 @@ static void mmc_blk_remove(struct mmc_card *card) mmc_set_drvdata(card, NULL); } -#ifdef CONFIG_PM -static int mmc_blk_suspend(struct mmc_card *card) +static int _mmc_blk_suspend(struct mmc_card *card) { struct mmc_blk_data *part_md; struct mmc_blk_data *md = mmc_get_drvdata(card); @@ -2416,6 +2415,17 @@ static int mmc_blk_suspend(struct mmc_card *card) return 0; } +static void mmc_blk_shutdown(struct mmc_card *card) +{ + _mmc_blk_suspend(card); +} + +#ifdef CONFIG_PM +static int mmc_blk_suspend(struct mmc_card *card) +{ + return _mmc_blk_suspend(card); +} + static int mmc_blk_resume(struct mmc_card *card) { struct mmc_blk_data *part_md; @@ -2448,6 +2458,7 @@ static struct mmc_driver mmc_driver = { .remove = mmc_blk_remove, .suspend = mmc_blk_suspend, .resume = mmc_blk_resume, + .shutdown = mmc_blk_shutdown, }; static int __init mmc_blk_init(void) diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 759714e..a69df52 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -3025,12 +3025,17 @@ static void mmc_test_remove(struct mmc_card *card) mmc_test_free_dbgfs_file(card); } +static void mmc_test_shutdown(struct mmc_card *card) +{ +} + static struct mmc_driver mmc_driver = { .drv = { .name = "mmc_test", }, .probe = mmc_test_probe, .remove = mmc_test_remove, + .shutdown = mmc_test_shutdown, }; static int __init mmc_test_init(void) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 3b7ca8a..219bf4b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -122,6 +122,14 @@ static int mmc_bus_remove(struct device *dev) return 0; } +static void mmc_bus_shutdown(struct device *dev) +{ + struct mmc_driver *drv = to_mmc_driver(dev->driver); + struct mmc_card *card = mmc_dev_to_card(dev); + + drv->shutdown(card); +} + #ifdef CONFIG_PM_SLEEP static int mmc_bus_suspend(struct device *dev) { @@ -205,6 +213,7 @@ static struct bus_type mmc_bus_type = { .uevent = mmc_bus_uevent, .probe = mmc_bus_probe, .remove = mmc_bus_remove, + .shutdown = mmc_bus_shutdown, .pm = &mmc_bus_pm_ops, }; diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6a98f32..842de3e 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -520,6 +520,7 @@ struct mmc_driver { void (*remove)(struct mmc_card *); int (*suspend)(struct mmc_card *); int (*resume)(struct mmc_card *); + void (*shutdown)(struct mmc_card *); }; extern int mmc_register_driver(struct mmc_driver *);