From patchwork Tue Jun 28 02:41:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 9201727 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 A99EA607D3 for ; Tue, 28 Jun 2016 02:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D198285E6 for ; Tue, 28 Jun 2016 02:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91D5E285E7; Tue, 28 Jun 2016 02:44:14 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D9CA285F7 for ; Tue, 28 Jun 2016 02:44:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHizH-0006gd-VN; Tue, 28 Jun 2016 02:42:55 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHiyJ-00068T-Qu for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2016 02:41:56 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O9G017IENH5TE20@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2016 11:41:29 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.113]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id AC.CB.05174.8D3E1775; Tue, 28 Jun 2016 11:41:29 +0900 (KST) X-AuditID: cbfee68d-f79876d000001436-b5-5771e3d87907 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 35.27.04429.8D3E1775; Mon, 27 Jun 2016 19:41:28 -0700 (MST) 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 <0O9G00A9QNH1H050@mmp2.samsung.com>; Tue, 28 Jun 2016 11:41:28 +0900 (KST) From: Andi Shyti To: Kukjin Kim , Krzysztof Kozlowski , Mark Brown Subject: [PATCH v2 4/5] spi: s3c64xx: simplify if statement in prepare_transfer function Date: Tue, 28 Jun 2016 11:41:14 +0900 Message-id: <1467081676-8442-5-git-send-email-andi.shyti@samsung.com> X-Mailer: git-send-email 2.8.1 In-reply-to: <1467081676-8442-1-git-send-email-andi.shyti@samsung.com> References: <1467081676-8442-1-git-send-email-andi.shyti@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsWyRsSkUPfm48Jwg9Y+RovtR56xWiz+8ZzJ YurDJ2wWN361sVq8fmFo0f/4NbPFpsfXWC0u75rDZjHj/D4mi8aPN9kduDyuL/nE7LFpVSeb x+Yl9R59W1YxenzeJBfAGsVlk5Kak1mWWqRvl8CVsf7SHuaCJUIVD9tvsjYwfuHrYuTkkBAw kdi5dSk7hC0mceHeejYQW0hgBaPEz6UKMDUTZi0CinMBxWcxSsw99QHK+cgo0fj5AgtIFZuA pkTT7R9g3SICxRJPrv5nBSliFvjGKLHg5ETGLkYODmGBKInpxx1BalgEV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Z SYQ36xFQiDclsbIqtSg/vqg0J7X4EKMp0F0TmaVEk/OBCSCvJN7Q2MTMyNLI3NDCyNhcSZz3 8f91YUIC6YklqdmpqQWpRTB9TBycUg2MK9jfdlg8Z3N+qHTbK89F9rVw/Lnsgwb/ju9n9FH0 YZ5wdXWbwF5nrUmfWHY+ung5rT1MlmXfurw29TdJ57n3mjw/aXX3/Ux3vpOagTY/5Vr/1rC9 Tc5/dlJL3/yQm6XRw9htzbMFeuZ/LTOKNRTKCHskIC5zxWevbbXTv/fW1k1nd+exT49QYinO SDTUYi4qTgQAdZiAisgCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160627_194156_104127_9B6E2D25 X-CRM114-Status: GOOD ( 15.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Andi Shyti , linux-spi@vger.kernel.org, Jaehoon Chung , Andi Shyti , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The whole function is inside an 'if' statement ("!is_polling(sdd)"). Check the opposite of that statement at the beginning and exit, this way we can have one 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 c65a9e6..6d8486f 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)