]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PM: EM: Add a skeleton code for netlink notification
authorChangwoo Min <changwoo@igalia.com>
Mon, 20 Oct 2025 22:09:08 +0000 (07:09 +0900)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 22 Oct 2025 19:44:37 +0000 (21:44 +0200)
Add a boilerplate code for netlink notification to register the new
protocol family. Also, initialize and register the netlink during booting.
The initialization is called at the postcore level, which is late enough
after the generic netlink is initialized.

Finally, update MAINTAINERS to include new files.

Signed-off-by: Changwoo Min <changwoo@igalia.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20251020220914.320832-5-changwoo@igalia.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
MAINTAINERS
kernel/power/Makefile
kernel/power/em_netlink.c [new file with mode: 0644]
kernel/power/em_netlink.h [new file with mode: 0644]

index e6b3bab9dbeb6d07a558ebdb06e3aeb2697df69a..0d96aadb0d86db7c3923ff6ea3575212dc85cc0b 100644 (file)
@@ -9183,7 +9183,7 @@ F:        include/linux/energy_model.h
 F:     Documentation/power/energy-model.rst
 F:     Documentation/netlink/specs/em.yaml
 F:     include/uapi/linux/energy_model.h
-F:     kernel/power/em_netlink_autogen.*
+F:     kernel/power/em_netlink*.*
 
 EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER
 M:     Laurentiu Tudor <laurentiu.tudor@nxp.com>
index 874ad834dc8dafeed9afd6677cefbabc147435de..773e2789412b96ff9dc864b0c3f7acf63b2f7ccb 100644 (file)
@@ -21,4 +21,6 @@ obj-$(CONFIG_PM_WAKELOCKS)    += wakelock.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)      += poweroff.o
 
-obj-$(CONFIG_ENERGY_MODEL)     += energy_model.o
+obj-$(CONFIG_ENERGY_MODEL)     += em.o
+em-y                           := energy_model.o
+em-$(CONFIG_NET)               += em_netlink_autogen.o em_netlink.o
diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c
new file mode 100644 (file)
index 0000000..f8c98ae
--- /dev/null
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *
+ * Generic netlink for energy model.
+ *
+ * Copyright (c) 2025 Valve Corporation.
+ * Author: Changwoo Min <changwoo@igalia.com>
+ */
+
+#define pr_fmt(fmt) "energy_model: " fmt
+
+#include <linux/energy_model.h>
+#include <net/sock.h>
+#include <net/genetlink.h>
+#include <uapi/linux/energy_model.h>
+
+#include "em_netlink.h"
+#include "em_netlink_autogen.h"
+
+int em_nl_get_pds_doit(struct sk_buff *skb, struct genl_info *info)
+{
+       return -EOPNOTSUPP;
+}
+
+int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info)
+{
+       return -EOPNOTSUPP;
+}
+
+static int __init em_netlink_init(void)
+{
+       return genl_register_family(&em_nl_family);
+}
+postcore_initcall(em_netlink_init);
diff --git a/kernel/power/em_netlink.h b/kernel/power/em_netlink.h
new file mode 100644 (file)
index 0000000..acd186c
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * Generic netlink for energy model.
+ *
+ * Copyright (c) 2025 Valve Corporation.
+ * Author: Changwoo Min <changwoo@igalia.com>
+ */
+#ifndef _EM_NETLINK_H
+#define _EM_NETLINK_H
+
+#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_NET)
+#else
+#endif
+
+#endif /* _EM_NETLINK_H */