• Home
  • Raw
  • Download

Lines Matching refs:rp

101     mon_text_read_wait(struct mon_reader_text *rp, struct file *file);
102 static void mon_text_read_head_t(struct mon_reader_text *rp,
104 static void mon_text_read_head_u(struct mon_reader_text *rp,
106 static void mon_text_read_statset(struct mon_reader_text *rp,
108 static void mon_text_read_intstat(struct mon_reader_text *rp,
110 static void mon_text_read_isostat(struct mon_reader_text *rp,
112 static void mon_text_read_isodesc(struct mon_reader_text *rp,
114 static void mon_text_read_data(struct mon_reader_text *rp,
188 static void mon_text_event(struct mon_reader_text *rp, struct urb *urb, in mon_text_event() argument
199 if (rp->nevents >= EVENT_MAX || in mon_text_event()
200 (ep = kmem_cache_alloc(rp->e_slab, GFP_ATOMIC)) == NULL) { in mon_text_event()
201 rp->r.m_bus->cnt_text_lost++; in mon_text_event()
245 ep->setup_flag = mon_text_get_setup(ep, urb, ev_type, rp->r.m_bus); in mon_text_event()
247 rp->r.m_bus); in mon_text_event()
249 rp->nevents++; in mon_text_event()
250 list_add_tail(&ep->e_link, &rp->e_list); in mon_text_event()
251 wake_up(&rp->wait); in mon_text_event()
256 struct mon_reader_text *rp = data; in mon_text_submit() local
257 mon_text_event(rp, urb, 'S', -EINPROGRESS); in mon_text_submit()
262 struct mon_reader_text *rp = data; in mon_text_complete() local
263 mon_text_event(rp, urb, 'C', status); in mon_text_complete()
268 struct mon_reader_text *rp = data; in mon_text_error() local
271 if (rp->nevents >= EVENT_MAX || in mon_text_error()
272 (ep = kmem_cache_alloc(rp->e_slab, GFP_ATOMIC)) == NULL) { in mon_text_error()
273 rp->r.m_bus->cnt_text_lost++; in mon_text_error()
291 rp->nevents++; in mon_text_error()
292 list_add_tail(&ep->e_link, &rp->e_list); in mon_text_error()
293 wake_up(&rp->wait); in mon_text_error()
299 static struct mon_event_text *mon_text_fetch(struct mon_reader_text *rp, in mon_text_fetch() argument
306 if (list_empty(&rp->e_list)) { in mon_text_fetch()
310 p = rp->e_list.next; in mon_text_fetch()
312 --rp->nevents; in mon_text_fetch()
322 struct mon_reader_text *rp; in mon_text_open() local
328 rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL); in mon_text_open()
329 if (rp == NULL) { in mon_text_open()
333 INIT_LIST_HEAD(&rp->e_list); in mon_text_open()
334 init_waitqueue_head(&rp->wait); in mon_text_open()
335 mutex_init(&rp->printf_lock); in mon_text_open()
337 rp->printf_size = PRINTF_DFL; in mon_text_open()
338 rp->printf_buf = kmalloc(rp->printf_size, GFP_KERNEL); in mon_text_open()
339 if (rp->printf_buf == NULL) { in mon_text_open()
344 rp->r.m_bus = mbus; in mon_text_open()
345 rp->r.r_data = rp; in mon_text_open()
346 rp->r.rnf_submit = mon_text_submit; in mon_text_open()
347 rp->r.rnf_error = mon_text_error; in mon_text_open()
348 rp->r.rnf_complete = mon_text_complete; in mon_text_open()
350 snprintf(rp->slab_name, SLAB_NAME_SZ, "mon_text_%p", rp); in mon_text_open()
351 rp->e_slab = kmem_cache_create(rp->slab_name, in mon_text_open()
354 if (rp->e_slab == NULL) { in mon_text_open()
359 mon_reader_add(mbus, &rp->r); in mon_text_open()
361 file->private_data = rp; in mon_text_open()
368 kfree(rp->printf_buf); in mon_text_open()
370 kfree(rp); in mon_text_open()
385 struct mon_reader_text *rp = file->private_data; in mon_text_read_t() local
389 if (IS_ERR(ep = mon_text_read_wait(rp, file))) in mon_text_read_t()
391 mutex_lock(&rp->printf_lock); in mon_text_read_t()
393 ptr.pbuf = rp->printf_buf; in mon_text_read_t()
394 ptr.limit = rp->printf_size; in mon_text_read_t()
396 mon_text_read_head_t(rp, &ptr, ep); in mon_text_read_t()
397 mon_text_read_statset(rp, &ptr, ep); in mon_text_read_t()
400 mon_text_read_data(rp, &ptr, ep); in mon_text_read_t()
402 if (copy_to_user(buf, rp->printf_buf, ptr.cnt)) in mon_text_read_t()
404 mutex_unlock(&rp->printf_lock); in mon_text_read_t()
405 kmem_cache_free(rp->e_slab, ep); in mon_text_read_t()
412 struct mon_reader_text *rp = file->private_data; in mon_text_read_u() local
416 if (IS_ERR(ep = mon_text_read_wait(rp, file))) in mon_text_read_u()
418 mutex_lock(&rp->printf_lock); in mon_text_read_u()
420 ptr.pbuf = rp->printf_buf; in mon_text_read_u()
421 ptr.limit = rp->printf_size; in mon_text_read_u()
423 mon_text_read_head_u(rp, &ptr, ep); in mon_text_read_u()
425 mon_text_read_statset(rp, &ptr, ep); in mon_text_read_u()
427 mon_text_read_isostat(rp, &ptr, ep); in mon_text_read_u()
428 mon_text_read_isodesc(rp, &ptr, ep); in mon_text_read_u()
430 mon_text_read_intstat(rp, &ptr, ep); in mon_text_read_u()
432 mon_text_read_statset(rp, &ptr, ep); in mon_text_read_u()
436 mon_text_read_data(rp, &ptr, ep); in mon_text_read_u()
438 if (copy_to_user(buf, rp->printf_buf, ptr.cnt)) in mon_text_read_u()
440 mutex_unlock(&rp->printf_lock); in mon_text_read_u()
441 kmem_cache_free(rp->e_slab, ep); in mon_text_read_u()
445 static struct mon_event_text *mon_text_read_wait(struct mon_reader_text *rp, in mon_text_read_wait() argument
448 struct mon_bus *mbus = rp->r.m_bus; in mon_text_read_wait()
452 add_wait_queue(&rp->wait, &waita); in mon_text_read_wait()
454 while ((ep = mon_text_fetch(rp, mbus)) == NULL) { in mon_text_read_wait()
457 remove_wait_queue(&rp->wait, &waita); in mon_text_read_wait()
466 remove_wait_queue(&rp->wait, &waita); in mon_text_read_wait()
472 remove_wait_queue(&rp->wait, &waita); in mon_text_read_wait()
476 static void mon_text_read_head_t(struct mon_reader_text *rp, in mon_text_read_head_t() argument
494 static void mon_text_read_head_u(struct mon_reader_text *rp, in mon_text_read_head_u() argument
512 static void mon_text_read_statset(struct mon_reader_text *rp, in mon_text_read_statset() argument
533 static void mon_text_read_intstat(struct mon_reader_text *rp, in mon_text_read_intstat() argument
540 static void mon_text_read_isostat(struct mon_reader_text *rp, in mon_text_read_isostat() argument
553 static void mon_text_read_isodesc(struct mon_reader_text *rp, in mon_text_read_isodesc() argument
575 static void mon_text_read_data(struct mon_reader_text *rp, in mon_text_read_data() argument
609 struct mon_reader_text *rp = file->private_data; in mon_text_release() local
623 mon_reader_del(mbus, &rp->r); in mon_text_release()
633 while (!list_empty(&rp->e_list)) { in mon_text_release()
634 p = rp->e_list.next; in mon_text_release()
637 --rp->nevents; in mon_text_release()
638 kmem_cache_free(rp->e_slab, ep); in mon_text_release()
642 kmem_cache_destroy(rp->e_slab); in mon_text_release()
643 kfree(rp->printf_buf); in mon_text_release()
644 kfree(rp); in mon_text_release()