Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp391618lqb; Tue, 16 Apr 2024 21:46:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWj0sl1laj2AbMT4EScDZh6BGNwNPYZIkpiwgmVpKmRt2Xq7kddC2+7lUMPR7rdtkB8yem/q6TbUzYjl9Aw8BmPGSGFvzrNYBmNlYufpw== X-Google-Smtp-Source: AGHT+IFdIQyX/0B3Fis+HdkRfyrSegioNJ9XgPYnZevcQSnFK76VxorhRgG+78y2CvlF/chFFFWG X-Received: by 2002:a17:90b:164c:b0:2a2:c16:d673 with SMTP id il12-20020a17090b164c00b002a20c16d673mr15768067pjb.36.1713329164354; Tue, 16 Apr 2024 21:46:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713329164; cv=pass; d=google.com; s=arc-20160816; b=U9cKvDWPfTXaAfbO+shCqFi1GFK6BRhsvNKQl62W0tlScPQvuoXEppyAIC7a7Sw5aA BVq66si8H06A1qTRdMn7UiMZTN1iPnBS9Ux4rVgV0/BIuRth1qK7wZCEdepPURvnQVeV EkYN4b3K/seMj37eYydDi9v/Thw6pb/Pa27Nu1Pf6ENo8YEPCaFq+5WgZVQyh5Itbce9 vaEjuO4XJgKA7qef9NzLs0HCmr5YSA93ZpG4/7oHt/l3b4O6q2bpn7R5d9c+DDW14mho 2n2H3LOVlM+Xm9WIpiPLcW/4ihxepbqR8Y/+9SZYjGRdHck4ePxtAOetLbI9NMp6qc19 DsPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=/+FnJ6J/RkjJ0VXVfZtkwMb7BZfv1rFQNC+1ugT22Ak=; fh=xmW5Kxg7OS1F7vPu3GiZz7i5G3qcCssHkkrA+injMdo=; b=H4+yMifujX/2MY4KNpzi9Z5q7RTDo/Y8bcWObmO05Ie7dYprqt0ei2381CfqW56Sa0 dYKyTbc1UENR1qmCjLR9O6QZuq/havs/O6IYtZhiHec+Wgh1DOPLi6mPZREuki+JwSRv O22FS1ewVMfRxDyQ3i1563L2Ao/hz6ncicns/LWpWrMRKKEG55XiA1eGPHhhkQOAkivH U92CcTRBQh6ZH+NvPNM6RNGwxQKIGwGKNW27p0VlD1iVmfP1OProbKaIYkklidiTkM8Z h60A3hN3399EbuAY3o3pBvdtlxg8Ivrxjh4lTBj+LcCgeVt8nCFaPJNDBNY7i6ChkSlI alOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KL98xNfS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id mm2-20020a17090b358200b002a5debb6badsi625624pjb.36.2024.04.16.21.46.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 21:46:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KL98xNfS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147933-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147933-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4E388B227BE for ; Wed, 17 Apr 2024 04:45:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7337481A8; Wed, 17 Apr 2024 04:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KL98xNfS" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B09B047F53; Wed, 17 Apr 2024 04:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713329122; cv=none; b=NfJT0+tP+eIaJSI6ZxQUldkHKDu9XWZT0qoCfM6qvUNlnqEdNogxCEr1dTOZxuOOHakHcF7Rdl74h8ka7g8qxQJwPJZKhhDWKwljZd0AOewgToDruVA4/kHHENDDipt+rh1yEH9UmtkUXUoPdFYjAgK5KPahnRVkGRqVz7GjhoA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713329122; c=relaxed/simple; bh=9GNRWeMaGUDIINfdfON0mc6ytXs7DVhN6Uaa7izOWVI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oqoyEZKyRZFbe1WWTwAsJKzoIpiI/RD14TOebKLjHHRP0VOxkg0KYC7q3k8Rmve2+xJeFUGs85ctet9QfB2Yb2O60MGppfALvvNNhOMlIdsDEtlBU9uAHouPlm6HfiNA1XSzHFR+76YibYxLoqJiKC6w60ym5LIZP0tqmPOkCJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KL98xNfS; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1e2b137d666so42006455ad.2; Tue, 16 Apr 2024 21:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713329120; x=1713933920; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/+FnJ6J/RkjJ0VXVfZtkwMb7BZfv1rFQNC+1ugT22Ak=; b=KL98xNfSgmxir2DCwXoWcRhBkAAPpJzFiVusRLbPw0QYP1eb4dPb0bBOHN9EpXIdwG 434COLKjJPgEltFyXXrgMvl03rPpYbuAV0kdPibH3x27c9XqBlMJC7yvEvQJnCWG3+Iv P6CsJ2WvAfJyMUUOtMtulkKTru65VDMv5FW+MD+oGfeM3Ug+CaddbyL3rRPhttRV7GIa dmJWTh/BbzxlFmNg8S+ugXan2Q8ESr/RSPcMNvBJDGVb7oO1cHvM/jZdhN/kUSmEAd4Z p7Cl6dOmGpglSblXg9JSgTZRYPzBZCwMZkCUyCFji5EFvs9rEx+0vzrfvILZ2GW3cEQX 2lKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713329120; x=1713933920; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/+FnJ6J/RkjJ0VXVfZtkwMb7BZfv1rFQNC+1ugT22Ak=; b=b+vEn4mk1I6vBP3U1wdJVMeLJmunp5Q4hbl3+P8rVl7OrGop9DqKF0MbmZ2KrbfCMu apdYevtNr8TPs0px9UMHbTPuopPJ1LGwsKXX87BDknBgiE/cL0gOuYsgnp4Xbhly4CrF Oc1A+YWAaRU4wK00uYfzXsycMznBsAEP7RDyDsm8gsv0Tbvo/ZEt80eyr52sbMgAAUle s18F0eSW14cqDk/OOWZoBPbzQvmz6fM7VotcgFYe4z5d+yAKywvqNY5cSn423RWZUQeo ZIFTJXyhVSFaLXtVZP4+7ppgmshyq/K7dAYgNbZdX7sQhy9GZEkD7l0bv4/4n85iGrRo yycA== X-Forwarded-Encrypted: i=1; AJvYcCWP8VEFo5ePUfFV7qMX4poS7gzXWiuOkQCLlHvMbnpErXhTz+dTf3nnDL4Xntdq4EcLJS1H5w8yrwckrHeVX7j+5AOldP1PRbcMRs/q2Pnb1jkn2XTUjjgbXhha4e0ziQqS9XcEMCDF48emRIgQ3Am/Yz7j+t5kLjvtVrtz8WT3j4lgUSZFjlho9A== X-Gm-Message-State: AOJu0YzhmKMURx1qTv+psdszM6PCGXeTfm5dZZsxdFXqC8zE+Eb4xwSR t5A+BVwMTO13I6Y8OH9ASucUI9Yw/GhEKsD54auqaK/IjUybWika X-Received: by 2002:a17:90a:b307:b0:2a3:48a8:cf7b with SMTP id d7-20020a17090ab30700b002a348a8cf7bmr15071413pjr.18.1713329119838; Tue, 16 Apr 2024 21:45:19 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id z88-20020a17090a6d6100b002a2dbbbb36asm511458pjj.37.2024.04.16.21.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 21:45:19 -0700 (PDT) From: Anand Moon To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers Date: Wed, 17 Apr 2024 10:14:47 +0530 Message-ID: <20240417044459.1908-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). While at it, use dev_err_probe consistently, and use its return value to return the error code. Signed-off-by: Anand Moon --- v3 - No change v2 - No change --- drivers/devfreq/exynos-bus.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 245898f1a88e..153340b6685f 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -160,7 +160,6 @@ static void exynos_bus_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); dev_pm_opp_put_regulators(bus->opp_token); } @@ -171,7 +170,6 @@ static void exynos_bus_passive_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); } static int exynos_bus_parent_parse_of(struct device_node *np, @@ -247,23 +245,15 @@ static int exynos_bus_parse_of(struct device_node *np, int ret; /* Get the clock to provide each bus with source clock */ - bus->clk = devm_clk_get(dev, "bus"); - if (IS_ERR(bus->clk)) { - dev_err(dev, "failed to get bus clock\n"); - return PTR_ERR(bus->clk); - } - - ret = clk_prepare_enable(bus->clk); - if (ret < 0) { - dev_err(dev, "failed to get enable clock\n"); - return ret; - } + bus->clk = devm_clk_get_enabled(dev, "bus"); + if (IS_ERR(bus->clk)) + return dev_err_probe(dev, PTR_ERR(bus->clk), "failed to get bus clock\n"); /* Get the freq and voltage from OPP table to scale the bus freq */ ret = dev_pm_opp_of_add_table(dev); if (ret < 0) { dev_err(dev, "failed to get OPP table\n"); - goto err_clk; + return ret; } rate = clk_get_rate(bus->clk); @@ -281,8 +271,6 @@ static int exynos_bus_parse_of(struct device_node *np, err_opp: dev_pm_opp_of_remove_table(dev); -err_clk: - clk_disable_unprepare(bus->clk); return ret; } @@ -453,7 +441,6 @@ static int exynos_bus_probe(struct platform_device *pdev) err: dev_pm_opp_of_remove_table(dev); - clk_disable_unprepare(bus->clk); err_reg: dev_pm_opp_put_regulators(bus->opp_token); -- 2.44.0