From patchwork Fri Nov 18 12:36:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 82879 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp51094qge; Fri, 18 Nov 2016 04:36:34 -0800 (PST) X-Received: by 10.37.164.104 with SMTP id f95mr4157031ybi.49.1479472593818; Fri, 18 Nov 2016 04:36:33 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j197si1632030ywb.470.2016.11.18.04.36.33; Fri, 18 Nov 2016 04:36:33 -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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752125AbcKRMgd (ORCPT + 4 others); Fri, 18 Nov 2016 07:36:33 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36603 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbcKRMgc (ORCPT ); Fri, 18 Nov 2016 07:36:32 -0500 Received: by mail-wm0-f50.google.com with SMTP id g23so35518962wme.1 for ; Fri, 18 Nov 2016 04:36:31 -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=BOF9TUENiTmLfxeE6bFoP+b8LwOhObEeZJLn2DGVa3M=; b=P3fjB3+mP/c99/sEanIVAw6SwGDdbP8DPiVP1fIM13cnLRxmAUWDrAfpV3bu1IgV4G FHUAuw1vFgUetHJpsvmVjHAVOXtG3E4t4Fp4z3SSElQxO5lmv/HJtw7dDn7pPVjcOx7F 9n/OfTNxTCwoPDwLNwfQM9YskLScP3lAlykGI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BOF9TUENiTmLfxeE6bFoP+b8LwOhObEeZJLn2DGVa3M=; b=h9lmYE5wLGmfO6wzdOti+V+Y4ZnhxJzhZImYQrXtaNF/w+N2LNtTZpR/6MZbkEkuGj SL2jwttYUpfgiYd0dA4zmrpHUlIq6ZkkSM/nye1/TR5zJG54+oFeFk2BiBA3GoetjkiR 7NPKu8WyotMxARCTgMQ60NwUzzOpYABGoscVtGa0NUBeD1AAFBm1GR3vXgGjN4g1NwrD EIdGN+l4jCRWPGdzDYpfkQPLmzd/WIY1ETCQ9h7ojXAl6C7KmcgtYqCkDAmCOks39mLS 3XKzPSQWEV2yUO7gxuma5tsD9lIvNdcLgHoJdngkpAMBPIBwBEYxnIwbMDRLYwgVdnaI 4F7Q== X-Gm-Message-State: ABUngvcFI1cuRqmipdTFntpwR7VBqg2EWkccWbkVtTbamb8acUFsGSXtqrP7n9LEoAOfas8/ X-Received: by 10.25.104.20 with SMTP id d20mr1643555lfc.59.1479472590937; Fri, 18 Nov 2016 04:36:30 -0800 (PST) Received: from linuslaptop.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m81sm2168038lfd.45.2016.11.18.04.36.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Nov 2016 04:36:30 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Chunyan Zhang , Baolin Wang , Linus Walleij Subject: [PATCH 3/3] mmc: block: move packed command struct init Date: Fri, 18 Nov 2016 13:36:16 +0100 Message-Id: <1479472576-2687-4-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479472576-2687-1-git-send-email-linus.walleij@linaro.org> References: <1479472576-2687-1-git-send-email-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org By moving the mmc_packed_init() and mmc_packed_clean() into the only file in the kernel where they are used, we save two exported functions and can staticize those to the block.c file. Signed-off-by: Linus Walleij --- drivers/mmc/card/block.c | 43 +++++++++++++++++++++++++++++++++++++++++++ drivers/mmc/card/queue.c | 43 ------------------------------------------- drivers/mmc/card/queue.h | 3 --- 3 files changed, 43 insertions(+), 46 deletions(-) -- 2.7.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/card/block.c b/drivers/mmc/card/block.c index eec4986a0175..ea9de876a846 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1432,6 +1432,49 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, return MMC_BLK_SUCCESS; } +static int mmc_packed_init(struct mmc_queue *mq, struct mmc_card *card) +{ + struct mmc_queue_req *mqrq_cur = &mq->mqrq[0]; + struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; + int ret = 0; + + + mqrq_cur->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL); + if (!mqrq_cur->packed) { + pr_warn("%s: unable to allocate packed cmd for mqrq_cur\n", + mmc_card_name(card)); + ret = -ENOMEM; + goto out; + } + + mqrq_prev->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL); + if (!mqrq_prev->packed) { + pr_warn("%s: unable to allocate packed cmd for mqrq_prev\n", + mmc_card_name(card)); + kfree(mqrq_cur->packed); + mqrq_cur->packed = NULL; + ret = -ENOMEM; + goto out; + } + + INIT_LIST_HEAD(&mqrq_cur->packed->list); + INIT_LIST_HEAD(&mqrq_prev->packed->list); + +out: + return ret; +} + +static void mmc_packed_clean(struct mmc_queue *mq) +{ + struct mmc_queue_req *mqrq_cur = &mq->mqrq[0]; + struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; + + kfree(mqrq_cur->packed); + mqrq_cur->packed = NULL; + kfree(mqrq_prev->packed); + mqrq_prev->packed = NULL; +} + static enum mmc_blk_status mmc_blk_packed_err_check(struct mmc_card *card, struct mmc_async_req *areq) { diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 8037f73a109a..3f6a2463ab30 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c @@ -362,49 +362,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq) } EXPORT_SYMBOL(mmc_cleanup_queue); -int mmc_packed_init(struct mmc_queue *mq, struct mmc_card *card) -{ - struct mmc_queue_req *mqrq_cur = &mq->mqrq[0]; - struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; - int ret = 0; - - - mqrq_cur->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL); - if (!mqrq_cur->packed) { - pr_warn("%s: unable to allocate packed cmd for mqrq_cur\n", - mmc_card_name(card)); - ret = -ENOMEM; - goto out; - } - - mqrq_prev->packed = kzalloc(sizeof(struct mmc_packed), GFP_KERNEL); - if (!mqrq_prev->packed) { - pr_warn("%s: unable to allocate packed cmd for mqrq_prev\n", - mmc_card_name(card)); - kfree(mqrq_cur->packed); - mqrq_cur->packed = NULL; - ret = -ENOMEM; - goto out; - } - - INIT_LIST_HEAD(&mqrq_cur->packed->list); - INIT_LIST_HEAD(&mqrq_prev->packed->list); - -out: - return ret; -} - -void mmc_packed_clean(struct mmc_queue *mq) -{ - struct mmc_queue_req *mqrq_cur = &mq->mqrq[0]; - struct mmc_queue_req *mqrq_prev = &mq->mqrq[1]; - - kfree(mqrq_cur->packed); - mqrq_cur->packed = NULL; - kfree(mqrq_prev->packed); - mqrq_prev->packed = NULL; -} - /** * mmc_queue_suspend - suspend a MMC request queue * @mq: MMC queue to suspend diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h index 6ccadf88ef27..ae96eb223990 100644 --- a/drivers/mmc/card/queue.h +++ b/drivers/mmc/card/queue.h @@ -76,9 +76,6 @@ extern unsigned int mmc_queue_map_sg(struct mmc_queue *, extern void mmc_queue_bounce_pre(struct mmc_queue_req *); extern void mmc_queue_bounce_post(struct mmc_queue_req *); -extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *); -extern void mmc_packed_clean(struct mmc_queue *); - extern int mmc_access_rpmb(struct mmc_queue *); #endif