Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp146782ima; Fri, 1 Feb 2019 00:51:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6CXkPLooyAQcRChydiHm0ZsgffN/wlZNH/X6Ec0Fj2tvTrxGv3Sbvcmx/so89mPfXhMLqD X-Received: by 2002:a17:902:43e4:: with SMTP id j91mr37789255pld.147.1549011111504; Fri, 01 Feb 2019 00:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011111; cv=none; d=google.com; s=arc-20160816; b=dyT6YV0V5oKuAxwj9Ks92O6N+9MZ5uy7KE4IGJEXScXxUGhlS6swf2amY3bCqDxc6N r0lulXuEb3I5gpulKlML2VR5eNBZZ3nNjQqsJQIs3A5reQ7BlP4tF+xtUXQAJT2Lr9wT qmv2t3pud4gGKpFyNTIl59KLQyQkEE1a/ZUi7L5uUUzoLROijAjmcMSD3DSZrVVqpALL F59Mn0LUuUNXA9/xO3jCds/VOrMxp0MOuyrIeyclZJgroa2tCh5OFrz/yy/qVX9IhVsZ QKGKScTm1LksAkf/+s2otCnDnAJlZjVlcBYxk5qfM+kkdWOx8otPGMnVtzaAL6ByVg2/ FIEg== 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=N5mJ1AAxytGZodzOo16w91XOhAp4pN9n448U5bQziBY=; b=SHlwI7tgC6mMQ+Dw/ZYIiP6l5J2oestELZ346ljDax3icuhKOfSTrAMG7c1LooehvD m3aUat7zfBaecgnxDbuzn2z0eRWK6JqxKZ9frPHUrxwsuWOoyCP8QL/OJlsh65uZMnky jyxPxOjnww79/0cPJ562gVtvEVuThGHrWb7LzE1y11jPQVPtB9jKNn8tAaS9u0R+2vNA Imj/Yic3qrZUL4bDhHfe+y0100j2mjcLmo3yXdTPQ/GBVumfLKFilv5FZFy9go2MauKm 6buE89cX3EBhqN8qk9JVUVpKxwhEGxdd2N+yiYDXXxIttb5zsBavCDyRcJjgYPVhlC5L QSCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZE65J7It; 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 a16si7324981plm.365.2019.02.01.00.51.36; Fri, 01 Feb 2019 00:51: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=ZE65J7It; 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 S1727216AbfBAIuZ (ORCPT + 99 others); Fri, 1 Feb 2019 03:50:25 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48410 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729478AbfBAIs1 (ORCPT ); Fri, 1 Feb 2019 03:48:27 -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=N5mJ1AAxytGZodzOo16w91XOhAp4pN9n448U5bQziBY=; b=ZE65J7ItNJ+ZOfZ3Mr3Mm1fl3E aY0PbCMBGbW64XSQz8iS0+QcEkpdhJbcJhK9H/nz2diSRxQVmcl+5HaGciP8ZSAmkkKQU++Uzrr+H JbahhXq0KXzG5UtC41unOoeoISl/Tl6jf32Yqs7NMz/+yO6U7NQBeBH2zPJ+5OiM8uOkdFUAcNr4w GkFPPcCO/HrT0czxI8kRwlHzVeppwAhkAx+F16ykf7kAGBoIOZWYKzsL/MlYCJyxvMQBUrKK4Z5Xu nkNHuOjh/kRyXc7sMTLWyGtTr37Fk0tG4SP5C4w8qtZxVhHbuRNM9mK688lBqmI4YGoSFm+a274xk l316XBYw==; 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 1gpUUq-0001QE-2W; Fri, 01 Feb 2019 08:48:24 +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 08/18] moxart_ether: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:47:51 +0100 Message-Id: <20190201084801.10983-9-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/moxa/moxart_ether.c | 11 +++++++---- drivers/net/ethernet/moxa/moxart_ether.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index b34055ac476f..00dec0ffb11b 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -81,11 +81,13 @@ static void moxart_mac_free_memory(struct net_device *ndev) priv->rx_buf_size, DMA_FROM_DEVICE); if (priv->tx_desc_base) - dma_free_coherent(NULL, TX_REG_DESC_SIZE * TX_DESC_NUM, + dma_free_coherent(&priv->pdev->dev, + TX_REG_DESC_SIZE * TX_DESC_NUM, priv->tx_desc_base, priv->tx_base); if (priv->rx_desc_base) - dma_free_coherent(NULL, RX_REG_DESC_SIZE * RX_DESC_NUM, + dma_free_coherent(&priv->pdev->dev, + RX_REG_DESC_SIZE * RX_DESC_NUM, priv->rx_desc_base, priv->rx_base); kfree(priv->tx_buf_base); @@ -476,6 +478,7 @@ static int moxart_mac_probe(struct platform_device *pdev) priv = netdev_priv(ndev); priv->ndev = ndev; + priv->pdev = pdev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ndev->base_addr = res->start; @@ -491,7 +494,7 @@ static int moxart_mac_probe(struct platform_device *pdev) priv->tx_buf_size = TX_BUF_SIZE; priv->rx_buf_size = RX_BUF_SIZE; - priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * + priv->tx_desc_base = dma_alloc_coherent(&pdev->dev, TX_REG_DESC_SIZE * TX_DESC_NUM, &priv->tx_base, GFP_DMA | GFP_KERNEL); if (!priv->tx_desc_base) { @@ -499,7 +502,7 @@ static int moxart_mac_probe(struct platform_device *pdev) goto init_fail; } - priv->rx_desc_base = dma_alloc_coherent(NULL, RX_REG_DESC_SIZE * + priv->rx_desc_base = dma_alloc_coherent(&pdev->dev, RX_REG_DESC_SIZE * RX_DESC_NUM, &priv->rx_base, GFP_DMA | GFP_KERNEL); if (!priv->rx_desc_base) { diff --git a/drivers/net/ethernet/moxa/moxart_ether.h b/drivers/net/ethernet/moxa/moxart_ether.h index bee608b547d1..bf4c3029cd0c 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.h +++ b/drivers/net/ethernet/moxa/moxart_ether.h @@ -292,6 +292,7 @@ #define LINK_STATUS 0x4 struct moxart_mac_priv_t { + struct platform_device *pdev; void __iomem *base; unsigned int reg_maccr; unsigned int reg_imr; -- 2.20.1