1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2020-21 Intel Corporation.
6 #include <linux/device.h>
7 #include <linux/kobject.h>
8 #include <linux/slab.h>
10 #include "iosm_ipc_uevent.h"
12 /* Update the uevent in work queue context */
13 static void ipc_uevent_work(struct work_struct *data)
15 struct ipc_uevent_info *info;
16 char *envp[2] = { NULL, NULL };
18 info = container_of(data, struct ipc_uevent_info, work);
20 envp[0] = info->uevent;
22 if (kobject_uevent_env(&info->dev->kobj, KOBJ_CHANGE, envp))
23 pr_err("uevent %s failed to sent", info->uevent);
28 void ipc_uevent_send(struct device *dev, char *uevent)
30 struct ipc_uevent_info *info = kzalloc(sizeof(*info), GFP_ATOMIC);
35 /* Initialize the kernel work queue */
36 INIT_WORK(&info->work, ipc_uevent_work);
38 /* Store the device and event information */
40 snprintf(info->uevent, MAX_UEVENT_LEN, "IOSM_EVENT=%s", uevent);
42 /* Schedule uevent in process context using work queue */
43 schedule_work(&info->work);