Lines Matching refs:monpriv
150 struct mon_private *monpriv) in mon_send_reply() argument
154 rc = iucv_message_reply(monpriv->path, &monmsg->msg, in mon_send_reply()
156 atomic_dec(&monpriv->msglim_count); in mon_send_reply()
160 monpriv->read_index = (monpriv->read_index + 1) % in mon_send_reply()
162 atomic_dec(&monpriv->read_ready); in mon_send_reply()
172 static void mon_free_mem(struct mon_private *monpriv) in mon_free_mem() argument
177 if (monpriv->msg_array[i]) in mon_free_mem()
178 kfree(monpriv->msg_array[i]); in mon_free_mem()
179 kfree(monpriv); in mon_free_mem()
185 struct mon_private *monpriv; in mon_alloc_mem() local
187 monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL); in mon_alloc_mem()
188 if (!monpriv) in mon_alloc_mem()
191 monpriv->msg_array[i] = kzalloc(sizeof(struct mon_msg), in mon_alloc_mem()
193 if (!monpriv->msg_array[i]) { in mon_alloc_mem()
194 mon_free_mem(monpriv); in mon_alloc_mem()
198 return monpriv; in mon_alloc_mem()
209 static struct mon_msg *mon_next_message(struct mon_private *monpriv) in mon_next_message() argument
213 if (!atomic_read(&monpriv->read_ready)) in mon_next_message()
215 monmsg = monpriv->msg_array[monpriv->read_index]; in mon_next_message()
221 monpriv->read_index = (monpriv->read_index + 1) % in mon_next_message()
223 atomic_dec(&monpriv->read_ready); in mon_next_message()
235 struct mon_private *monpriv = path->private; in mon_iucv_path_complete() local
237 atomic_set(&monpriv->iucv_connected, 1); in mon_iucv_path_complete()
243 struct mon_private *monpriv = path->private; in mon_iucv_path_severed() local
248 atomic_set(&monpriv->iucv_severed, 1); in mon_iucv_path_severed()
256 struct mon_private *monpriv = path->private; in mon_iucv_message_pending() local
258 memcpy(&monpriv->msg_array[monpriv->write_index]->msg, in mon_iucv_message_pending()
260 if (atomic_inc_return(&monpriv->msglim_count) == MON_MSGLIM) { in mon_iucv_message_pending()
262 monpriv->msg_array[monpriv->write_index]->msglim_reached = 1; in mon_iucv_message_pending()
264 monpriv->write_index = (monpriv->write_index + 1) % MON_MSGLIM; in mon_iucv_message_pending()
265 atomic_inc(&monpriv->read_ready); in mon_iucv_message_pending()
280 struct mon_private *monpriv; in mon_open() local
291 monpriv = mon_alloc_mem(); in mon_open()
292 if (!monpriv) in mon_open()
298 monpriv->path = iucv_path_alloc(MON_MSGLIM, IUCV_IPRMDATA, GFP_KERNEL); in mon_open()
299 if (!monpriv->path) in mon_open()
301 rc = iucv_path_connect(monpriv->path, &monreader_iucv_handler, in mon_open()
302 MON_SERVICE, NULL, user_data_connect, monpriv); in mon_open()
313 atomic_read(&monpriv->iucv_connected) || in mon_open()
314 atomic_read(&monpriv->iucv_severed)); in mon_open()
315 if (atomic_read(&monpriv->iucv_severed)) { in mon_open()
316 atomic_set(&monpriv->iucv_severed, 0); in mon_open()
317 atomic_set(&monpriv->iucv_connected, 0); in mon_open()
321 filp->private_data = monpriv; in mon_open()
322 dev_set_drvdata(monreader_device, monpriv); in mon_open()
326 iucv_path_free(monpriv->path); in mon_open()
328 mon_free_mem(monpriv); in mon_open()
338 struct mon_private *monpriv = filp->private_data; in mon_close() local
343 if (monpriv->path) { in mon_close()
344 rc = iucv_path_sever(monpriv->path, user_data_sever); in mon_close()
348 iucv_path_free(monpriv->path); in mon_close()
351 atomic_set(&monpriv->iucv_severed, 0); in mon_close()
352 atomic_set(&monpriv->iucv_connected, 0); in mon_close()
353 atomic_set(&monpriv->read_ready, 0); in mon_close()
354 atomic_set(&monpriv->msglim_count, 0); in mon_close()
355 monpriv->write_index = 0; in mon_close()
356 monpriv->read_index = 0; in mon_close()
360 kfree(monpriv->msg_array[i]); in mon_close()
361 kfree(monpriv); in mon_close()
369 struct mon_private *monpriv = filp->private_data; in mon_read() local
374 monmsg = mon_next_message(monpriv); in mon_read()
382 atomic_read(&monpriv->read_ready) || in mon_read()
383 atomic_read(&monpriv->iucv_severed)); in mon_read()
386 if (unlikely(atomic_read(&monpriv->iucv_severed))) in mon_read()
388 monmsg = monpriv->msg_array[monpriv->read_index]; in mon_read()
424 ret = mon_send_reply(monmsg, monpriv); in mon_read()
434 struct mon_private *monpriv = filp->private_data; in mon_poll() local
437 if (unlikely(atomic_read(&monpriv->iucv_severed))) in mon_poll()
439 if (atomic_read(&monpriv->read_ready)) in mon_poll()
465 struct mon_private *monpriv = dev_get_drvdata(dev); in monreader_freeze() local
468 if (!monpriv) in monreader_freeze()
470 if (monpriv->path) { in monreader_freeze()
471 rc = iucv_path_sever(monpriv->path, user_data_sever); in monreader_freeze()
475 iucv_path_free(monpriv->path); in monreader_freeze()
477 atomic_set(&monpriv->iucv_severed, 0); in monreader_freeze()
478 atomic_set(&monpriv->iucv_connected, 0); in monreader_freeze()
479 atomic_set(&monpriv->read_ready, 0); in monreader_freeze()
480 atomic_set(&monpriv->msglim_count, 0); in monreader_freeze()
481 monpriv->write_index = 0; in monreader_freeze()
482 monpriv->read_index = 0; in monreader_freeze()
483 monpriv->path = NULL; in monreader_freeze()
489 struct mon_private *monpriv = dev_get_drvdata(dev); in monreader_thaw() local
492 if (!monpriv) in monreader_thaw()
495 monpriv->path = iucv_path_alloc(MON_MSGLIM, IUCV_IPRMDATA, GFP_KERNEL); in monreader_thaw()
496 if (!monpriv->path) in monreader_thaw()
498 rc = iucv_path_connect(monpriv->path, &monreader_iucv_handler, in monreader_thaw()
499 MON_SERVICE, NULL, user_data_connect, monpriv); in monreader_thaw()
506 atomic_read(&monpriv->iucv_connected) || in monreader_thaw()
507 atomic_read(&monpriv->iucv_severed)); in monreader_thaw()
508 if (atomic_read(&monpriv->iucv_severed)) in monreader_thaw()
513 iucv_path_free(monpriv->path); in monreader_thaw()
514 monpriv->path = NULL; in monreader_thaw()
516 atomic_set(&monpriv->iucv_severed, 1); in monreader_thaw()