Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp640321pxu; Fri, 23 Oct 2020 09:34:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBoy7hzpkYS5HOz5X/2MbZIJKOOubijOFHHUBb6m8yCTjDLJDRWeT/Tg9hKUnThKBbwPvn X-Received: by 2002:a05:6402:1a4d:: with SMTP id bf13mr2038899edb.314.1603470884601; Fri, 23 Oct 2020 09:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603470884; cv=none; d=google.com; s=arc-20160816; b=P9278/9BYoTDUpcTxOIo9HxtYLz0BCit/KtVO1aNFobfjuf+Dw5QvyZ56kBVOqjL9U I0SZ9K0gov8yDvBM6lFWzW43+2uycnffSjuqWqTxWcUV0WK+/93qHspco2pOR7rS5ftL g93xrVIpoxmnqr8PbEGJaR3QC1qTkoKNVCSNmeZjWpGCYJkGxei7SH5pcR2pNb3O7W2e WEjSsu/pibbOteqcfNyo5JOQdi0PRnhjkcS7AeatWVMS3ghGb6uccTPdy+/7WdBzfmZ0 qjM/2c+GZamhAfb/P+dGXcaNv8xOXTJ/0myvPZmLKBnI6f1FHXOxLLmqBuSDqpAk+iYT G8CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gn5DknvYUS8gaJK7SA20CMYZrLt7z5HU+35vnjJnh9M=; b=WUCCxVmk2Ye9gGL32KFP2sSL6iQQXuEJ2KmaSlrg8sEc2eu+ERzM0w8H55txBoRvIF v7bwgLMV5fPweaPJyv4SKVAyHT8kO39v/09rzara3Um3d1zt1C+Th/DppVUz/zRxGQEn /fT/5WWIiFPg2NsoZ7+lqI0gpuQyGn2hFq0WC0iQbmUa2xZsPWdv7bQ81uAMpKotuZQ/ 41gzNOFA27y7oc99CbQ94LXOqnijuaxxZROPsfry6mOd9P3K+KaUBlhuANWv7AlS1pjv nHRedMy0HcZAXRDW/rBfzjx772XMsqp8RWkq6GIvhUPKLiNdj3B8iS3rTWn7wMl+45RH bHwg== 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 l90si1073120edl.249.2020.10.23.09.34.22; Fri, 23 Oct 2020 09:34:44 -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 S1750895AbgJWPgr (ORCPT + 99 others); Fri, 23 Oct 2020 11:36:47 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:63900 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750889AbgJWPgr (ORCPT ); Fri, 23 Oct 2020 11:36:47 -0400 Received: from 89-64-88-190.dynamic.chello.pl (89.64.88.190) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.491) id f97b26b3a52a1870; Fri, 23 Oct 2020 17:36:44 +0200 From: "Rafael J. Wysocki" To: Linux PM , Viresh Kumar Cc: LKML , Srinivas Pandruvada , Zhang Rui Subject: [PATCH v2 3/4] cpufreq: Introduce cpufreq_driver_test_flags() Date: Fri, 23 Oct 2020 17:35:46 +0200 Message-ID: <28638601.XPu5T7AxD8@kreacher> In-Reply-To: <2183878.gTFULuzKx9@kreacher> References: <2183878.gTFULuzKx9@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Add a helper function to test the flags of the cpufreq driver in use againt a given flags mask. In particular, this will be needed to test the CPUFREQ_NEED_UPDATE_LIMITS cpufreq driver flag in the schedutil governor. Signed-off-by: Rafael J. Wysocki --- New patch in v2. --- drivers/cpufreq/cpufreq.c | 12 ++++++++++++ include/linux/cpufreq.h | 1 + 2 files changed, 13 insertions(+) Index: linux-pm/drivers/cpufreq/cpufreq.c =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq.c +++ linux-pm/drivers/cpufreq/cpufreq.c @@ -1909,6 +1909,18 @@ void cpufreq_resume(void) } /** + * cpufreq_driver_test_flags - Test cpufreq driver's flags against given ones. + * @flags: Flags to test against the current cpufreq driver's flags. + * + * Assumes that the driver is there, so callers must ensure that this is the + * case. + */ +bool cpufreq_driver_test_flags(u16 flags) +{ + return !!(cpufreq_driver->flags & flags); +} + +/** * cpufreq_get_current_driver - return current driver's name * * Return the name string of the currently loaded cpufreq driver Index: linux-pm/include/linux/cpufreq.h =================================================================== --- linux-pm.orig/include/linux/cpufreq.h +++ linux-pm/include/linux/cpufreq.h @@ -428,6 +428,7 @@ struct cpufreq_driver { int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); +bool cpufreq_driver_test_flags(u16 flags); const char *cpufreq_get_current_driver(void); void *cpufreq_get_driver_data(void);