From patchwork Thu Sep 26 08:38:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13813063 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 E14B7CCFA13 for ; Thu, 26 Sep 2024 08:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=FBBF6xlG+nyURWLI9I8LX/i+D05pAfeijhLcDboaOUA=; b=kh+0G5gZFvHYRs DX5+YI/xjvnFkgNx/opOQ09mSweC/WX+w9ptZMpelTv7bAU3BTMIN00YtM/rGmXwRfS1UqHVPJlav 2wVIqZy6lM5+ChTBKZqiwPToQDdtzFps4/ua5HPvgLa3zPyrfWWIEZSyRqLgAwxrenIcEeud3x5QO +6cHhHDIYzXk/a/R63w2yQLrP1KhXrnYCtN3whRTfBUiY4SUDPJyWl6mChU7WnOx6+RstWoXa8y7u U8+6vhYXRgmOeJpsDwaDI2QfjMUny6swNpho4UECojfmC64DyZB9/j2lnkVeuqStZO7ONduP2KItr OcqnvI3+pGXDNaFyAnhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkDL-00000007l9B-0we4; Thu, 26 Sep 2024 08:51:07 +0000 Received: from mail.manjaro.org ([116.203.91.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stk14-00000007iG0-3K0x; Thu, 26 Sep 2024 08:38:28 +0000 From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1727339905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L5klnkF4wtonDE46Lon77oxl2lTvUoZwDONtF/BOYTw=; b=pDAK9tDtR9WtDecPc3W/VNrNtqCwWWrkrDJ12x6+2fVENUODvgXXjkuvzJAuqmsmd/LME6 kKgoecpybZSlqmXe+W5WrS5blD9cDzqSQV1IDtK2QCg21BeUPhc6HC8kPObjYe6J0XkShx MY8Tqw0JApIXXzEkhT/BOcklgveK3qpwn1h47/6+g4lc32ILfeGd19q3UjZedsQh4DicQU WOoU18Jhy1tsfDqrhlARCimM08GcwVNwzCpHh9k4lQUWVCNEtv7uIvb4Cw7IF0FkRIy7IB BUhPFX1SWX7/XSkG1TrvwcyQt4ZoaW0UA3R55Fv1ogEkzknvy2384+7P0ZYzuQ== 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 1/5] spi: rockchip: Perform trivial code cleanups Date: Thu, 26 Sep 2024 10:38:12 +0200 Message-Id: <663ec6bb472ab83bb5824a09d11b36ef20a43fc7.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_013827_139784_BF95E4B3 X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Perform a few trivial code cleanups, to obey the reverse Christmas tree rule, to avoid unnecessary line wrapping by using the 100-column width better, to actually obey the 100-column width in one case, and to make the way a couple of wrapped function arguments are indented a bit more readable. No intended functional changes are introduced by these code cleanups. Signed-off-by: Dragan Simic Reviewed-by: Heiko Stuebner --- drivers/spi/spi-rockchip.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index e1ecd96c7858..81f2a966c124 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -742,34 +742,32 @@ static int rockchip_spi_setup(struct spi_device *spi) static int rockchip_spi_probe(struct platform_device *pdev) { - int ret; - struct rockchip_spi *rs; + struct device_node *np = pdev->dev.of_node; struct spi_controller *ctlr; + struct rockchip_spi *rs; struct resource *mem; - struct device_node *np = pdev->dev.of_node; u32 rsd_nsecs, num_cs; bool target_mode; + int ret; target_mode = of_property_read_bool(np, "spi-slave"); if (target_mode) - ctlr = spi_alloc_target(&pdev->dev, - sizeof(struct rockchip_spi)); + ctlr = spi_alloc_target(&pdev->dev, sizeof(struct rockchip_spi)); else - ctlr = spi_alloc_host(&pdev->dev, - sizeof(struct rockchip_spi)); + ctlr = spi_alloc_host(&pdev->dev, sizeof(struct rockchip_spi)); if (!ctlr) return -ENOMEM; platform_set_drvdata(pdev, ctlr); rs = spi_controller_get_devdata(ctlr); /* Get basic io resource and map it */ rs->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); if (IS_ERR(rs->regs)) { - ret = PTR_ERR(rs->regs); + ret = PTR_ERR(rs->regs); goto err_put_ctlr; } @@ -794,26 +792,25 @@ static int rockchip_spi_probe(struct platform_device *pdev) goto err_put_ctlr; ret = devm_request_threaded_irq(&pdev->dev, ret, rockchip_spi_isr, NULL, - IRQF_ONESHOT, dev_name(&pdev->dev), ctlr); + IRQF_ONESHOT, dev_name(&pdev->dev), ctlr); if (ret) goto err_put_ctlr; rs->dev = &pdev->dev; rs->freq = clk_get_rate(rs->spiclk); if (!of_property_read_u32(pdev->dev.of_node, "rx-sample-delay-ns", &rsd_nsecs)) { /* rx sample delay is expressed in parent clock cycles (max 3) */ - u32 rsd = DIV_ROUND_CLOSEST(rsd_nsecs * (rs->freq >> 8), - 1000000000 >> 8); + u32 rsd = DIV_ROUND_CLOSEST(rsd_nsecs * (rs->freq >> 8), 1000000000 >> 8); if (!rsd) { dev_warn(rs->dev, "%u Hz are too slow to express %u ns delay\n", - rs->freq, rsd_nsecs); + rs->freq, rsd_nsecs); } else if (rsd > CR0_RSD_MAX) { rsd = CR0_RSD_MAX; - dev_warn(rs->dev, "%u Hz are too fast to express %u ns delay, clamping at %u ns\n", - rs->freq, rsd_nsecs, - CR0_RSD_MAX * 1000000000U / rs->freq); + dev_warn(rs->dev, + "%u Hz are too fast to express %u ns delay, clamping at %u ns\n", + rs->freq, rsd_nsecs, CR0_RSD_MAX * 1000000000U / rs->freq); } rs->rsd = rsd; } From patchwork Thu Sep 26 08:38:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13813067 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 9515CCCFA13 for ; Thu, 26 Sep 2024 08:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=psdVGGLBmuNjBn83xCRByfjWc8OTUtPQaDK2BapUq9g=; b=q7DcMgPHxZSupf G9cH9zeO1I7xWz7JYrR7WOKdHfhCpDLGFIQUDOkOo6Pnjnqq96WpDR+exqT/5vc9CGt74u6nyL8i3 BOuxP/q4KgazTe3o4j+mrpoqdMabgNoSEfVHeidupijXwe4HA0QmffkeDsuVj1cS6HvOWeVdvxvZG 3hUSZ8xCv9lp6aJoFImNhfbrUXW4gcwEwMaypcmk530IsFro1/fCHk5p5FlehW6l7z8BH5k7pILcV 4qAciIyUFun2E2q8IZzbaHCIEmBzlyhJSxbtbuiw352E+xW18ejqHeFgXCN8rRA/GkVQpLqVLsjpJ gKxP8RXhDZclRMKuW+tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkIC-00000007mAz-1nLJ; Thu, 26 Sep 2024 08:56:08 +0000 Received: from mail.manjaro.org ([116.203.91.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stk15-00000007iG1-1HFm; Thu, 26 Sep 2024 08:38:29 +0000 From: Dragan Simic DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manjaro.org; s=2021; t=1727339906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vl6o00F5vcnezSkxhr2a1kCj0/F15fsYEAmFewTFJWk=; b=FEmCfeSCYQKa24aRCe9Wn80zHbf3lmrairBcJwyLgmwEtoowPk6yvSOWg5N+V/dV3UlRo6 XZOLV+aBXBQxC8/LTdqt2Zwcj5M2vn5rgobfw4C2pKkwvkB4qP1m7lS4OzZ4slIemM0pIy 47jw1DHLwDKUbsqsV+j4L/JiHgWmBKmxQvD2pYvbdNhvZ9Yhs8iiK0GUHNtlx2QZJKWldY oKlpYWMDYuY3pp2Z9q0//56aVM7KEo1MA5yMqD0k79OHBVJwxAjQkJc8cKgaEZwEybykpU Pd8L6quiKpduC3LyeGYv8FEmGGTG7i0fvJeNaLSEivzqZosXZAyRPN2ypOSOqw== 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 2/5] spi: rockchip-sfc: Perform trivial code cleanups Date: Thu, 26 Sep 2024 10:38:13 +0200 Message-Id: <251242bfc9c4fdc01d930f093022ce0c9481d58e.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_013827_513597_097E9810 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Perform a couple of trivial code cleanups, to avoid unnecessary line wrapping by using the 100-column width a bit better, and to drop a stray empty line. No intended functional changes are introduced by these code cleanups. Signed-off-by: Dragan Simic Reviewed-by: Heiko Stuebner --- drivers/spi/spi-rockchip-sfc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-rockchip-sfc.c b/drivers/spi/spi-rockchip-sfc.c index 0d7fadcd4ed3..505d5089bf03 100644 --- a/drivers/spi/spi-rockchip-sfc.c +++ b/drivers/spi/spi-rockchip-sfc.c @@ -591,19 +591,17 @@ static int rockchip_sfc_probe(struct platform_device *pdev) return PTR_ERR(sfc->hclk); } - sfc->use_dma = !of_property_read_bool(sfc->dev->of_node, - "rockchip,sfc-no-dma"); + sfc->use_dma = !of_property_read_bool(sfc->dev->of_node, "rockchip,sfc-no-dma"); if (sfc->use_dma) { ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); if (ret) { dev_warn(dev, "Unable to set dma mask\n"); return ret; } sfc->buffer = dmam_alloc_coherent(dev, SFC_MAX_IOSIZE_VER3, - &sfc->dma_buffer, - GFP_KERNEL); + &sfc->dma_buffer, GFP_KERNEL); if (!sfc->buffer) return -ENOMEM; } @@ -629,7 +627,6 @@ static int rockchip_sfc_probe(struct platform_device *pdev) 0, pdev->name, sfc); if (ret) { dev_err(dev, "Failed to request irq\n"); - goto err_irq; } From patchwork Thu Sep 26 08:38:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13813068 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 E8B48CCF9E9 for ; Thu, 26 Sep 2024 08:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=XYBlRMzsczb6bFE5G1T9C+Biz3U4FPjauDztzKST1a0=; b=j8n+I/yQwAAWNE pKsWZj8KemZmVJ9s89C78DovI4DXEAUAEbFgsRgmVS4x9i58mNQgTYAXTv/rZc8XkNzdrtkYbLvSk Lv6SjjCniCq3aSbOt4rCGnw5z7V+32o42EZih4pTspcr1S1fs4LfzQhH+tFx7cEAfabOR5IpLqg7d C1Sel6B6dXAqfwmkIczIJxSmP5I4wKSKIPVk95UMj3eJH7hnhQC4zEdcB6gG5s1vo75gh264DIL6v nRBtMlejkKgeaSQrXShST6nIU5y7Sx2CkOqke13b4xYYYa5ucvukCqGG9h11j5qjWsuL3km8UOfrI QKKbs3Qti1euJDsIVQ0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkJN-00000007mYO-2nvj; Thu, 26 Sep 2024 08:57:21 +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-00000007iGG-01Ka; 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=1727339906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7TZTm9G40QKJombFH2v6+fmEe7Da2EmVAJMyeMXsFnE=; b=Fkqf9ZCdiec98LA9/HwKlLSiB0j8z4f0hddfGgtUwE9BYcI0+TtHuF7cOjYh8Bp+EYUZ/i qsEKvJYxUS+1s7uB9p4LeI9sBbuc7ez2DFupsdAXS/fxhJFTMzF6yGv8YxHb/s1mI0ZEI0 TDa55UcVlONeE6issvBih62aBiltlBwW4mV6dW7tehrOgAuOJH/cnmZI9Yqr3Uxj9wnlQJ 7Abw3DGMf1iWgTpF61w7Be71XCHCMm+UuIW+24NZo/2ji0HX1NNI76dNcNCX4gM4MhEyXh GKXRojS8xm0S5lm0ZxdfB2jPVNhira7SUlfExjWHU6xxSciUq1R4qO175Uewvg== 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 3/5] spi: rockchip: Don't check for failed get_fifo_len() Date: Thu, 26 Sep 2024 10:38:14 +0200 Message-Id: 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_013828_222038_6B16087A X-CRM114-Status: UNSURE ( 8.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Since commit 13a96935e6f6 ("spi: rockchip: Support 64-location deep FIFOs"), function get_fifo_len() can no longer return zero, so delete the redundant check for zero in function rockchip_spi_probe(). Signed-off-by: Dragan Simic Reviewed-by: Heiko Stuebner --- drivers/spi/spi-rockchip.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 81f2a966c124..28879fed03f8 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -816,11 +816,6 @@ static int rockchip_spi_probe(struct platform_device *pdev) } rs->fifo_len = get_fifo_len(rs); - if (!rs->fifo_len) { - dev_err(&pdev->dev, "Failed to get fifo length\n"); - ret = -EINVAL; - goto err_put_ctlr; - } pm_runtime_set_autosuspend_delay(&pdev->dev, ROCKCHIP_AUTOSUSPEND_TIMEOUT); pm_runtime_use_autosuspend(&pdev->dev); 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: 13813069 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 6066ACCF9E9 for ; Thu, 26 Sep 2024 08:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=FIrjvcYad6nUctDw754VR5GawkSgtTpoqGn7Y/UvG88=; b=o/Sp8gBsSCGuxi ROukaXVyY6AirUsHg5ypyP9kiTTla7STJitTcaMhcSod/uGmnUWfn1iLADfM1w+28Z0V+YeGBNwMb J7KTBS7Y+eNmCZKQW5zHyzuy8lwElP50W3I3d4yOlQx8374T4AnJrr6anbNF+xaAWUWpyh3gDV0Jm HYaxVXP3jSUjCV7aP0XSN1lv8mVO0zuAmhMdRrMIBZE13dByJqtZj6mM0M3L80jg5pzrtwZAh1X8N 4er9fYVDEvsne0TVN/sTL/FlSmg9M91fBf6CKnUHS5j6yx4us5b96QdqVtO9dM01sL6LxCYkBblu/ BMlJ4PQEAXohaY+Pkw6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkKV-00000007mis-3vhh; 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-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=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; } From patchwork Thu Sep 26 08:38:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragan Simic X-Patchwork-Id: 13813070 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 6D2A3CCFA13 for ; Thu, 26 Sep 2024 08:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=49W3pEK8jYOaQOxtyoQobgn1wVCSiZkpkPMgCaxPtBk=; b=2JRC73ekVnk5gt ghP8zUHRlHXgoFvVCcVo3IUfCfft48AVZwQzD9gBRBglTullDU+rtnbX1gMZG5Q8J8kQJ1LtyivLE Mm5R2zXjm5F3Nxunow6M10YFhuMOJH01U5p4fCPCuYxjV4S/za6el/JrgGdwWwiu+K1IUmbC/PjtI iofGm6gPaVZiRPw0fwKaRPmdpio0XV9e1F/Fe1otUp6CZiOwUQQXhTu4ivjVKg6aTynFaM4Ez1vMQ 9NjpcpkQjvV0DqqCxA2c/3hItCmiw/8pCLEMLfMvkmZOM/8Kgm0qNLZRmt4svUAl9Y6wemHtWcT/Y LTSgO8ixozINOJ3O1Smg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stkKf-00000007mlL-2r0b; Thu, 26 Sep 2024 08:58:41 +0000 Received: from mail.manjaro.org ([116.203.91.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1stk17-00000007iH1-1GYq; Thu, 26 Sep 2024 08:38:31 +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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2zU9euMRPUNtRudXGXDojMT1hcsLIwDGY8GKYM1HzlQ=; b=V6fVcQq1T1VhWGqyYNepekEB48Eox0YqFTBqP0KZwgUcejt7l7F7b7Ex0dLG4eLXWXKlxR 8n2vz5HiWTll95QqFpuJ8hMdnP2iq1/j0ev/oTNz8TWkCBkx/EgclMTxbm/hv3SViQe5m2 hsf01WweWvYrRZYyR7yaEyPjfmt2G0kSzkvNOjQVmXourk8iqwsasWFIoFRPwlhkg9vY0r CsJHf7QUKHh+n+vm3J5D/hqvMVFHYehCnaBedpOyRMqmotsKS87Js+muTdC/A95Z+cZEJx mLJmEkb9s9U6BRczZtwuscinpM8ptsLJNXOSd+NFsumsxYYt8AyNcCSEqU9yVw== 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 5/5] spi: rockchip-sfc: Use dev_err_probe() in the probe path Date: Thu, 26 Sep 2024 10:38:16 +0200 Message-Id: <8f65c1ec7737af7f2a538fcae3618756a53ba3fa.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_516896_5145027B X-CRM114-Status: UNSURE ( 9.06 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=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. Signed-off-by: Dragan Simic Reviewed-by: Heiko Stuebner --- drivers/spi/spi-rockchip-sfc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-rockchip-sfc.c b/drivers/spi/spi-rockchip-sfc.c index 505d5089bf03..7e0fb4944a34 100644 --- a/drivers/spi/spi-rockchip-sfc.c +++ b/drivers/spi/spi-rockchip-sfc.c @@ -580,16 +580,14 @@ static int rockchip_sfc_probe(struct platform_device *pdev) return PTR_ERR(sfc->regbase); sfc->clk = devm_clk_get(&pdev->dev, "clk_sfc"); - if (IS_ERR(sfc->clk)) { - dev_err(&pdev->dev, "Failed to get sfc interface clk\n"); - return PTR_ERR(sfc->clk); - } + if (IS_ERR(sfc->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(sfc->clk), + "Failed to get sfc interface clk\n"); sfc->hclk = devm_clk_get(&pdev->dev, "hclk_sfc"); - if (IS_ERR(sfc->hclk)) { - dev_err(&pdev->dev, "Failed to get sfc ahb clk\n"); - return PTR_ERR(sfc->hclk); - } + if (IS_ERR(sfc->hclk)) + return dev_err_probe(&pdev->dev, PTR_ERR(sfc->hclk), + "Failed to get sfc ahb clk\n"); sfc->use_dma = !of_property_read_bool(sfc->dev->of_node, "rockchip,sfc-no-dma");