From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14914CA1015 for ; Fri, 5 Sep 2025 09:47:52 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4cJBNQ5Jbxz3bm3; Fri, 5 Sep 2025 19:47:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1757065670; cv=none; b=ZqMxHXkseinSzzkj7ZFPTmPDNQm18bOwG3Y0A9GWvC1F5fQtEx73Tks7jYMPEzToFTh0Wk6hDH14zUZa2ZqB1H0TBhG9A2Yffyg3vv1UYkn+DJYSwe3Mx47U7jApXBhmSerZMAo5vRF6+o8EsJgNRiQqTbeAdyD4RA9lraawJMAEnDvx8UXPhTEYZ3CWPKvZYuya8NyA1kcTJdoQFwWKM1287uh9ht/+kXZKuYOg1W5J6bWiX5kG+PxBdclN/lItMMNGLWEgW720L+LyS39J0wFAXTD1yOnXLL2eL+LFDrqfWJLwl7jmBX36Zoro+J6/m4Z78oZm0nbE3HvICVNDtg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1757065670; c=relaxed/relaxed; bh=zDj9uPFRVkQmhjP4RN13h8zu9xrzmms+0gYa3fleM4c=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U2auJPR5XtdK2xl5uLHMeWmer8yWvHKDcDtKr7P0Y4gKyAx0p8fk7mDIGMDEd29ckd61yhdvyM270TNzShtP/m8DwitJnnXVO7mQT3u1UbPwvXO4wcsNRazfFDJZtauEEeULXYJcRsHExHbi4v0mOOLobI8JhdhuTMv40G2gwXH4LCXvQ8lcaU2kr4C/fAZ4jQL5SiEnDJBYhysihE3H0vXWYRejNsICs7OiR6zJzjbhXrGaFyMRxGThhV/dxB70Xn0VSiUiFBIegWKz9plFaWGkPORmP3mBJqU1hkfMX3gy+YIKUVPmcaGUGWMzbJsN1L+GdHBM/dxb6s8f+7Weeg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=185.176.79.56; helo=frasgout.his.huawei.com; envelope-from=jonathan.cameron@huawei.com; receiver=lists.ozlabs.org) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4cJBNP6NX5z3bl7 for ; Fri, 5 Sep 2025 19:47:49 +1000 (AEST) Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cJBHr7169z6L5Zv; Fri, 5 Sep 2025 17:43:52 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id C5FBC1402F1; Fri, 5 Sep 2025 17:47:46 +0800 (CST) Received: from localhost (10.203.177.15) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 5 Sep 2025 11:47:44 +0200 Date: Fri, 5 Sep 2025 10:47:43 +0100 From: Jonathan Cameron To: Zihuan Zhang CC: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , "Will Deacon" , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , "Jani Nikula" , Rodrigo Vivi , Tvrtko Ursulin , "David Airlie" , Simona Vetter , Daniel Lezcano , Sascha Hauer , "Shawn Guo" , Eduardo Valentin , Keerthy , Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , "Pengutronix Kernel Team" , Beata Michalska , Fabio Estevam , Pavel Machek , "Sumit Gupta" , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , , , , , , , , , Subject: Re: [PATCH v4 03/10] cpufreq: intel_pstate: Use scope-based cleanup helper Message-ID: <20250905104743.00004177@huawei.com> In-Reply-To: <20250903131733.57637-4-zhangzihuan@kylinos.cn> References: <20250903131733.57637-1-zhangzihuan@kylinos.cn> <20250903131733.57637-4-zhangzihuan@kylinos.cn> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.15] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To frapeml500008.china.huawei.com (7.182.85.71) On Wed, 3 Sep 2025 21:17:26 +0800 Zihuan Zhang wrote: > Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) > annotation for policy references. This reduces the risk of reference > counting mistakes and aligns the code with the latest kernel style. > > No functional change intended. > > Signed-off-by: Zihuan Zhang One trivial comment inline. This LGTM Reviewed-by: Jonathan Cameron > --- > drivers/cpufreq/intel_pstate.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index f366d35c5840..925efb1e65be 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -1209,6 +1209,17 @@ static bool hybrid_clear_max_perf_cpu(void) > return ret; > } > > +static struct freq_qos_request *intel_pstate_cpufreq_get_req(int cpu) > +{ > + struct cpufreq_policy *policy __free(put_cpufreq_policy) = > + cpufreq_cpu_get(cpu); > + > + if (!policy) > + return NULL; > + > + return policy->driver_data; > +} > + > static void __intel_pstate_get_hwp_cap(struct cpudata *cpu) > { > u64 cap; > @@ -1698,19 +1709,13 @@ static ssize_t store_no_turbo(struct kobject *a, struct 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; > > for_each_possible_cpu(i) { > struct cpudata *cpu = all_cpu_data[i]; > unsigned int freq, perf_pct; > > - policy = cpufreq_cpu_get(i); > - if (!policy) > - continue; > - > - req = policy->driver_data; > - cpufreq_cpu_put(policy); > + req = intel_pstate_cpufreq_get_req(i); > I'd drop this blank line as it'll keep the setting or req and checking it closely coupled. Previously the put inbetween stopped that but now we can improve the formatting! > if (!req) > continue;