Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp146105ima; Fri, 1 Feb 2019 00:50:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7/7d1MmVbymcLCuQzWRrfTX9M5Qcb31R/Qa6meXB+5Ok+HfkiknQWes5qELMqZmSvWGuJC X-Received: by 2002:a62:4851:: with SMTP id v78mr38700184pfa.97.1549011051492; Fri, 01 Feb 2019 00:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011051; cv=none; d=google.com; s=arc-20160816; b=0oAMVR0UJVWH5pQISTG+GVQUNkojV4Lwbcd/zyQZHAKpSGMmx1jehtH8Lq2f9NQOgh 9W9wnOegBhTnfVm3yREa5cpOU+qmz6oaNigjJ3cQk3aQFnl3tjMaGUdoKyjmnZ9YaNHN /HxX72VGPvzF4Wf+6KKLavmPgxzQK2NZCORoWfQyqMk5TmmhS4jxir3aDdrM28+bbCk6 OGNKtzY3aXUyP8Q5GtzsXTvvWRplca9ot2agCRwa4uLXzm6uiCb163jgUJmujY1MYbLi rDqDhKG3G4+L3nBCxnJdMU+pjWWd/9a2KUlc6TmdYIPljOzPJH+RDl5Poe1pUy6+RHYx gpDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YxHcnjYJIyN9dSw5XNTjzAkmGK4z/ENOgPTYk1FGBZI=; b=xydaG4C64bJO3oSbWSITGa17NBJ1sC5P3eWMx6Qkpo0S+K7Ct7/MCz5Rp0KA2Rglhd wQbhQCu4njxB0QF+Qz2bYIQ7DikEwXDy7rSCp9rpEB8Zvs9Hxazb7+DF5mebt25HzrWk Lve1t48J1aibJwhGMqQQZktEvXT0Mx/oUpYUtsb64GxzdyyScmn5LwIdbItEVTdj9/Ee Bi9eSMzoCT6KVSXSR3jVHUpfBhYu4Cr7xE6CqjnVTlDo0Vq6Q6Z7jamljnPe4d7fUkCq mvf5l/RupGLukfjJTYxQVWvTRx8gOuyewCOBofQQxkGNea75lddfFwSWKASvx4Z0cTYR xpAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="axF0SJy/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t65si7113045pfb.247.2019.02.01.00.50.36; Fri, 01 Feb 2019 00:50:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="axF0SJy/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729465AbfBAIsU (ORCPT + 99 others); Fri, 1 Feb 2019 03:48:20 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48354 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729327AbfBAIsT (ORCPT ); Fri, 1 Feb 2019 03:48:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YxHcnjYJIyN9dSw5XNTjzAkmGK4z/ENOgPTYk1FGBZI=; b=axF0SJy/rQePO2MdOwLhL4wPZm kUGopL49AOrSRzl7zCnocUs7dIHDJws07LpYoYsPTEyFk14KXaLkViehcpaVs2szWBv5z+Hj/AbNO P5fJbWvTN15cCZwf5Cv2GtV37plJ7YSdmW1UYy/S4PYgS04+9pbR+hiAfMCkVimPtvL9a+/xoBo65 Ydnho+Kwb4CoNb/R+G7dECObMxocnY/6bQDDlwgPwEO4D0z+HZR6FK7CDPBfdRD/ww0KFQfYv2WTx XLnnEYImVHE298dffp2Q9L2pnQeB+3NhqHvTFs64TCXXrr3S6xQyZNcX9F+Y5bJqePrQd6frh+fcP ttlTkpsA==; Received: from 089144212163.atnat0021.highway.a1.net ([89.144.212.163] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gpUUi-0001OX-3c; Fri, 01 Feb 2019 08:48:16 +0000 From: Christoph Hellwig To: John Crispin , Vinod Koul , Dmitry Tarnyagin , Nicolas Ferre , Sudip Mukherjee , Felipe Balbi , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org Cc: iommu@lists.linux-foundation.org Subject: [PATCH 05/18] macb_main: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:47:48 +0100 Message-Id: <20190201084801.10983-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190201084801.10983-1-hch@lst.de> References: <20190201084801.10983-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DMA API generally relies on a struct device to work properly, and only barely works without one for legacy reasons. Pass the easily available struct device from the platform_device to remedy this. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/cadence/macb_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 2b2882615e8b..61a27963f1d1 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3673,9 +3673,9 @@ static netdev_tx_t at91ether_start_xmit(struct sk_buff *skb, /* Store packet information (to free when Tx completed) */ lp->skb = skb; lp->skb_length = skb->len; - lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len, - DMA_TO_DEVICE); - if (dma_mapping_error(NULL, lp->skb_physaddr)) { + lp->skb_physaddr = dma_map_single(&lp->pdev->dev, skb->data, + skb->len, DMA_TO_DEVICE); + if (dma_mapping_error(&lp->pdev->dev, lp->skb_physaddr)) { dev_kfree_skb_any(skb); dev->stats.tx_dropped++; netdev_err(dev, "%s: DMA mapping error\n", __func__); @@ -3765,7 +3765,7 @@ static irqreturn_t at91ether_interrupt(int irq, void *dev_id) if (lp->skb) { dev_kfree_skb_irq(lp->skb); lp->skb = NULL; - dma_unmap_single(NULL, lp->skb_physaddr, + dma_unmap_single(&lp->pdev->dev, lp->skb_physaddr, lp->skb_length, DMA_TO_DEVICE); dev->stats.tx_packets++; dev->stats.tx_bytes += lp->skb_length; -- 2.20.1