From patchwork Mon Jul 23 03:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10539577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF98A174A for ; Mon, 23 Jul 2018 03:29:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A875022A65 for ; Mon, 23 Jul 2018 03:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99D85285AF; Mon, 23 Jul 2018 03:29:20 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 512B822A65 for ; Mon, 23 Jul 2018 03:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=sAZ4UwBy3ZL1qtyywGe5zR2FL8WXSJi2hjH8h7qe2jY=; b=YPYeMB9oY3h5Wa LCMxtiE5sedoaI9SzK6JVcCjS+aQEg6bcX80Ptredecsz0BQDc0mzqizp4rIuKaleF16xOs2Z4iEG ahm+R/ZpjcFaCHfpbSvfIwsEDT9kOlMO1M1Z0TiGAMZPQ93lW1SV/48dd0K8ObSJujv0i5Zs3ZRZs 2RzEbZJgq9zEINNmAwoC1/EcULguHjuMIe4Kf9mPM8uzqoy3y/Ei5hETfeno1R9TgSox9Qtbv8qnd cbIbUfi9UzoLGKJzlM/XnNNDIdFj5c2RBhf8dRWrhwRlFFmEkPGYPcF0EOhEVNwQQcp0HgLApkMW+ UJoCGzG/tCgjL9/Z/L0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhRXD-000794-1Y for patchwork-linux-mediatek@patchwork.kernel.org; Mon, 23 Jul 2018 03:29:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhRX4-0006vi-OZ; Mon, 23 Jul 2018 03:29:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=z4mRpkCJVMgwJMTPjsJbl/zYkvlrQUnxmfT38AGgMaE=; b=r1NJtYEYvLmbcapzScFO8BUT5b uWJpS9G5J0x1Oplvaj5bxf5ZxM3Wafqs8VgFgEJ2sikpwV9NEo5tayWIQN00ZXWaty1I9LIEGgave mrkinFVe9qaziGFNiQ9tyZSSWBl5ndd31xykZt4AlRAUPMv5evSZV3cekDmTNGde3u26bEElwrvTu rhwK9hptLXMxE6qAzHKuUkGotLXmylCphcbGz74wWk9o8+g+SQeq7sYChAYwjOWH3Unp4t3MkVolv lPCulmZU9L1Df8CXNXBtObSouWLOI1orsYDX3uLinpgY/Inul5qXvVF0XJ+db1bewcWPhBZJJ7SoA ZIAJwVWw==; Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhRO0-0003Ux-KF; Mon, 23 Jul 2018 03:19:50 +0000 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1118D2E820A79; Mon, 23 Jul 2018 11:19:22 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.382.0; Mon, 23 Jul 2018 11:19:13 +0800 From: YueHaibing To: , , , , Subject: [PATCH v2 net-next] net: mediatek: use dma_zalloc_coherent instead of allocator/memset Date: Mon, 23 Jul 2018 11:16:47 +0800 Message-ID: <20180723031647.9820-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180723_041949_013748_55F06041 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, YueHaibing , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset 0. Signed-off-by: YueHaibing --- v2: remove redundant __GFP_ZERO --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index d8ebf0a..c30aea2 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1221,14 +1221,11 @@ static int mtk_tx_alloc(struct mtk_eth *eth) if (!ring->buf) goto no_tx_mem; - ring->dma = dma_alloc_coherent(eth->dev, - MTK_DMA_SIZE * sz, - &ring->phys, - GFP_ATOMIC | __GFP_ZERO); + ring->dma = dma_zalloc_coherent(eth->dev, MTK_DMA_SIZE * sz, + &ring->phys, GFP_ATOMIC); if (!ring->dma) goto no_tx_mem; - memset(ring->dma, 0, MTK_DMA_SIZE * sz); for (i = 0; i < MTK_DMA_SIZE; i++) { int next = (i + 1) % MTK_DMA_SIZE; u32 next_ptr = ring->phys + next * sz;