X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=net%2Fbluetooth%2Frfcomm%2Ftty.c;h=6d689200bcf3e9c68113b964b610668d6c631f68;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=ed8abeff351c9801afeefcf5cd74119b65121e3c;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index ed8abeff3..6d689200b 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -77,7 +77,7 @@ struct rfcomm_dev { }; static LIST_HEAD(rfcomm_dev_list); -static rwlock_t rfcomm_dev_lock = RW_LOCK_UNLOCKED; +static DEFINE_RWLOCK(rfcomm_dev_lock); static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb); static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err); @@ -645,32 +645,26 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp) rfcomm_dev_put(dev); } -static int rfcomm_tty_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count) +static int rfcomm_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) { struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; struct rfcomm_dlc *dlc = dev->dlc; struct sk_buff *skb; int err = 0, sent = 0, size; - BT_DBG("tty %p from_user %d count %d", tty, from_user, count); + BT_DBG("tty %p count %d", tty, count); while (count) { size = min_t(uint, count, dlc->mtu); - if (from_user) - skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_KERNEL); - else - skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC); + skb = rfcomm_wmalloc(dev, size + RFCOMM_SKB_RESERVE, GFP_ATOMIC); if (!skb) break; skb_reserve(skb, RFCOMM_SKB_HEAD_RESERVE); - if (from_user) - copy_from_user(skb_put(skb, size), buf + sent, size); - else - memcpy(skb_put(skb, size), buf + sent, size); + memcpy(skb_put(skb, size), buf + sent, size); if ((err = rfcomm_dlc_send(dlc, skb)) < 0) { kfree_skb(skb);