Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp147515ima; Fri, 1 Feb 2019 00:52:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7D8FHCs8NT+JaWlm+wE/wbK7mNWc3D4EHVCK6BJEwUMi66JE71sqdyAmucWvf7Xp15z5FR X-Received: by 2002:a62:6ec8:: with SMTP id j191mr38456709pfc.198.1549011171330; Fri, 01 Feb 2019 00:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011171; cv=none; d=google.com; s=arc-20160816; b=EZGU8zQ34YqEuD9vPJPFuMx7VUp43X+pqLSKofTNiwp7FVNnLojdHliqWC96D4PsIB Ed/3EkSLVRth7iVfLP74BjygXCL1X+Zrx8s7gPMqQIkqN39iqgLAhMVBgG22JEe+mVMo y8KJhROnS7qBsmEqZ8/YfyCvchCHj6+wMk3Vk4+NwrabqnC7MlRVUCbOPMhSZH6FJ6WQ INCkczPXl8hg6j29wL8Nbejn7+vVCAiu+1/9gHgCgknWBYUUEJQRyiSDnYKjR716bw8K GgRCQGnvxCY0cZNgrjLUeCba4sAyz7w5qabX7NCW4E+i0ayvu3N8q/39OkkPj/LaWx+p L80g== 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=JrHN5I49NV0qZtB9rpJexCxtdUcm7mEw+htvncP4Mps=; b=x6S+JvNARa5oQSPDBQ4GHOMg63oNqNKHSJVc6SKx49QedTTxjjWfdWyEffvEGyeys4 PR0tUTeABoiIopG407fwhMUGS4+hOrQJIo9G7Lce3vyeFynPe7KXptdtn2piA1dGmSjq O1GjK/tdWCBwZbcZcawcTNZc4eg7CQj1mh5OG1+tzVQzI4fyq2kGC4RO+pTyCh9+U1BQ aJ3AqQWoC4wAzs7B703/b88b4UGSXcj7mhOdxZT+5odzmWqsp5m9qAWQVzGrDvc9n9v6 TlIvE2g96EopX2Cj8xQ4APEyg5ZijeX6fc9o0zpuvQ0aOgIhe7PCgRV8GM6BC27O7SNq txkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=KN5jdBes; 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 m20si6122214pgk.323.2019.02.01.00.52.35; Fri, 01 Feb 2019 00:52: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=KN5jdBes; 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 S1729548AbfBAIs3 (ORCPT + 99 others); Fri, 1 Feb 2019 03:48:29 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48366 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729475AbfBAIsW (ORCPT ); Fri, 1 Feb 2019 03:48:22 -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=JrHN5I49NV0qZtB9rpJexCxtdUcm7mEw+htvncP4Mps=; b=KN5jdBesGBbJzuiSAKnjYbrS45 jODfuCNRFto1xnUgIKRdZiGl4x/76/4HKEhHe+2xeySDEe7hc+Sn6NwVl7L9Uz8yXNjYp2Uz+1Cyl Bqp8C1969QjzJ4W/YVeMp4gCwp2yw5g8YZY2uc7s14UmlaKk3H71QpO6+N/r76jTc65/IlaRlLMWv 4QIUGeb1mSRZUEy+N5ridjhswONjwrG/FeMPTD/haxpa9+Lf2mHTkjTQUEA2lUTO1XaygyHNublia MXcYmuatFdhwP/tojkXqXgN68ynEMHrXTNjlZvAlOCexrtAYHCVlSbwPcDdUWc/vo1kTlMS4kwtXW cHrdkCiw==; 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 1gpUUk-0001P5-Pk; Fri, 01 Feb 2019 08:48:19 +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 06/18] lantiq_etop: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:47:49 +0100 Message-Id: <20190201084801.10983-7-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. Note this driver seems to lack dma_unmap_* calls entirely, but fixing that is left for another time. Signed-off-by: Christoph Hellwig --- drivers/net/ethernet/lantiq_etop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c index 32ac9045cdae..f9bb890733b5 100644 --- a/drivers/net/ethernet/lantiq_etop.c +++ b/drivers/net/ethernet/lantiq_etop.c @@ -112,10 +112,12 @@ struct ltq_etop_priv { static int ltq_etop_alloc_skb(struct ltq_etop_chan *ch) { + struct ltq_etop_priv *priv = netdev_priv(ch->netdev); + ch->skb[ch->dma.desc] = netdev_alloc_skb(ch->netdev, MAX_DMA_DATA_LEN); if (!ch->skb[ch->dma.desc]) return -ENOMEM; - ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(NULL, + ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(&priv->pdev->dev, ch->skb[ch->dma.desc]->data, MAX_DMA_DATA_LEN, DMA_FROM_DEVICE); ch->dma.desc_base[ch->dma.desc].addr = @@ -487,7 +489,7 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev) netif_trans_update(dev); spin_lock_irqsave(&priv->lock, flags); - desc->addr = ((unsigned int) dma_map_single(NULL, skb->data, len, + desc->addr = ((unsigned int) dma_map_single(&priv->pdev->dev, skb->data, len, DMA_TO_DEVICE)) - byte_offset; wmb(); desc->ctl = LTQ_DMA_OWN | LTQ_DMA_SOP | LTQ_DMA_EOP | -- 2.20.1