.. | .. |
---|
29 | 29 | MODULE_DESCRIPTION ("Linux for S/390 IUCV special message driver"); |
---|
30 | 30 | |
---|
31 | 31 | static struct iucv_path *smsg_path; |
---|
32 | | -/* dummy device used as trigger for PM functions */ |
---|
33 | | -static struct device *smsg_dev; |
---|
34 | 32 | |
---|
35 | 33 | static DEFINE_SPINLOCK(smsg_list_lock); |
---|
36 | 34 | static LIST_HEAD(smsg_list); |
---|
37 | | -static int iucv_path_connected; |
---|
38 | 35 | |
---|
39 | 36 | static int smsg_path_pending(struct iucv_path *, u8 *, u8 *); |
---|
40 | 37 | static void smsg_message_pending(struct iucv_path *, struct iucv_message *); |
---|
.. | .. |
---|
124 | 121 | kfree(cb); |
---|
125 | 122 | } |
---|
126 | 123 | |
---|
127 | | -static int smsg_pm_freeze(struct device *dev) |
---|
128 | | -{ |
---|
129 | | -#ifdef CONFIG_PM_DEBUG |
---|
130 | | - printk(KERN_WARNING "smsg_pm_freeze\n"); |
---|
131 | | -#endif |
---|
132 | | - if (smsg_path && iucv_path_connected) { |
---|
133 | | - iucv_path_sever(smsg_path, NULL); |
---|
134 | | - iucv_path_connected = 0; |
---|
135 | | - } |
---|
136 | | - return 0; |
---|
137 | | -} |
---|
138 | | - |
---|
139 | | -static int smsg_pm_restore_thaw(struct device *dev) |
---|
140 | | -{ |
---|
141 | | - int rc; |
---|
142 | | - |
---|
143 | | -#ifdef CONFIG_PM_DEBUG |
---|
144 | | - printk(KERN_WARNING "smsg_pm_restore_thaw\n"); |
---|
145 | | -#endif |
---|
146 | | - if (smsg_path && !iucv_path_connected) { |
---|
147 | | - memset(smsg_path, 0, sizeof(*smsg_path)); |
---|
148 | | - smsg_path->msglim = 255; |
---|
149 | | - smsg_path->flags = 0; |
---|
150 | | - rc = iucv_path_connect(smsg_path, &smsg_handler, "*MSG ", |
---|
151 | | - NULL, NULL, NULL); |
---|
152 | | -#ifdef CONFIG_PM_DEBUG |
---|
153 | | - if (rc) |
---|
154 | | - printk(KERN_ERR |
---|
155 | | - "iucv_path_connect returned with rc %i\n", rc); |
---|
156 | | -#endif |
---|
157 | | - if (!rc) |
---|
158 | | - iucv_path_connected = 1; |
---|
159 | | - cpcmd("SET SMSG IUCV", NULL, 0, NULL); |
---|
160 | | - } |
---|
161 | | - return 0; |
---|
162 | | -} |
---|
163 | | - |
---|
164 | | -static const struct dev_pm_ops smsg_pm_ops = { |
---|
165 | | - .freeze = smsg_pm_freeze, |
---|
166 | | - .thaw = smsg_pm_restore_thaw, |
---|
167 | | - .restore = smsg_pm_restore_thaw, |
---|
168 | | -}; |
---|
169 | | - |
---|
170 | 124 | static struct device_driver smsg_driver = { |
---|
171 | 125 | .owner = THIS_MODULE, |
---|
172 | 126 | .name = SMSGIUCV_DRV_NAME, |
---|
173 | 127 | .bus = &iucv_bus, |
---|
174 | | - .pm = &smsg_pm_ops, |
---|
175 | 128 | }; |
---|
176 | 129 | |
---|
177 | 130 | static void __exit smsg_exit(void) |
---|
178 | 131 | { |
---|
179 | 132 | cpcmd("SET SMSG OFF", NULL, 0, NULL); |
---|
180 | | - device_unregister(smsg_dev); |
---|
181 | 133 | iucv_unregister(&smsg_handler, 1); |
---|
182 | 134 | driver_unregister(&smsg_driver); |
---|
183 | 135 | } |
---|
.. | .. |
---|
205 | 157 | NULL, NULL, NULL); |
---|
206 | 158 | if (rc) |
---|
207 | 159 | goto out_free_path; |
---|
208 | | - else |
---|
209 | | - iucv_path_connected = 1; |
---|
210 | | - smsg_dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
---|
211 | | - if (!smsg_dev) { |
---|
212 | | - rc = -ENOMEM; |
---|
213 | | - goto out_free_path; |
---|
214 | | - } |
---|
215 | | - dev_set_name(smsg_dev, "smsg_iucv"); |
---|
216 | | - smsg_dev->bus = &iucv_bus; |
---|
217 | | - smsg_dev->parent = iucv_root; |
---|
218 | | - smsg_dev->release = (void (*)(struct device *))kfree; |
---|
219 | | - smsg_dev->driver = &smsg_driver; |
---|
220 | | - rc = device_register(smsg_dev); |
---|
221 | | - if (rc) |
---|
222 | | - goto out_put; |
---|
223 | 160 | |
---|
224 | 161 | cpcmd("SET SMSG IUCV", NULL, 0, NULL); |
---|
225 | 162 | return 0; |
---|
226 | 163 | |
---|
227 | | -out_put: |
---|
228 | | - put_device(smsg_dev); |
---|
229 | 164 | out_free_path: |
---|
230 | 165 | iucv_path_free(smsg_path); |
---|
231 | 166 | smsg_path = NULL; |
---|