From patchwork Thu Mar 23 07:45:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 95886 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp618933qgd; Thu, 23 Mar 2017 00:46:08 -0700 (PDT) X-Received: by 10.99.232.5 with SMTP id s5mr1389472pgh.66.1490255168290; Thu, 23 Mar 2017 00:46:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si4633091pln.61.2017.03.23.00.46.08; Thu, 23 Mar 2017 00:46:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752509AbdCWHp5 (ORCPT + 5 others); Thu, 23 Mar 2017 03:45:57 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:35915 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752224AbdCWHpy (ORCPT ); Thu, 23 Mar 2017 03:45:54 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ON900AVMC8E3Y40@mailout3.w1.samsung.com>; Thu, 23 Mar 2017 07:45:50 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170323074549eucas1p2e91e11e08a01097f7b2db9f4eef0e29a~ucymmXxgL2940529405eucas1p2L; Thu, 23 Mar 2017 07:45:49 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id D5.1A.28517.D2D73D85; Thu, 23 Mar 2017 07:45:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170323074548eucas1p142511884e12d6211bebd9cbabde2f9c9~ucyl4Rgd11228512285eucas1p1o; Thu, 23 Mar 2017 07:45:48 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-c3-58d37d2d68ab Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 8D.23.06687.89D73D85; Thu, 23 Mar 2017 07:47:36 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ON9006HQC88AT50@eusync2.samsung.com>; Thu, 23 Mar 2017 07:45:48 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Seung-Woo Kim , Joonyoung Shim , Inki Dae , stable@vger.kernel.org Subject: [PATCH 1/2] serial: samsung: Use right device for DMA-mapping calls Date: Thu, 23 Mar 2017 08:45:21 +0100 Message-id: <1490255131-9597-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFIsWRmVeSWpSXmKPExsWy7djP87q6tZcjDC695LTYOGM9q0Xz4vVs FpPuT2CxeHHvIovF+fMb2C1mnN/HZHFmcS+7xdojd9ktDr9pZ7VYsPERo8WMyS/ZHLg9Nq3q ZPPYP3cNu0ffllWMHp83yQWwRHHZpKTmZJalFunbJXBlXPh/nb3gNn/FmhvzWBoYd/F2MXJy SAiYSHTufcoOYYtJXLi3nq2LkYt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JhR29TBDr5CROHpvMOoGRewEjwypG kdTS4tz03GJDveLE3OLSvHS95PzcTYzA4N127OfmHYyXNgYfYhTgYFTi4Y2ouRQhxJpYVlyZ e4hRgoNZSYTXtvByhBBvSmJlVWpRfnxRaU5q8SFGU6DlE5mlRJPzgZGVVxJvaGJobmloZGxh YW5kpCTOW/LhSriQQHpiSWp2ampBahFMHxMHp1QDY2btp1df7m/WPdm6a8Oqn/fk4906+UuS ru5dvCJiZcadN7Efbhw7tSHX5EFkj1Zi+oPc45PDBTM7U/beE+u6lu3f9zWv4qnlx/XXrswI 5//ipLpeK5cnuXm5vKz0h5mx8iXMm5/ol1vviNA3uhy4137mJ4X86IbWNs5H1QZZNvPYtfeY H6gOVGIpzkg01GIuKk4EAKPy5qd0AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170323074548eucas1p142511884e12d6211bebd9cbabde2f9c9 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170323074548eucas1p142511884e12d6211bebd9cbabde2f9c9 X-RootMTR: 20170323074548eucas1p142511884e12d6211bebd9cbabde2f9c9 References: Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Driver should provide its own struct device for all DMA-mapping calls instead of extracting device pointer from DMA engine channel. Reported-by: Seung-Woo Kim Fixes: 2c37eedb74c8 ("serial: samsung: add dma reqest/release functions") CC: stable@vger.kernel.org # v4.0+ Signed-off-by: Marek Szyprowski --- drivers/tty/serial/samsung.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 1.9.1 diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 7a17aedbf902..9f3759bdb44f 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -901,14 +901,13 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) return -ENOMEM; } - dma->rx_addr = dma_map_single(dma->rx_chan->device->dev, dma->rx_buf, + dma->rx_addr = dma_map_single(p->port.dev, dma->rx_buf, dma->rx_size, DMA_FROM_DEVICE); spin_lock_irqsave(&p->port.lock, flags); /* TX buffer */ - dma->tx_addr = dma_map_single(dma->tx_chan->device->dev, - p->port.state->xmit.buf, + dma->tx_addr = dma_map_single(p->port.dev, p->port.state->xmit.buf, UART_XMIT_SIZE, DMA_TO_DEVICE); spin_unlock_irqrestore(&p->port.lock, flags); @@ -922,7 +921,7 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) if (dma->rx_chan) { dmaengine_terminate_all(dma->rx_chan); - dma_unmap_single(dma->rx_chan->device->dev, dma->rx_addr, + dma_unmap_single(p->port.dev, dma->rx_addr, dma->rx_size, DMA_FROM_DEVICE); kfree(dma->rx_buf); dma_release_channel(dma->rx_chan); @@ -931,7 +930,7 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) if (dma->tx_chan) { dmaengine_terminate_all(dma->tx_chan); - dma_unmap_single(dma->tx_chan->device->dev, dma->tx_addr, + dma_unmap_single(p->port.dev, dma->tx_addr, UART_XMIT_SIZE, DMA_TO_DEVICE); dma_release_channel(dma->tx_chan); dma->tx_chan = NULL;