Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp146435ima; Fri, 1 Feb 2019 00:51:20 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibcj+xmpRi4yuunPmWS8rBsWLn93LnY9m+reEFB5Q1nxiSo2gaIYjJ1L8LLeMt5MBEVLVTx X-Received: by 2002:a65:500c:: with SMTP id f12mr1312886pgo.226.1549011080823; Fri, 01 Feb 2019 00:51:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549011080; cv=none; d=google.com; s=arc-20160816; b=k2oNSGvBrnYqTc7U1KupZMPQuMDTyqRtJKo+E+aCt+kXSbr/Mh4OG4rGkKBXIfX1Ve BvtB4XyAUT2aU3SChE/mb+t3k+rFxx9XSJDiSWl2OLjEHYTYOFGYOhrqHk8LhXtMDh+U iuRILiz7DsTeQdpPJmmnCDR/JNbDp80FHfTLj1/HDv676c08nA+NnDg5kf5PTbUBZ6Cr GAMo89mtOOyW+99f8B84yJUz2vnJa2G3Cht1QHRRoU6pCaejgNWiji6asnULCkMCIYin uibzvjdkAenlq1q8s47Nr5BTTGnyZbNeUvG23X8dTJg/yy27iYxtTRdlXZpJRu+2Oonn Mx1A== 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=pU0HGVd2mqMY96Sg+NjMcR2p0eV/+Kyy5J3jOlZeRfA=; b=anELOCaeDvQRR8rf5GPnMr+NSVQoWBaPqVAQUuL3KChsiTPPPJd1vz6f1iv3UdpfLB Q+HmJnvRPliqfiouquCFitUvcxx/RLx+h3eCxZ27EImn/IYPOvM33kp2wiMwXxHG+gNP rHl8OkvHFcRecO+aOMCZ3kbH9WnkpwqjCRT5f4XPK3FYfeuWlcjriP6PjqFIDteRm4ZP iUup+xk9GRUVLBN7Ymim9JFhDDVtgxnL3sGbmEFVSSwA7z2+yYBuOmT1qFIOJbwWyfLA fkIlJ3o2Mq5Zc6JO6FEtiyHsNfVgDs/jLdiV0pHOJyDI6jUnrgjx/juLoQ7g0Fh44Wj5 2hMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DVnztnYQ; 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 b14si1827888plk.333.2019.02.01.00.51.05; Fri, 01 Feb 2019 00:51:20 -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=DVnztnYQ; 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 S1729705AbfBAIsl (ORCPT + 99 others); Fri, 1 Feb 2019 03:48:41 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:48470 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729634AbfBAIsf (ORCPT ); Fri, 1 Feb 2019 03:48:35 -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=pU0HGVd2mqMY96Sg+NjMcR2p0eV/+Kyy5J3jOlZeRfA=; b=DVnztnYQZKzoT+JeFlNalarZXc DKYysDp7mfma5POpYC66khqOTC3hwKqlH0UkhiF052GFkvIRXiHNM2wrhaUNP2F5l6juTEr+T7hrT hS//HLgdatiRar2k9vIXFDmlysobYx0LAk9qyxYNxKtZ1sg7/XYWyGUivFAgfk3GVts5fHyHwqwnf O82txf8uvAHAjz8jDyJDxiMjAMx0wL6clUmFBUlkWAJambBIMlVC1RSI2KD3j0nD05W3N1/FnPBWy G40VoJ1mRzh0wM5Ggb6UKzr6k+9LoXDeN8xpkDLqMry8GFJAilOiwyXJKCe6e0NFX8iNe8zcmafo/ 6ZOcrW1w==; 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 1gpUUx-0001S8-UW; Fri, 01 Feb 2019 08:48:32 +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 11/18] parport_ip32: pass struct device to DMA API functions Date: Fri, 1 Feb 2019 09:47:54 +0100 Message-Id: <20190201084801.10983-12-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/parport/parport_ip32.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c index 62873070f988..b7a892791c3e 100644 --- a/drivers/parport/parport_ip32.c +++ b/drivers/parport/parport_ip32.c @@ -568,6 +568,7 @@ static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id) /** * parport_ip32_dma_start - begins a DMA transfer + * @p: partport to work on * @dir: DMA direction: DMA_TO_DEVICE or DMA_FROM_DEVICE * @addr: pointer to data buffer * @count: buffer size @@ -575,8 +576,8 @@ static irqreturn_t parport_ip32_merr_interrupt(int irq, void *dev_id) * Calls to parport_ip32_dma_start() and parport_ip32_dma_stop() must be * correctly balanced. */ -static int parport_ip32_dma_start(enum dma_data_direction dir, - void *addr, size_t count) +static int parport_ip32_dma_start(struct parport *p, + enum dma_data_direction dir, void *addr, size_t count) { unsigned int limit; u64 ctrl; @@ -601,7 +602,7 @@ static int parport_ip32_dma_start(enum dma_data_direction dir, /* Prepare DMA pointers */ parport_ip32_dma.dir = dir; - parport_ip32_dma.buf = dma_map_single(NULL, addr, count, dir); + parport_ip32_dma.buf = dma_map_single(&p->bus_dev, addr, count, dir); parport_ip32_dma.len = count; parport_ip32_dma.next = parport_ip32_dma.buf; parport_ip32_dma.left = parport_ip32_dma.len; @@ -625,11 +626,12 @@ static int parport_ip32_dma_start(enum dma_data_direction dir, /** * parport_ip32_dma_stop - ends a running DMA transfer + * @p: partport to work on * * Calls to parport_ip32_dma_start() and parport_ip32_dma_stop() must be * correctly balanced. */ -static void parport_ip32_dma_stop(void) +static void parport_ip32_dma_stop(struct parport *p) { u64 ctx_a; u64 ctx_b; @@ -685,8 +687,8 @@ static void parport_ip32_dma_stop(void) enable_irq(MACEISA_PAR_CTXB_IRQ); parport_ip32_dma.irq_on = 1; - dma_unmap_single(NULL, parport_ip32_dma.buf, parport_ip32_dma.len, - parport_ip32_dma.dir); + dma_unmap_single(&p->bus_dev, parport_ip32_dma.buf, + parport_ip32_dma.len, parport_ip32_dma.dir); } /** @@ -1445,7 +1447,7 @@ static size_t parport_ip32_fifo_write_block_dma(struct parport *p, priv->irq_mode = PARPORT_IP32_IRQ_HERE; - parport_ip32_dma_start(DMA_TO_DEVICE, (void *)buf, len); + parport_ip32_dma_start(p, DMA_TO_DEVICE, (void *)buf, len); reinit_completion(&priv->irq_complete); parport_ip32_frob_econtrol(p, ECR_DMAEN | ECR_SERVINTR, ECR_DMAEN); @@ -1461,7 +1463,7 @@ static size_t parport_ip32_fifo_write_block_dma(struct parport *p, if (ecr & ECR_SERVINTR) break; /* DMA transfer just finished */ } - parport_ip32_dma_stop(); + parport_ip32_dma_stop(p); written = len - parport_ip32_dma_get_residue(); priv->irq_mode = PARPORT_IP32_IRQ_FWD; -- 2.20.1