Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp488617ima; Fri, 1 Feb 2019 06:27:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yeXrix58N73ee3f6AZUffO7t6XW0GUzUlZH5+TAY4HVGg8wuOW+PjRTvOLPuq+FuPyDXS X-Received: by 2002:a62:f54f:: with SMTP id n76mr39626057pfh.59.1549031255452; Fri, 01 Feb 2019 06:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549031255; cv=none; d=google.com; s=arc-20160816; b=0EK+R/LOvC2gHAdxwWG3nlmWbJhlpZ2DgZrcOnxOpP8HbE9TJFbDevfQJ6bnpuOzgA qsE0TzJSIflAQ+qo6tZ5dBneSKelS/zIjpnKdTS4/Cc9l8cqzmUpeD85SEBinbSkQKqH y696pFx1crDieV1sXGEEeAV4PmAzZRgbVGG0/LOyCCtZRIMYkV05sM+68PGNVC35akzH TPvTfIFm3kQE/LvEi2Z1bglor2Q/thC/xMyIOdB+uKRKMKSDORM68IKdmrYUHzAxwjXU lRPtXV/xJtELQlcI0YEtCofe8g2VrpUKVLxfVE1CMQEkvbxxqPOT6an9rJcmLYkUldMS ZQTQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PzTeQ6mXBVATTZmm+kyTqGSEVKkBa5saKWMAvplKRaQ=; b=lj/JkxwzUStg+oxDmll6Vo4gHfnREmHUrqw0TrtxyY3GFmVFdzYxxzJVIIrVCU++ho w21MAySwTNXPAR4T0ttFncRDtjUcFkqR0IB2JpTzo1JPHGsY/sC6a6F76oElvDtFsumc 95ipAWLoFYI7lU9uYzNvOOUCLPmhQacbziGjNSQ2i8miXvw4bPukpzxd5Ru2IHvbROFY oAoOXyfQ6lR9KbptV2ftuwpatKhH0EwtUHcsiGdGAZTdbPcXDTieZMsHQGdWvykQyyI/ eeDRH41lMRndyC2o3qy2i54vnT9dv+c+YDXBP+Zklju8rSvy1FoHFfqqwF7+VYdGeoiz TaoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h191si6972939pgc.302.2019.02.01.06.27.19; Fri, 01 Feb 2019 06:27:35 -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; 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 S1730259AbfBAOOj (ORCPT + 99 others); Fri, 1 Feb 2019 09:14:39 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60590 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbfBAOOi (ORCPT ); Fri, 1 Feb 2019 09:14:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CAB0880D; Fri, 1 Feb 2019 06:14:37 -0800 (PST) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6685A3F59C; Fri, 1 Feb 2019 06:14:35 -0800 (PST) Subject: Re: [PATCH 10/18] smc911x: pass struct device to DMA API functions To: Christoph Hellwig , 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 References: <20190201084801.10983-1-hch@lst.de> <20190201084801.10983-11-hch@lst.de> From: Robin Murphy Message-ID: Date: Fri, 1 Feb 2019 14:14:34 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190201084801.10983-11-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/02/2019 08:47, Christoph Hellwig wrote: > 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. Hmm, as far as I'm aware these are PIO chips with external DMA handshaking, rather than actual DMA masters... > Signed-off-by: Christoph Hellwig > --- > drivers/net/ethernet/smsc/smc911x.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c > index 8355dfbb8ec3..b550e624500d 100644 > --- a/drivers/net/ethernet/smsc/smc911x.c > +++ b/drivers/net/ethernet/smsc/smc911x.c > @@ -1188,7 +1188,7 @@ smc911x_tx_dma_irq(void *data) > > DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, dev, "TX DMA irq handler\n"); > BUG_ON(skb == NULL); > - dma_unmap_single(NULL, tx_dmabuf, tx_dmalen, DMA_TO_DEVICE); > + dma_unmap_single(lp->dev, tx_dmabuf, tx_dmalen, DMA_TO_DEVICE); ..so while the wrong device is still better than no device at all, this probably wants lp->txdma->device->dev. > netif_trans_update(dev); > dev_kfree_skb_irq(skb); > lp->current_tx_skb = NULL; > @@ -1219,7 +1219,7 @@ smc911x_rx_dma_irq(void *data) > > DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__); > DBG(SMC_DEBUG_RX | SMC_DEBUG_DMA, dev, "RX DMA irq handler\n"); > - dma_unmap_single(NULL, rx_dmabuf, rx_dmalen, DMA_FROM_DEVICE); > + dma_unmap_single(lp->dev, rx_dmabuf, rx_dmalen, DMA_FROM_DEVICE); And equivalently for rxdma here. However, given that this all seems only relevant to antique ARCH_PXA platforms which are presumably managing to work as-is, it's probably not worth tinkering too much. I'd just stick a note in the commit message that we're still only making these self-consistent with the existing dma_map_single() calls rather than necessarily correct. Robin. > BUG_ON(skb == NULL); > lp->current_rx_skb = NULL; > PRINT_PKT(skb->data, skb->len); >