From patchwork Thu Jun 8 08:54:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 103351 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2337046qgd; Thu, 8 Jun 2017 01:54:30 -0700 (PDT) X-Received: by 10.84.230.134 with SMTP id e6mr32687188plk.256.1496912069955; Thu, 08 Jun 2017 01:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496912069; cv=none; d=google.com; s=arc-20160816; b=dhvJom5yzI18Nak5lfZCV+QYUuV6vlW1ynnnVjBgrs+jGSHcgMf9TVsydqGumg7pkT FUJ+1nBXP3SF00mTwFyypr7KFKG0V5T0XuB1KMc1wxUdQq1t6iYZkEyMc5OxgP2K2P7s 1A4fjNgQxYD9lIVQ2sQWwIK1OF1/l7RTZtfJMhdfEq31skz5dGnrhKOXXc7F85YN2iSK AOBCo/x1rcBFpgpSQ1Wpsne7SFiRT1qGKP0gkn4CzTqlaux1E21ilN9HllTudFsgk6+C aZ8MEWcEW0ezOGyy5wm4ddvkZL/MzbbhtJR3ASILrHc+1gDCW7LRrj9o5OKHs5kfHTxd dmBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=klBVjwZZV7X5vMVscBvzyXmwk2t3c00k2n7j5uJ82xs=; b=EP+zZaeIoXBIFJfC3pxLsoJem+BZw6EvSCDJzjfH3P8QwXFIkRxzq8ezjEPKLAAVFU HxWD5wdubICKQm3nY1984tqV1wt2joJH8ogRJjdTLZjc3oboLoIdpUjiSKSVCsxnAHx1 0QbPP4sn96+PDe4LuFrMuQK7XUcQyX1l8yXyK4YPZ42gg1yb8wVMFfuecUPnDYbGTBoM U/6AI5WirtIuGXlx6SbE69GWo3O6fAqqqMWIaEpySR6khwI12tR7dmaSDdfJG7H+EXB4 PxZ3HWlDXn7DYDyaJaH6sr/2u3InA1q/ZO/KxdLTBNKb7uY0pBQxO0MXSpEurLQ9AMot itQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x196si4121624pgx.147.2017.06.08.01.54.29; Thu, 08 Jun 2017 01:54:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751856AbdFHIy2 (ORCPT + 6 others); Thu, 8 Jun 2017 04:54:28 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33223 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751850AbdFHIy1 (ORCPT ); Thu, 8 Jun 2017 04:54:27 -0400 Received: by mail-lf0-f46.google.com with SMTP id a136so15259914lfa.0 for ; Thu, 08 Jun 2017 01:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4ksd7MpE5rEyZb5sqw4fRjlckWcTCngtSgrm9DM7t7U=; b=dYX2Vq5lqHBmkntot3POCyLBg9yHTTYOAz7k9UUuXhYRr5EnkCq5ytLlaeSWHDl0qO 2F8sljwmV035NJwmbViYGi/kIVMXwrr7Nf5fWTVQV4UiyVnPTmrpfpu2o8oa4Swqu10K EUhd473loRdBiRXwMfKPuXhNeCrzeecQMzMSw= 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:in-reply-to :references; bh=4ksd7MpE5rEyZb5sqw4fRjlckWcTCngtSgrm9DM7t7U=; b=WxHfh5rHLtqN2ClBcydwTctTvqWmG8f+O7e+mqzyBWpkHC+NVSSm2zJKaPKC2dorAb dhldb7E5u6y0c6LOVJ/CH2tlsesriwMDKw8Df8EdXRQ3X2mrr5HyQHb6NCzwPqpkLICq NBOvaVyOdt3Mdg6rCOjZDXdGon1oB8q5w/TFWlexAtCHvE9pPCMjcJESlAdGQhqo2Aou zdSFRTrp0t5tby4SYmsAkAq5fP6MrorJE2HS+NDPJiyKRy2THat0sBRL1Os3EwCn5Hpb +WTQt+Bsy+aGB2QRLWegklrpUgeR3ovoPg5oKjcZlf9uBBnzhTvwoGai8mSEFJyCsEKr yzcQ== X-Gm-Message-State: AODbwcA0KRHBao8zNkOQup6d2LTJ42YxINe7sJsz51bfUBUJTgnvsjxL ubbCB3CBVOLIJYJ3s2pW8g== X-Received: by 10.25.190.77 with SMTP id o74mr11262937lff.124.1496912065808; Thu, 08 Jun 2017 01:54:25 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n71sm878356lje.14.2017.06.08.01.54.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 01:54:24 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter Cc: Linus Walleij Subject: [PATCH 5/6 v3] mmc: debugfs: Move EXT CSD debugfs access to block layer Date: Thu, 8 Jun 2017 10:54:02 +0200 Message-Id: <20170608085403.11795-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170608085403.11795-1-linus.walleij@linaro.org> References: <20170608085403.11795-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Just like the previous commit moving status retriveal for MMC and SD cards into the block layer (when active), this moves the retrieveal of the EXT CSD from the card from the special ext_csd file into the block stack as well. It has been tested with and without the block layer and during heavy load from dd. Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - No changes just resending --- drivers/mmc/core/block.c | 21 +++++++++++++++++++++ drivers/mmc/core/block.h | 1 + drivers/mmc/core/debugfs.c | 4 +--- drivers/mmc/core/queue.h | 2 ++ 4 files changed, 25 insertions(+), 3 deletions(-) -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 96fe0640c480..4708f95ebdd0 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1176,6 +1176,7 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) struct mmc_card *card = mq->card; struct mmc_blk_data *md = mq->blkdata; struct mmc_blk_ioc_data **idata; + u8 **ext_csd; u32 status; int ret; int i; @@ -1211,6 +1212,10 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) if (!ret) ret = status; break; + case MMC_DRV_OP_GET_EXT_CSD: + ext_csd = mq_rq->drv_op_data; + ret = mmc_get_ext_csd(card, ext_csd); + break; default: pr_err("%s: unknown driver specific operation\n", md->disk->disk_name); @@ -1982,6 +1987,22 @@ int mmc_blk_card_status_get(struct mmc_card *card, u64 *val) } EXPORT_SYMBOL(mmc_blk_card_status_get); +/* Called from debugfs for MMC cards */ +int mmc_blk_get_ext_csd(struct mmc_card *card, u8 **ext_csd) +{ + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); + struct mmc_queue *mq = &md->queue; + struct request *req; + + /* Ask the block layer about the EXT CSD */ + req = blk_get_request(mq->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); + req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_EXT_CSD; + req_to_mmc_queue_req(req)->drv_op_data = ext_csd; + blk_execute_rq(mq->queue, NULL, req, 0); + return req_to_mmc_queue_req(req)->drv_op_result; +} +EXPORT_SYMBOL(mmc_blk_get_ext_csd); + static inline int mmc_blk_readonly(struct mmc_card *card) { return mmc_card_readonly(card) || diff --git a/drivers/mmc/core/block.h b/drivers/mmc/core/block.h index 70861f3a059a..377ebbf6a978 100644 --- a/drivers/mmc/core/block.h +++ b/drivers/mmc/core/block.h @@ -6,5 +6,6 @@ struct request; void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req); int mmc_blk_card_status_get(struct mmc_card *card, u64 *val); +int mmc_blk_get_ext_csd(struct mmc_card *card, u8 **ext_csd); #endif diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index dca5717c437b..cc1f7085111c 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -305,9 +305,7 @@ static int mmc_ext_csd_open(struct inode *inode, struct file *filp) if (!buf) return -ENOMEM; - mmc_get_card(card); - err = mmc_get_ext_csd(card, &ext_csd); - mmc_put_card(card); + err = mmc_blk_get_ext_csd(card, &ext_csd); if (err) goto out_free; diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h index c2325c6659f5..04fc89360a7a 100644 --- a/drivers/mmc/core/queue.h +++ b/drivers/mmc/core/queue.h @@ -37,11 +37,13 @@ struct mmc_blk_request { * @MMC_DRV_OP_IOCTL: ioctl operation * @MMC_DRV_OP_BOOT_WP: write protect boot partitions * @MMC_DRV_OP_GET_CARD_STATUS: get card status + * @MMC_DRV_OP_GET_EXT_CSD: get the EXT CSD from an eMMC card */ enum mmc_drv_op { MMC_DRV_OP_IOCTL, MMC_DRV_OP_BOOT_WP, MMC_DRV_OP_GET_CARD_STATUS, + MMC_DRV_OP_GET_EXT_CSD, }; struct mmc_queue_req {