Lines Matching defs:kingsun
3 * Filename: kingsun-sir.c
132 struct kingsun_cb *kingsun = urb->context;
133 struct net_device *netdev = kingsun->netdev;
136 if (!netif_running(kingsun->netdev)) {
155 struct kingsun_cb *kingsun;
164 kingsun = netdev_priv(netdev);
166 spin_lock(&kingsun->lock);
170 kingsun->out_buf,
174 usb_fill_int_urb(kingsun->tx_urb, kingsun->usbdev,
175 usb_sndintpipe(kingsun->usbdev, kingsun->ep_out),
176 kingsun->out_buf, wraplen, kingsun_send_irq,
177 kingsun, 1);
179 if ((ret = usb_submit_urb(kingsun->tx_urb, GFP_ATOMIC))) {
195 spin_unlock(&kingsun->lock);
203 struct kingsun_cb *kingsun = urb->context;
207 if (!netif_running(kingsun->netdev)) {
208 kingsun->receiving = 0;
216 kingsun->receiving = 0;
220 if (urb->actual_length == kingsun->max_rx) {
226 1..kingsun->max_rx -1 . Values outside this range indicate
229 if (bytes[0] >= 1 && bytes[0] < kingsun->max_rx) {
231 async_unwrap_char(kingsun->netdev,
232 &kingsun->netdev->stats,
233 &kingsun->rx_buff, bytes[i]);
235 do_gettimeofday(&kingsun->rx_time);
236 kingsun->receiving =
237 (kingsun->rx_buff.state != OUTSIDE_FRAME)
242 __func__, kingsun->max_rx, urb->actual_length);
255 struct kingsun_cb *kingsun = netdev_priv(netdev);
260 kingsun->receiving = 0;
263 kingsun->rx_buff.in_frame = FALSE;
264 kingsun->rx_buff.state = OUTSIDE_FRAME;
265 kingsun->rx_buff.truesize = IRDA_SKB_MAX_MTU;
266 kingsun->rx_buff.skb = dev_alloc_skb(IRDA_SKB_MAX_MTU);
267 if (!kingsun->rx_buff.skb)
270 skb_reserve(kingsun->rx_buff.skb, 1);
271 kingsun->rx_buff.head = kingsun->rx_buff.skb->data;
272 do_gettimeofday(&kingsun->rx_time);
274 kingsun->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
275 if (!kingsun->rx_urb)
278 kingsun->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
279 if (!kingsun->tx_urb)
286 sprintf(hwname, "usb#%d", kingsun->usbdev->devnum);
287 kingsun->irlap = irlap_open(netdev, &kingsun->qos, hwname);
288 if (!kingsun->irlap) {
289 err("kingsun-sir: irlap_open failed");
294 usb_fill_int_urb(kingsun->rx_urb, kingsun->usbdev,
295 usb_rcvintpipe(kingsun->usbdev, kingsun->ep_in),
296 kingsun->in_buf, kingsun->max_rx,
297 kingsun_rcv_irq, kingsun, 1);
298 kingsun->rx_urb->status = 0;
299 err = usb_submit_urb(kingsun->rx_urb, GFP_KERNEL);
301 err("kingsun-sir: first urb-submit failed: %d", err);
319 irlap_close(kingsun->irlap);
321 if (kingsun->tx_urb) {
322 usb_free_urb(kingsun->tx_urb);
323 kingsun->tx_urb = NULL;
325 if (kingsun->rx_urb) {
326 usb_free_urb(kingsun->rx_urb);
327 kingsun->rx_urb = NULL;
329 if (kingsun->rx_buff.skb) {
330 kfree_skb(kingsun->rx_buff.skb);
331 kingsun->rx_buff.skb = NULL;
332 kingsun->rx_buff.head = NULL;
338 * Function kingsun_net_close (kingsun)
345 struct kingsun_cb *kingsun = netdev_priv(netdev);
351 usb_kill_urb(kingsun->tx_urb);
352 usb_kill_urb(kingsun->rx_urb);
354 usb_free_urb(kingsun->tx_urb);
355 usb_free_urb(kingsun->rx_urb);
357 kingsun->tx_urb = NULL;
358 kingsun->rx_urb = NULL;
360 kfree_skb(kingsun->rx_buff.skb);
361 kingsun->rx_buff.skb = NULL;
362 kingsun->rx_buff.head = NULL;
363 kingsun->rx_buff.in_frame = FALSE;
364 kingsun->rx_buff.state = OUTSIDE_FRAME;
365 kingsun->receiving = 0;
368 if (kingsun->irlap)
369 irlap_close(kingsun->irlap);
371 kingsun->irlap = NULL;
383 struct kingsun_cb *kingsun = netdev_priv(netdev);
392 if (netif_device_present(kingsun->netdev))
402 if (netif_running(kingsun->netdev))
403 irda_device_set_media_busy(kingsun->netdev, TRUE);
408 irq->ifr_receiving = kingsun->receiving;
437 struct kingsun_cb *kingsun = NULL;
449 err("kingsun-sir: expected 2 endpoints, found %d",
455 err("kingsun-sir: endpoint 0 is not interrupt IN");
470 err("kingsun-sir: endpoint 1 is not interrupt OUT");
479 net = alloc_irdadev(sizeof(*kingsun));
484 kingsun = netdev_priv(net);
485 kingsun->irlap = NULL;
486 kingsun->tx_urb = NULL;
487 kingsun->rx_urb = NULL;
488 kingsun->ep_in = ep_in;
489 kingsun->ep_out = ep_out;
490 kingsun->in_buf = NULL;
491 kingsun->out_buf = NULL;
492 kingsun->max_rx = (__u8)maxp_in;
493 kingsun->max_tx = (__u8)maxp_out;
494 kingsun->netdev = net;
495 kingsun->usbdev = dev;
496 kingsun->rx_buff.in_frame = FALSE;
497 kingsun->rx_buff.state = OUTSIDE_FRAME;
498 kingsun->rx_buff.skb = NULL;
499 kingsun->receiving = 0;
500 spin_lock_init(&kingsun->lock);
503 kingsun->in_buf = kmalloc(kingsun->max_rx, GFP_KERNEL);
504 if (!kingsun->in_buf)
508 kingsun->out_buf = kmalloc(KINGSUN_FIFO_SIZE, GFP_KERNEL);
509 if (!kingsun->out_buf)
518 irda_init_max_qos_capabilies(&kingsun->qos);
521 kingsun->qos.baud_rate.bits &= IR_9600;
522 kingsun->qos.min_turn_time.bits &= KINGSUN_MTT;
523 irda_qos_bits_to_value(&kingsun->qos);
535 usb_set_intfdata(intf, kingsun);
547 if (kingsun->out_buf) kfree(kingsun->out_buf);
548 if (kingsun->in_buf) kfree(kingsun->in_buf);
559 struct kingsun_cb *kingsun = usb_get_intfdata(intf);
561 if (!kingsun)
564 unregister_netdev(kingsun->netdev);
567 if (kingsun->tx_urb != NULL) {
568 usb_kill_urb(kingsun->tx_urb);
569 usb_free_urb(kingsun->tx_urb);
570 kingsun->tx_urb = NULL;
572 if (kingsun->rx_urb != NULL) {
573 usb_kill_urb(kingsun->rx_urb);
574 usb_free_urb(kingsun->rx_urb);
575 kingsun->rx_urb = NULL;
578 kfree(kingsun->out_buf);
579 kfree(kingsun->in_buf);
580 free_netdev(kingsun->netdev);
589 struct kingsun_cb *kingsun = usb_get_intfdata(intf);
591 netif_device_detach(kingsun->netdev);
592 if (kingsun->tx_urb != NULL) usb_kill_urb(kingsun->tx_urb);
593 if (kingsun->rx_urb != NULL) usb_kill_urb(kingsun->rx_urb);
600 struct kingsun_cb *kingsun = usb_get_intfdata(intf);
602 if (kingsun->rx_urb != NULL)
603 usb_submit_urb(kingsun->rx_urb, GFP_KERNEL);
604 netif_device_attach(kingsun->netdev);
614 .name = "kingsun-sir",