xref: /linux/kernel/power/em_netlink.h (revision d348c22394ad3c8eaf7bc693cb0ca0edc2ec5246)
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 struct em_perf_domain *em_perf_domain_get_by_id(int id);
16 void em_notify_pd_created(const struct em_perf_domain *pd);
17 void em_notify_pd_deleted(const struct em_perf_domain *pd);
18 void em_notify_pd_updated(const struct em_perf_domain *pd);
19 #else
20 static inline
21 int for_each_em_perf_domain(int (*cb)(struct em_perf_domain*, void *),
22 			    void *data)
23 {
24 	return -EINVAL;
25 }
26 static inline
27 struct em_perf_domain *em_perf_domain_get_by_id(int id)
28 {
29 	return NULL;
30 }
31 
32 static inline void em_notify_pd_created(const struct em_perf_domain *pd) {}
33 
34 static inline void em_notify_pd_deleted(const struct em_perf_domain *pd) {}
35 
36 static inline void em_notify_pd_updated(const struct em_perf_domain *pd) {}
37 #endif
38 
39 #endif /* _EM_NETLINK_H */
40