From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4D142749C8; Wed, 27 Aug 2025 02:32:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756261974; cv=none; b=dssvUoATmwNcQbMMKrDb0/CuE3D94COEECSv55437ec68IrrHcJRyF8PwORSt7cxNCEdNAca3GZnz74aNhWk7U/L56+Y3yOuSS2ZOEfFsQVv+MRag89fi0Txa+k8989dFHV4kN3Lx8dt/HDnMOYVpMclsPtU+rt4YLDGk1elZzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756261974; c=relaxed/simple; bh=IRJtOWw1tJbn4PcCRFV7BFvO9tWthYl8inlmLi18Fs0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hO1WHDg7gjM5RH9BlNAx6LErdTLMqHxeFSKglbEixTSrQst3kLbw5oKplS54KivQ2dIiiX5mIUrRo1cdeXbdqeysdBlztndPss2B2bgwjBqamxMplrYPaaqncVUHIHGuEB/7hpSIh839XddfS01+jwYjF18EFogIotT0FSGTZ48= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 1d737d6682ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:6d3e075b-e924-46f6-b0b7-4508981631c2,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:478b077a2744cb4e057cec0aaaa4c892,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 1d737d6682ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 50369807; Wed, 27 Aug 2025 10:32:45 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 6744FE008FAB; Wed, 27 Aug 2025 10:32:45 +0800 (CST) X-ns-mid: postfix-68AE6E4D-257290204 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id BBFD3E008FAA; Wed, 27 Aug 2025 10:32:37 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 01/18] arm64: topology: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:45 +0800 Message-Id: <20250827023202.10310-2-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- arch/arm64/kernel/topology.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 5d07ee85bdae..e3cb6d54f35b 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -307,17 +307,16 @@ int arch_freq_get_on_cpu(int cpu) */ if (!housekeeping_cpu(cpu, HK_TYPE_TICK) || time_is_before_jiffies(last_update + msecs_to_jiffies(AMU_SAMPLE_EXP= _MS))) { - struct cpufreq_policy *policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy); int ref_cpu; =20 + policy =3D cpufreq_cpu_get(cpu); if (!policy) return -EINVAL; =20 if (!cpumask_intersects(policy->related_cpus, - housekeeping_cpumask(HK_TYPE_TICK))) { - cpufreq_cpu_put(policy); + housekeeping_cpumask(HK_TYPE_TICK))) return -EOPNOTSUPP; - } =20 for_each_cpu_wrap(ref_cpu, policy->cpus, cpu + 1) { if (ref_cpu =3D=3D start_cpu) { @@ -329,8 +328,6 @@ int arch_freq_get_on_cpu(int cpu) break; } =20 - cpufreq_cpu_put(policy); - if (ref_cpu >=3D nr_cpu_ids) /* No alternative to pull info from */ return -EAGAIN; --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCEC82749D7; Wed, 27 Aug 2025 02:33:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756261991; cv=none; b=PYdGCtLC8ygFYI7zcMHSm+Enzp9DVDRCVThj7ZpCNr+J/8mJQsuSc0LFrgCjbPhTGX6xcFSQmsB7DVnae77RIGWqLVHJtuWwTGclVuqwhB0IXCQ2Cfx6lQxdEqlzmDO+AHHNOhwePMNFaQsdfSTUs+z1o1AmEzzX5HcQqS38WsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756261991; c=relaxed/simple; bh=+f4QSAQC2yNHPnxnePrPMIynJzPewfq7dADENJq5g7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n3EUj4dTHNRDvO8HZYuhACrDCwzLNtUFvEYEbbd2QNG8iR8Ag9R25ACJQfHOx4IPhg14h9E3vzuTafeeK4tHPrvPYjOB+HbUmXm7C4VRg6OIOKgWPXSZKIvdDM73RRaTnZNkFz+0VVjqQNZxoC/q8EwO2T3JRhIOGbxPxeazIwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 276ea1e282ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:dc696ab5-fc40-45bc-8152-d851101007ae,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:da19883316a45391f6b44bbfbaebe014,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 276ea1e282ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 828220855; Wed, 27 Aug 2025 10:33:02 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 115D4E008FAB; Wed, 27 Aug 2025 10:33:02 +0800 (CST) X-ns-mid: postfix-68AE6E5D-888915205 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 3D8ECE008FAA; Wed, 27 Aug 2025 10:32:56 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 02/18] KVM: x86: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:46 +0800 Message-Id: <20250827023202.10310-3-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- arch/x86/kvm/x86.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a1c49bc681c4..2a825f4ec701 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9492,16 +9492,14 @@ static void kvm_timer_init(void) max_tsc_khz =3D tsc_khz; =20 if (IS_ENABLED(CONFIG_CPU_FREQ)) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); int cpu; =20 cpu =3D get_cpu(); policy =3D cpufreq_cpu_get(cpu); - if (policy) { - if (policy->cpuinfo.max_freq) - max_tsc_khz =3D policy->cpuinfo.max_freq; - cpufreq_cpu_put(policy); - } + if (policy && policy->cpuinfo.max_freq) + max_tsc_khz =3D policy->cpuinfo.max_freq; + put_cpu(); } cpufreq_register_notifier(&kvmclock_cpufreq_notifier_block, --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BED2274B53; Wed, 27 Aug 2025 02:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262003; cv=none; b=ImuXDPpstskLocHMj8ezeTvmrW57QpgyPw39YD37WIGG6p4H4Yu/1eLSY6miNZk5iC16UMYEC7h77HeoUaAK16RHNdbVbhhyjG8IjIInHslpCDJiXrNHTWkaLDJmOWrVxjs9cSrQDgRqg4JWBaQRDWfAkSHmhYjGAirS47MqpoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262003; c=relaxed/simple; bh=PNqX9DaOJhZpVmh3AJHV2oF9xa7264gAeDqy5YZ3O1g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tzi4xmTYSN2+S11FWYSf2KojzHm5u6L3lnjUB6FGJxbVHp6/3FiGrDcfUndsPAdfBQq+y98n/e5QuI5zFaKZ/e2vloFNR9vWeL52Zq1DVW6TyBxcN5Ei9M5FDWpJwbDAUxu5WdJYGkHGPLDFF4pxnmmEJqiN45E8YBRROFlKwzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 2f55d79a82ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:f5b84325-56d7-4bff-9325-647f2c0ae4f1,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:3c6e133d2f67ea6d5913ce8d71ce8a39,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 2f55d79a82ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1538814642; Wed, 27 Aug 2025 10:33:15 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id A6A7CE008FAB; Wed, 27 Aug 2025 10:33:14 +0800 (CST) X-ns-mid: postfix-68AE6E6A-525672206 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id C4075E008FAA; Wed, 27 Aug 2025 10:33:08 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 03/18] ACPI: processor: thermal: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:47 +0800 Message-Id: <20250827023202.10310-4-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/acpi/processor_thermal.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_ther= mal.c index 1219adb11ab9..f99ed0812934 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -64,17 +64,13 @@ static int phys_package_first_cpu(int cpu) =20 static int cpu_has_cpufreq(unsigned int cpu) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 if (!acpi_processor_cpufreq_init) return 0; =20 policy =3D cpufreq_cpu_get(cpu); - if (policy) { - cpufreq_cpu_put(policy); - return 1; - } - return 0; + return !!policy; } =20 static int cpufreq_get_max_state(unsigned int cpu) @@ -95,7 +91,7 @@ static int cpufreq_get_cur_state(unsigned int cpu) =20 static int cpufreq_set_cur_state(unsigned int cpu, int state) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); struct acpi_processor *pr; unsigned long max_freq; int i, ret; @@ -127,8 +123,6 @@ static int cpufreq_set_cur_state(unsigned int cpu, int = state) max_freq =3D (policy->cpuinfo.max_freq * (100 - reduction_step(i) * cpufreq_thermal_reduction_pctg)) / 100; =20 - cpufreq_cpu_put(policy); - ret =3D freq_qos_update_request(&pr->thermal_req, max_freq); if (ret < 0) { pr_warn("Failed to update thermal freq constraint: CPU%d (%d)\n", --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03EFB2750E2; Wed, 27 Aug 2025 02:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262017; cv=none; b=h0dxE2m0lj+VBAg0aJrtS/AUcGAktcIFrihQxL3BG1qSZ6zmvxQjfOMUxe0y2Qz/HkMl2AFh/H5SDZLaGucCOoh4d1p1JtZmXwdii0oDqp4P9RELrLarofmEvZs/DpH9EdYuqVaXqn0IRj5D1l4MoYI2WCcZLAjum1rhhyCKqLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262017; c=relaxed/simple; bh=qTLPr9sojmkKLgq03acguEwvxibY2UhcUEPrs2v2JRs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YfJIJTuNlUuUU2fqneGBbzU7u8EeBlRYU222fjQruHSN9eBnXQJemgCusupc4eGqBC71Q9YkoL1KcxB3cbmpyBuRyrgEMdxeDOiX6xSUEv9tYNTK4Szq9p/IJS+rkf4WoCV2KhXt4eC5q1NVJdRjGsqvlTMta7KVuYHBkYt0A9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 358ca20682ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:e6e7109d-7ea1-4adc-90bb-5714c1f6811b,IP:0,U RL:0,TC:0,Content:32,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:32 X-CID-META: VersionHash:6493067,CLOUDID:58aaf5e18fe01ce1812229774ab50032,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 358ca20682ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1356445048; Wed, 27 Aug 2025 10:33:26 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id D0F1CE008FAA; Wed, 27 Aug 2025 10:33:25 +0800 (CST) X-ns-mid: postfix-68AE6E73-917867208 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id A7BD5E008FAB; Wed, 27 Aug 2025 10:33:18 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 04/18] cpufreq: brcmstb-avs-cpufreq: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:48 +0800 Message-Id: <20250827023202.10310-5-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/brcmstb-avs-cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmst= b-avs-cpufreq.c index 5940d262374f..71450cca8e9f 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -480,7 +480,7 @@ static bool brcm_avs_is_firmware_loaded(struct private_= data *priv) =20 static unsigned int brcm_avs_cpufreq_get(unsigned int cpu) { - struct cpufreq_policy *policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpu); struct private_data *priv; =20 if (!policy) @@ -488,8 +488,6 @@ static unsigned int brcm_avs_cpufreq_get(unsigned int c= pu) =20 priv =3D policy->driver_data; =20 - cpufreq_cpu_put(policy); - return brcm_avs_get_frequency(priv->base); } =20 --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C5C227815D; Wed, 27 Aug 2025 02:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262037; cv=none; b=ovXw5qDK8b5g8F+R170jkuiztS/cPdF6SsOpzdlNWPwFcQ3abQSqrHpDq8ikWxoAiAqu70cFjPERoMNh834e82ZVZkKHwiq2tO+QKa5HSPs/j6XKUGtOzpAbzlqS3OnFM+4ZqTKKA6opSX30+oZi7wH7rDB0W1rZ4GVua0/FPCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262037; c=relaxed/simple; bh=7k8OO6SyXdF96nmFlGQLiS/Od+RSXA98Wxhn0E3RQ9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cNM3xXdfTP/jCezHDH7FagG50Z0FVG8VCDvzJ7wf+FMD8DFLhk+0W676RLWIBlPAVWJJnz6tgWbQfjTaq4KuwGg3A4PgHn//qpj/68Q3otnV/R+CsVYtzWjOidinKbDuVOHUsKnT6V9RSHiuQfD31rDJr/jqRvLv8ygr8eUy2UM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 4286dbde82ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:7c6b7657-ec75-45a0-b733-6ba7ba4e3af4,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:b3d99bd22cf68e7ce72580e5493d381a,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:1, IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV: 0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4286dbde82ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 553426776; Wed, 27 Aug 2025 10:33:47 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 34F13E008FAA; Wed, 27 Aug 2025 10:33:47 +0800 (CST) X-ns-mid: postfix-68AE6E8A-406372209 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id E7D32E008FAE; Wed, 27 Aug 2025 10:33:25 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 05/18] cpufreq: CPPC: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:49 +0800 Message-Id: <20250827023202.10310-6-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/cppc_cpufreq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 4a17162a392d..7183754b1f31 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -726,7 +726,7 @@ static int cppc_get_perf_ctrs_sample(int cpu, static unsigned int cppc_cpufreq_get_rate(unsigned int cpu) { struct cppc_perf_fb_ctrs fb_ctrs_t0 =3D {0}, fb_ctrs_t1 =3D {0}; - struct cpufreq_policy *policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpu); struct cppc_cpudata *cpu_data; u64 delivered_perf; int ret; @@ -736,8 +736,6 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int = cpu) =20 cpu_data =3D policy->driver_data; =20 - cpufreq_cpu_put(policy); - ret =3D cppc_get_perf_ctrs_sample(cpu, &fb_ctrs_t0, &fb_ctrs_t1); if (ret) { if (ret =3D=3D -EFAULT) --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFD682765C7; Wed, 27 Aug 2025 02:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262047; cv=none; b=e1gpEzzRzp68q2ryabr/mLZ+ugQuyLNho8GqPBZOPp5Ykwj18pvhrKwZn005eAq7dw5vnySpygAUJMC7VcKyuAr5VdhYMwp4EQu1Y1ZJTl/DuudkTFie8JXu6gGBoKGlcY2O3fj+9J4yoYjs0RfW76iONEHo2BwpW5pmrVm4caw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262047; c=relaxed/simple; bh=1ccEEFVTMD5bQVYXET0LUOjFkFKErdy7JufDPxZOcsw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NMPmCnTEEqCno7Rob6g1gYmM1yo2/0MUhbD+5NMxbPm5K3uVYi8nRpa2geQoGIs9cwu4FGUzOPzAUai6FINHSeM5yj9LsiKsSEcZcI0nxNd9DEcNuxlsiZ4Ik23lwLWl1tPRWM0h46CwiP3MtWtmo6xAtA1Rnr+6tDCzNPzX8x8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 4761eea082ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:251e3759-9259-4617-9049-60d96fd5d3a9,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:c58015e2d3ed3de85363bc835c7272f6,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4761eea082ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1639701763; Wed, 27 Aug 2025 10:33:55 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id AF259E008FAA; Wed, 27 Aug 2025 10:33:52 +0800 (CST) X-ns-mid: postfix-68AE6E90-537935210 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 4A0FFE008FAF; Wed, 27 Aug 2025 10:33:47 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 06/18] cpufreq: intel_pstate: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:50 +0800 Message-Id: <20250827023202.10310-7-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/intel_pstate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f366d35c5840..4e7e2990e9a6 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1698,19 +1698,18 @@ static ssize_t store_no_turbo(struct kobject *a, st= ruct kobj_attribute *b, static void update_qos_request(enum freq_qos_req_type type) { struct freq_qos_request *req; - struct cpufreq_policy *policy; int i; =20 for_each_possible_cpu(i) { struct cpudata *cpu =3D all_cpu_data[i]; unsigned int freq, perf_pct; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 policy =3D cpufreq_cpu_get(i); if (!policy) continue; =20 req =3D policy->driver_data; - cpufreq_cpu_put(policy); =20 if (!req) continue; --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C31D52773E0; Wed, 27 Aug 2025 02:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262050; cv=none; b=Iaox5ViJORq1R64Xl9zNBzJZnrZ8Ar3zL7muWYWykeZcfRQ03kSVE/BL2tF8v6dPnkOprQ2sikj40xsTi59C4WWrT4HGD3TQglb2UVekHatyHPTQ0GCY+3a07YVPfKm2vwb5e2OYHeY8hmrjmlHBowNdBJyAW6MlbSL/Er3Qnuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262050; c=relaxed/simple; bh=rkwb4IeMY1GAAMkcKNNGOUfz988DBM38McQun8BvQ2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kJRRSY6+1GF7LZj/qOdf9yoZDw3TNIt7QlocqUMuXljOiPtXcORlbFpzi4geXz8Kd73a9CMWiFkYrOcw0niXxX0PwJVNnanbSuJSqEAr2NTA1tilRwGXPq0eizLAL/4B1KM7uuDqHZAzw1NiaZEwpffDEJKVE2kZ85aEla0lUwI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 491fce4c82ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:127d0195-46b5-41ae-87e2-a49f4d2bb859,IP:0,U RL:0,TC:0,Content:26,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:26 X-CID-META: VersionHash:6493067,CLOUDID:75de0d3453df4922818232808e2aa09c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 491fce4c82ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 461494435; Wed, 27 Aug 2025 10:33:58 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id AA9A2E008FAA; Wed, 27 Aug 2025 10:33:58 +0800 (CST) X-ns-mid: postfix-68AE6E96-41491213 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id C4296E008FAC; Wed, 27 Aug 2025 10:33:52 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 07/18] cpufreq: longhaul: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:51 +0800 Message-Id: <20250827023202.10310-8-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/longhaul.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index ba0e08c8486a..ae5596919671 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -950,7 +950,7 @@ static int __init longhaul_init(void) =20 static void __exit longhaul_exit(void) { - struct cpufreq_policy *policy =3D cpufreq_cpu_get(0); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); int i; =20 for (i =3D 0; i < numscales; i++) { @@ -968,7 +968,6 @@ static void __exit longhaul_exit(void) } } =20 - cpufreq_cpu_put(policy); cpufreq_unregister_driver(&longhaul_driver); kfree(longhaul_table); } --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE76A274FED; Wed, 27 Aug 2025 02:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262053; cv=none; b=s4T2Rxo9Dtf4GFHUlpvdiFZ+ebVx6ulrEm4E4wxn9vJYZtQKwT9zxQNkAG6VLb2l+fvb+fH3eh6SYe/Tktla2T92zYbuIec1CImaXSvLRxgNHpV8payGRKM69zXQ1+j2pL31kgHUTS12X5Wbsb0ifTEqzxYyHiEmmQ+2X1uNaQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262053; c=relaxed/simple; bh=QVeFRI/dyD3binc6t5bphA+vmew2cEPhw3+uE2T7PbM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ky6PkBRutpt430k4xloG3DVZd8/put4Xcxae934DIH+ENKIdBs0bkvBoOERG8pXa+1tiaDVDDGLAciS+Jev0RKYLNI6koHV9ueBEThF71mTF/9jNd3ZgBg75Utmizt9361nGcx6/Qmd909iK+zNOAY01RIkuBaXpdg+lNgfuTqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 4c8a061a82ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:7941979a-16b2-4797-b1a9-4f221b9551e0,IP:0,U RL:0,TC:0,Content:26,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:26 X-CID-META: VersionHash:6493067,CLOUDID:d0484afa4e7372fbe40ead58952fe818,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 4c8a061a82ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 42068490; Wed, 27 Aug 2025 10:34:04 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 67386E008FAA; Wed, 27 Aug 2025 10:34:04 +0800 (CST) X-ns-mid: postfix-68AE6E9C-117426214 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id BFF27E008FAE; Wed, 27 Aug 2025 10:33:58 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 08/18] cpufreq: mediatek: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:52 +0800 Message-Id: <20250827023202.10310-9-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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_blo= ck *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 =3D 0; =20 info =3D container_of(nb, struct mtk_cpu_dvfs_info, opp_nb); @@ -354,11 +354,9 @@ static int mtk_cpufreq_opp_notifier(struct notifier_bl= ock *nb, =20 dev_pm_opp_put(new_opp); policy =3D cpufreq_cpu_get(info->opp_cpu); - if (policy) { + if (policy) cpufreq_driver_target(policy, freq / 1000, CPUFREQ_RELATION_L); - cpufreq_cpu_put(policy); - } } } =20 --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3E5E288527; Wed, 27 Aug 2025 02:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262063; cv=none; b=jxXhrFeUIt7EkMTU7eT60AefTw7jCR8IRfA3wexxkS5jlibkaHnK2/xyKkR3swLbXQ3CfMso4HtSc4bbeF4K7iM7U1ZaUzhjnM1itaE9adTtWJmN45593zqUfdndsdnynbrQLYXqMYTInNGLmELEyf7DgY6km6rCXJUIK4RC7IE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262063; c=relaxed/simple; bh=ffG04aq2DZGbN0kmqZNgsrV7aLIbVVfJH1cQmy9sA98=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NisIG1BTqs1zxoaiKtFuKcYGUWTD+NLAs2jECRaQMRwisiSYBawvMbEUUAxxXwracYvc7Y5t3j6hk9d/J2yc3p0dw4gdOGqOLOc5Rsj0aDf19z+dgok+JoFY1+hfAB9aPYi3UZnBXOTTfn45v1aUnHFgprcZZcQb1VG08LLJszI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 5083df9882ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:5bb8290f-a5fb-4028-b230-da01455c4163,IP:0,U RL:0,TC:0,Content:38,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:38 X-CID-META: VersionHash:6493067,CLOUDID:67defe441fab8a4a40fe0b0794910e9c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 5083df9882ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 92438297; Wed, 27 Aug 2025 10:34:11 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 0B892E008FAA; Wed, 27 Aug 2025 10:34:11 +0800 (CST) X-ns-mid: postfix-68AE6EA1-678600215 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 7BE61E008FAC; Wed, 27 Aug 2025 10:34:04 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 09/18] cpufreq: powernv: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:53 +0800 Message-Id: <20250827023202.10310-10-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/powernv-cpufreq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cp= ufreq.c index 7d9a5f656de8..782cf5a482c0 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -892,15 +892,15 @@ static int powernv_cpufreq_reboot_notifier(struct not= ifier_block *nb, unsigned long action, void *unused) { int cpu; - struct cpufreq_policy *cpu_policy; =20 rebooting =3D true; for_each_online_cpu(cpu) { + struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy); + cpu_policy =3D cpufreq_cpu_get(cpu); if (!cpu_policy) continue; powernv_cpufreq_target_index(cpu_policy, get_nominal_index()); - cpufreq_cpu_put(cpu_policy); } =20 return NOTIFY_DONE; @@ -913,7 +913,6 @@ static struct notifier_block powernv_cpufreq_reboot_nb = =3D { static void powernv_cpufreq_work_fn(struct work_struct *work) { struct chip *chip =3D container_of(work, struct chip, throttle); - struct cpufreq_policy *policy; unsigned int cpu; cpumask_t mask; =20 @@ -928,6 +927,7 @@ static void powernv_cpufreq_work_fn(struct work_struct = *work) chip->restore =3D false; for_each_cpu(cpu, &mask) { int index; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 policy =3D cpufreq_cpu_get(cpu); if (!policy) @@ -935,7 +935,6 @@ static void powernv_cpufreq_work_fn(struct work_struct = *work) index =3D cpufreq_table_find_index_c(policy, policy->cur, false); powernv_cpufreq_target_index(policy, index); cpumask_andnot(&mask, &mask, policy->cpus); - cpufreq_cpu_put(policy); } out: cpus_read_unlock(); --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BDAF2C2346; Wed, 27 Aug 2025 02:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262067; cv=none; b=K01VEcCwfvbPDV5Zar+fOmApz7Va2yrPIwcWZPPieHI2bRvRsk5rGQ+4s6vcAuWiJgGm3AuGZ97BQMmThncMrjAOTAuBqRQEWTU7RDTQ3/VLJqu2xvoD1ooWB2x/yEl5R0dQ0+l//Y7NPXLaeBZBXq9gFh5ZzzDnQDBlUhiYjxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262067; c=relaxed/simple; bh=E3gEOR9GivUy2Y6VPlkAKwU8CtXVLfqDpZhCB/Acr6g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R7Xaqt7XPtwKt+Ig7/OfDw4Sv9TcVog2cyHDFNkI82oOMRMIQtt7RFf36PeErRWT4pzQPrFE20pn+E9GTaGabtbxQWqnPEjuc4wC4zxdMeLKOnWnm3rCoCKv9N+KAPuSQy/Vjtl/UWlW4L/vRAaG87JhiwpPJchLoWG1uPouH7o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 53da52a882ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:295b4bbf-f515-4c1c-b191-0179b187e57f,IP:0,U RL:0,TC:0,Content:34,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:34 X-CID-META: VersionHash:6493067,CLOUDID:f75c8664b440e68f8cb9ce3e9da3dd88,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 53da52a882ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1662742771; Wed, 27 Aug 2025 10:34:16 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 9E76FE008FAA; Wed, 27 Aug 2025 10:34:16 +0800 (CST) X-ns-mid: postfix-68AE6EA8-504909217 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 204CAE008FAE; Wed, 27 Aug 2025 10:34:11 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 10/18] cpufreq: s5pv210: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:54 +0800 Message-Id: <20250827023202.10310-11-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/s5pv210-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cp= ufreq.c index 76c888ed8d16..95f1568e9530 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -555,7 +555,7 @@ static int s5pv210_cpufreq_reboot_notifier_event(struct= notifier_block *this, unsigned long event, void *ptr) { int ret; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 policy =3D cpufreq_cpu_get(0); if (!policy) { @@ -564,7 +564,6 @@ static int s5pv210_cpufreq_reboot_notifier_event(struct= notifier_block *this, } =20 ret =3D cpufreq_driver_target(policy, SLEEP_FREQ, 0); - cpufreq_cpu_put(policy); =20 if (ret < 0) return NOTIFY_BAD; --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB12B2D2490; Wed, 27 Aug 2025 02:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262073; cv=none; b=cP5q+SCScYEKwswubsoDXHvhu5tyEcvvoEGRUU05hAq15+QEU1BRtkpYzf8pJPhKTMq05Nen4tqDL9CBDKHICRcQKHYp/oy+S6tsrOTvzjVRw2WVDx29ETW4exop4VCC5lR9A1i96YadMkKxd4gebxAraa5MdfHFzccXSm0otc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262073; c=relaxed/simple; bh=dKS5q8O89iMv/ztLo8xppzzmVEnEZvLZz02J8Z+LHYo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=laBQuwsuhHx4hfjNVNMtoLOGxVn9EObCopVbvWk/P6vdUJBcjwVp7dciqbmYrt4lS5y2j91eBYFFwwGkzWktxRJ70rQ+pGEdojtBHQ7O4lckgFl+QpU1Mg/elvt9PWWb3s2P+IzT8VksVrB+b8jf94VydWyBau3StrpjJn+3dNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 574650b882ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:416c131f-cdc4-4357-a970-0a338a0322ab,IP:0,U RL:0,TC:0,Content:32,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:32 X-CID-META: VersionHash:6493067,CLOUDID:61c6fed7fe483e194f2a90096c436016,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 574650b882ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 107580283; Wed, 27 Aug 2025 10:34:22 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 35F5DE008FAB; Wed, 27 Aug 2025 10:34:22 +0800 (CST) X-ns-mid: postfix-68AE6EAD-937581218 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id B441EE008FAC; Wed, 27 Aug 2025 10:34:16 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 11/18] cpufreq: tegra186: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:55 +0800 Message-Id: <20250827023202.10310-12-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/cpufreq/tegra186-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-= cpufreq.c index cbabb726c664..4d71e262a729 100644 --- a/drivers/cpufreq/tegra186-cpufreq.c +++ b/drivers/cpufreq/tegra186-cpufreq.c @@ -105,7 +105,7 @@ static unsigned int tegra186_cpufreq_get(unsigned int c= pu) { struct tegra186_cpufreq_data *data =3D cpufreq_get_driver_data(); struct tegra186_cpufreq_cluster *cluster; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); unsigned int edvd_offset, cluster_id; u32 ndiv; =20 @@ -117,7 +117,6 @@ static unsigned int tegra186_cpufreq_get(unsigned int c= pu) ndiv =3D readl(data->regs + edvd_offset) & EDVD_CORE_VOLT_FREQ_F_MASK; cluster_id =3D data->cpus[policy->cpu].bpmp_cluster_id; cluster =3D &data->clusters[cluster_id]; - cpufreq_cpu_put(policy); =20 return (cluster->ref_clk_khz * ndiv) / cluster->div; } --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCAC7276027; Wed, 27 Aug 2025 02:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262077; cv=none; b=QpLOmdjTL8yjjcrnEkLLA+ShmfGodv10TMQmN2rTp5yjTohH3UXqnYd71g0YZpUgW6YplQ0sL+RX3bh53ZZEjMxuCP+8BMQ3BJsnqP+aEKDDvIalBk8099qPfVw3Ljxtk/cS5DXBSHaoydfkTDBVy91wZtYPhgsHFuDIgx3M9yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262077; c=relaxed/simple; bh=wcWYK9rz85+B8ZktIkNdqYJxtGKGtnnb8GGxqugYRB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pz3uGllvctaapMOXm8ACrRC1jYLOi27Omy9Lw9xXwyFFLBaGSm0E8tX2k9oUXmXd5VfdpcHiSKC7OXrR7RJ9X9O0qODyPsGm4oZvfQ49MCIxj08/PDpv5W05jmAM33O3XOZbMYAXW4xUtZBCpAbZglPMYrh9mRQxp2Ayk1HR78A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 5a9f8dc482ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:df2516fb-3a56-48c1-9b74-afbcc02e0f8e,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:055083efc466c8f175331ea40732d173,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 5a9f8dc482ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 946874906; Wed, 27 Aug 2025 10:34:28 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id C8E9CE008FAA; Wed, 27 Aug 2025 10:34:27 +0800 (CST) X-ns-mid: postfix-68AE6EB3-644502219 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 36833E008FAE; Wed, 27 Aug 2025 10:34:22 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 12/18] PM / devfreq: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:56 +0800 Message-Id: <20250827023202.10310-13-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/devfreq/governor_passive.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_= passive.c index 953cf9a1e9f7..99597c921e38 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -80,13 +80,13 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, struct devfreq_passive_data *p_data =3D (struct devfreq_passive_data *)devfreq->data; struct devfreq_cpu_data *parent_cpu_data; - struct cpufreq_policy *policy; unsigned long cpu, cpu_cur, cpu_min, cpu_max, cpu_percent; unsigned long dev_min, dev_max; unsigned long freq =3D 0; int ret =3D 0; =20 for_each_online_cpu(cpu) { + struct cpufreq_policy *policy __free(put_cpufreq_policy); policy =3D cpufreq_cpu_get(cpu); if (!policy) { ret =3D -EINVAL; @@ -94,10 +94,8 @@ static int get_target_freq_with_cpufreq(struct devfreq *= devfreq, } =20 parent_cpu_data =3D get_parent_cpu_data(p_data, policy); - if (!parent_cpu_data) { - cpufreq_cpu_put(policy); + if (!parent_cpu_data) continue; - } =20 /* Get target freq via required opps */ cpu_cur =3D parent_cpu_data->cur_freq * HZ_PER_KHZ; @@ -106,7 +104,6 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, devfreq->opp_table, &cpu_cur); if (freq) { *target_freq =3D max(freq, *target_freq); - cpufreq_cpu_put(policy); continue; } =20 @@ -121,7 +118,6 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, freq =3D dev_min + mult_frac(dev_max - dev_min, cpu_percent, 100); =20 *target_freq =3D max(freq, *target_freq); - cpufreq_cpu_put(policy); } =20 return ret; @@ -256,7 +252,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) struct device *dev =3D devfreq->dev.parent; struct opp_table *opp_table =3D NULL; struct devfreq_cpu_data *parent_cpu_data; - struct cpufreq_policy *policy; struct device *cpu_dev; unsigned int cpu; int ret; @@ -273,6 +268,7 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) } =20 for_each_possible_cpu(cpu) { + struct cpufreq_policy *policy __free(put_cpufreq_policy); policy =3D cpufreq_cpu_get(cpu); if (!policy) { ret =3D -EPROBE_DEFER; @@ -280,16 +276,14 @@ static int cpufreq_passive_register_notifier(struct d= evfreq *devfreq) } =20 parent_cpu_data =3D get_parent_cpu_data(p_data, policy); - if (parent_cpu_data) { - cpufreq_cpu_put(policy); + if (parent_cpu_data) continue; - } =20 parent_cpu_data =3D kzalloc(sizeof(*parent_cpu_data), GFP_KERNEL); if (!parent_cpu_data) { ret =3D -ENOMEM; - goto err_put_policy; + goto err; } =20 cpu_dev =3D get_cpu_device(cpu); @@ -314,7 +308,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) parent_cpu_data->max_freq =3D policy->cpuinfo.max_freq; =20 list_add_tail(&parent_cpu_data->node, &p_data->cpu_data_list); - cpufreq_cpu_put(policy); } =20 mutex_lock(&devfreq->lock); @@ -327,8 +320,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) =20 err_free_cpu_data: kfree(parent_cpu_data); -err_put_policy: - cpufreq_cpu_put(policy); err: =20 return ret; --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E49F2FAC0A; Wed, 27 Aug 2025 02:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262089; cv=none; b=GtuEvtNTCB9NGr95os+rq3wuvnLfwntuaD2S+nA9CfJc4LvGQF2Z4pC4tihepSny8BfEnnDOt9BU006t4+rIlIhy3YDWKwlucYsDsZLrmAY9gpt/x8BjCM9aG4gLjQPUlwAl7GVz/a5He/V2tNfyGQFmebPlBquWzgenVDlyP00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262089; c=relaxed/simple; bh=zZXgnX+W1CXrmYXCsFK+Zm3j34pOJ31BJv6utloF218=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=InSTCbf34tPQEy07NrJNSVVsJd5UD7gS3292YiuCpjXre37QiM1zsVmXX11OCAkhEmxGD0yWxWHBIvOupzUBaYjfctlkSb2ewNYUZQxuIG8s6fp+VP5ugztnDDgB8mGCtODzWvym5ddRdKRyykVG6oQOnhe9PIwY19EE02p5igs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 60c5210a82ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:2e1b9a1e-efda-43e8-9741-7accc6502d60,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:9c93b9b8c5fde1ad829be2d56bbb0d93,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 60c5210a82ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1158270070; Wed, 27 Aug 2025 10:34:38 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 5951CE008FAC; Wed, 27 Aug 2025 10:34:38 +0800 (CST) X-ns-mid: postfix-68AE6EBE-218835221 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id E7FCBE008FAF; Wed, 27 Aug 2025 10:34:27 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 13/18] drm/i915: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:57 +0800 Message-Id: <20250827023202.10310-14-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/gpu/drm/i915/gt/intel_llc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_llc.c b/drivers/gpu/drm/i915/gt/= intel_llc.c index 1d19c073ba2e..53cef2ab133d 100644 --- a/drivers/gpu/drm/i915/gt/intel_llc.c +++ b/drivers/gpu/drm/i915/gt/intel_llc.c @@ -29,13 +29,12 @@ static struct intel_gt *llc_to_gt(struct intel_llc *llc) =20 static unsigned int cpu_max_MHz(void) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); unsigned int max_khz; =20 policy =3D cpufreq_cpu_get(0); if (policy) { max_khz =3D policy->cpuinfo.max_freq; - cpufreq_cpu_put(policy); } else { /* * Default to measured freq if none found, PCU will ensure we --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7E2A2FDC31; Wed, 27 Aug 2025 02:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262092; cv=none; b=pdUinAyIHd4bKApkSbo1uZgFcP/pLw8Z8a+YuPySmZWok2wnsNuikAXo4crhGUUqaGgHgtqoxIrt0h579JDoCDpQGpbV9sYmBwA2nMi5sNfP1GoBeVevatzmp31zUKl3E8T/olf/o6p7dfykSKpeqdGbw4cLbYXXkWVWPsFhpIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756262092; c=relaxed/simple; bh=flSfPRNQnYMom8ROcCS1tPymmpBjL2uMjRUbr65zK+U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=C0g8gSWJIIZhAQp57StK6jTCC3SWkR6I/xN9nvpvcEBf5Pz7DYP0/cPdjjt7IPrpZaWzYXmG6EHCVw5kngexXC1eRq2n83qh51KA8ZbgrinZO5PtaJ2c/6Ta+Xsk5djih3pLdkOBbmbz36ReEg5GAvIaqCya9vN0sO16OCCamd4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 64a67eb882ee11f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:e8eb1380-9b4f-4676-8e85-4dd94b7a98db,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:ad5ebea67f0f0036752eb1b7b2dd6389,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:1, IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV: 0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 64a67eb882ee11f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 976442035; Wed, 27 Aug 2025 10:34:45 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id D683BE008FAA; Wed, 27 Aug 2025 10:34:43 +0800 (CST) X-ns-mid: postfix-68AE6EC3-738925222 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 6F1FDE008FB0; Wed, 27 Aug 2025 10:34:38 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 14/18] cpufreq: powerpc: macintosh: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:58 +0800 Message-Id: <20250827023202.10310-15-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/macintosh/windfarm_cpufreq_clamp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh= /windfarm_cpufreq_clamp.c index 28d18ef22bbb..f05e2167481f 100644 --- a/drivers/macintosh/windfarm_cpufreq_clamp.c +++ b/drivers/macintosh/windfarm_cpufreq_clamp.c @@ -62,7 +62,7 @@ static const struct wf_control_ops clamp_ops =3D { =20 static int __init wf_cpufreq_clamp_init(void) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); struct wf_control *clamp; struct device *dev; int ret; @@ -79,8 +79,6 @@ static int __init wf_cpufreq_clamp_init(void) ret =3D freq_qos_add_request(&policy->constraints, &qos_req, FREQ_QOS_MAX, max_freq); =20 - cpufreq_cpu_put(policy); - if (ret < 0) { pr_err("%s: Failed to add freq constraint (%d)\n", __func__, ret); --=20 2.25.1 From nobody Fri Oct 3 18:10:03 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8139C26E71C; Wed, 27 Aug 2025 05:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756271223; cv=none; b=XgzwzV20w73oe8vLtgCIuWdcT/FinPDo/mPsytS6WYzGmVXSGQRA+B9LKbh/p6D8wCsUokSh8FaVVA1YF0FO1igZYyDY83BZLayX5BTCOjH6CbbfakbZ77G0vpa0NkbC3DPUQdhJo3I7iLJXzTHUfmZJodqpvl5AEjOD3D1+plA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756271223; c=relaxed/simple; bh=JI7aOfvbtpkrYD3QrqSIAxy6G2P6kcd830fbhdrC4vM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y3wSNsQa8SeA3K1UEFhJTN40Kqf7hS3jZJ4P2Chd0kFX+24ukCEZbcGQbSQuA0bB7rBO6Sri6Z+B1/0z4rtlvwhUWztNvowJq739Z/bmru86tbs6srpBMWWRejD0u7bM4Ao21YWv+OpqIc1wiUr3d/bbPbRvNG5hPtHNdv+DsY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: a657db4e830311f0b29709d653e92f7d-20250827 X-CID-CACHE: Type:Local,Time:202508271301+08,HitQuantity:1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:bc547704-46f6-4537-bcbe-586d6e61cfdb,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:7871a2c7ca51f2bc02737c897857e02d,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: a657db4e830311f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 2029553132; Wed, 27 Aug 2025 13:06:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id A2772E008FB5; Wed, 27 Aug 2025 11:51:18 +0800 (CST) X-ns-mid: postfix-68AE80B6-481635499 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 49687E008FB2; Wed, 27 Aug 2025 11:51:01 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 15/18] powercap: dtpm_cpu: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 11:50:56 +0800 Message-Id: <20250827035056.353772-1-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/powercap/dtpm_cpu.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index 99390ec1481f..65117569d0f3 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -144,19 +144,16 @@ static int update_pd_power_uw(struct dtpm *dtpm) static void pd_release(struct dtpm *dtpm) { struct dtpm_cpu *dtpm_cpu =3D to_dtpm_cpu(dtpm); - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 if (freq_qos_request_active(&dtpm_cpu->qos_req)) freq_qos_remove_request(&dtpm_cpu->qos_req); =20 policy =3D cpufreq_cpu_get(dtpm_cpu->cpu); - if (policy) { + if (policy) for_each_cpu(dtpm_cpu->cpu, policy->related_cpus) per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) =3D NULL; =20 - cpufreq_cpu_put(policy); - } - kfree(dtpm_cpu); } =20 @@ -192,7 +189,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) { struct dtpm_cpu *dtpm_cpu; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); struct em_perf_state *table; struct em_perf_domain *pd; char name[CPUFREQ_NAME_LEN]; @@ -207,16 +204,12 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *par= ent) return 0; =20 pd =3D em_cpu_get(cpu); - if (!pd || em_is_artificial(pd)) { - ret =3D -EINVAL; - goto release_policy; - } + if (!pd || em_is_artificial(pd)) + return -EINVAL; =20 dtpm_cpu =3D kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); - if (!dtpm_cpu) { - ret =3D -ENOMEM; - goto release_policy; - } + if (!dtpm_cpu) + return -ENOMEM; =20 dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops); dtpm_cpu->cpu =3D cpu; @@ -239,7 +232,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) if (ret < 0) goto out_dtpm_unregister; =20 - cpufreq_cpu_put(policy); return 0; =20 out_dtpm_unregister: @@ -251,8 +243,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) per_cpu(dtpm_per_cpu, cpu) =3D NULL; kfree(dtpm_cpu); =20 -release_policy: - cpufreq_cpu_put(policy); return ret; } =20 --=20 2.25.1 From nobody Fri Oct 3 18:10:04 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16A412D7BF; Wed, 27 Aug 2025 05:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270925; cv=none; b=clzOfoJ7jtadz6uCYuAsWyEkE0TqmNu/RB8pVNF7dQQ6TqbuYOjjJxj21zA4egnZOg6ygzAn+I+/vBSC3RuoHkXtKYxd6xBONUpo6UaeBwEY8nXMkB+qqGiuOZDPegcMHVOe1gbWGcn+2LHaun90Z8+HZGOKNmxeb+HWnR5IHzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270925; c=relaxed/simple; bh=JI7aOfvbtpkrYD3QrqSIAxy6G2P6kcd830fbhdrC4vM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eZdqmLpSy7B0KiFN/Pz3eVL5S6Agrz+sjXT3rjdJC1gLDGCNuKhLaveXvcqQXBjjt/9uaQ00ya9KQSFn/Wbedbue1w6Q4ewyUnmjrpDDPx1R76t0UpikpkVq+BVhkWsyKl1wDmgpMk8t7WU575DJLvZZkWMxxeXyCyEDNxqKTLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f35a7542830211f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:f450acc9-5e41-4f07-b72d-89f0f284ee93,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:7ef16cb1b0f5c94da2d4ef951972d460,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: f35a7542830211f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1248728101; Wed, 27 Aug 2025 13:01:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id B6D48E008FAA; Wed, 27 Aug 2025 10:34:49 +0800 (CST) X-ns-mid: postfix-68AE6EC9-204746223 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id ECEDDE008FAC; Wed, 27 Aug 2025 10:34:43 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 15/18] powercap: dtpm_cpu: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:31:59 +0800 Message-Id: <20250827023202.10310-16-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/powercap/dtpm_cpu.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index 99390ec1481f..65117569d0f3 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -144,19 +144,16 @@ static int update_pd_power_uw(struct dtpm *dtpm) static void pd_release(struct dtpm *dtpm) { struct dtpm_cpu *dtpm_cpu =3D to_dtpm_cpu(dtpm); - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 if (freq_qos_request_active(&dtpm_cpu->qos_req)) freq_qos_remove_request(&dtpm_cpu->qos_req); =20 policy =3D cpufreq_cpu_get(dtpm_cpu->cpu); - if (policy) { + if (policy) for_each_cpu(dtpm_cpu->cpu, policy->related_cpus) per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) =3D NULL; =20 - cpufreq_cpu_put(policy); - } - kfree(dtpm_cpu); } =20 @@ -192,7 +189,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) { struct dtpm_cpu *dtpm_cpu; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); struct em_perf_state *table; struct em_perf_domain *pd; char name[CPUFREQ_NAME_LEN]; @@ -207,16 +204,12 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *par= ent) return 0; =20 pd =3D em_cpu_get(cpu); - if (!pd || em_is_artificial(pd)) { - ret =3D -EINVAL; - goto release_policy; - } + if (!pd || em_is_artificial(pd)) + return -EINVAL; =20 dtpm_cpu =3D kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); - if (!dtpm_cpu) { - ret =3D -ENOMEM; - goto release_policy; - } + if (!dtpm_cpu) + return -ENOMEM; =20 dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops); dtpm_cpu->cpu =3D cpu; @@ -239,7 +232,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) if (ret < 0) goto out_dtpm_unregister; =20 - cpufreq_cpu_put(policy); return 0; =20 out_dtpm_unregister: @@ -251,8 +243,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) per_cpu(dtpm_per_cpu, cpu) =3D NULL; kfree(dtpm_cpu); =20 -release_policy: - cpufreq_cpu_put(policy); return ret; } =20 --=20 2.25.1 From nobody Fri Oct 3 18:10:04 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 804B4192D68; Wed, 27 Aug 2025 05:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270923; cv=none; b=FnhA1jcRIWigRHs7y/ZQXa/Skr04nVy35CKA7qxh2Oe/fxlXsBRl6sXtZGBKdWYHTL9CRvSxD4ux6sRYRy2tpUCPdaTVxfQTsVPwmWk0Zf23dlR/DtcvMvcSgde/a+xP0G5/GZ+4msR87Ru4t5S5LV3boT5b3eB1EdYCkF5Y07Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270923; c=relaxed/simple; bh=S0QwNQ6X1uOd5DUCm9OkT1QLmodMCgstDqlqPF81VjE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qohAufE1CD/nIyvc71OOpvECHG0265KCVGYDpiqrCEMjamjvI7Md2wTXDu/GkhkTupx7I3achcBZwNF6ZuZWo1FCIhIsFsqm9FnKL0Vloa7JEKZfigKRo0smF3IZXqxgTe+e5nCJdCk+CnoUZxQJx2OM9q7b3dEOKbNExF6iS90= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f370b8c0830211f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:70140bf9-ef77-4383-a566-c38e2ed42667,IP:0,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:25 X-CID-META: VersionHash:6493067,CLOUDID:280c6ba2b5a0315afe92559bd8410c7c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:5, IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV: 0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: f370b8c0830211f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 661534961; Wed, 27 Aug 2025 13:01:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 65EA8E008FAC; Wed, 27 Aug 2025 10:34:55 +0800 (CST) X-ns-mid: postfix-68AE6ECF-20984224 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id CB324E008FAE; Wed, 27 Aug 2025 10:34:49 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 16/18] thermal: imx: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:32:00 +0800 Message-Id: <20250827023202.10310-17-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/thermal/imx_thermal.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 38c993d1bcb3..8e776d314d88 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -201,7 +201,6 @@ static struct thermal_soc_data thermal_imx7d_data =3D { =20 struct imx_thermal_data { struct device *dev; - struct cpufreq_policy *policy; struct thermal_zone_device *tz; struct thermal_cooling_device *cdev; struct regmap *tempmon; @@ -541,22 +540,21 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match); static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *da= ta) { struct device_node *np; + struct cpufreq_policy *policy __free(put_cpufreq_policy); int ret =3D 0; =20 - data->policy =3D cpufreq_cpu_get(0); - if (!data->policy) { + policy =3D cpufreq_cpu_get(0); + if (!policy) { pr_debug("%s: CPUFreq policy not found\n", __func__); return -EPROBE_DEFER; } =20 - np =3D of_get_cpu_node(data->policy->cpu, NULL); + np =3D of_get_cpu_node(policy->cpu, NULL); =20 if (!np || !of_property_present(np, "#cooling-cells")) { data->cdev =3D cpufreq_cooling_register(data->policy); - if (IS_ERR(data->cdev)) { + if (IS_ERR(data->cdev)) ret =3D PTR_ERR(data->cdev); - cpufreq_cpu_put(data->policy); - } } =20 of_node_put(np); @@ -567,7 +565,6 @@ static int imx_thermal_register_legacy_cooling(struct i= mx_thermal_data *data) static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data = *data) { cpufreq_cooling_unregister(data->cdev); - cpufreq_cpu_put(data->policy); } =20 #else --=20 2.25.1 From nobody Fri Oct 3 18:10:04 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7933621B8F7; Wed, 27 Aug 2025 05:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270924; cv=none; b=PPlFsxR0udGamoB/oiSrzYRZ+8G82g+Y1PXkkBaKtENydd84WFikhwwMIb1k+1XCoDTSYeoMPhwUei23MZPLKgPkfDUDabINfhPGx/K40RZIi2IRX+b4YDCXZfwhp95rwCZWggwqAj/0KvI6dcFaflGi7OHWQWHzCbgap0EMrD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270924; c=relaxed/simple; bh=78mbABd3CMXGSKUQvx0oRZg6rezTKm+e6aMTj9t5z44=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uIqjfY55+9sA1IcppDedXRweAVxQ1RuQHaIJRkX8JryD2/OgWKzDTeA/J6vsW1vLzuzrjUnMWCWAGM3VKafAT91cjcLelJtErFML5r4DEZxAyp026KXDBcmM1VhsLjI3hOrGehNjHwYiW6S7Qz8wlbP/XzSO1uBAYiyvQjRPCJw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f37b122a830211f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:37f8ad9c-4ad8-4b06-94c1-2b4948d3043c,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:80cb6ac02342e1dbc78a57acf95a60bb,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: f37b122a830211f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 797351173; Wed, 27 Aug 2025 13:01:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id DD65EE008FAE; Wed, 27 Aug 2025 10:35:00 +0800 (CST) X-ns-mid: postfix-68AE6ED4-748503225 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 7A7D0E008FB0; Wed, 27 Aug 2025 10:34:55 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 17/18] thermal/drivers/ti-soc-thermal: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:32:01 +0800 Message-Id: <20250827023202.10310-18-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 0cf0826b805a..c0db27670974 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -27,7 +27,6 @@ =20 /* common data structures */ struct ti_thermal_data { - struct cpufreq_policy *policy; struct thermal_zone_device *ti_thermal; struct thermal_zone_device *pcb_tz; struct thermal_cooling_device *cool_dev; @@ -218,6 +217,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) { struct ti_thermal_data *data; struct device_node *np =3D bgp->dev->of_node; + struct cpufreq_policy *policy __free(put_cpufreq_policy); =20 /* * We are assuming here that if one deploys the zone @@ -234,8 +234,8 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) if (!data) return -EINVAL; =20 - data->policy =3D cpufreq_cpu_get(0); - if (!data->policy) { + policy =3D cpufreq_cpu_get(0); + if (!policy) { pr_debug("%s: CPUFreq policy not found\n", __func__); return -EPROBE_DEFER; } @@ -246,7 +246,6 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) int ret =3D PTR_ERR(data->cool_dev); dev_err(bgp->dev, "Failed to register cpu cooling device %d\n", ret); - cpufreq_cpu_put(data->policy); =20 return ret; } @@ -261,11 +260,8 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandga= p *bgp, int id) =20 data =3D ti_bandgap_get_sensor_data(bgp, id); =20 - if (!IS_ERR_OR_NULL(data)) { + if (!IS_ERR_OR_NULL(data)) cpufreq_cooling_unregister(data->cool_dev); - if (data->policy) - cpufreq_cpu_put(data->policy); - } =20 return 0; } --=20 2.25.1 From nobody Fri Oct 3 18:10:04 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0144123507E; Wed, 27 Aug 2025 05:02:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270924; cv=none; b=m0fBy+jxv+WayTgcvBS0stXGIvEuc/I1Xci4HQrMkjf2BIXbUCF6keEtA0eLQ5Zty+N635GSI2rhv0APXtE4ngDOdlcLttXzFfBLugXwSMAIWp1pyANI4eLvGTEkyjJR3dqCYHQx09CE7AJQnIJcINdpXj1oud5Iw5+ojejFz5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756270924; c=relaxed/simple; bh=FE0eo5Ga2qkimmk9oNH2NxpHXXg2SOZVHj8Um2Vo+f4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MrMCv5Fbdk8TPGGWrXacBoKqGya8wyWo6LwjVF4IybPCNGgNeGuT7anESBwBXU/e64whFoLRo8/Z1dOaBwn/ps0kSlmneIQTDFQFOdG/DUM4Rg45CMYwwRppLd+hOpayYODllDTSMqlhVqCoyVjz1tO8HY6TDiX7Nfc1Ru3uBWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f38b124c830211f0b29709d653e92f7d-20250827 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:0290cae2-efde-447b-90d3-a1b8997896e3,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:b88084040a57fcf217a1f01948e6576c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: f38b124c830211f0b29709d653e92f7d-20250827 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 799344177; Wed, 27 Aug 2025 13:01:54 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 8E1F0E008FB0; Wed, 27 Aug 2025 10:35:06 +0800 (CST) X-ns-mid: postfix-68AE6EDA-170480226 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id F2CB3E008FB2; Wed, 27 Aug 2025 10:35:00 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Markus Mayer , Florian Fainelli , Srinivas Pandruvada , Madhavan Srinivasan , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy , Matthias Brugger , AngeloGioacchino Del Regno Cc: zhenglifeng , "H . Peter Anvin" , Zhang Rui , Len Brown , Nicholas Piggin , Christophe Leroy , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , 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, Zihuan Zhang Subject: [PATCH v2 18/18] PM: EM: Use __free(put_cpufreq_policy) for policy reference Date: Wed, 27 Aug 2025 10:32:02 +0800 Message-Id: <20250827023202.10310-19-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250827023202.10310-1-zhangzihuan@kylinos.cn> References: <20250827023202.10310-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- kernel/power/energy_model.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index ea7995a25780..4f91112c10bd 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -451,7 +451,7 @@ static void em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *t= able) { struct em_perf_domain *pd =3D dev->em_pd; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); int found =3D 0; int i, cpu; =20 @@ -479,8 +479,6 @@ em_cpufreq_update_efficiencies(struct device *dev, stru= ct em_perf_state *table) found++; } =20 - cpufreq_cpu_put(policy); - if (!found) return; =20 @@ -787,7 +785,7 @@ static void em_check_capacity_update(void) =20 /* Check if CPUs capacity has changed than update EM */ for_each_possible_cpu(cpu) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); struct em_perf_domain *pd; struct device *dev; =20 @@ -801,7 +799,6 @@ static void em_check_capacity_update(void) msecs_to_jiffies(1000)); break; } - cpufreq_cpu_put(policy); =20 dev =3D get_cpu_device(cpu); pd =3D em_pd_get(dev); --=20 2.25.1