From patchwork Fri Jun 30 12:06:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 106689 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp5835149obb; Fri, 30 Jun 2017 05:10:28 -0700 (PDT) X-Received: by 10.99.99.193 with SMTP id x184mr20324999pgb.13.1498824628498; Fri, 30 Jun 2017 05:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498824628; cv=none; d=google.com; s=arc-20160816; b=0x747p4QzUM4rNtDG8qgiiqRJyomlo6g2wEjsZ1yB5oWBkvBySmqyyGfcCdma3b900 Dv/BDF+KYknpnjC+wDz9vImzW9A1CtuQmw6Cs6Fkx+bN21pHJvDGUvUTDY8336/JUzq0 8NVnsREFSaRdSReWDJ6EallNqH0TSJ6fkBAfYKV6ucNTprFzev2iGLQC2XE2ofyP/qcv rPys5msiWPSFiluA564ADYKxnuu0nrx5aQFW7phSeEz4fCOsaaVaPh8R81qObXlKZDXn xx8kMiYLa7i1MMfUEOcQJivCjCsOfs5iBr6ojNlVRykoVGJYeWrlhN63jlYSrSrP/wFq G2Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=nOg/YDmo3s/84azF23QesXNXGrnmoU4YqET2yI3vQfA=; b=dNIZFUe7TREy6gjyjkJWTohh9l2p1qwiOWo/FjJP47tKribpKr9RFygygCC2BQRd2E PA0aZ2vgVafW39VKvqVZZa6dywFyPFeR1HXicb/9xc6eCn9VyERK2rgpB8SMk/zMPf0K xkRZrIn+nPp20sdp5vkoq1f/J0cGoPNmhhQFnSTdYDQwDvFCnV6GQOSeA+XeTpmXdgHE ue0tMQEKfjz636w+MZGEnJOh2n4PuR1EEOKP4MkUEl34oADrXA1GEoF34+eRUqtG07G6 t8xUJg3uCLr+mk3Nk4NLIbV/PlkYYA2rng33Oioam9cXNVc1u3dKhWsFz3yG9tQAYZW7 z73w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=fLbClIvK; 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 m63si6016544pld.547.2017.06.30.05.10.28; Fri, 30 Jun 2017 05:10:28 -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 header.b=fLbClIvK; 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 S1751917AbdF3MIu (ORCPT + 6 others); Fri, 30 Jun 2017 08:08:50 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:34615 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751649AbdF3MHO (ORCPT ); Fri, 30 Jun 2017 08:07:14 -0400 Received: by mail-lf0-f45.google.com with SMTP id l13so69096079lfl.1 for ; Fri, 30 Jun 2017 05:07:13 -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; bh=RbY4bC/SeC0wuejhgGeaK30nwvkyj8U7rG0F7g0UyEk=; b=fLbClIvKlSfIfCF20xhI3txGaw+VV01r4sTxL2IS016+QEAKZkdTzMbvxeMaV0ehb7 yxVxLO0A0NWvg/LWcZngRycNwDnBgl7ARDkqnajTctnVw9R9HpiSvTJ437Cme21kszli LuCNSccUChvtGquALHBDZyPa2PkXAeysIWZjI= 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=RbY4bC/SeC0wuejhgGeaK30nwvkyj8U7rG0F7g0UyEk=; b=Lx2aAtV3OcjdgLK0EHPdwf7BntS1O8Chxg8Y9fg5Gk+2q8+a0ByCEvTmkUvTXHyu2H +g6jjLC9R5MY2yIFp/Q1mYADCl8/ADArptGWDOn0BsL441FBqVOS62zsA9Pqg9Do0/Jy GBRTfGceaP2LpMNQlnKibsVr1fpxlIE2aXNTJREjxyPAQqJKGHFwjzZQhueS5DUlMgkT 6lrLx/RpduGQrAG2igXchrLY1nptgUK4c/diVmV+pRezwegKhPRYpTOtdrFGjpAqVW7O PQsrHGX9o3vDVX7ZJEQVF+F+EXMS0MSugGvJe1e6B4AZsKGyAVOzcFliamOURq0ZpZhF +CcA== X-Gm-Message-State: AKS2vOzVHTa1PzYPHOewe1RitwJ0CkGd0LX7oVYQDGYaWaGhXAVfxk3O 176wbZf7/qEoLzOE4MPHfw== X-Received: by 10.25.153.134 with SMTP id b128mr2785974lfe.90.1498824432029; Fri, 30 Jun 2017 05:07:12 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 19sm1531492ljv.62.2017.06.30.05.07.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 05:07:10 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Adrian Hunter , Linus Walleij Subject: [PATCH 1/3 v4] mmc: block: Anonymize the drv op data pointer Date: Fri, 30 Jun 2017 14:06:47 +0200 Message-Id: <20170630120649.27007-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org We have a data pointer for the ioctl() data, but we need to pass other data along with the DRV_OP:s, so make this a void * so it can be reused. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - No changes just resending ChangeLog v2->v3: - No changes just resending --- drivers/mmc/core/block.c | 8 +++++--- drivers/mmc/core/queue.h | 2 +- 2 files changed, 6 insertions(+), 4 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 3c7efbdc8591..d410f578b8df 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -598,7 +598,7 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, __GFP_RECLAIM); idatas[0] = idata; req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_IOCTL; - req_to_mmc_queue_req(req)->idata = idatas; + req_to_mmc_queue_req(req)->drv_op_data = idatas; req_to_mmc_queue_req(req)->ioc_count = 1; blk_execute_rq(mq->queue, NULL, req, 0); ioc_err = req_to_mmc_queue_req(req)->drv_op_result; @@ -674,7 +674,7 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev, idata[0]->ic.write_flag ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, __GFP_RECLAIM); req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_IOCTL; - req_to_mmc_queue_req(req)->idata = idata; + req_to_mmc_queue_req(req)->drv_op_data = idata; req_to_mmc_queue_req(req)->ioc_count = num_of_cmds; blk_execute_rq(mq->queue, NULL, req, 0); ioc_err = req_to_mmc_queue_req(req)->drv_op_result; @@ -1175,6 +1175,7 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) struct mmc_queue_req *mq_rq; struct mmc_card *card = mq->card; struct mmc_blk_data *md = mq->blkdata; + struct mmc_blk_ioc_data **idata; int ret; int i; @@ -1182,8 +1183,9 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) switch (mq_rq->drv_op) { case MMC_DRV_OP_IOCTL: + idata = mq_rq->drv_op_data; for (i = 0; i < mq_rq->ioc_count; i++) { - ret = __mmc_blk_ioctl_cmd(card, md, mq_rq->idata[i]); + ret = __mmc_blk_ioctl_cmd(card, md, idata[i]); if (ret) break; } diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h index 361b46408e0f..cf26a15a64bf 100644 --- a/drivers/mmc/core/queue.h +++ b/drivers/mmc/core/queue.h @@ -51,7 +51,7 @@ struct mmc_queue_req { struct mmc_async_req areq; enum mmc_drv_op drv_op; int drv_op_result; - struct mmc_blk_ioc_data **idata; + void *drv_op_data; unsigned int ioc_count; }; From patchwork Fri Jun 30 12:06:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 106691 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp5835617obb; Fri, 30 Jun 2017 05:10:53 -0700 (PDT) X-Received: by 10.84.196.129 with SMTP id l1mr24366333pld.109.1498824653459; Fri, 30 Jun 2017 05:10:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498824653; cv=none; d=google.com; s=arc-20160816; b=OmIhtx34yreV5tH5wjpxAicioD+Ef3VfVXfV4Pqjheuv/qZrgHq/4JyjiUplJia8mn PcY7UCUG2ENfDMrSjYjhjJHo1SixUO52OMKueVDBCmHkOYjhqeStCrlznOJ7TM9ZzLhi BaZj4b+4PRi3MtBt2Yq3Q95OqEiXta9gWR7Mb2MfVZHIioj8+RgDMmcyrnyblK5c89Bv M3lQv6cGHjMBxrM3mLU/qcykPMr30ptHQbtg++Z5PoAHSKQFJIybc/wR19hWnhgTZIhF 6NG53iJcOO/FhC2KxlpngpocUkoHdtbEK73d2dxjFhfEW9hcoqKEshVe7kq9TlLlahlm bb5A== 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=1N9nyL/jN6AHwneNCXak0+DrvjTrFm/hs1qTR7rqgkc=; b=Q8e1iOo37i2wsOIgCmjil5RFg/nccmeh1NIlPr7IM8ggeI+B6GF2DYgt0syOTno7Qv pNCJC89Q75iw2bsEWIjBRxNfHvdPIcfZ9vEsRC9noZ9KTUGfzf3wQcp7ViSj//pVcbPY BGYb8qNutXN8N3rDCJWC0Bb+PrsqH3XJiqTI3v+TatfRqDQH8UFxwy3HCtxC0uw5zZI4 xoIUlmNT90Z9VlcU0ZEfnucnpL35ZkKcrIWHW7slfE61vr6yYtBtXShJLsgp3+lz5o/N pBoEdTcGGHIC8B0dEm8Yv4m4NTWiGSCQkQlmmcXi/vdKHJhwTAbWdyxS5yviPb3FJh+S X3ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=kscGwodj; 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 i187si5612045pfc.217.2017.06.30.05.10.53; Fri, 30 Jun 2017 05:10:53 -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 header.b=kscGwodj; 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 S1751565AbdF3MIs (ORCPT + 6 others); Fri, 30 Jun 2017 08:08:48 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:35925 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752009AbdF3MHX (ORCPT ); Fri, 30 Jun 2017 08:07:23 -0400 Received: by mail-lf0-f47.google.com with SMTP id h22so68990367lfk.3 for ; Fri, 30 Jun 2017 05:07:22 -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=Upt2h5gEs/vi/huw9w8iwJZelIZ6bGF+jPv+sXRDAe8=; b=kscGwodjAd6bdyRjf/KTVaM3WYQAjZxvzOJv5EKbhkJ4DWpjOtokTbqySJg1e01hgl o5gkSkbmMAbrCRikn7pcx4dl2Mx5LiPOLHEDzZvWtQ/PSo1imeFvblfBDUd3hftoYU5T csintaW5W6IsEgu8iXvm9Vnr+OeUEFUZIEwNc= 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=Upt2h5gEs/vi/huw9w8iwJZelIZ6bGF+jPv+sXRDAe8=; b=hl2n8AbyB4F/DEXA+xyj5D8XNVN3/tlLPjOXx/C9iNbTvcL6Alu88QteMs85ashXjW j+zHCYdg4paKDo8uuQhoYGg/mjJUibJnZY3w0KvZ6Sam6flfv+7LrA6oyUFXl84JLktu X4CzldatULOS5Y8++KVAa6Edod1iSjVC31pYCui/6W+oNss4kxP5C+prcyb5Buyopaga aoIr+ftineBIzQ3ojrYj5+dqlBJC1+E86FiKVz8GLuezkdnnhM3KTJqnTkJ08p+ibPk5 L2cAlpkAk3S+WqLUGkFmovLkrpxoXfxloEQHCwaaFiMdo1uCgIDX7NpeD775RHH/sBFQ pcHw== X-Gm-Message-State: AKS2vOyO2/t9oyXRWHFsF7Lg2rVVggSvwowM1A7PLpGImscq/3uvVHdb i/Cr/GK9tKyylnYRqPYmYQ== X-Received: by 10.25.79.9 with SMTP id d9mr4348556lfb.133.1498824436181; Fri, 30 Jun 2017 05:07:16 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 19sm1531492ljv.62.2017.06.30.05.07.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 05:07:14 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Adrian Hunter , Linus Walleij Subject: [PATCH 2/3 v4] mmc: ops: export mmc_get_status() Date: Fri, 30 Jun 2017 14:06:48 +0200 Message-Id: <20170630120649.27007-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170630120649.27007-1-linus.walleij@linaro.org> References: <20170630120649.27007-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This function retrieves the status of the card with the default number of retries. Since the block layer wants to use this, and since the block layer is a loadable kernel module, we need to export this symbol. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - No changes just resending ChangeLog v2->v3: - New patch to fix a build error, enumerating v3 to keep it together with the other patches. --- drivers/mmc/core/mmc_ops.c | 1 + 1 file changed, 1 insertion(+) -- 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/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 5f7c5920231a..b56fa822ab6b 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -83,6 +83,7 @@ int mmc_send_status(struct mmc_card *card, u32 *status) { return __mmc_send_status(card, status, MMC_CMD_RETRIES); } +EXPORT_SYMBOL_GPL(mmc_send_status); static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) { From patchwork Fri Jun 30 12:06:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 106690 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp5835593obb; Fri, 30 Jun 2017 05:10:52 -0700 (PDT) X-Received: by 10.98.73.65 with SMTP id w62mr4328592pfa.61.1498824652362; Fri, 30 Jun 2017 05:10:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498824652; cv=none; d=google.com; s=arc-20160816; b=NllXj8orYEho7Vo6d/4Pt3oXE5R0OkMloIZEP/OThOQrqYTIP+HNzUf6HZji5ETxq7 hPwFOIhBk4vN0EDjS3ex2SFwl6hZx7n4Q92Mrnn/IRCOtOfbRLcqFX8gjSlSMDHjpWjg V2rwft52k86H4WIoh/uTI4izISNoONdpWxnXx6NkQnJfa16LAyrIMkQXV1C/z0/hTfJf EJfUkNzxT0FeDjNULuTFJ78o3FnoiZoLK4PiEGJAmeAdS15b8Jvaj7V49BpxRbrQP3fL CSc4NxOt043dYp+nj7vvcp1ISE9lD/nnWHLwQpHwLapRXWMLOnEnfzL9D0aqyMY7ZsLs vR7w== 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=BKbSq+Hop4DECu+6IhD7Rg8oyZ4l5Py6If6yMm17m+w=; b=Iv5TKTXeHRvkPAK5zG99sTgjJHEz9WR+fCiiKnQC75dgG/pjixdyi1XEJDcAliCxEN 442uvWyoYgc+AyHY6fjmw0nsaybF5U0PZkwXum5xSz5Luql6iC9fpoxTNciOLnXoqDrv HHTr/VlPijK9RQjFEwPcfj8OwIyrGEVOOh1iS4znumbSGX3oJMd2y0YBza7OGjm2ztmO aHQGRV7XqCAmN+UVl5hRSP95XK55wHDj462m19aI8TnWQthQ1J4WZi9O4kbmWgkDRaCV J/FiTByBl/eiu402or94qWhFWc8J2i1KGa80pfAiYLjow1ruMF0ljaIONYHzNM0icpdy 1n9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Z8IXomRA; 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 i187si5612045pfc.217.2017.06.30.05.10.52; Fri, 30 Jun 2017 05:10:52 -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 header.b=Z8IXomRA; 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 S1751689AbdF3MIt (ORCPT + 6 others); Fri, 30 Jun 2017 08:08:49 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:35396 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbdF3MHV (ORCPT ); Fri, 30 Jun 2017 08:07:21 -0400 Received: by mail-lf0-f53.google.com with SMTP id b207so68974362lfg.2 for ; Fri, 30 Jun 2017 05:07:20 -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=XrqWmHf7hvBEABL9FE7sT0mv+jYIC/qWDIRyPcybknU=; b=Z8IXomRAOqfDIT8KTi7fLDdZvyIgLtcvVsBCfpu4Vs4k8DyKZP4g7fZTyQnbJCimZV +lfX2ajlkIf5LMuyUJcpmWp3wZ5Hzbkm1v4lEMcLCtJ704lILIbGL0PsmfpdTtVDthQr /WakpqUNbfV6xtc2wK03zzBXpWvBmsV0az6cA= 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=XrqWmHf7hvBEABL9FE7sT0mv+jYIC/qWDIRyPcybknU=; b=hl/9LV7DMQDOlDTWqPHLyxRXiCStCXfMo2JOfY3IsGoFA8n6cuhYF+L+5QNsRvKX2e f1in1VSoFwCH8VZPidZiUiemp+nL9W3l5vJu1ggJoGh1WvNwFxHmsgzXuRsbNQAuX8fA 1UCZGyqFufpW4nL+mcsE1Li111D6lTsQopT/U4Gu/3wIgrvxzfmqeGs3fi4IrKmPotfd 2kbyL189dm1oOenr8XUCdNP1qI++cLdpJbOefTBp+8/0y9zPrTBwgX7hk7569hpOQ18f lu8aL66fhbJYD75ppsubSxAAyUaS5RQcXzh6ZU/M6q2c5ifXmuE31drI+Sy1R0Vd8mM+ ocDw== X-Gm-Message-State: AKS2vOyOF9xeV4b9Q8UxEfY2kD+Yktpy4o6eZdh3kYiN4xtE4Rbk9ZuV wOTIpO7omETOHX/R2htAwA== X-Received: by 10.25.229.2 with SMTP id c2mr7039377lfh.52.1498824439114; Fri, 30 Jun 2017 05:07:19 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 19sm1531492ljv.62.2017.06.30.05.07.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 05:07:17 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Adrian Hunter , Linus Walleij Subject: [PATCH 3/3 v4] mmc: debugfs: Move block debugfs into block module Date: Fri, 30 Jun 2017 14:06:49 +0200 Message-Id: <20170630120649.27007-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170630120649.27007-1-linus.walleij@linaro.org> References: <20170630120649.27007-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org If we don't have the block layer enabled, we do not present card status and extcsd in the debugfs. Debugfs is not ABI, and maintaining files of no relevance for non-block devices comes at a high maintenance cost if we shall support it with the block layer compiled out. The debugfs entries suffer from all the same starvation issues as the other userspace things, under e.g. a heavy dd operation. The expected number of debugfs users utilizing these two debugfs files is already low as there is an ioctl() to get the same information using the mmc-tools, and of these few users the expected number of people using it on SDIO or combo cards are expected to be zero. It is therefore logical to move this over to the block layer when it is enabled, using the new custom requests and issue it using the block request queue. On the other hand it moves some debugfs code from debugfs.c and into block.c. Tested during heavy dd load by cat:in the status file. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Squash all the refactorings of these operations into a big commit simply moving all the debugfs over to the block layer and only creating the files from there. - Avoid the whole middle-step of creating #if IS_ENABLED() that was required to move it stepwise from the debugfs file to the block file. --- drivers/mmc/core/block.c | 143 +++++++++++++++++++++++++++++++++++++++++++++ drivers/mmc/core/debugfs.c | 89 ---------------------------- drivers/mmc/core/queue.h | 4 ++ 3 files changed, 147 insertions(+), 89 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 d410f578b8df..dbfbc76576ea 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -1176,6 +1177,8 @@ 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; @@ -1205,6 +1208,15 @@ static void mmc_blk_issue_drv_op(struct mmc_queue *mq, struct request *req) card->ext_csd.boot_ro_lock |= EXT_CSD_BOOT_WP_B_PWR_WP_EN; break; + case MMC_DRV_OP_GET_CARD_STATUS: + ret = mmc_send_status(card, &status); + 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); @@ -2236,6 +2248,134 @@ static int mmc_add_disk(struct mmc_blk_data *md) return ret; } +#ifdef CONFIG_DEBUG_FS + +static int mmc_dbg_card_status_get(void *data, u64 *val) +{ + struct mmc_card *card = data; + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); + struct mmc_queue *mq = &md->queue; + struct request *req; + int ret; + + /* Ask the block layer about the card status */ + req = blk_get_request(mq->queue, REQ_OP_DRV_IN, __GFP_RECLAIM); + req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_CARD_STATUS; + blk_execute_rq(mq->queue, NULL, req, 0); + ret = req_to_mmc_queue_req(req)->drv_op_result; + if (ret >= 0) { + *val = ret; + ret = 0; + } + + return ret; +} +DEFINE_SIMPLE_ATTRIBUTE(mmc_dbg_card_status_fops, mmc_dbg_card_status_get, + NULL, "%08llx\n"); + +/* That is two digits * 512 + 1 for newline */ +#define EXT_CSD_STR_LEN 1025 + +static int mmc_ext_csd_open(struct inode *inode, struct file *filp) +{ + struct mmc_card *card = inode->i_private; + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); + struct mmc_queue *mq = &md->queue; + struct request *req; + char *buf; + ssize_t n = 0; + u8 *ext_csd; + int err, i; + + buf = kmalloc(EXT_CSD_STR_LEN + 1, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + /* Ask the block layer for 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); + err = req_to_mmc_queue_req(req)->drv_op_result; + if (err) { + pr_err("FAILED %d\n", err); + goto out_free; + } + + for (i = 0; i < 512; i++) + n += sprintf(buf + n, "%02x", ext_csd[i]); + n += sprintf(buf + n, "\n"); + + if (n != EXT_CSD_STR_LEN) { + err = -EINVAL; + goto out_free; + } + + filp->private_data = buf; + kfree(ext_csd); + return 0; + +out_free: + kfree(buf); + return err; +} + +static ssize_t mmc_ext_csd_read(struct file *filp, char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + char *buf = filp->private_data; + + return simple_read_from_buffer(ubuf, cnt, ppos, + buf, EXT_CSD_STR_LEN); +} + +static int mmc_ext_csd_release(struct inode *inode, struct file *file) +{ + kfree(file->private_data); + return 0; +} + +static const struct file_operations mmc_dbg_ext_csd_fops = { + .open = mmc_ext_csd_open, + .read = mmc_ext_csd_read, + .release = mmc_ext_csd_release, + .llseek = default_llseek, +}; + +static int mmc_blk_add_debugfs(struct mmc_card *card) +{ + struct dentry *root; + + if (!card->debugfs_root) + return 0; + + root = card->debugfs_root; + + if (mmc_card_mmc(card) || mmc_card_sd(card)) { + if (!debugfs_create_file("status", S_IRUSR, root, card, + &mmc_dbg_card_status_fops)) + return -EIO; + } + + if (mmc_card_mmc(card)) { + if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, + &mmc_dbg_ext_csd_fops)) + return -EIO; + } + + return 0; +} + + +#else + +static int mmc_blk_add_debugfs(struct mmc_card *card) +{ + return 0; +} + +#endif /* CONFIG_DEBUG_FS */ + static int mmc_blk_probe(struct mmc_card *card) { struct mmc_blk_data *md, *part_md; @@ -2272,6 +2412,9 @@ static int mmc_blk_probe(struct mmc_card *card) goto out; } + /* Add two debugfs entries */ + mmc_blk_add_debugfs(card); + pm_runtime_set_autosuspend_delay(&card->dev, 3000); pm_runtime_use_autosuspend(&card->dev); diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index a1fba5732d66..01e459a34f33 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -281,85 +281,6 @@ void mmc_remove_host_debugfs(struct mmc_host *host) debugfs_remove_recursive(host->debugfs_root); } -static int mmc_dbg_card_status_get(void *data, u64 *val) -{ - struct mmc_card *card = data; - u32 status; - int ret; - - mmc_get_card(card); - - ret = mmc_send_status(data, &status); - if (!ret) - *val = status; - - mmc_put_card(card); - - return ret; -} -DEFINE_SIMPLE_ATTRIBUTE(mmc_dbg_card_status_fops, mmc_dbg_card_status_get, - NULL, "%08llx\n"); - -#define EXT_CSD_STR_LEN 1025 - -static int mmc_ext_csd_open(struct inode *inode, struct file *filp) -{ - struct mmc_card *card = inode->i_private; - char *buf; - ssize_t n = 0; - u8 *ext_csd; - int err, i; - - buf = kmalloc(EXT_CSD_STR_LEN + 1, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mmc_get_card(card); - err = mmc_get_ext_csd(card, &ext_csd); - mmc_put_card(card); - if (err) - goto out_free; - - for (i = 0; i < 512; i++) - n += sprintf(buf + n, "%02x", ext_csd[i]); - n += sprintf(buf + n, "\n"); - - if (n != EXT_CSD_STR_LEN) { - err = -EINVAL; - goto out_free; - } - - filp->private_data = buf; - kfree(ext_csd); - return 0; - -out_free: - kfree(buf); - return err; -} - -static ssize_t mmc_ext_csd_read(struct file *filp, char __user *ubuf, - size_t cnt, loff_t *ppos) -{ - char *buf = filp->private_data; - - return simple_read_from_buffer(ubuf, cnt, ppos, - buf, EXT_CSD_STR_LEN); -} - -static int mmc_ext_csd_release(struct inode *inode, struct file *file) -{ - kfree(file->private_data); - return 0; -} - -static const struct file_operations mmc_dbg_ext_csd_fops = { - .open = mmc_ext_csd_open, - .read = mmc_ext_csd_read, - .release = mmc_ext_csd_release, - .llseek = default_llseek, -}; - void mmc_add_card_debugfs(struct mmc_card *card) { struct mmc_host *host = card->host; @@ -382,16 +303,6 @@ void mmc_add_card_debugfs(struct mmc_card *card) if (!debugfs_create_x32("state", S_IRUSR, root, &card->state)) goto err; - if (mmc_card_mmc(card) || mmc_card_sd(card)) - if (!debugfs_create_file("status", S_IRUSR, root, card, - &mmc_dbg_card_status_fops)) - goto err; - - if (mmc_card_mmc(card)) - if (!debugfs_create_file("ext_csd", S_IRUSR, root, card, - &mmc_dbg_ext_csd_fops)) - goto err; - return; err: diff --git a/drivers/mmc/core/queue.h b/drivers/mmc/core/queue.h index cf26a15a64bf..04fc89360a7a 100644 --- a/drivers/mmc/core/queue.h +++ b/drivers/mmc/core/queue.h @@ -36,10 +36,14 @@ struct mmc_blk_request { * enum mmc_drv_op - enumerates the operations in the mmc_queue_req * @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 {