From patchwork Mon Jul 14 09:34:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gao, Yunpeng" X-Patchwork-Id: 4543721 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9644EC0514 for ; Mon, 14 Jul 2014 09:32:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E530120131 for ; Mon, 14 Jul 2014 09:32:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D62F520149 for ; Mon, 14 Jul 2014 09:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751282AbaGNJcs (ORCPT ); Mon, 14 Jul 2014 05:32:48 -0400 Received: from mga09.intel.com ([134.134.136.24]:44089 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753855AbaGNJcp (ORCPT ); Mon, 14 Jul 2014 05:32:45 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 14 Jul 2014 02:27:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,657,1400050800"; d="scan'208";a="542956259" Received: from spark-hp-compaq-8000-elite-cmt-pc.bj.intel.com ([172.16.181.71]) by orsmga001.jf.intel.com with ESMTP; 14 Jul 2014 02:32:43 -0700 From: Yunpeng Gao To: linux-mmc@vger.kernel.org Cc: Yunpeng Gao Subject: [PATCH] mmc: blk: add emmc cache flush in shutdown callback Date: Mon, 14 Jul 2014 17:34:19 +0800 Message-Id: <1405330459-2335-1-git-send-email-yunpeng.gao@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If eMMC Cache feature enabled, we'd better flush eMMC cache in the shutdown callback. Otherwise data corruption issue may be observed. Signed-off-by: Yunpeng Gao --- drivers/mmc/card/block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 452782b..8a4010e 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2509,6 +2509,10 @@ static int _mmc_blk_suspend(struct mmc_card *card) static void mmc_blk_shutdown(struct mmc_card *card) { _mmc_blk_suspend(card); + + mmc_claim_host(card->host); + mmc_flush_cache(card); + mmc_release_host(card->host); } #ifdef CONFIG_PM