0001
0002
0003
0004
0005
0006 #include <linux/device.h>
0007 #include <linux/kobject.h>
0008 #include <linux/slab.h>
0009
0010 #include "iosm_ipc_uevent.h"
0011
0012
0013 static void ipc_uevent_work(struct work_struct *data)
0014 {
0015 struct ipc_uevent_info *info;
0016 char *envp[2] = { NULL, NULL };
0017
0018 info = container_of(data, struct ipc_uevent_info, work);
0019
0020 envp[0] = info->uevent;
0021
0022 if (kobject_uevent_env(&info->dev->kobj, KOBJ_CHANGE, envp))
0023 pr_err("uevent %s failed to sent", info->uevent);
0024
0025 kfree(info);
0026 }
0027
0028 void ipc_uevent_send(struct device *dev, char *uevent)
0029 {
0030 struct ipc_uevent_info *info = kzalloc(sizeof(*info), GFP_ATOMIC);
0031
0032 if (!info)
0033 return;
0034
0035
0036 INIT_WORK(&info->work, ipc_uevent_work);
0037
0038
0039 info->dev = dev;
0040 snprintf(info->uevent, MAX_UEVENT_LEN, "IOSM_EVENT=%s", uevent);
0041
0042
0043 schedule_work(&info->work);
0044 }