From patchwork Fri Aug 23 10:16:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13774925 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 3BB76C531DC for ; Fri, 23 Aug 2024 10:21:11 +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=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=FsNcphld+gcWbuUSi0xHI3Rbrh ZuCFAlqAMlv8uuaBsNLetsk0U9gTGR++6bIsZJnfODowmEIJzgzM29UK74TzOrLTx351ziSME10Xj 7nX0Yjn9bhhYbgb5XHnYTy/UZtqqqMWaeGO9LbYzat4jwe3Gw3gtlVaw8kmvFe1G63TiM/i3q9ZiL wG9Hdi/HmnldCsfX55tz9cwwzVBxqpd7WtHJJ5nAxr8dUuchpCE7djs8b+7/OJXOIygKktLyxceur Ip3dmycfahQQgxc14tuoD12vWACmZguP+LkdQu47CubApV5ACnHFRcdpbuUorE661zNEjHrnJfIc/ 71DT+ziA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRPi-0000000GJUB-2lP3; Fri, 23 Aug 2024 10:21:02 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRL5-0000000GHqo-23EZ for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:16:17 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a866966ffceso7789166b.2 for ; Fri, 23 Aug 2024 03:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724408174; x=1725012974; 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=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=xYoqpntwuMOMlfSIfAvLqb+cPs2CQQTac6rbLiEMEbzCNnG7GTUx+Al7kNUNThauEw G8hNHgi3ZAiMJ24mdVYqsHEIkb0lmWCCmCglR2WyhfyU1YZLEbUbwRNRoNzu2MZS30IU r8zj1cDHL1R1fLwuaQhAjAGVOr60gOBuVMIFgNuv6FcGefR41fpb/hQdgho8kckomqIQ sWZasdmLCW9rSmtIYQPTIpzZ+Gh3D2p7SwMLZlWLTR7k5EiGgLcu137LaSjY2tu9TprU +J4qk+Ms9MEVHjj0XbbO5psHm7zJk1gFURNmy4k88+pXzT6Ye55M9V06EEz+T/knf/YG UiTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724408174; x=1725012974; 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=G7t3y5+/zYw1uRCizz7bvbUmiS1vcdmMCZnETRzZwr0=; b=vL77e2jlD3p8QZ/qpzZmUsIkpZpgOC8JrbPgQnJZpacuULmcT81m1w7FoA1waRLEVh DCVWIPKHsJ3aiaejuSZGRNhCP9Kw7kdM1sy4o7GxlEmFkLnogiFvz+u+tzUALC5rj4Jr mhjlLX3NcpRWsKj3lPVQ4pIyYk0hdBLxUWyA/ACaVjsFmh8nEfUFQ3+Yk6P/b6/F6ZAz tijdFgc7rkT3OtNwScqDUpyNFCF+/I85+mLGOQjrP76QhM+k1QW2knlpjL+HSOIpy7Fj fUQvdRxSv7C4a3sGiRpH9/cWbv2KeNMOgoKDsHqT/YB4H3Fz2XXX/m2LQ/fENzd1PtnT INsw== X-Forwarded-Encrypted: i=1; AJvYcCVSHQsOObilKqCXFepgPGvYVGQowP0nB2y/kEzeYjiCJbcqNOM01WS9vDRHalXERvqjIUpNd1F/YZnMA4DIv4UL@lists.infradead.org X-Gm-Message-State: AOJu0YyzB5fEqt92oorIyjvf2KyvqFoRkAMjZoVhwe9pQpq2T+oPYG/L 3P3XmidwyoOtJ4phkEwVWFSd/hpOl8ovX/CcSevZKpO5lkwVO3EfzNxYyPXaJ2w= X-Google-Smtp-Source: AGHT+IFfy+OGNSeG7SJwkUpL7Mu8EF/PyhzdcUVTDpOXbF/eS35DAJqbkG6gabVNuzT1c5TAzBjNFg== X-Received: by 2002:a17:907:7f2a:b0:a83:a86a:549a with SMTP id a640c23a62f3a-a86a5185ae4mr70199966b.1.1724408173829; Fri, 23 Aug 2024 03:16:13 -0700 (PDT) Received: from [127.0.1.1] ([178.197.222.82]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f2a1df5sm237912166b.68.2024.08.23.03.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 03:16:12 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 23 Aug 2024 12:16:00 +0200 Subject: [PATCH 5/7] memory: pl172: simplify with devm_clk_get_enabled() MIME-Version: 1.0 Message-Id: <20240823-b4-cleanup-h-guard-v1-5-01668915bd55@linaro.org> References: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> In-Reply-To: <20240823-b4-cleanup-h-guard-v1-0-01668915bd55@linaro.org> To: Santosh Shilimkar , Krzysztof Kozlowski , Roger Quadros , Tony Lindgren , Vladimir Zapolskiy , Miquel Raynal , Michal Simek Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1959; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=ZwCto+Ttph4EufVXEro/gEKUqJQirV37As8vR+9RWpU=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmyGFiSXY1vA0zswAcRg937hXMqwpJ4t2399ap6 Zc17P/RQWiJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZshhYgAKCRDBN2bmhouD 17p1EACCnXOOL7qiPpF1BVtDZJyarNwyghSByLJr+OShMsFmzfL5fqK3GScCm0Bj5tf5tFbpbQ5 4DJJ1trhs+rjYKho1Euf2qMyByMQviKQz7374W4xt5N/ovZJ+Fg9sOhE1mO+En6Hvna0dmajS/c oiu4h3guIuqxSo6dpFkaHPOhgpZbEb3Dtfd3iAx9PuxXu4mijxyh/YGo0Y2A1YKcvyE6DUOvk9M jJa54LPKp7VRceGAFUBCGQj1cm9CQrQaMW4nO+kb99NfInXzV14s3UOvQwucjesIiDJUpSVMkO/ Psn2QKZBU9tWM8MLWMm8C9u293iSX+xawdxcNKFbI/OQjBpq8H+DfVviF8tK5MYL3SPgYyEMEE9 86s2CghofhJi17lfZOairekgkW5n0bAEY3Zmg3EjZhaNeev73dDZVaWuKZfEwuH3BFppKfdjuOu nETH6p8zg3F/8eCvi1KLZNVcb3dhzw2AfFmlbhmkpKAFE5nwO8opG2o8k7gjNAgxUq/HDW9wbb7 h2aPwn5RP7JFlkphz5esizu/oNSCTe7oK41p5khXYS9v1azXwXO+DgGQYYsIBuGn2gnjAWvsos9 x4EDWmHau7gceYlm6H87WjiER4YPR9KTS+u84BmTDWnYnRgCnMR9dJcbzYSt/BY9Oj3Z26zNX6a IbxrCHk2x5zf8AQ== 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-20240823_031615_579651_E0BA8D54 X-CRM114-Status: GOOD ( 12.63 ) 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 clk_get_rate() error to make it even simpler. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Jonathan Cameron Reviewed-by: Vladimir Zapolskiy --- drivers/memory/pl172.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c index 390012401f64..db5fbee34077 100644 --- a/drivers/memory/pl172.c +++ b/drivers/memory/pl172.c @@ -216,28 +216,20 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) if (!pl172) return -ENOMEM; - pl172->clk = devm_clk_get(dev, "mpmcclk"); + pl172->clk = devm_clk_get_enabled(dev, "mpmcclk"); if (IS_ERR(pl172->clk)) return dev_err_probe(dev, PTR_ERR(pl172->clk), "no mpmcclk provided clock\n"); - ret = clk_prepare_enable(pl172->clk); - if (ret) { - dev_err(dev, "unable to mpmcclk enable clock\n"); - return ret; - } - pl172->rate = clk_get_rate(pl172->clk) / MSEC_PER_SEC; - if (!pl172->rate) { - dev_err(dev, "unable to get mpmcclk clock rate\n"); - ret = -EINVAL; - goto err_clk_enable; - } + if (!pl172->rate) + return dev_err_probe(dev, -EINVAL, + "unable to get mpmcclk clock rate\n"); ret = amba_request_regions(adev, NULL); if (ret) { dev_err(dev, "unable to request AMBA regions\n"); - goto err_clk_enable; + return ret; } pl172->base = devm_ioremap(dev, adev->res.start, @@ -267,16 +259,11 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id) err_no_ioremap: amba_release_regions(adev); -err_clk_enable: - clk_disable_unprepare(pl172->clk); return ret; } static void pl172_remove(struct amba_device *adev) { - struct pl172_data *pl172 = amba_get_drvdata(adev); - - clk_disable_unprepare(pl172->clk); amba_release_regions(adev); }