Commit e4ed8d26 authored by Changwoo Min's avatar Changwoo Min Committed by Rafael J. Wysocki
Browse files

PM: EM: Add a skeleton code for netlink notification



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: default avatarChangwoo Min <changwoo@igalia.com>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20251020220914.320832-5-changwoo@igalia.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent bd26631c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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>
+3 −1
Original line number Diff line number Diff line
@@ -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
+34 −0
Original line number Diff line number Diff line
// 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);
+16 −0
Original line number Diff line number Diff line
/* 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 */