From patchwork Mon Feb 26 18:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13572687 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 166DDC5478C for ; Mon, 26 Feb 2024 18:33: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=voe/6EuqZ7h5D9ZVQKW5tf7CVFK2sc7XLhLOm/amNig=; b=aipEkZZVNm+52Y UH/XbrywUrvHwmmDNzJKwsodLlqmdeks4lR+C/P1FCdsh4qngMBlcc0vQB2yrJkFAxmi/bczudJcO X5LLhAes4tnIBrJBs6RyIrqZ9T4wbLI+d3W4yUYngdBQaL4ELMWbs/jFPtKrtu1vFklAAuoeRq3vM asLTkrsqkEtrFHfOAL+YbKAPTNA8Kqsf7vW5wNZFti8tUZCZoHtboKrwPC6+SkVucHSwx0tWPWFwg 7agfCFStC9MJcL533TkB3Fah11unHuy5/4zx0LdMQW059GVIh5umT12K48j9jjlj2JpKYrU+4fzSI Ck9EUuAcwC0eCCqplBLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1refn9-00000002CER-2Q0J; Mon, 26 Feb 2024 18:33:31 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1refn6-00000002CDY-45Zs for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 18:33:30 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1dc1ff58fe4so29847275ad.1 for ; Mon, 26 Feb 2024 10:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708972408; x=1709577208; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HAEObWk7q9tpmoQojnoq6Ltq98FhWaI3HcoghSaFe9w=; b=ayAGCsPV0xwt4Fcc9iIWjtZtHfAc4PfnJr4ixjRZupPfH2KYMynIRb2yZDpZBGt9JL HZMTPpiECcx9hCjrWzKU29BZH879GOHUipNW8knhWCahPjUthtbUjRY0v0f9yrFKwy/S oGMn2OLgaqkCpxo+/JRPlTyzR5o8pOhP9M8vb3jwpG6mn7fMHH/iF9ztURSfV1lM+24a M+Q3USqVyA6xwBaVeKQJZ8FKebSWYAuWB2a/o12ggeMvIZQQ4nIVJG9BcdLoyhlhF2xE 5mPLB0dHMpiAd8sYSN704rEQN5hR1ehdXYMbUHKB00QQ3EaK5iUUCVASOxhOS3qwtPuG zyHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708972408; x=1709577208; 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=HAEObWk7q9tpmoQojnoq6Ltq98FhWaI3HcoghSaFe9w=; b=eUCKp0BwEDJwf5rU0buILZU+HoGIOOKT8O2wqQf1ECURQ4lpJXac6FTLFGvahP+nhe 4ysxQOGPXc2pmLC/ojoDhZnyaJ0+EElkQ5W52ug8rAEnd7F6hwsJ3PeExXADwQaXTbk5 xu5cqPM46tE3u2UuW7uHYRFx6aIZOQ7UdWrAlcPUGFnuOmM6/HbH7BcQ630ngMjt82ec Ku+5nOwluwHJmXiPgoOOyu12fu+sRZOcmciLpeo1YR/80kB/NYg93MLlYialTvN2K8SM Iv/SNv7ZnDbwmQT3UlcFVb/y6Ai5o4FzxIgj6/s6+yImtYd90XsHjk/Jr1hbB/34Jy+V rjQQ== X-Forwarded-Encrypted: i=1; AJvYcCVoRgoSL81pohdlJzP1yiXCrQnDEXkxZ5WcRyPF8gqXB9rQxju7kfUItBkhewFVmXGMB9LOBwWEdKnNqdGshRJlsT3pbzejMY/CNYnN8OguEuspmNU= X-Gm-Message-State: AOJu0YzkrlOlBXinTlLEtdRInfj/nwsKy8CY5uwov2k2qcuwh5CqXhrY BGABMwn3YJ2BqNmBkZxr9id2uDx+zkSMnCB7u28+q/z0u0rtqk0b X-Google-Smtp-Source: AGHT+IGz32s4Nqri0wpJmVkUdRWblviR+tS2ZYRNwFOfB42AasdShh+BjCineXQuWxw668weMUhVAQ== X-Received: by 2002:a17:902:b7c4:b0:1dc:b01e:99d0 with SMTP id v4-20020a170902b7c400b001dcb01e99d0mr1494288plz.1.1708972407905; Mon, 26 Feb 2024 10:33:27 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id jh2-20020a170903328200b001da15580ca8sm12302plb.52.2024.02.26.10.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:33:27 -0800 (PST) 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: [PATCHv1 1/2] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers Date: Tue, 27 Feb 2024 00:02:56 +0530 Message-ID: <20240226183308.4730-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_103329_042507_2609C47A X-CRM114-Status: GOOD ( 17.38 ) 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 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 --- 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);