Lines Matching full:dlc
63 struct rfcomm_dlc *dlc; member
75 static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb);
76 static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err);
77 static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig);
84 struct rfcomm_dlc *dlc = dev->dlc; in rfcomm_dev_destruct() local
86 BT_DBG("dev %p dlc %p", dev, dlc); in rfcomm_dev_destruct()
88 rfcomm_dlc_lock(dlc); in rfcomm_dev_destruct()
89 /* Detach DLC if it's owned by this dev */ in rfcomm_dev_destruct()
90 if (dlc->owner == dev) in rfcomm_dev_destruct()
91 dlc->owner = NULL; in rfcomm_dev_destruct()
92 rfcomm_dlc_unlock(dlc); in rfcomm_dev_destruct()
94 rfcomm_dlc_put(dlc); in rfcomm_dev_destruct()
110 /* device-specific initialization: open the dlc */
116 err = rfcomm_dlc_open(dev->dlc, &dev->src, &dev->dst, dev->channel); in rfcomm_dev_activate()
122 /* we block the open until the dlc->state becomes BT_CONNECTED */
127 return (dev->dlc->state == BT_CONNECTED); in rfcomm_dev_carrier_raised()
130 /* device-specific cleanup: close the dlc */
138 /* close the dlc */ in rfcomm_dev_shutdown()
139 rfcomm_dlc_close(dev->dlc, 0); in rfcomm_dev_shutdown()
217 struct rfcomm_dlc *dlc) in __rfcomm_dev_add() argument
276 rfcomm_dlc_lock(dlc); in __rfcomm_dev_add()
279 struct sock *sk = dlc->owner; in __rfcomm_dev_add()
284 rfcomm_dlc_throttle(dlc); in __rfcomm_dev_add()
293 dlc->data_ready = rfcomm_dev_data_ready; in __rfcomm_dev_add()
294 dlc->state_change = rfcomm_dev_state_change; in __rfcomm_dev_add()
295 dlc->modem_status = rfcomm_dev_modem_status; in __rfcomm_dev_add()
297 dlc->owner = dev; in __rfcomm_dev_add()
298 dev->dlc = dlc; in __rfcomm_dev_add()
300 rfcomm_dev_modem_status(dlc, dlc->remote_v24_sig); in __rfcomm_dev_add()
302 rfcomm_dlc_unlock(dlc); in __rfcomm_dev_add()
317 static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) in rfcomm_dev_add() argument
324 dev = __rfcomm_dev_add(req, dlc); in rfcomm_dev_add()
326 rfcomm_dlc_put(dlc); in rfcomm_dev_add()
353 struct rfcomm_dlc *dlc = dev->dlc; in rfcomm_room() local
358 return max(0, pending) * dlc->mtu; in rfcomm_room()
393 struct rfcomm_dlc *dlc; in __rfcomm_create_dev() local
409 dlc = rfcomm_pi(sk)->dlc; in __rfcomm_create_dev()
410 rfcomm_dlc_hold(dlc); in __rfcomm_create_dev()
413 dlc = rfcomm_dlc_exists(&req.src, &req.dst, req.channel); in __rfcomm_create_dev()
414 if (IS_ERR(dlc)) in __rfcomm_create_dev()
415 return PTR_ERR(dlc); in __rfcomm_create_dev()
416 if (dlc) in __rfcomm_create_dev()
418 dlc = rfcomm_dlc_alloc(GFP_KERNEL); in __rfcomm_create_dev()
419 if (!dlc) in __rfcomm_create_dev()
423 id = rfcomm_dev_add(&req, dlc); in __rfcomm_create_dev()
428 /* DLC is now used by device. in __rfcomm_create_dev()
463 rfcomm_dlc_close(dev->dlc, 0); in __rfcomm_release_dev()
532 (di + n)->state = dev->dlc->state; in rfcomm_get_dev_list()
569 di.state = dev->dlc->state; in rfcomm_get_dev_info()
601 /* ---- DLC callbacks ---- */
602 static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) in rfcomm_dev_data_ready() argument
604 struct rfcomm_dev *dev = dlc->owner; in rfcomm_dev_data_ready()
616 BT_DBG("dlc %p len %d", dlc, skb->len); in rfcomm_dev_data_ready()
624 static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) in rfcomm_dev_state_change() argument
626 struct rfcomm_dev *dev = dlc->owner; in rfcomm_dev_state_change()
630 BT_DBG("dlc %p dev %p err %d", dlc, dev, err); in rfcomm_dev_state_change()
633 if (dlc->state == BT_CONNECTED) { in rfcomm_dev_state_change()
637 } else if (dlc->state == BT_CLOSED) in rfcomm_dev_state_change()
641 static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig) in rfcomm_dev_modem_status() argument
643 struct rfcomm_dev *dev = dlc->owner; in rfcomm_dev_modem_status()
647 BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig); in rfcomm_dev_modem_status()
667 rfcomm_dlc_lock(dev->dlc); in rfcomm_tty_copy_pending()
675 rfcomm_dlc_unlock(dev->dlc); in rfcomm_tty_copy_pending()
690 rfcomm_dlc_lock(dev->dlc); in rfcomm_tty_cleanup()
692 rfcomm_dlc_unlock(dev->dlc); in rfcomm_tty_cleanup()
695 * purge the dlc->tx_queue to avoid circular dependencies in rfcomm_tty_cleanup()
696 * between dev and dlc in rfcomm_tty_cleanup()
698 skb_queue_purge(&dev->dlc->tx_queue); in rfcomm_tty_cleanup()
710 struct rfcomm_dlc *dlc; in rfcomm_tty_install() local
717 dlc = dev->dlc; in rfcomm_tty_install()
719 /* Attach TTY and open DLC */ in rfcomm_tty_install()
720 rfcomm_dlc_lock(dlc); in rfcomm_tty_install()
722 rfcomm_dlc_unlock(dlc); in rfcomm_tty_install()
766 rfcomm_dlc_unthrottle(dev->dlc); in rfcomm_tty_open()
775 BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc, in rfcomm_tty_close()
784 struct rfcomm_dlc *dlc = dev->dlc; in rfcomm_tty_write() local
791 size = min_t(uint, count, dlc->mtu); in rfcomm_tty_write()
801 rfcomm_dlc_send_noerror(dlc, skb); in rfcomm_tty_write()
815 if (dev && dev->dlc) in rfcomm_tty_write_room()
869 if (!dev || !dev->dlc || !dev->dlc->session) in rfcomm_tty_set_termios()
990 rfcomm_send_rpn(dev->dlc->session, 1, dev->dlc->dlci, baud, in rfcomm_tty_set_termios()
1001 rfcomm_dlc_throttle(dev->dlc); in rfcomm_tty_throttle()
1010 rfcomm_dlc_unthrottle(dev->dlc); in rfcomm_tty_unthrottle()
1019 if (!dev || !dev->dlc) in rfcomm_tty_chars_in_buffer()
1022 if (!skb_queue_empty(&dev->dlc->tx_queue)) in rfcomm_tty_chars_in_buffer()
1023 return dev->dlc->mtu; in rfcomm_tty_chars_in_buffer()
1034 if (!dev || !dev->dlc) in rfcomm_tty_flush_buffer()
1037 skb_queue_purge(&dev->dlc->tx_queue); in rfcomm_tty_flush_buffer()
1072 struct rfcomm_dlc *dlc = dev->dlc; in rfcomm_tty_tiocmset() local
1077 rfcomm_dlc_get_modem_status(dlc, &v24_sig); in rfcomm_tty_tiocmset()
1097 rfcomm_dlc_set_modem_status(dlc, v24_sig); in rfcomm_tty_tiocmset()