From patchwork Wed Jan 31 12:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 13539436 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 1F29A7BB0D; Wed, 31 Jan 2024 13:09:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706593; cv=none; b=qF914E5jgWwuLRQbuh2Enep6IXR2BkFoURxY2o8Bu33o37+lKVc8W2/RTNiHL8LAyHnNIwFJtzQfJkaEqlGGv/2bMY+qn2BgFY6e50oKDGzuhS05++btUFqwhOUOZHbtxBucHtgPduZXv2dXQb3i3hzSQ3SJzQ0DVm57YUiRTaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706706593; c=relaxed/simple; bh=RCT/pm4jNBaLXvngRoHheyS4c+M6ptTcHkicWfz+8qM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M4zgDtscQ3hwrXYNWy7CLJ78jpMBBAd8xDgXQDbcqUiLOlmsebtxXzOj3zn7gi+3etxkWsNWpayA2oKUh19mbJ0vGKESs68CzvPJaSfrVifOBZG9GFjd8K5J3E72H2twLrD3f9MXjbycXtN/xzzl4Q4mIkJc0a1p/lfjbN2HNkc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iakkdDkD; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iakkdDkD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706706592; x=1738242592; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RCT/pm4jNBaLXvngRoHheyS4c+M6ptTcHkicWfz+8qM=; b=iakkdDkDzaii6RpggdOMoQDECMkJrKC9xbrAWqlsfY5gqSVYXbCTN7Qt AUEwt6svXrRN9pnjYYZe/3wQVqsuA4W4iExdUcTA0VH4ss06GXwo1ep7z s+avRwpGo4ArjBfDvQBnGcqPGZgxcEVdk9hI1SOj4/L1FJiehHMBLYTwD FguLrljlMTM5/5zqSa/mUgJLAZu725dorlgc69+vpNZl9ltSiuktHL483 yvyP71AYoth2T60ss/XCh/eXnXqR4SZRf/n2L3Z7OSuZ3ee38pHDCK7iq YvCWdJjiGP9Eh3t/DEEAx1vniA2/NR8Vk8a+N+SdgpoueGtoRDiWREw/M Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="17127000" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="17127000" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 05:09:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="858816208" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="858816208" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.252.43.19]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 05:09:46 -0800 From: Stanislaw Gruszka To: linux-pm@vger.kernel.org Cc: "Rafael J. Wysocki" , Srinivas Pandruvada , Ricardo Neri , Daniel Lezcano , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH 2/3] thermal: netlink: Export thermal_group_has_listeners() Date: Wed, 31 Jan 2024 13:05:34 +0100 Message-Id: <20240131120535.933424-3-stanislaw.gruszka@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240131120535.933424-1-stanislaw.gruszka@linux.intel.com> References: <20240131120535.933424-1-stanislaw.gruszka@linux.intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Let drivers use thermal_group_has_listners(). The intel_hfi driver needs it to enable HFI only when user-space consumers are present. Signed-off-by: Stanislaw Gruszka --- drivers/thermal/thermal_netlink.c | 7 +------ drivers/thermal/thermal_netlink.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c index 569e4fa62f73..44e8df2751ba 100644 --- a/drivers/thermal/thermal_netlink.c +++ b/drivers/thermal/thermal_netlink.c @@ -13,11 +13,6 @@ #include "thermal_core.h" -enum thermal_genl_multicast_groups { - THERMAL_GENL_SAMPLING_GROUP = 0, - THERMAL_GENL_EVENT_GROUP = 1, -}; - static const struct genl_multicast_group thermal_genl_mcgrps[] = { [THERMAL_GENL_SAMPLING_GROUP] = { .name = THERMAL_GENL_SAMPLING_GROUP_NAME, }, [THERMAL_GENL_EVENT_GROUP] = { .name = THERMAL_GENL_EVENT_GROUP_NAME, }, @@ -76,7 +71,7 @@ typedef int (*cb_t)(struct param *); static struct genl_family thermal_gnl_family; -static int thermal_group_has_listeners(enum thermal_genl_multicast_groups group) +int thermal_group_has_listeners(enum thermal_genl_multicast_groups group) { return genl_has_listeners(&thermal_gnl_family, &init_net, group); } diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h index 0a9987c3bc57..3272a966f404 100644 --- a/drivers/thermal/thermal_netlink.h +++ b/drivers/thermal/thermal_netlink.h @@ -10,10 +10,16 @@ struct thermal_genl_cpu_caps { int efficiency; }; +enum thermal_genl_multicast_groups { + THERMAL_GENL_SAMPLING_GROUP = 0, + THERMAL_GENL_EVENT_GROUP = 1, +}; + /* Netlink notification function */ #ifdef CONFIG_THERMAL_NETLINK int __init thermal_netlink_init(void); void __init thermal_netlink_exit(void); +int thermal_group_has_listeners(enum thermal_genl_multicast_groups group); int thermal_notify_tz_create(int tz_id, const char *name); int thermal_notify_tz_delete(int tz_id); int thermal_notify_tz_enable(int tz_id); @@ -38,6 +44,11 @@ static inline int thermal_netlink_init(void) return 0; } +static inline int thermal_group_has_listeners(enum thermal_genl_multicast_groups group) +{ + return 0; +} + static inline int thermal_notify_tz_create(int tz_id, const char *name) { return 0;