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: 9436389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3494C60469 for ; Fri, 18 Nov 2016 12:36:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40C09298A0 for ; Fri, 18 Nov 2016 12:36:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35A3F298A2; Fri, 18 Nov 2016 12:36:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5D22298A0 for ; Fri, 18 Nov 2016 12:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752125AbcKRMgd (ORCPT ); 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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