From patchwork Tue Jan 24 10:17:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 92325 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1624370obz; Tue, 24 Jan 2017 02:18:28 -0800 (PST) X-Received: by 10.99.223.5 with SMTP id u5mr38486042pgg.58.1485253108706; Tue, 24 Jan 2017 02:18:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si7259622pfb.261.2017.01.24.02.18.28; Tue, 24 Jan 2017 02:18:28 -0800 (PST) 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 S1750967AbdAXKS1 (ORCPT + 5 others); Tue, 24 Jan 2017 05:18:27 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:34640 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750956AbdAXKS0 (ORCPT ); Tue, 24 Jan 2017 05:18:26 -0500 Received: by mail-lf0-f46.google.com with SMTP id v186so108168064lfa.1 for ; Tue, 24 Jan 2017 02:18:25 -0800 (PST) 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=j3j7DeXByiwDcYt8bkir/JR2+Onpp9GazrR8DG+Jp90=; b=LB/ZfJROabAox/8GnVS9WDXGXMlO2HQC2vL3x29IBvi4OTWdofLmnTp7UAO882D/qL m7Nc56gjSmTLr3tG86sbTTZ44/ZNzPFwYfbPi5jCdd+k+Wn3m4iav2qmJp5b1Ejq4NM8 ozyGo/ENTUusIbwLno+3vIjfJDi6jmmsMAh74= 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=j3j7DeXByiwDcYt8bkir/JR2+Onpp9GazrR8DG+Jp90=; b=gWJ9IhYGbGhY6LDFIzeg6ShxYos8j29sIu03dbSYzv51JRNoALnr97K17+z6U6bVMe g5Ojn8+3A/Jg8dxAVtxnvGC2GOJXYnp7BWZhwuimVhjuSLmtckgJS7f30tAz2VgVfCQl q0kX3TkDgz3MBO5vajdtFU6rp/tjAOA94ru6MCt+BR9N2yazjf8sZIOvO/UB+YRCFmkS phtsuvaNZwhzGQEdmN3VtMiclJx8OrGdb83B9PAIecDBCHdRzd/kS7mhGKmXpwu0O3Jv VfyOM5WWBrHBvmvy2fTiX+j0ns0VOtU/Ph6QHuUrPFkv1z++VO36B6lyE4LqCLL96vDJ dOCw== X-Gm-Message-State: AIkVDXIy+o/krFdFDGuZZuIGY08lC9GPXDbdwzC5iKFk5ghyG/znZyf+2HpDsqQ7z7sNkt0L X-Received: by 10.46.83.19 with SMTP id h19mr14232482ljb.72.1485253104720; Tue, 24 Jan 2017 02:18:24 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o91sm7410797lfg.17.2017.01.24.02.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 02:18:23 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, Ulf Hansson Cc: Chunyan Zhang , Baolin Wang , Paolo Valente , Linus Walleij Subject: [PATCH 6/6] mmc: block: stop passing around pointless return values Date: Tue, 24 Jan 2017 11:17:57 +0100 Message-Id: <20170124101757.19676-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170124101757.19676-1-linus.walleij@linaro.org> References: <20170124101757.19676-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The mmc_blk_issue_rq() function is called in exactly one place in queue.c and there the return value is ignored. So the functions called from that function that also meticulously return 0/1 do so for no good reason. Error reporting on the asynchronous requests are done upward to the block layer when the requests are eventually completed or fail, which may happen during the flow of the mmc_blk_issue_* functions directly (for "special commands") or later, when an asynchronous read/write request is completed. The issuing functions do not give rise to errors on their own, and there is nothing to return back to the caller in queue.c. Drop all return values and make the function return void. Signed-off-by: Linus Walleij --- drivers/mmc/core/block.c | 38 ++++++++++++++------------------------ drivers/mmc/core/block.h | 2 +- 2 files changed, 15 insertions(+), 25 deletions(-) -- 2.9.3 -- 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 f3e0c778cdbd..ede759dda395 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1149,7 +1149,7 @@ int mmc_access_rpmb(struct mmc_queue *mq) return false; } -static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) +static void mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; @@ -1187,11 +1187,9 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) mmc_blk_reset_success(md, type); fail: blk_end_request(req, err, blk_rq_bytes(req)); - - return err ? 0 : 1; } -static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, +static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->blkdata; @@ -1254,11 +1252,9 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, mmc_blk_reset_success(md, type); out: blk_end_request(req, err, blk_rq_bytes(req)); - - return err ? 0 : 1; } -static int mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req) +static void mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; @@ -1269,8 +1265,6 @@ static int mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req) ret = -EIO; blk_end_request_all(req, ret); - - return ret ? 0 : 1; } /* @@ -1622,7 +1616,7 @@ static void mmc_blk_rw_start_new(struct mmc_queue *mq, struct mmc_card *card, } } -static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) +static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; @@ -1635,7 +1629,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) struct mmc_async_req *old_areq; if (!rqc && !mq->mqrq_prev->req) - return 0; + return; do { if (rqc) { @@ -1648,7 +1642,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) pr_err("%s: Transfer size is not 4KB sector size aligned\n", rqc->rq_disk->disk_name); mmc_blk_rw_cmd_abort(card, rqc); - return 0; + return; } mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); @@ -1665,7 +1659,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) */ if (status == MMC_BLK_NEW_REQUEST) mq->flags |= MMC_QUEUE_NEW_REQUEST; - return 0; + return; } /* @@ -1699,7 +1693,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) __func__, blk_rq_bytes(req), brq->data.bytes_xfered); mmc_blk_rw_cmd_abort(card, req); - return 0; + return; } break; case MMC_BLK_CMD_ERR: @@ -1767,18 +1761,16 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) } } while (ret); - return 1; + return; cmd_abort: mmc_blk_rw_cmd_abort(card, req); start_new_req: mmc_blk_rw_start_new(mq, card, rqc); - - return 0; } -int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) +void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) { int ret; struct mmc_blk_data *md = mq->blkdata; @@ -1794,7 +1786,6 @@ int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) if (req) { blk_end_request_all(req, -EIO); } - ret = 0; goto out; } @@ -1803,19 +1794,19 @@ int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) /* complete ongoing async transfer before issuing discard */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); - ret = mmc_blk_issue_discard_rq(mq, req); + mmc_blk_issue_discard_rq(mq, req); } else if (req && req_op(req) == REQ_OP_SECURE_ERASE) { /* complete ongoing async transfer before issuing secure erase*/ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); - ret = mmc_blk_issue_secdiscard_rq(mq, req); + mmc_blk_issue_secdiscard_rq(mq, req); } else if (req && req_op(req) == REQ_OP_FLUSH) { /* complete ongoing async transfer before issuing flush */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); - ret = mmc_blk_issue_flush(mq, req); + mmc_blk_issue_flush(mq, req); } else { - ret = mmc_blk_issue_rw_rq(mq, req); + mmc_blk_issue_rw_rq(mq, req); } out: @@ -1827,7 +1818,6 @@ int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) * the 'mmc_blk_issue_rq' with 'mqrq_prev->req'. */ mmc_put_card(card); - return ret; } static inline int mmc_blk_readonly(struct mmc_card *card) diff --git a/drivers/mmc/core/block.h b/drivers/mmc/core/block.h index 00b7483f2d6e..860ca7c8df86 100644 --- a/drivers/mmc/core/block.h +++ b/drivers/mmc/core/block.h @@ -4,6 +4,6 @@ struct mmc_queue; struct request; -int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req); +void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req); #endif