23 #include <linux/module.h>
25 #include <linux/errno.h>
26 #include <linux/device.h>
27 #include <linux/slab.h>
46 static struct device *smsg_dev;
50 static int iucv_path_connected;
56 .path_pending = smsg_path_pending,
57 .message_pending = smsg_message_pending,
63 if (
strncmp(ipvmid,
"*MSG ", 8) != 0)
66 return iucv_path_accept(path, &smsg_handler,
"SMSGIUCV ",
NULL);
69 static void smsg_message_pending(
struct iucv_path *path,
74 unsigned char sender[9];
89 for (i = 7; i >= 0; i--) {
90 if (sender[i] !=
' ' && sender[i] !=
'\t')
94 spin_lock(&smsg_list_lock);
100 spin_unlock(&smsg_list_lock);
116 spin_lock_bh(&smsg_list_lock);
118 spin_unlock_bh(&smsg_list_lock);
128 spin_lock_bh(&smsg_list_lock);
137 spin_unlock_bh(&smsg_list_lock);
141 static int smsg_pm_freeze(
struct device *
dev)
143 #ifdef CONFIG_PM_DEBUG
146 if (smsg_path && iucv_path_connected) {
148 iucv_path_connected = 0;
153 static int smsg_pm_restore_thaw(
struct device *dev)
157 #ifdef CONFIG_PM_DEBUG
160 if (smsg_path && !iucv_path_connected) {
161 memset(smsg_path, 0,
sizeof(*smsg_path));
163 smsg_path->
flags = 0;
164 rc = iucv_path_connect(smsg_path, &smsg_handler,
"*MSG ",
166 #ifdef CONFIG_PM_DEBUG
169 "iucv_path_connect returned with rc %i\n", rc);
172 iucv_path_connected = 1;
178 static const struct dev_pm_ops smsg_pm_ops = {
179 .freeze = smsg_pm_freeze,
180 .thaw = smsg_pm_restore_thaw,
181 .restore = smsg_pm_restore_thaw,
191 static void __exit smsg_exit(
void)
199 static int __init smsg_init(
void)
213 smsg_path = iucv_path_alloc(255, 0,
GFP_KERNEL);
218 rc = iucv_path_connect(smsg_path, &smsg_handler,
"*MSG ",
223 iucv_path_connected = 1;
233 smsg_dev->
driver = &smsg_driver;
244 iucv_path_free(smsg_path);