On 9/21/25 04:19, Changwoo Min wrote:
> Implement two event notifications when a performance domain is created
> (EM_CMD_PD_CREATED) and updated (EM_CMD_PD_UPDATED). The message format
> of these two event notifications is the same as EM_CMD_GET_PD_TABLE --
> containing the performance domain's ID and its energy model table.
>
> Signed-off-by: Changwoo Min <changwoo@igalia.com>
> ---
> kernel/power/em_netlink.c | 38 ++++++++++++++++++++++++++++++++++++--
> 1 file changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/em_netlink.c b/kernel/power/em_netlink.c
> index ff6aa848d998..ff3eab078546 100644
> --- a/kernel/power/em_netlink.c
> +++ b/kernel/power/em_netlink.c
> @@ -215,14 +215,48 @@ int em_nl_get_pd_table_doit(struct sk_buff *skb, struct genl_info *info)
>
>
> /**************************** Event encoding *********************************/
> +static int __em_notify_pd_table(const struct em_perf_domain *pd, int ntf_type)
> +{
> + struct sk_buff *msg;
> + int msg_sz, ret = -EMSGSIZE;
> + void *hdr;
> +
> + if (!genl_has_listeners(&em_nl_family, &init_net, EM_NLGRP_EVENT))
> + return 0;
> +
> + msg_sz = __em_nl_get_pd_table_size(pd);
> +
> + msg = genlmsg_new(msg_sz, GFP_KERNEL);
> + if (!msg)
> + return -ENOMEM;
> +
> + hdr = genlmsg_put(msg, 0, 0, &em_nl_family, 0, ntf_type);
> + if (!hdr)
> + goto out_free_msg;
> +
> + ret = __em_nl_get_pd_table(msg, pd);
> + if (ret)
> + goto out_free_msg;
> +
> + genlmsg_end(msg, hdr);
> +
> + genlmsg_multicast(&em_nl_family, msg, 0, EM_NLGRP_EVENT, GFP_KERNEL);
> +
> + return 0;
> +
> +out_free_msg:
> + nlmsg_free(msg);
> + return ret;
> +}
> +
> int em_notify_pd_created(const struct em_perf_domain *pd)
> {
> - return -EOPNOTSUPP;
> + return __em_notify_pd_table(pd, EM_CMD_PD_CREATED);
> }
>
> int em_notify_pd_updated(const struct em_perf_domain *pd)
> {
> - return -EOPNOTSUPP;
> + return __em_notify_pd_table(pd, EM_CMD_PD_UPDATED);
> }
>
> static int __em_notify_pd_deleted_size(const struct em_perf_domain *pd)
Similar comment to the one in previous patch.
Can we just simply change these functions to void?