Lines Matching refs:ap
45 irnet_ctrl_write(irnet_socket * ap, in irnet_ctrl_write() argument
54 DENTER(CTRL_TRACE, "(ap=0x%p, count=%Zd)\n", ap, count); in irnet_ctrl_write()
112 memcpy(ap->rname, start + 5, length - 5); in irnet_ctrl_write()
113 ap->rname[length - 5] = '\0'; in irnet_ctrl_write()
116 ap->rname[0] = '\0'; in irnet_ctrl_write()
117 DEBUG(CTRL_INFO, "Got rname = ``%s''\n", ap->rname); in irnet_ctrl_write()
150 ap->rsaddr = addr; in irnet_ctrl_write()
151 DEBUG(CTRL_INFO, "Got rsaddr = %08x\n", ap->rsaddr); in irnet_ctrl_write()
156 ap->rdaddr = addr; in irnet_ctrl_write()
157 DEBUG(CTRL_INFO, "Got rdaddr = %08x\n", ap->rdaddr); in irnet_ctrl_write()
185 irnet_get_discovery_log(irnet_socket * ap) in irnet_get_discovery_log() argument
190 ap->discoveries = irlmp_get_discoveries(&ap->disco_number, mask, in irnet_get_discovery_log()
194 if(ap->discoveries == NULL) in irnet_get_discovery_log()
195 ap->disco_number = -1; in irnet_get_discovery_log()
198 ap->discoveries, ap->disco_number); in irnet_get_discovery_log()
217 irnet_read_discovery_log(irnet_socket *ap, char *event, int buf_size) in irnet_read_discovery_log() argument
222 ap, event); in irnet_read_discovery_log()
225 if(ap->disco_number == -1) in irnet_read_discovery_log()
232 if(ap->discoveries == NULL) in irnet_read_discovery_log()
233 irnet_get_discovery_log(ap); in irnet_read_discovery_log()
236 if(ap->disco_index < ap->disco_number) in irnet_read_discovery_log()
241 ap->discoveries[ap->disco_index].daddr, in irnet_read_discovery_log()
242 ap->discoveries[ap->disco_index].info, in irnet_read_discovery_log()
243 ap->discoveries[ap->disco_index].saddr, in irnet_read_discovery_log()
244 ap->discoveries[ap->disco_index].hints[0], in irnet_read_discovery_log()
245 ap->discoveries[ap->disco_index].hints[1]); in irnet_read_discovery_log()
247 ap->disco_index, ap->discoveries[ap->disco_index].info); in irnet_read_discovery_log()
252 ap->disco_index++; in irnet_read_discovery_log()
256 if(ap->disco_index >= ap->disco_number) in irnet_read_discovery_log()
260 ap->discoveries); in irnet_read_discovery_log()
261 if(ap->discoveries != NULL) in irnet_read_discovery_log()
264 kfree(ap->discoveries); in irnet_read_discovery_log()
265 ap->discoveries = NULL; in irnet_read_discovery_log()
267 ap->disco_number = -1; in irnet_read_discovery_log()
279 irnet_ctrl_read(irnet_socket * ap, in irnet_ctrl_read() argument
288 DENTER(CTRL_TRACE, "(ap=0x%p, count=%Zd)\n", ap, count); in irnet_ctrl_read()
292 if (irnet_read_discovery_log(ap, event, sizeof(event))) in irnet_ctrl_read()
313 if(ap->event_index != irnet_events.index) in irnet_ctrl_read()
336 switch(irnet_events.log[ap->event_index].event) in irnet_ctrl_read()
341 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
342 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
343 irnet_events.log[ap->event_index].saddr, in irnet_ctrl_read()
344 irnet_events.log[ap->event_index].hints.byte[0], in irnet_ctrl_read()
345 irnet_events.log[ap->event_index].hints.byte[1]); in irnet_ctrl_read()
350 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
351 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
352 irnet_events.log[ap->event_index].saddr, in irnet_ctrl_read()
353 irnet_events.log[ap->event_index].hints.byte[0], in irnet_ctrl_read()
354 irnet_events.log[ap->event_index].hints.byte[1]); in irnet_ctrl_read()
358 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
359 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
360 irnet_events.log[ap->event_index].unit); in irnet_ctrl_read()
364 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
365 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
366 irnet_events.log[ap->event_index].unit); in irnet_ctrl_read()
370 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
371 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
372 irnet_events.log[ap->event_index].saddr); in irnet_ctrl_read()
376 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
377 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
378 irnet_events.log[ap->event_index].unit); in irnet_ctrl_read()
382 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
383 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
384 irnet_events.log[ap->event_index].unit); in irnet_ctrl_read()
388 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
389 irnet_events.log[ap->event_index].name, in irnet_ctrl_read()
390 irnet_events.log[ap->event_index].unit); in irnet_ctrl_read()
394 irnet_events.log[ap->event_index].daddr, in irnet_ctrl_read()
395 irnet_events.log[ap->event_index].name); in irnet_ctrl_read()
401 ap->event_index = (ap->event_index + 1) % IRNET_MAX_EVENTS; in irnet_ctrl_read()
422 irnet_ctrl_poll(irnet_socket * ap, in irnet_ctrl_poll() argument
428 DENTER(CTRL_TRACE, "(ap=0x%p)\n", ap); in irnet_ctrl_poll()
433 if(ap->event_index != irnet_events.index) in irnet_ctrl_poll()
436 if(ap->disco_number != -1) in irnet_ctrl_poll()
439 if(ap->discoveries == NULL) in irnet_ctrl_poll()
440 irnet_get_discovery_log(ap); in irnet_ctrl_poll()
442 if(ap->disco_number != -1) in irnet_ctrl_poll()
469 struct irnet_socket * ap; in dev_irnet_open() local
481 ap = kzalloc(sizeof(*ap), GFP_KERNEL); in dev_irnet_open()
482 DABORT(ap == NULL, -ENOMEM, FS_ERROR, "Can't allocate struct irnet...\n"); in dev_irnet_open()
485 ap->file = file; in dev_irnet_open()
488 ap->ppp_open = 0; in dev_irnet_open()
489 ap->chan.private = ap; in dev_irnet_open()
490 ap->chan.ops = &irnet_ppp_ops; in dev_irnet_open()
491 ap->chan.mtu = (2048 - TTP_MAX_HEADER - 2 - PPP_HDRLEN); in dev_irnet_open()
492 ap->chan.hdrlen = 2 + TTP_MAX_HEADER; /* for A/C + Max IrDA hdr */ in dev_irnet_open()
494 ap->mru = (2048 - TTP_MAX_HEADER - 2 - PPP_HDRLEN); in dev_irnet_open()
495 ap->xaccm[0] = ~0U; in dev_irnet_open()
496 ap->xaccm[3] = 0x60000000U; in dev_irnet_open()
497 ap->raccm = ~0U; in dev_irnet_open()
500 err = irda_irnet_create(ap); in dev_irnet_open()
504 kfree(ap); in dev_irnet_open()
510 ap->event_index = irnet_events.index; /* Cancel all past events */ in dev_irnet_open()
512 mutex_init(&ap->lock); in dev_irnet_open()
515 file->private_data = ap; in dev_irnet_open()
517 DEXIT(FS_TRACE, " - ap=0x%p\n", ap); in dev_irnet_open()
532 irnet_socket * ap = file->private_data; in dev_irnet_close() local
535 file, ap); in dev_irnet_close()
536 DABORT(ap == NULL, 0, FS_ERROR, "ap is NULL !!!\n"); in dev_irnet_close()
542 irda_irnet_destroy(ap); in dev_irnet_close()
545 if(ap->ppp_open) in dev_irnet_close()
548 ap->ppp_open = 0; in dev_irnet_close()
549 ppp_unregister_channel(&ap->chan); in dev_irnet_close()
552 kfree(ap); in dev_irnet_close()
569 irnet_socket * ap = file->private_data; in dev_irnet_write() local
572 file, ap, count); in dev_irnet_write()
573 DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); in dev_irnet_write()
576 if(ap->ppp_open) in dev_irnet_write()
579 return irnet_ctrl_write(ap, buf, count); in dev_irnet_write()
593 irnet_socket * ap = file->private_data; in dev_irnet_read() local
596 file, ap, count); in dev_irnet_read()
597 DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); in dev_irnet_read()
600 if(ap->ppp_open) in dev_irnet_read()
603 return irnet_ctrl_read(ap, file, buf, count); in dev_irnet_read()
614 irnet_socket * ap = file->private_data; in dev_irnet_poll() local
618 file, ap); in dev_irnet_poll()
621 DABORT(ap == NULL, mask, FS_ERROR, "ap is NULL !!!\n"); in dev_irnet_poll()
624 if(!ap->ppp_open) in dev_irnet_poll()
625 mask |= irnet_ctrl_poll(ap, file, wait); in dev_irnet_poll()
643 irnet_socket * ap = file->private_data; in dev_irnet_ioctl() local
649 file, ap, cmd); in dev_irnet_ioctl()
652 DASSERT(ap != NULL, -ENXIO, PPP_ERROR, "ap is NULL...\n"); in dev_irnet_ioctl()
669 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
672 err = ppp_register_channel(&ap->chan); in dev_irnet_ioctl()
676 ap->ppp_open = 1; in dev_irnet_ioctl()
680 irda_irnet_connect(ap); in dev_irnet_ioctl()
685 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
692 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
695 if(ap->ppp_open) in dev_irnet_ioctl()
697 ap->ppp_open = 0; in dev_irnet_ioctl()
698 ppp_unregister_channel(&ap->chan); in dev_irnet_ioctl()
704 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
710 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
713 if(ap->ppp_open && !put_user(ppp_channel_index(&ap->chan), in dev_irnet_ioctl()
717 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
720 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
723 if(ap->ppp_open && !put_user(ppp_unit_number(&ap->chan), in dev_irnet_ioctl()
727 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
747 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
750 err = ppp_irnet_ioctl(&ap->chan, cmd, arg); in dev_irnet_ioctl()
752 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
760 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
764 if(!kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) in dev_irnet_ioctl()
767 if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios)) in dev_irnet_ioctl()
771 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
776 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
780 if(!user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) in dev_irnet_ioctl()
783 if(!user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp)) in dev_irnet_ioctl()
787 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
810 if (mutex_lock_interruptible(&ap->lock)) in dev_irnet_ioctl()
812 ppp_output_wakeup(&ap->chan); in dev_irnet_ioctl()
813 mutex_unlock(&ap->lock); in dev_irnet_ioctl()
849 irnet_prepare_skb(irnet_socket * ap, in irnet_prepare_skb() argument
858 ap, skb); in irnet_prepare_skb()
870 if((data[0] == 0) && (ap->flags & SC_COMP_PROT) && (!islcp)) in irnet_prepare_skb()
874 needaddr = 2*((ap->flags & SC_COMP_AC) == 0 || islcp); in irnet_prepare_skb()
877 if((skb_headroom(skb) < (ap->max_header_size + needaddr)) || in irnet_prepare_skb()
885 new_skb = skb_realloc_headroom(skb, ap->max_header_size + needaddr); in irnet_prepare_skb()
1024 irnet_socket * ap = (struct irnet_socket *) chan->private; in ppp_irnet_ioctl() local
1031 chan, ap, cmd); in ppp_irnet_ioctl()
1034 DASSERT(ap != NULL, -ENXIO, PPP_ERROR, "ap is NULL...\n"); in ppp_irnet_ioctl()
1041 val = ap->flags | ap->rbits; in ppp_irnet_ioctl()
1049 ap->flags = val & ~SC_RCV_BITS; in ppp_irnet_ioctl()
1050 ap->rbits = val & SC_RCV_BITS; in ppp_irnet_ioctl()
1056 if(put_user(ap->xaccm[0], (u32 __user *) argp)) in ppp_irnet_ioctl()
1061 if(get_user(ap->xaccm[0], (u32 __user *) argp)) in ppp_irnet_ioctl()
1066 if(put_user(ap->raccm, (u32 __user *) argp)) in ppp_irnet_ioctl()
1071 if(get_user(ap->raccm, (u32 __user *) argp)) in ppp_irnet_ioctl()
1076 if(copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm))) in ppp_irnet_ioctl()
1085 memcpy(ap->xaccm, accm, sizeof(ap->xaccm)); in ppp_irnet_ioctl()
1091 if(put_user(ap->mru, (int __user *) argp)) in ppp_irnet_ioctl()
1100 ap->mru = val; in ppp_irnet_ioctl()