BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, skb->pkt_type, skb->len); 
BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len); 
static int bfusb_send_frame(struct sk_buff *skb){	struct hci_dev *hdev = (struct hci_dev *) skb->dev;	struct bfusb *bfusb;	struct sk_buff *nskb;	unsigned char buf[3];	int sent = 0, size, count;	BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, skb->pkt_type, skb->len);	if (!hdev) {		BT_ERR("Frame for unknown HCI device (hdev=NULL)");		return -ENODEV;	}	if (!test_bit(HCI_RUNNING, &hdev->flags))		return -EBUSY;	bfusb = (struct bfusb *) hdev->driver_data;	switch (skb->pkt_type) {	case HCI_COMMAND_PKT:		hdev->stat.cmd_tx++;		break;	case HCI_ACLDATA_PKT:		hdev->stat.acl_tx++;		break;	case HCI_SCODATA_PKT:		hdev->stat.sco_tx++;		break;	};	/* Prepend skb with frame type */	memcpy(skb_push(skb, 1), &(skb->pkt_type), 1);	count = skb->len;	/* Max HCI frame size seems to be 1511 + 1 */	if (!(nskb = bt_skb_alloc(count + 32, GFP_ATOMIC))) {		BT_ERR("Can't allocate memory for new packet");		return -ENOMEM;	}	nskb->dev = (void *) bfusb;	while (count) {		size = min_t(uint, count, BFUSB_MAX_BLOCK_SIZE);		buf[0] = 0xc1 | ((sent == 0) ? 0x04 : 0) | ((count == size) ? 0x08 : 0);		buf[1] = 0x00;		buf[2] = (size == BFUSB_MAX_BLOCK_SIZE) ? 0 : size;		memcpy(skb_put(nskb, 3), buf, 3);		memcpy(skb_put(nskb, size), skb->data + sent, size);		sent  += size;		count -= size;	}	/* Don't send frame with multiple size of bulk max packet */	if ((nskb->len % bfusb->bulk_pkt_size) == 0) {		buf[0] = 0xdd;		buf[1] = 0x00;		memcpy(skb_put(nskb, 2), buf, 2);	}	read_lock(&bfusb->lock);	skb_queue_tail(&bfusb->transmit_q, nskb);	bfusb_tx_wakeup(bfusb);	read_unlock(&bfusb->lock);	kfree_skb(skb);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0d48d93947dd9ea21c5cdc76a8581b06a4a39281/bfusb.c/clean/drivers/bluetooth/bfusb.c