xref: /linux/kernel/power/em_netlink.h (revision 486b257357c23743d9729ea715136d105fff461e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  *
4  * Generic netlink for energy model.
5  *
6  * Copyright (c) 2025 Valve Corporation.
7  * Author: Changwoo Min <changwoo@igalia.com>
8  */
9 #ifndef _EM_NETLINK_H
10 #define _EM_NETLINK_H
11 
12 #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_NET)
13 int for_each_em_perf_domain(int (*cb)(struct em_perf_domain*, void *),
14 			    void *data);
15 int em_perf_domain_for_id(int id, int (*cb)(struct em_perf_domain *, void *),
16 			  void *data);
17 void em_notify_pd_created(const struct em_perf_domain *pd);
18 void em_notify_pd_deleted(const struct em_perf_domain *pd);
19 void em_notify_pd_updated(const struct em_perf_domain *pd);
20 #else
21 static inline
22 int for_each_em_perf_domain(int (*cb)(struct em_perf_domain*, void *),
23 			    void *data)
24 {
25 	return -EINVAL;
26 }
27 static inline
28 int em_perf_domain_for_id(int id, int (*cb)(struct em_perf_domain *, void *),
29 			  void *data)
30 {
31 	return -EINVAL;
32 }
33 
34 static inline void em_notify_pd_created(const struct em_perf_domain *pd) {}
35 
36 static inline void em_notify_pd_deleted(const struct em_perf_domain *pd) {}
37 
38 static inline void em_notify_pd_updated(const struct em_perf_domain *pd) {}
39 #endif
40 
41 #endif /* _EM_NETLINK_H */
42