From patchwork Fri May 10 09:40:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13661200 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 92996C25B10 for ; Fri, 10 May 2024 09:41:14 +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=Z+9G1yxYKtu4NscNwEzQhwMH0FI7NfNpRT+Xo6aBufM=; b=ApMUVZJZ+Jf80Q fMC4xC04NpVZOSs7ddUHReQkcPJ2f9aNHwDT3xI1M7iY7cZw/0Z8NdvtCi5OvgJet8/pkw+TyL5BO Iifsmd6JGcSiR5pvKJVaXg8o/16qv2IjO8+ztE8YfuqoGttDxQVapQhgK0L+6eLTVjXPgzcv3CI+p Ei72eq6lem38JGUYwfBe8A5gdxWQxYI5NRvBu0ClvqVmr18F5FvxOCUWxzI/fe7Hcir7sXN0WQQKM 6KEV/PnQumZt0bsNynEQVvlbxnDdUbz0hSkKTTw4/DODk3fPoSgn0oEM1ShLAhFtl0hkexB1IVFXn VyTnzTPJGGyhT0/s4+nQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5MkN-00000004je9-47RY; Fri, 10 May 2024 09:40:59 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5MkK-00000004jdI-0aI8 for linux-arm-kernel@lists.infradead.org; Fri, 10 May 2024 09:40:57 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6f4551f2725so1611596b3a.1 for ; Fri, 10 May 2024 02:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715334055; x=1715938855; 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=RkRaYasEXgqE/p0OdCATEgprTM8CbZFE90OPXfYhKMQ=; b=BsfHCBDKq/90MnqK6ucTxOeTVdMPZlwzeWoppvjC4vOxnR3JbLVuEaetUdnAAazo0B nk0wQM3r+aIFR08pquuOGh8ByZvzPafl3AUyI7ybNNMP6v4JdnHxBcHrfKc82KS4XoF9 xIi61f+a+s8Rne7vslKrqjn+EKbI1xpJUnBK9afoRTFvvh7Zax6vz/nkFkx4r67gAQIE wPKwQ8qiqrUeQkswxPiQ0PIG2d/YEUmk/ytCdO630mnV0vJfau+iZOe671Zg10mIQTSD eILIhEF1eUUd7BbgKSifJralEGKTJQ0Tbmt+9DBSTKZ1TLrzsoe0NfmbFjYCAU2XT/fW NqpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715334055; x=1715938855; 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=RkRaYasEXgqE/p0OdCATEgprTM8CbZFE90OPXfYhKMQ=; b=PYe4BycaRr4fYeo1HFXtxhygVm5f7C2xj+MxlMZjHQsogZnVx6nZWQ7J/GN88dzgfx zdjAwbJiqZZ6955j8yN08HH4i2C2qVSACGqUCeUk0jSlKbju3+es/ROZgIT7m8EjG9lb 8YwxH/g0KC6J+sJ8G9y0xP/Rga06K+E7647WSAifYY8cTCpijqU+rJqvPmprlYEsCHQM KiLIiNytcORycqaGPzueCb8hSun7WhzhIY8+iVLvtxO2XDE7wODmCd7dwRgW+62KpKfZ D4r5wbvfmRXk7i2Md+1u2BybSztIFA9xdh3ASt89wyDVr6JpRS10XyfDRWFeSokENn/T vG5Q== X-Forwarded-Encrypted: i=1; AJvYcCU7gOhDUY3pC09M91FqFfO9pXAbzvqjz/3f+sf6icBsNFqm5NTFYqhZhKp3ulKppgGyO6HyB2GqMX53EtHg1i2YmqCIBjoHNkGW2Gb0Pfh05HlWnpA= X-Gm-Message-State: AOJu0YxKEByLERdvOJZIKXxkh7cCJGCmDN9daGrSKPuT5WrN0/LeRMio 3Bt51ilr7zlRXxZdeEhFZ89cNbpmK9SrvxPl7oqMhxoVdCzVJMBi X-Google-Smtp-Source: AGHT+IH0qhnOyz8bzZsEARgaFLjiq9X1vf+A71YpS9o0PB1YNYRGjZdOMaaTV2N8Jxrn2cF+sK4F8w== X-Received: by 2002:a05:6a00:3ccd:b0:6f3:ebc4:4406 with SMTP id d2e1a72fcca58-6f4e026b878mr2506655b3a.7.1715334054910; Fri, 10 May 2024 02:40:54 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2ade28asm2554518b3a.139.2024.05.10.02.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:40:54 -0700 (PDT) From: Anand Moon To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/2] PM / devfreq: exynos: Use Use devm_clk_get_enabled() helpers Date: Fri, 10 May 2024 15:10:24 +0530 Message-ID: <20240510094034.12493-1-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240510_024056_198935_4513BB3E X-CRM114-Status: GOOD ( 19.03 ) 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 --- v5 - No change V4 - wrap up the error messagee within 80 char v3 - No change v2 - No change --- drivers/devfreq/exynos-bus.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 00118580905a..7d06c476d8e9 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,16 @@ 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 +272,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 +442,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);