From patchwork Fri Aug 28 15:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11743203 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1853E913 for ; Fri, 28 Aug 2020 15:26:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E43C5208D5 for ; Fri, 28 Aug 2020 15:26:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628408; bh=log7AWSuF7JDEl3CBLoeT1NR4965UMi8bHOOurlBFhI=; h=From:To:Cc:Subject:Date:List-ID:From; b=uyBMPG/AL3FsyPJPATqnIfDfcqeIOxv25/N4psSFusohRik/lL5TS9c7O4ddCZ2eg WOv1Na+8rvL3qmafxRi65ZZbQ4TJFA4BQQQxbUhv7IRhWaVM68IoRmh2kwCWXfuL6F 1C92bTffqv1ryQl1VV4LtkMOC1QTIy5AKjbqsxPU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgH1P0q (ORCPT ); Fri, 28 Aug 2020 11:26:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:37672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727843AbgH1P0p (ORCPT ); Fri, 28 Aug 2020 11:26:45 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37345208C9; Fri, 28 Aug 2020 15:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628404; bh=log7AWSuF7JDEl3CBLoeT1NR4965UMi8bHOOurlBFhI=; h=From:To:Cc:Subject:Date:From; b=dMDYP5r9cdaKFRyr7mNN7hs6VyR+O+iZydqxbOsqcYAf+bXjVXMRlFi0oE3FzTOD0 h6ZmkSqU4+De+egmyCUSFm7VIGozhViBbWg4FS+574X/ck2R4m02Me/8fZ67Htfhui +AhhWO2mDGCKAxVHoMlu8NFh8/OZknduFMlFuSu8= From: Krzysztof Kozlowski To: Vinod Koul , Dan Williams , Maxime Coquelin , Alexandre Torgue , Michal Simek , Radhey Shyam Pandey , Nicholas Graumann , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/3] dmaengine: pl330: Simplify with dev_err_probe() Date: Fri, 28 Aug 2020 17:26:35 +0200 Message-Id: <20200828152637.16903-1-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski --- drivers/dma/pl330.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 106f47298f9e..bb27338ec1ae 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -3034,9 +3034,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pl330->rstc = devm_reset_control_get_optional(&adev->dev, "dma"); if (IS_ERR(pl330->rstc)) { - if (PTR_ERR(pl330->rstc) != -EPROBE_DEFER) - dev_err(&adev->dev, "Failed to get reset!\n"); - return PTR_ERR(pl330->rstc); + return dev_err_probe(&adev->dev, PTR_ERR(pl330->rstc), "Failed to get reset!\n"); } else { ret = reset_control_deassert(pl330->rstc); if (ret) { @@ -3047,9 +3045,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pl330->rstc_ocp = devm_reset_control_get_optional(&adev->dev, "dma-ocp"); if (IS_ERR(pl330->rstc_ocp)) { - if (PTR_ERR(pl330->rstc_ocp) != -EPROBE_DEFER) - dev_err(&adev->dev, "Failed to get OCP reset!\n"); - return PTR_ERR(pl330->rstc_ocp); + return dev_err_probe(&adev->dev, PTR_ERR(pl330->rstc_ocp), + "Failed to get OCP reset!\n"); } else { ret = reset_control_deassert(pl330->rstc_ocp); if (ret) { From patchwork Fri Aug 28 15:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11743205 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DD3B13B6 for ; Fri, 28 Aug 2020 15:26:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16683208C9 for ; Fri, 28 Aug 2020 15:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628416; bh=83QJ4zEIz76mA1hS6M2smn2fhAmAbrBZQN+yfkylPbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MUsiDHmRiFqfTavZ4dmqyp1W/bPxqF56ExeFsbDOxq9sV/oRlLoVOtODCotSiZIKn 54L4Dairwk2uxqH9Y6gvLDaQO0J2Fn+R3FkWq7OHCtvaMUiIjsDG+K8OeCp5M3uj07 RH+wQHZOlgYa1pDNIS3w1aGukDdGIb8FTsm1n2FA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728222AbgH1P0y (ORCPT ); Fri, 28 Aug 2020 11:26:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:37720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728164AbgH1P0s (ORCPT ); Fri, 28 Aug 2020 11:26:48 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B8DD2098B; Fri, 28 Aug 2020 15:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628407; bh=83QJ4zEIz76mA1hS6M2smn2fhAmAbrBZQN+yfkylPbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oL0AYrgbGu8lpCoD+SZXyeWLzrYoWg7v/KutvpK1olNrIBLOgkaDpTjjy+BeyYFun uIlswo8htLt/exM0xJafr+bdhtVTre59sbtia2Ptc+DGhqhfTquwgqGlXXIBRA/AOX DdlQBSCXa5XXmmVi/ltkxtD93Y/31p5S2RKx8Dkc= From: Krzysztof Kozlowski To: Vinod Koul , Dan Williams , Maxime Coquelin , Alexandre Torgue , Michal Simek , Radhey Shyam Pandey , Nicholas Graumann , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/3] dmaengine: stm32: Simplify with dev_err_probe() Date: Fri, 28 Aug 2020 17:26:36 +0200 Message-Id: <20200828152637.16903-2-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200828152637.16903-1-krzk@kernel.org> References: <20200828152637.16903-1-krzk@kernel.org> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski --- drivers/dma/stm32-dma.c | 8 ++------ drivers/dma/stm32-dmamux.c | 9 +++------ drivers/dma/stm32-mdma.c | 9 +++------ 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 96ad1b3d24c6..d0055d2f0b9a 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -1311,12 +1311,8 @@ static int stm32_dma_probe(struct platform_device *pdev) return PTR_ERR(dmadev->base); dmadev->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dmadev->clk)) { - ret = PTR_ERR(dmadev->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Can't get clock\n"); - return ret; - } + if (IS_ERR(dmadev->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dmadev->clk), "Can't get clock\n"); ret = clk_prepare_enable(dmadev->clk); if (ret < 0) { diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c index 12f7637e13a1..a10ccd964376 100644 --- a/drivers/dma/stm32-dmamux.c +++ b/drivers/dma/stm32-dmamux.c @@ -252,12 +252,9 @@ static int stm32_dmamux_probe(struct platform_device *pdev) spin_lock_init(&stm32_dmamux->lock); stm32_dmamux->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(stm32_dmamux->clk)) { - ret = PTR_ERR(stm32_dmamux->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Missing clock controller\n"); - return ret; - } + if (IS_ERR(stm32_dmamux->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(stm32_dmamux->clk), + "Missing clock controller\n"); ret = clk_prepare_enable(stm32_dmamux->clk); if (ret < 0) { diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 5469563703d1..08cfbfab837b 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -1580,12 +1580,9 @@ static int stm32_mdma_probe(struct platform_device *pdev) return PTR_ERR(dmadev->base); dmadev->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(dmadev->clk)) { - ret = PTR_ERR(dmadev->clk); - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Missing clock controller\n"); - return ret; - } + if (IS_ERR(dmadev->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(dmadev->clk), + "Missing clock controller\n"); ret = clk_prepare_enable(dmadev->clk); if (ret < 0) { From patchwork Fri Aug 28 15:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11743207 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 35E20913 for ; Fri, 28 Aug 2020 15:27:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AD7F208FE for ; Fri, 28 Aug 2020 15:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628420; bh=24sRIQKF90KGrD04GnXmBdm+l+GRCZb8x1J9A9FTPeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v+LfIedMGCromtVyIXk20C9vB2zfRT2ESiaWgaaoSP9yd8uYAzTio4Vw0nytGaRNj w0QN2hJyHjto5uZeTvN0Rw1GltADYMUUsJ1zzUmkQVDvEh82HiknvOmONNPpePH3nF UM7WuR8MfAkGV8nr5JUMg+55Lcr+NPmeoCbGqc2M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728236AbgH1P05 (ORCPT ); Fri, 28 Aug 2020 11:26:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728204AbgH1P0v (ORCPT ); Fri, 28 Aug 2020 11:26:51 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58223208D5; Fri, 28 Aug 2020 15:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598628411; bh=24sRIQKF90KGrD04GnXmBdm+l+GRCZb8x1J9A9FTPeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKrormv2PQjSm9o8tVds65EgrQucz2shYLT66nj51TKUuwiPpsLW0VKYWYP51XrAp bGqKIcVfGm5mJ8YD6y46HGXEzgyV25eiiFwG6Y4hvRcIctqvHJ1RW1iY7Y+pyr591J SMCbRcCe1VsXP0c1oiOU2WSMc15wnNsgcyqMa4y0= From: Krzysztof Kozlowski To: Vinod Koul , Dan Williams , Maxime Coquelin , Alexandre Torgue , Michal Simek , Radhey Shyam Pandey , Nicholas Graumann , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] dmaengine: xilinx: Simplify with dev_err_probe() Date: Fri, 28 Aug 2020 17:26:37 +0200 Message-Id: <20200828152637.16903-3-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200828152637.16903-1-krzk@kernel.org> References: <20200828152637.16903-1-krzk@kernel.org> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski --- drivers/dma/xilinx/xilinx_dma.c | 36 ++++++++------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 5429497d3560..286cf94a950d 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2536,13 +2536,8 @@ static int axidma_clk_init(struct platform_device *pdev, struct clk **axi_clk, *tmp_clk = NULL; *axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk"); - if (IS_ERR(*axi_clk)) { - err = PTR_ERR(*axi_clk); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n", - err); - return err; - } + if (IS_ERR(*axi_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n"); *tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk"); if (IS_ERR(*tx_clk)) @@ -2603,22 +2598,12 @@ static int axicdma_clk_init(struct platform_device *pdev, struct clk **axi_clk, *tmp2_clk = NULL; *axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk"); - if (IS_ERR(*axi_clk)) { - err = PTR_ERR(*axi_clk); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get axi_clk (%d)\n", - err); - return err; - } + if (IS_ERR(*axi_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n"); *dev_clk = devm_clk_get(&pdev->dev, "m_axi_aclk"); - if (IS_ERR(*dev_clk)) { - err = PTR_ERR(*dev_clk); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get dev_clk (%d)\n", - err); - return err; - } + if (IS_ERR(*dev_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(*dev_clk), "failed to get dev_clk\n"); err = clk_prepare_enable(*axi_clk); if (err) { @@ -2647,13 +2632,8 @@ static int axivdma_clk_init(struct platform_device *pdev, struct clk **axi_clk, int err; *axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk"); - if (IS_ERR(*axi_clk)) { - err = PTR_ERR(*axi_clk); - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get axi_aclk (%d)\n", - err); - return err; - } + if (IS_ERR(*axi_clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(*axi_clk), "failed to get axi_aclk\n"); *tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk"); if (IS_ERR(*tx_clk))