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); From patchwork Fri May 10 09:40:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13661201 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 EE88CC25B10 for ; Fri, 10 May 2024 09:41:17 +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:References:In-Reply-To: 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: List-Owner; bh=0dfXvAu2I7Nr8Dg7cjKWAbD08iU9plkAu8qjn8cJpRs=; b=L8XS0wp2bAJnu+ 8MkyoM2GRXbA8ryLS0agvhW8zF8gOZngdCRvRECxpQE2uPfoPcrOvlS7Q2UV7/vTCdHdMEgRGPaOJ 76YadY1mSTiKP9BKPDN1t6awmrAKJBuQ1PQPnUStN80BP7sjGt0mftOe9HOXY11cjZN1yx8b+V1eH kRwSl2HqKiJTiEyZO6LnEGDfJLXjqfqgssBt1SMiZLdxU+NvHJdEXcrqs9qYZ8GFlGw/o6ATI2Jxt /xC9P/+5Ydaw8T3udmIPMuEG0dpgGg/OvlTMPvouMjEpO8MZWuv0vqSx2XOfCSB/5DFcs0iSz1PdQ UyZCIqVI9xTqStHh41Ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5MkT-00000004jfl-3HUJ; Fri, 10 May 2024 09:41:05 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5MkQ-00000004jep-2ONV for linux-arm-kernel@lists.infradead.org; Fri, 10 May 2024 09:41:03 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6ee13f19e7eso1641622b3a.1 for ; Fri, 10 May 2024 02:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715334061; x=1715938861; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xYCA026a98+jinm4XXjivyCMpzTaBQNxk+cwgCPrDy4=; b=D2SSDfzQZdCsrCVk0yDxE8JJgAG6+CWwek+hQj4VN9cY+QqHfXBzPeqXHzBkSocmsE 53ey63ZhSAGlu8qWpvGhhwzPwLrdAtxmU8VefV/eNMI478tWDUegBxfQ8SwNLxYo5hUL inRLrvkMkho6si0W75jNphJSEJfSD6z6D/511V6+SHVqye+AEf4i7A7Dm8dChOac7Fdk E0XxZY/8skTFfZe3JOqi9c4+p/jf0+NjOeXfAJDIAmz9hJMidNbXypbIXx6RU7OhsANB MAwSB6HzDDyVaSj807tcXjk+D20QopMVX6+7dU6/rGMWOp+LYZXAwzg+uxwq8+mbg7q1 yolA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715334061; x=1715938861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xYCA026a98+jinm4XXjivyCMpzTaBQNxk+cwgCPrDy4=; b=WSReDGue0xmycS2TuMnOHTij3hQ+pgxIP2M/PkLFkjyB03maKREl7x+vcLW+ZJwTCV SBZ3K50Q9Ce+sNq5Mq+0rh/7N8Vy8sVq2oCiOMCmm0AdjH9UbORZI9yGozBT/whvADkh prjNgXInf66xaz6tOv/RY5NgrGUg4mNqmGa2I8fz+Vi0u8zW5ydD7y+qWW2bZekOpGEc 3jUwe0qzpSHDbSi0BBukF45m+H4NPQW3bo4f7AhI1OdbhCVW/dvaQDXObptcHKLlqoBC SIJPAziOKQn/JMHZaDI/E/S+FJMLIpNwi+pzaKDR+FVlk6ejV2juAOysf1nWVPeWszrJ RU1w== X-Forwarded-Encrypted: i=1; AJvYcCVo2Vq1h4+TZQbw/UuLH83eqeVFaigmIH83pgtPtxUZfyfgI7eQNfBo+pNmEi9uO+8FQETAGTk9O79AHuRRSDMrf6078q/S6w1IQ1uhF5rqx16Emh4= X-Gm-Message-State: AOJu0Yzfk+YCz4505RhmorPEVsonH7JzSiXok8qG4qE/hDdJyWwB1Aia XOxutmcjlNvfDLYAioE7m71503iBv/j/htFK15hxStL8RF4mrkzH X-Google-Smtp-Source: AGHT+IGv0EhQaZQv5264QLirP3eVLjx8maXcHjKU/FgFJ8ZT4iudZpiwgz4HLBkM4c/WXo008palAg== X-Received: by 2002:a05:6a00:3cc7:b0:6f3:e6e0:d9fb with SMTP id d2e1a72fcca58-6f4e02c6a0emr2055840b3a.11.1715334061383; Fri, 10 May 2024 02:41:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:41:01 -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 2/2] PM / devfreq: exynos: Use local clk variable instead of exynos_bus member Date: Fri, 10 May 2024 15:10:25 +0530 Message-ID: <20240510094034.12493-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240510094034.12493-1-linux.amoon@gmail.com> References: <20240510094034.12493-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240510_024102_631284_3F408EC1 X-CRM114-Status: GOOD ( 20.87 ) 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 This commit modifies the exynos bus driver to use a local clk variable for clock handling instead of storing it in the exynos_bus struct member. This helps in simplifying the code and makes it more readable. Suggested-by: Christophe JAILLET Signed-off-by: Anand Moon --- v5: New patch --- drivers/devfreq/exynos-bus.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 7d06c476d8e9..e55ae59a8ae7 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -34,7 +34,6 @@ struct exynos_bus { unsigned long curr_freq; int opp_token; - struct clk *clk; unsigned int ratio; }; @@ -241,13 +240,14 @@ static int exynos_bus_parse_of(struct device_node *np, { struct device *dev = bus->dev; struct dev_pm_opp *opp; + struct clk *clk; unsigned long rate; int ret; /* Get the clock to provide each bus with source clock */ - bus->clk = devm_clk_get_enabled(dev, "bus"); - if (IS_ERR(bus->clk)) - return dev_err_probe(dev, PTR_ERR(bus->clk), + clk = devm_clk_get_enabled(dev, "bus"); + if (IS_ERR(clk)) + return dev_err_probe(dev, PTR_ERR(clk), "failed to get bus clock\n"); /* Get the freq and voltage from OPP table to scale the bus freq */ @@ -257,7 +257,7 @@ static int exynos_bus_parse_of(struct device_node *np, return ret; } - rate = clk_get_rate(bus->clk); + rate = clk_get_rate(clk); opp = devfreq_recommended_opp(dev, &rate, 0); if (IS_ERR(opp)) {