From patchwork Fri Jun 17 07:57:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9182975 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 D34DA6075F for ; Fri, 17 Jun 2016 08:01:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C34032714B for ; Fri, 17 Jun 2016 08:01:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B80802839E; Fri, 17 Jun 2016 08:01:53 +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=unavailable 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 6E3E42714B for ; Fri, 17 Jun 2016 08:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755239AbcFQIB0 (ORCPT ); Fri, 17 Jun 2016 04:01:26 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:56971 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754938AbcFQH5d (ORCPT ); Fri, 17 Jun 2016 03:57:33 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O8W00QQZORTT1C0@mailout2.samsung.com>; Fri, 17 Jun 2016 16:57:30 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.115]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 25.22.04903.96DA3675; Fri, 17 Jun 2016 16:57:29 +0900 (KST) X-AuditID: cbfee690-f79056d000001327-f2-5763ad697e72 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id A9.FD.06657.96DA3675; Fri, 17 Jun 2016 16:57:29 +0900 (KST) Received: from samsunx.samsung ([10.113.63.54]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O8W00H9UORQH320@mmp2.samsung.com>; Fri, 17 Jun 2016 16:57:29 +0900 (KST) From: Andi Shyti To: Mark Brown Cc: Kukjin Kim , Krzysztof Kozlowski , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andi Shyti , Andi Shyti Subject: [PATCH 5/5] spi: s3c63xx: simplify if statement in prepare_transfer function Date: Fri, 17 Jun 2016 16:57:25 +0900 Message-id: <1466150245-2648-6-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1466150245-2648-1-git-send-email-andi.shyti@samsung.com> References: <1466150245-2648-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWyRsSkWDdzbXK4QcMLK4vtR56xWiz+8ZzJ YurDJ2wWr18YWvQ/fs1ssenxNVaLy7vmsFk0frzJ7sDhcX3JJ2aPTas62Tw2L6n36NuyitHj 8ya5ANYoLpuU1JzMstQifbsEroyTn6sKZgpV7J23g72B8Q1fFyMnh4SAicTOE3NZIWwxiQv3 1rOB2EICKxgl1jyJg6lZuamHCSI+i1HixALHLkYuIPsjo8Tvxf/AEmwCmhJNt3+ANYsIKEtc /b6XBaSIWeAno8TVO60sIAlhgXCJhRdWMoPYLAKqEou3PWMEsXkFXCW+rF3NDrFNTuLy9Adg gzgF3CQWXvkMVMMBtM1V4uJLTZCZEgKL2C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sriTO+/j/ujAhgfTEktTs 1NSC1CKYPiYOTqkGxqyuxmqHlsJcK6lFJezacpJ1119pViz1WOeW8eK4nmxjf2RAwnGR8H3X Xbk1ZW45MRkkb9T5LOsVfj7neOlU95T6x0kLpnDyKam8v7c75qk/a1Tsydgtz143ZEdyR3Pu NJ3+cu3Cb7eW3LFlfJydap53rV76YfhB8QvlbzWcI1Zv9jDtPztLiaU4I9FQi7moOBEAG3oh bb0CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The whole function is in an if statement ("!is_polling(sdd)"). Check the opposite of that statement at the beginning and exit, this way we can have a level less of indentation. Remove the goto paths as they are redundant. Signed-off-by: Andi Shyti --- drivers/spi/spi-s3c64xx.c | 50 +++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index a98930a..c45c88c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -341,38 +341,32 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi) dma_filter_fn filter = sdd->cntrlr_info->filter; struct device *dev = &sdd->pdev->dev; dma_cap_mask_t mask; - int ret; - if (!is_polling(sdd)) { - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - - /* Acquire DMA channels */ - sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter, - sdd->cntrlr_info->dma_rx, dev, "rx"); - if (!sdd->rx_dma.ch) { - dev_err(dev, "Failed to get RX DMA channel\n"); - ret = -EBUSY; - goto out; - } - spi->dma_rx = sdd->rx_dma.ch; - - sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter, - sdd->cntrlr_info->dma_tx, dev, "tx"); - if (!sdd->tx_dma.ch) { - dev_err(dev, "Failed to get TX DMA channel\n"); - ret = -EBUSY; - goto out_rx; - } - spi->dma_tx = sdd->tx_dma.ch; + if (is_polling(sdd)) + return 0; + + dma_cap_zero(mask); + dma_cap_set(DMA_SLAVE, mask); + + /* Acquire DMA channels */ + sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter, + sdd->cntrlr_info->dma_rx, dev, "rx"); + if (!sdd->rx_dma.ch) { + dev_err(dev, "Failed to get RX DMA channel\n"); + return -EBUSY; } + spi->dma_rx = sdd->rx_dma.ch; - return 0; + sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter, + sdd->cntrlr_info->dma_tx, dev, "tx"); + if (!sdd->tx_dma.ch) { + dev_err(dev, "Failed to get TX DMA channel\n"); + dma_release_channel(sdd->rx_dma.ch); + return -EBUSY; + } + spi->dma_tx = sdd->tx_dma.ch; -out_rx: - dma_release_channel(sdd->rx_dma.ch); -out: - return ret; + return 0; } static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi)