From patchwork Thu Sep 26 08:38:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13813074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADFAFCCF9E9 for ; Thu, 26 Sep 2024 08:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8DgRQOFCytjI9FkTJ+0ouOWyTm9ikdd+11U8xTNi5DM=; b=0aGRjS8TvVOdQX8JxPpGzH4uAX TpJcwF49Z1Ktuirk3Phh3sM/mIyiptmX9muydHd+NSpsN0OsNL/4Ym+kvhLSd/yiOxWhQrbet/HUE mvimprzHsEw5/5JlGTm/1GXdO4TzW0laLBT5ozCwkSECOFvhb+maWYiwPC06QwtcPCFxN4+09b1ZE KRFEcMK0MGk2/9B+jxiuyCHnqkvhoIVw3w9Eb8LPhmJIoOyTKNjmn4B0/54HxpMdH8rf7Rp5nJBbf 42an8SHj5k0YYP+VmztPOSrUoR+txCbvsLUVATX9n10NMkoJyltkqp05jFRKlGCLBbfjaIQwn6Gq9 4ozvenEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkKU-00000007miP-4381; Thu, 26 Sep 2024 08:58:31 +0000 Received: from mail.manjaro.org ([2a01:4f8:c0c:51f3::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stk16-00000007iGp-40ea; Thu, 26 Sep 2024 08:38:30 +0000 From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1727339907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8DgRQOFCytjI9FkTJ+0ouOWyTm9ikdd+11U8xTNi5DM=; b=mk9/5BNbLd8di80h3Sj4QuyCqmD58BFew1dpSOO93UBPKQWUMJldotxP+aBSqEac4q6FpN capubeEq8cs5yCcU/nHPdPu6gLT9c4kgIXLT4fXyGNair8+UMfshd6HsnlyLzUIADF/mc0 xjtZfowXp9IejsxfH4ihCw0TZlbjbLaZNsjJs/0WBHifN4zj8NK1oYGeJwH6WD6+CHANMk 6Ho0uvNONEloVtAQVQej4lYKQwBitmY/h9a2woSiv/GfFgn/wVLGud0ZSblDAa9dgdNvPB xyyt5ul/Qj0I1fWCwQ1t9d9LmH6zgC9ZuDtKUqe48otBXkdelBiXAx+PEXhXiw== To: linux-spi@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: broonie@kernel.org, heiko@sntech.de, oss@helene.moe, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] spi: rockchip: Use dev_err_probe() in the probe path Date: Thu, 26 Sep 2024 10:38:15 +0200 Message-Id: <8bc905ff3c47ed458d8c65a031822ba6b9df8a07.1727337732.git.dsimic@manjaro.org> In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: ORIGINATING; auth=pass smtp.auth=dsimic@manjaro.org smtp.mailfrom=dsimic@manjaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240926_013829_360632_F2990514 X-CRM114-Status: GOOD ( 12.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use function dev_err_probe() in the probe path instead of dev_err() where appropriate, to make the code a bit more uniform and compact, and to improve error handling for the TX and RX DMA channel requests. Previously, deferred requests for the TX and RX DMA channels produced no debug messages, and the final error messages didn't include the error codes, which are all highly useful when debugging permanently failed DMA channel requests, such as when the required drivers aren't enabled. Suggested-by: Hélene Vulquin Signed-off-by: Dragan Simic --- drivers/spi/spi-rockchip.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 28879fed03f8..6b5c67a357bb 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -773,15 +773,15 @@ static int rockchip_spi_probe(struct platform_device *pdev) rs->apb_pclk = devm_clk_get_enabled(&pdev->dev, "apb_pclk"); if (IS_ERR(rs->apb_pclk)) { - dev_err(&pdev->dev, "Failed to get apb_pclk\n"); - ret = PTR_ERR(rs->apb_pclk); + ret = dev_err_probe(&pdev->dev, PTR_ERR(rs->apb_pclk), + "Failed to get apb_pclk\n"); goto err_put_ctlr; } rs->spiclk = devm_clk_get_enabled(&pdev->dev, "spiclk"); if (IS_ERR(rs->spiclk)) { - dev_err(&pdev->dev, "Failed to get spi_pclk\n"); - ret = PTR_ERR(rs->spiclk); + ret = dev_err_probe(&pdev->dev, PTR_ERR(rs->spiclk), + "Failed to get spi_pclk\n"); goto err_put_ctlr; } @@ -853,22 +853,21 @@ static int rockchip_spi_probe(struct platform_device *pdev) ctlr->dma_tx = dma_request_chan(rs->dev, "tx"); if (IS_ERR(ctlr->dma_tx)) { - /* Check tx to see if we need defer probing driver */ - if (PTR_ERR(ctlr->dma_tx) == -EPROBE_DEFER) { - ret = -EPROBE_DEFER; + /* Check tx to see if we need to defer driver probing */ + ret = dev_err_probe(rs->dev, PTR_ERR(ctlr->dma_tx), + "Failed to request TX DMA channel\n"); + if (ret == -EPROBE_DEFER) goto err_disable_pm_runtime; - } - dev_warn(rs->dev, "Failed to request TX DMA channel\n"); ctlr->dma_tx = NULL; } ctlr->dma_rx = dma_request_chan(rs->dev, "rx"); if (IS_ERR(ctlr->dma_rx)) { - if (PTR_ERR(ctlr->dma_rx) == -EPROBE_DEFER) { - ret = -EPROBE_DEFER; + /* Check rx to see if we need to defer driver probing */ + ret = dev_err_probe(rs->dev, PTR_ERR(ctlr->dma_rx), + "Failed to request RX DMA channel\n"); + if (ret == -EPROBE_DEFER) goto err_free_dma_tx; - } - dev_warn(rs->dev, "Failed to request RX DMA channel\n"); ctlr->dma_rx = NULL; }