From patchwork Mon Jul 21 16:48:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4597471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE01CC0514 for ; Mon, 21 Jul 2014 16:52:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E06820109 for ; Mon, 21 Jul 2014 16:52:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45ABC200D5 for ; Mon, 21 Jul 2014 16:52:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9GnH-0001dI-VS; Mon, 21 Jul 2014 16:50:31 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9Gmd-0008Un-Aj for linux-arm-kernel@lists.infradead.org; Mon, 21 Jul 2014 16:49:52 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 96091AAA; Mon, 21 Jul 2014 18:49:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost.localdomain (unknown [190.2.108.81]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4D2D87A0; Mon, 21 Jul 2014 18:49:34 +0200 (CEST) From: Ezequiel Garcia To: , Subject: [PATCH 4/6] net: mvpp2: Simplify BM pool buffers freeing Date: Mon, 21 Jul 2014 13:48:14 -0300 Message-Id: <1405961296-5846-5-git-send-email-ezequiel.garcia@free-electrons.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1405961296-5846-1-git-send-email-ezequiel.garcia@free-electrons.com> References: <1405961296-5846-1-git-send-email-ezequiel.garcia@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140721_094951_681319_7DE30540 X-CRM114-Status: GOOD ( 15.29 ) X-Spam-Score: 1.0 (+) Cc: Thomas Petazzoni , Lior Amsalem , Jason Cooper , Tawfik Bayouk , Ezequiel Garcia , Gregory Clement , Marcin Wojtas , David Miller X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that all the users of mvpp2_bm_bufs_free() have been fixed, we can safely clean the function prototype. The function is always called to release all the buffers in a BM pool, and the number of buffers freed is not needed. Therefore, we change the return to a void, and remove the "num" parameter. This is a cosmetic change, to make the code slightly cleaner. Signed-off-by: Ezequiel Garcia --- drivers/net/ethernet/marvell/mvpp2.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 43d3391..b009eee 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -3385,17 +3385,12 @@ static void mvpp2_bm_pool_bufsize_set(struct mvpp2 *priv, mvpp2_write(priv, MVPP2_POOL_BUF_SIZE_REG(bm_pool->id), val); } -/* Free "num" buffers from the pool */ -static int mvpp2_bm_bufs_free(struct mvpp2 *priv, - struct mvpp2_bm_pool *bm_pool, int num) +/* Free all buffers from the pool */ +static void mvpp2_bm_bufs_free(struct mvpp2 *priv, struct mvpp2_bm_pool *bm_pool) { int i; - if (num >= bm_pool->buf_num) - /* Free all buffers from the pool */ - num = bm_pool->buf_num; - - for (i = 0; i < num; i++) { + for (i = 0; i < bm_pool->buf_num; i++) { u32 vaddr; /* Get buffer virtual adress (indirect access) */ @@ -3408,7 +3403,6 @@ static int mvpp2_bm_bufs_free(struct mvpp2 *priv, /* Update BM driver with number of buffers removed from pool */ bm_pool->buf_num -= i; - return i; } /* Cleanup pool */ @@ -3416,10 +3410,9 @@ static int mvpp2_bm_pool_destroy(struct platform_device *pdev, struct mvpp2 *priv, struct mvpp2_bm_pool *bm_pool) { - int num; u32 val; - num = mvpp2_bm_bufs_free(priv, bm_pool, bm_pool->buf_num); + mvpp2_bm_bufs_free(priv, bm_pool); if (bm_pool->buf_num) { WARN(1, "cannot free all buffers in pool %d\n", bm_pool->id); return 0; @@ -3675,7 +3668,7 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, MVPP2_BM_LONG_BUF_NUM : MVPP2_BM_SHORT_BUF_NUM; else - mvpp2_bm_bufs_free(port->priv, new_pool, pkts_num); + mvpp2_bm_bufs_free(port->priv, new_pool); new_pool->pkt_size = pkt_size; @@ -3748,7 +3741,7 @@ static int mvpp2_bm_update_mtu(struct net_device *dev, int mtu) int pkt_size = MVPP2_RX_PKT_SIZE(mtu); /* Update BM pool with new buffer size */ - mvpp2_bm_bufs_free(port->priv, port_pool, pkts_num); + mvpp2_bm_bufs_free(port->priv, port_pool); if (port_pool->buf_num) { WARN(1, "cannot free all buffers in pool %d\n", port_pool->id); return -EIO;