Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2505049ybk; Mon, 18 May 2020 00:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ZmpnQofuXemgjhmr76HYqGra9PEwPatiNEswJvkQJRqV5wdT004shI4b5U3BK5oqbzeg X-Received: by 2002:a17:906:328c:: with SMTP id 12mr12820091ejw.69.1589786442725; Mon, 18 May 2020 00:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589786442; cv=none; d=google.com; s=arc-20160816; b=ZDFDldr7Fs/O0T+a486IZyORH0XGeYDpBqphLwkPqhPapV1j7szCmyeg75y4gZ+D1o fUtpV7nfEhPVJOgFPLo2a84aiZCFF3kYDIqHhpHRQckIXWAo0c4Z4dvGoDJ8Ct561Kms wgpvLzbD2T2znghaO0VJsZJkNBcQ+nDh3XjGpTkabaBYgCxThuVRQlyCanzQKqceIT5r jM5mZZDHiMZ8XuZ+b1G/ttGFO5YCkbJcq0F901fzZ7ysrD/JAzgU6sur0IOmdCBcoMeh Y/3eTDqZZmAmbxLeBZMkXmfvJii6yqx9MXDCCpS0GVpAXKsAyg8XfHZn/dFRu6ui29tY f4sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=TTf3RJN79ZvLoD+dKircUcAvZvVdUsZ33nGAbFN8Ppw=; b=YrD1nrDJkgttxwHqH/T6Fj4jES1GdcpTu8xhO32YWZ28ktsNsqDMwlzFSYvleDNLft qCnanV7dwwilyw2jTYoRpGcjHD5yKyCgI3DuFiLBwSk570plkGqPf6MA64fUuilBQzZD u9Jr9SJUoswM0zAkkBNeQodclsDW1cpJUvdVI3pHpq8tiRLMRIDYajBlku8u02Kyryv4 zTkt0/OZsD3k6pNwmJ6gcUWVaBcD8kEvKRZpbzhY+c1g9LzkhmtgnOb6QLYC3kpq/P9J ssHzDzuwz0NvQ0S5lyfEZjD4DKQGw/exIhNvq0of01SFSfKCam1uQbOWx5GJNbZ0AxrB Xkfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c18si6569382eja.143.2020.05.18.00.20.19; Mon, 18 May 2020 00:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbgERHQu (ORCPT + 99 others); Mon, 18 May 2020 03:16:50 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4809 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726800AbgERHQr (ORCPT ); Mon, 18 May 2020 03:16:47 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E4EDE43FD8761C7DB1C1; Mon, 18 May 2020 15:16:43 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 18 May 2020 15:16:35 +0800 From: Xiongfeng Wang To: , , , CC: , , , , , , Subject: [RFC PATCH v2 2/3] cpufreq: export 'cpufreq_policy_list' and make macro 'for_each_*_policy' public Date: Mon, 18 May 2020 15:10:07 +0800 Message-ID: <1589785808-12138-3-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1589785808-12138-1-git-send-email-wangxiongfeng2@huawei.com> References: <1589785808-12138-1-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export variable 'cpufreq_policy_list' and make macro 'for_each_*_policy" public. This is preparation for adding SW BOOST support for CPPC. Signed-off-by: Xiongfeng Wang --- drivers/cpufreq/cpufreq.c | 16 ++-------------- include/linux/cpufreq.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index bb6746e..953e163 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -30,20 +30,8 @@ #include #include -static LIST_HEAD(cpufreq_policy_list); - -/* Macros to iterate over CPU policies */ -#define for_each_suitable_policy(__policy, __active) \ - list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \ - if ((__active) == !policy_is_inactive(__policy)) - -#define for_each_active_policy(__policy) \ - for_each_suitable_policy(__policy, true) -#define for_each_inactive_policy(__policy) \ - for_each_suitable_policy(__policy, false) - -#define for_each_policy(__policy) \ - list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) +LIST_HEAD(cpufreq_policy_list); +EXPORT_SYMBOL_GPL(cpufreq_policy_list); /* Iterate over governors */ static LIST_HEAD(cpufreq_governor_list); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 018dce8..27a2a7f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -222,6 +222,20 @@ static inline bool policy_is_shared(struct cpufreq_policy *policy) struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); void cpufreq_enable_fast_switch(struct cpufreq_policy *policy); void cpufreq_disable_fast_switch(struct cpufreq_policy *policy); + +extern struct list_head cpufreq_policy_list; + +/* Macros to iterate over CPU policies */ +#define for_each_suitable_policy(__policy, __active) \ + list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) \ + if ((__active) == !policy_is_inactive(__policy)) +#define for_each_active_policy(__policy) \ + for_each_suitable_policy(__policy, true) +#define for_each_inactive_policy(__policy) \ + for_each_suitable_policy(__policy, false) +#define for_each_policy(__policy) \ + list_for_each_entry(__policy, &cpufreq_policy_list, policy_list) + #else static inline unsigned int cpufreq_get(unsigned int cpu) { -- 1.7.12.4