From patchwork Fri Dec 16 09:56:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9477671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 23BB76047D for ; Fri, 16 Dec 2016 09:57:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CC7128793 for ; Fri, 16 Dec 2016 09:57:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 214C9287BA; Fri, 16 Dec 2016 09:57:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6228F28793 for ; Fri, 16 Dec 2016 09:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760449AbcLPJ5P (ORCPT ); Fri, 16 Dec 2016 04:57:15 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:36368 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760295AbcLPJ5N (ORCPT ); Fri, 16 Dec 2016 04:57:13 -0500 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OI9010K9VN9GE90@mailout4.samsung.com>; Fri, 16 Dec 2016 18:57:10 +0900 (KST) X-AuditID: cbfee61b-f796f6d000004092-f4-5853ba7682de Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 31.1F.16530.67AB3585; Fri, 16 Dec 2016 18:57:10 +0900 (KST) Received: from AMDC2765.digital.local ([106.116.147.25]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OI9008FDVN3ST50@mmp2.samsung.com>; Fri, 16 Dec 2016 18:57:10 +0900 (KST) 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 Subject: [PATCH] serial: samsung: Simplify DMA engine initialization code Date: Fri, 16 Dec 2016 10:56:53 +0100 Message-id: <1481882213-10856-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t9jQd2yXcERBsuOG1psnLGe1aJ58Xo2 i/PnN7BbzDi/j8nizOJedou1R+6yWxx+087qwO6xaVUnm8f+uWvYPfq2rGL0+LxJLoAlys0m IzUxJbVIITUvOT8lMy/dVik0xE3XQkkhLzE31VYpQtc3JEhJoSwxpxTIMzJAAw7OAe7BSvp2 CW4ZR69dZSw4IlTR8vsNawPjOf4uRk4OCQETiamrJ7JA2GISF+6tZ+ti5OIQEpjFKPHo9y5G COcXo8SV+a/BqtgEDCW63naxgdgiAs4Ss88uZAIpYhb4xCjRsugaI0hCWMBT4ujBrWBFLAKq EofuTmUCsXkFPCQ2rZwCtU5O4uSxyawTGLkXMDKsYpRILUguKE5KzzXKSy3XK07MLS7NS9dL zs/dxAgOzmfSOxgP73I/xCjAwajEw/tjW1CEEGtiWXFl7iFGCQ5mJRHewm3BEUK8KYmVValF +fFFpTmpxYcYTYEOmMgsJZqcD4ycvJJ4QxNzE3NjAwtzS0sTIyVx3sbZz8KFBNITS1KzU1ML Uotg+pg4OKUaGMUur4i6HblBJS7c47KPwtT08vp5H6qKxAQ17AU2+E48qmBi4rFG5frPPc7n dVUC/ATcfuWbVnhzyNyPlzs0M6xx7oKIlZH3JD03Lu1s+CNu1Ka2xbSlYL5itrL5XEeBjZo8 t34XSyx7vz1+o71WPc/nKPM78y4lNqius7sQzxvgs+b4njcaSizFGYmGWsxFxYkAI1lb52QC AAA= X-MTR: 20000000000000000@CPGS Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dma_request_slave_channel_compat() requires filter function and mask, which are not needed on device tree based platforms, so simplify the code by calling the more appropriate dma_request_chan() function. This additionally gives us proper error handling, because the new function returns error codes instead of NULL on failure. Signed-off-by: Marek Szyprowski Reviewed-by: Sylwester Nawrocki --- drivers/tty/serial/samsung.c | 17 ++++++----------- drivers/tty/serial/samsung.h | 4 ---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index f44615fa474d..a9b309ba24a4 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -859,7 +859,6 @@ static void s3c24xx_serial_break_ctl(struct uart_port *port, int break_state) static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) { struct s3c24xx_uart_dma *dma = p->dma; - dma_cap_mask_t mask; unsigned long flags; /* Default slave configuration parameters */ @@ -876,21 +875,17 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) else dma->tx_conf.dst_maxburst = 1; - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); + dma->rx_chan = dma_request_chan(p->port.dev, "rx"); - dma->rx_chan = dma_request_slave_channel_compat(mask, dma->fn, - dma->rx_param, p->port.dev, "rx"); - if (!dma->rx_chan) - return -ENODEV; + if (IS_ERR(dma->rx_chan)) + return PTR_ERR(dma->rx_chan); dmaengine_slave_config(dma->rx_chan, &dma->rx_conf); - dma->tx_chan = dma_request_slave_channel_compat(mask, dma->fn, - dma->tx_param, p->port.dev, "tx"); - if (!dma->tx_chan) { + dma->tx_chan = dma_request_chan(p->port.dev, "tx"); + if (IS_ERR(dma->tx_chan)) { dma_release_channel(dma->rx_chan); - return -ENODEV; + return PTR_ERR(dma->tx_chan); } dmaengine_slave_config(dma->tx_chan, &dma->tx_conf); diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h index a04acef1cb20..965199b6c16f 100644 --- a/drivers/tty/serial/samsung.h +++ b/drivers/tty/serial/samsung.h @@ -44,10 +44,6 @@ struct s3c24xx_serial_drv_data { }; struct s3c24xx_uart_dma { - dma_filter_fn fn; - void *rx_param; - void *tx_param; - unsigned int rx_chan_id; unsigned int tx_chan_id;