Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp146457ima; Fri, 1 Feb 2019 00:51:22 -0800 (PST) X-Google-Smtp-Source: AHgI3IalToPNs1W8gT0aSRiogZ1xJVwTaMqBb5krE1bthO06P8xXkvWVejbTf8nBVMGwdUUNrx82 X-Received: by 2002:a63:1d59:: with SMTP id d25mr1430400pgm.180.1549011082918; Fri, 01 Feb 2019 00:51:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011082; cv=none; d=google.com; s=arc-20160816; b=gjzQhmWYYEWi8g76HOMUnr6euGiCoybv052sbYz1uBi9cCBJuoUcda3zy9999QhAL2 13RuDNfaKdVqwc6Ao6zWhTPWXXq1vUk9P0RzXrUxeUDM4st8W53RD2MLbh5vSoDcLS5n DPzqbCHBT2DyYdb3AW7V8qU7H/Kuv0ZQJ7tS12tqn+qDeROePtuSfTURUQjc5O5mSzCS qCrYMcqZpS/u2lLljh6EE1E26N+ArAedbtfZrc6hpi2GBJRoIEQzSfz0OMd/ljjqmAon IFuo1s/TljYKgvCcQJ85CqcMbBR3v0GzONsbv4Bw/VgK680lcUfy+EbSY0Zp3BBMGe8E kfTg== 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=EDCotptuNgPwBtYaw+R0wEyOKfRmfUUw71HtLikhNLA=; b=NsFQenXqqJSOGluEcnnIT8ogcp9u3SqTitoetgYB3dnY+FZNAqTE+80cgxgydRR3tg VZjFInVUKmN16z55M3rTZ2/Ds3UePR9wd6gy8TDbZIqr7Rb2GYY0FG+AIeOikxoMOYVp YQFSwnyNccWRI8C3Rqx7eXKIIdj1pnNzGL8NJ7rh8XKc+OMiqoOgLG/NQf64F3QkDavp Tulea1df9ke3L16B4z2n96gYDEbNwLDlP1DvUMKrpQdUAS2bt0adFDWX3Eb4fayoTLK7 r9LZhaWI/Np56P5Nk15p7q/1lUqiAU+3/M9Sw8WNrmrvxlfu6HbHeQHjAP7+3iAoUI9F HUjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Dv3neyaR; 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 x10si3156702pgl.209.2019.02.01.00.51.07; Fri, 01 Feb 2019 00:51:22 -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=Dv3neyaR; 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 S1729876AbfBAItd (ORCPT + 99 others); Fri, 1 Feb 2019 03:49:33 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48512 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729682AbfBAIsk (ORCPT ); Fri, 1 Feb 2019 03:48:40 -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=EDCotptuNgPwBtYaw+R0wEyOKfRmfUUw71HtLikhNLA=; b=Dv3neyaRGIu+SiwE9QyF7BMirl TtVPfoQaeoohV30jRW4quZEBxwq41HRwagK8Rlw36NvKcsk8ickC5rAj8X1k2C8ZWbk6nxIRRLSen nzN74fwBrPKdtHLfeLR3sVJmaanh9E/SlWAewWQf7/ozNF+Rla6nKQTt4zOcf9zuIHCeOsSxJLh+6 OSxA7h53T37EaJEfCDBtfnC2pkWtLC/FaYJ+ywUIgsNBCt3f2CovwppI0WzO+h8ejL8LIZBpKuj1k RnumHHkGa6qc0bLGZVMFTy0NaO0rQRTbv+IO0c3Tykd9DlCJ01GJJuqJVe2GUp6oj1wARcKrKoW1E VqfY6XhQ==; 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 1gpUV3-0001TO-0W; Fri, 01 Feb 2019 08:48:37 +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 13/18] fotg210-udc: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:47:56 +0100 Message-Id: <20190201084801.10983-14-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/usb/gadget/udc/fotg210-udc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index fe9cf415f2f1..cec49294bac6 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c @@ -326,6 +326,7 @@ static void fotg210_wait_dma_done(struct fotg210_ep *ep) static void fotg210_start_dma(struct fotg210_ep *ep, struct fotg210_request *req) { + struct device *dev = &ep->fotg210->gadget.dev; dma_addr_t d; u8 *buffer; u32 length; @@ -348,10 +349,10 @@ static void fotg210_start_dma(struct fotg210_ep *ep, length = req->req.length; } - d = dma_map_single(NULL, buffer, length, + d = dma_map_single(dev, buffer, length, ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); - if (dma_mapping_error(NULL, d)) { + if (dma_mapping_error(dev, d)) { pr_err("dma_mapping_error\n"); return; } @@ -366,7 +367,7 @@ static void fotg210_start_dma(struct fotg210_ep *ep, /* update actual transfer length */ req->req.actual += length; - dma_unmap_single(NULL, d, length, DMA_TO_DEVICE); + dma_unmap_single(dev, d, length, DMA_TO_DEVICE); } static void fotg210_ep0_queue(struct fotg210_ep *ep, -- 2.20.1