linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Zihuan Zhang <zhangzihuan@kylinos.cn>
Cc: "Rafael J . wysocki" <rafael@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Markus Mayer <mmayer@broadcom.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	Eduardo Valentin <edubezval@gmail.com>,
	Keerthy <j-keerthy@ti.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	zhenglifeng <zhenglifeng1@huawei.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Zhang Rui <rui.zhang@intel.com>, Len Brown <lenb@kernel.org>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Beata Michalska <beata.michalska@arm.com>,
	Fabio Estevam <festevam@gmail.com>,
	Pavel Machek <pavel@kernel.org>, Sumit Gupta <sumitg@nvidia.com>,
	Prasanna Kumar T S M <ptsm@linux.microsoft.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Yicong Yang <yangyicong@hisilicon.com>,
	linux-pm@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org,
	linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-tegra@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, imx@lists.linux.dev,
	linux-omap@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 08/18] cpufreq: mediatek: Use __free(put_cpufreq_policy) for policy reference
Date: Fri, 29 Aug 2025 11:48:12 +0530	[thread overview]
Message-ID: <20250829061812.fziokvashujzbtth@vireshk-i7> (raw)
In-Reply-To: <20250827023202.10310-9-zhangzihuan@kylinos.cn>

On 27-08-25, 10:31, Zihuan Zhang wrote:
> Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy)
> annotation for policy references. This reduces the risk of reference
> counting mistakes and aligns the code with the latest kernel style.
> 
> No functional change intended.
> 
> Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
> ---
>  drivers/cpufreq/mediatek-cpufreq.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
> index f3f02c4b6888..1fae060e16d9 100644
> --- a/drivers/cpufreq/mediatek-cpufreq.c
> +++ b/drivers/cpufreq/mediatek-cpufreq.c
> @@ -320,7 +320,7 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
>  	struct dev_pm_opp *new_opp;
>  	struct mtk_cpu_dvfs_info *info;
>  	unsigned long freq, volt;
> -	struct cpufreq_policy *policy;
> +	struct cpufreq_policy *policy __free(put_cpufreq_policy);
>  	int ret = 0;
>  
>  	info = container_of(nb, struct mtk_cpu_dvfs_info, opp_nb);
> @@ -354,11 +354,9 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
>  
>  			dev_pm_opp_put(new_opp);
>  			policy = cpufreq_cpu_get(info->opp_cpu);
> -			if (policy) {
> +			if (policy)
>  				cpufreq_driver_target(policy, freq / 1000,
>  						      CPUFREQ_RELATION_L);
> -				cpufreq_cpu_put(policy);
> -			}
>  		}
>  	}

Merged with:

diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index 1fae060e16d9..fae062a6431f 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -320,7 +320,6 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
        struct dev_pm_opp *new_opp;
        struct mtk_cpu_dvfs_info *info;
        unsigned long freq, volt;
-       struct cpufreq_policy *policy __free(put_cpufreq_policy);
        int ret = 0;

        info = container_of(nb, struct mtk_cpu_dvfs_info, opp_nb);
@@ -353,7 +352,9 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
                        }

                        dev_pm_opp_put(new_opp);
-                       policy = cpufreq_cpu_get(info->opp_cpu);
+
+                       struct cpufreq_policy *policy __free(put_cpufreq_policy)
+                               = cpufreq_cpu_get(info->opp_cpu);
                        if (policy)
                                cpufreq_driver_target(policy, freq / 1000,
                                                      CPUFREQ_RELATION_L);

-- 
viresh

  reply	other threads:[~2025-08-29  6:18 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  2:31 [PATCH v2 00/18] cpufreq: use __free() for all cpufreq_cpu_get() references Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 01/18] arm64: topology: Use __free(put_cpufreq_policy) for policy reference Zihuan Zhang
2025-08-27  8:30   ` Ben Horgan
2025-08-27  8:55     ` Zihuan Zhang
2025-08-27  9:12       ` Ben Horgan
2025-08-27  9:21         ` Zihuan Zhang
2025-08-27  9:17     ` Sudeep Holla
     [not found]     ` <1756341899099493.57.seg@mailgw.kylinos.cn>
2025-08-28  2:32       ` Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 02/18] KVM: x86: " Zihuan Zhang
2025-08-27 14:13   ` Sean Christopherson
2025-08-28  1:17     ` Zihuan Zhang
2025-08-28 17:15       ` Sean Christopherson
2025-08-27  2:31 ` [PATCH v2 03/18] ACPI: processor: thermal: " Zihuan Zhang
2025-08-28  9:40   ` Rafael J. Wysocki
2025-08-29  1:09     ` Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 04/18] cpufreq: brcmstb-avs-cpufreq: " Zihuan Zhang
2025-08-29  5:59   ` Viresh Kumar
2025-08-29  6:16     ` Zihuan Zhang
2025-08-29  6:26       ` Viresh Kumar
2025-08-29  6:32         ` Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 05/18] cpufreq: CPPC: " Zihuan Zhang
2025-08-29  6:04   ` Viresh Kumar
2025-08-27  2:31 ` [PATCH v2 06/18] cpufreq: intel_pstate: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 07/18] cpufreq: longhaul: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 08/18] cpufreq: mediatek: " Zihuan Zhang
2025-08-29  6:18   ` Viresh Kumar [this message]
2025-08-27  2:31 ` [PATCH v2 09/18] cpufreq: powernv: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 10/18] cpufreq: s5pv210: " Zihuan Zhang
2025-08-29  6:13   ` Viresh Kumar
2025-08-27  2:31 ` [PATCH v2 11/18] cpufreq: tegra186: " Zihuan Zhang
2025-08-29  6:29   ` Viresh Kumar
2025-08-27  2:31 ` [PATCH v2 12/18] PM / devfreq: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 13/18] drm/i915: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 14/18] cpufreq: powerpc: macintosh: " Zihuan Zhang
2025-08-27  2:31 ` [PATCH v2 15/18] powercap: dtpm_cpu: " Zihuan Zhang
2025-08-27  2:32 ` [PATCH v2 16/18] thermal: imx: " Zihuan Zhang
2025-08-27  2:32 ` [PATCH v2 17/18] thermal/drivers/ti-soc-thermal: " Zihuan Zhang
2025-08-27  2:32 ` [PATCH v2 18/18] PM: EM: " Zihuan Zhang
2025-08-27  3:50 ` [PATCH v2 15/18] powercap: dtpm_cpu: " Zihuan Zhang
2025-08-27  5:21   ` Zihuan Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250829061812.fziokvashujzbtth@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=airlied@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=beata.michalska@arm.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=cw00.choi@samsung.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hpa@zytor.com \
    --cc=imx@lists.linux.dev \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=j-keerthy@ti.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=jonathanh@nvidia.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukasz.luba@arm.com \
    --cc=maddy@linux.ibm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mingo@redhat.com \
    --cc=mmayer@broadcom.com \
    --cc=mpe@ellerman.id.au \
    --cc=myungjoo.ham@samsung.com \
    --cc=npiggin@gmail.com \
    --cc=pavel@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=ptsm@linux.microsoft.com \
    --cc=rafael@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=seanjc@google.com \
    --cc=shawnguo@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=sudeep.holla@arm.com \
    --cc=sumitg@nvidia.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tursulin@ursulin.net \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=yangyicong@hisilicon.com \
    --cc=zhangzihuan@kylinos.cn \
    --cc=zhenglifeng1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).