From patchwork Sun Aug 25 14:14:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13776790 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 C0959C5320E for ; Sun, 25 Aug 2024 14:19:21 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dPfVC68w4G9TItKcZX9hLfDBOa9Rh2fNT0mcRYJpZNk=; b=NQ2r6wRTE4LzOrstiG4kzM//WB 2aUCE0ud04X4YeARgJ7E+K7IydSnNoqvN8FdJNIcgWIxqdwIrIHs8poFvpkHiUuRzCZvsJW6WG+nP ahU2W6u9wW+8swkP3nyNQmHtabR8Y8ti+G+GoVSmlof8K9tkt2jSWF6eLazVsIfOvtLTz2lKF8IeA VWfNl45ACuqh2W6mBdh6u4Gnm1CeP8oPvKKt2gMxCruY8RPnqR2PZ5qqCTByyZvOXaS8RUrHD057i V7vCLYo4Y4gqz60jUCDxiwBwfyfn64pAEXxH/ST8hdG02eAG0deypGWfC4Ya8STS+Z1TAR7FObLxh YyM1sZdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siE5I-00000004TXd-3bQj; Sun, 25 Aug 2024 14:19:12 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siE0v-00000004SK5-1rF1 for linux-arm-kernel@lists.infradead.org; Sun, 25 Aug 2024 14:14:43 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4280ef642fbso4330385e9.1 for ; Sun, 25 Aug 2024 07:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724595280; x=1725200080; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dPfVC68w4G9TItKcZX9hLfDBOa9Rh2fNT0mcRYJpZNk=; b=hD+65tpTEWtq9ENKXa6rVYWm2o9DjwkzSIIAQ/6ZPh3U8vNqRVirdIdl/E1NC0tFCP 7lHyqXhy4rhkRnLgW2mzQaXc7ymfLI+WoKD4y00eUfumb6hihseGcdOG/hvoGVpSm1Kz kgNDuA4itjv+VClB1qW3uJQpN4uBQJkNGQDx0SaIMy5zFAbU4ak5CAPBpriVboygbBEz VX41uPW+HAmbJfEgvytOdZ7CH4dTgTrSjcNxPysmnfdci32uBNTZgaWGx72HOM9gxm2m RbnEPdtdYtFOthfQQeYhWrUFAbXutY5v7UhzrKS4oXUoPRGzdgggmyy4clnwz9oSnM6U Sr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724595280; x=1725200080; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dPfVC68w4G9TItKcZX9hLfDBOa9Rh2fNT0mcRYJpZNk=; b=jwuvPPH+z3zXDx/35Zw/E2WqLKg06x9w4gZnIynHbm/zYC5rY6oKgxXB5X/xeh8PjP 5oNyJQVcqqmamOpLP1CJY8sANZkYH1wFcU9kXgIDGbzztuWLzSpoflw1+dzdk49ji3b+ eVHq1qO3qSYirn6d0lTm8mr8OMF0tCF+8JTOHUKr3dKAZbIW/f5OcZBx8cdqO6oslLkH zOmQ0KFxYCl6MEr8KsuzgXoiDqO5KHhIi5rRWH89nx6UVFOwo0RlLiJCKqI8qBxsMp9y jT4WT3ebUKZXOaPWPwvLeBd6dvq357UTbhjGbtO0rHAPjRVg/z9R8VgPrJr0eoATbizh Br+A== X-Forwarded-Encrypted: i=1; AJvYcCUCYFT38JkkKaFH8YZ/ORrqkEdOkEUYYcXSp5lsZzv6dHcAoqwKGbRHXQkKZa5ogBHWuS4TqDdjiWRDJkgGD1+u@lists.infradead.org X-Gm-Message-State: AOJu0YywviASRdKcqqmpIy6lc/Td94kYmmOpQuk9XjH8XgLiABhASxln ehuNuGJUh4PQudK2PnlN0waeMIKFg5FKL2paB/VKmrb+Numy4ZOxnRYNJVXBlD4= X-Google-Smtp-Source: AGHT+IElMKRI5xZ8yzDk8JbJF8qKOxDYwCIunD6hU146I7V15XtRVaFAqCfrraqfYRZZ0YGENwgH/A== X-Received: by 2002:a05:600c:1c1f:b0:427:9f71:16ba with SMTP id 5b1f17b1804b1-42acca112admr31861355e9.5.1724595279439; Sun, 25 Aug 2024 07:14:39 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac5162347sm122556045e9.23.2024.08.25.07.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2024 07:14:39 -0700 (PDT) From: Krzysztof Kozlowski Date: Sun, 25 Aug 2024 16:14:28 +0200 Subject: [PATCH 5/5] reset: lpc18xx: simplify with devm_clk_get_enabled() MIME-Version: 1.0 Message-Id: <20240825-reset-cleanup-scoped-v1-5-03f6d834f8c0@linaro.org> References: <20240825-reset-cleanup-scoped-v1-0-03f6d834f8c0@linaro.org> In-Reply-To: <20240825-reset-cleanup-scoped-v1-0-03f6d834f8c0@linaro.org> To: Philipp Zabel , Antoine Tenart , Sebastian Hesselbarth , Damien Le Moal , Palmer Dabbelt , Vladimir Zapolskiy Cc: linux-kernel@vger.kernel.org, Damien Le Moal , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2441; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=3FUpFc5Q6VFd1fQ8A/U87QLsFQnyhnFox4YWGWQ0Hbk=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyzxGxK3ymr8fJfvYSTHWGw3mhICORfcHW0/ex woHJNmabneJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZss8RgAKCRDBN2bmhouD 15u+D/9Enprg8sJbkA1Du6xadF51tsosIPpeLdcevWdfza41+UoHchX5cxoDdM6x3VHFYX5PSvr Vomw26pQKB8SMQUS38dtxNYBc3yrtp97ZP+t1ryzjTmkPEX7Nl76aJnQgsDxFFqoHepwuupIHCs FUoV6QMXQbjQvINTbf+hIky6dYdBoaYMe6ln95ldHsqc+3hJzfiKkum72zx3hK1kepxrvn7NikR O7dV/PuemP226IU/zwtMmhwCNTRaU+OFVdWrC807JD/Kua7UZ8bERqRR1aZw2p2jyyvXXCsb6yu gehSPqxngcswmzrm2lPn+CRZhKGdpxHLjyzoJX0edDaYAtvUeOlnVxKrm6mV6g0tPjV5p+qfj2P /CYDSpOaNixEpQqahTXrdrx1PW45Y7NVkfPYZaaFSqNLo5R17dbZCq960XCavRAdEXmAPCaVFa9 0TM+Rl5tlPvjpkKutR7FtTrJhq29nVqACJIFbcgK6Z2rr/X7He2hf76yDDfHTQM6xAq079EdQIr eGxBvKCPMoNs3sxD47j8uBxqztQ7eCWvZbGljfM3g2sPWhYi9n16BP95eZt9xH0cPj4nKAmNMWE jbXjXkQ/TK235iBhyt+rEN/t91x9JxGZmALel2kJeKHIejYXTEd75zBGb3WGxS93VDUjVyqBdBu i6S6vCcYnfzEz6w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240825_071441_504962_F48D2242 X-CRM114-Status: GOOD ( 13.07 ) 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 devm_clk_get_enabled() to drop clock prepare/unprepare parts and make code simpler. Change to dev_err_probe() in handling reset_controller_register() error to make it even simpler. Signed-off-by: Krzysztof Kozlowski Acked-by: Vladimir Zapolskiy Reviewed-by: Vladimir Zapolskiy Reviewed-by: Damien Le Moal --- drivers/reset/reset-lpc18xx.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/reset/reset-lpc18xx.c b/drivers/reset/reset-lpc18xx.c index e7896e3f1851..e42b2f24a93d 100644 --- a/drivers/reset/reset-lpc18xx.c +++ b/drivers/reset/reset-lpc18xx.c @@ -150,28 +150,16 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev) if (IS_ERR(rc->base)) return PTR_ERR(rc->base); - rc->clk_reg = devm_clk_get(&pdev->dev, "reg"); + rc->clk_reg = devm_clk_get_enabled(&pdev->dev, "reg"); if (IS_ERR(rc->clk_reg)) return dev_err_probe(&pdev->dev, PTR_ERR(rc->clk_reg), "reg clock not found\n"); - rc->clk_delay = devm_clk_get(&pdev->dev, "delay"); + rc->clk_delay = devm_clk_get_enabled(&pdev->dev, "delay"); if (IS_ERR(rc->clk_delay)) return dev_err_probe(&pdev->dev, PTR_ERR(rc->clk_delay), "delay clock not found\n"); - ret = clk_prepare_enable(rc->clk_reg); - if (ret) { - dev_err(&pdev->dev, "unable to enable reg clock\n"); - return ret; - } - - ret = clk_prepare_enable(rc->clk_delay); - if (ret) { - dev_err(&pdev->dev, "unable to enable delay clock\n"); - goto dis_clk_reg; - } - fcclk = clk_get_rate(rc->clk_reg) / USEC_PER_SEC; firc = clk_get_rate(rc->clk_delay) / USEC_PER_SEC; if (fcclk == 0 || firc == 0) @@ -187,10 +175,8 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev) rc->rcdev.of_node = pdev->dev.of_node; ret = reset_controller_register(&rc->rcdev); - if (ret) { - dev_err(&pdev->dev, "unable to register device\n"); - goto dis_clks; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "unable to register device\n"); rc->restart_nb.priority = 192, rc->restart_nb.notifier_call = lpc18xx_rgu_restart, @@ -199,13 +185,6 @@ static int lpc18xx_rgu_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "failed to register restart handler\n"); return 0; - -dis_clks: - clk_disable_unprepare(rc->clk_delay); -dis_clk_reg: - clk_disable_unprepare(rc->clk_reg); - - return ret; } static const struct of_device_id lpc18xx_rgu_match[] = {