Commit 05c14f17 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/net-2.6

into ppc970.osdl.org:/home/torvalds/v2.5/linux
parents ff4dc41e db78e720
...@@ -70,7 +70,7 @@ MODULE_DEVICE_TABLE(usb, bfusb_table); ...@@ -70,7 +70,7 @@ MODULE_DEVICE_TABLE(usb, bfusb_table);
#define BFUSB_MAX_BULK_RX 2 #define BFUSB_MAX_BULK_RX 2
struct bfusb { struct bfusb {
struct hci_dev hdev; struct hci_dev *hdev;
unsigned long state; unsigned long state;
...@@ -155,7 +155,7 @@ static int bfusb_send_bulk(struct bfusb *bfusb, struct sk_buff *skb) ...@@ -155,7 +155,7 @@ static int bfusb_send_bulk(struct bfusb *bfusb, struct sk_buff *skb)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s bulk tx submit failed urb %p err %d", BT_ERR("%s bulk tx submit failed urb %p err %d",
bfusb->hdev.name, urb, err); bfusb->hdev->name, urb, err);
skb_unlink(skb); skb_unlink(skb);
usb_free_urb(urb); usb_free_urb(urb);
} else } else
...@@ -200,13 +200,13 @@ static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -200,13 +200,13 @@ static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs)
atomic_dec(&bfusb->pending_tx); atomic_dec(&bfusb->pending_tx);
if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags)) if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
return; return;
if (!urb->status) if (!urb->status)
bfusb->hdev.stat.byte_tx += skb->len; bfusb->hdev->stat.byte_tx += skb->len;
else else
bfusb->hdev.stat.err_tx++; bfusb->hdev->stat.err_tx++;
read_lock(&bfusb->lock); read_lock(&bfusb->lock);
...@@ -250,7 +250,7 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb) ...@@ -250,7 +250,7 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s bulk rx submit failed urb %p err %d", BT_ERR("%s bulk rx submit failed urb %p err %d",
bfusb->hdev.name, urb, err); bfusb->hdev->name, urb, err);
skb_unlink(skb); skb_unlink(skb);
kfree_skb(skb); kfree_skb(skb);
usb_free_urb(urb); usb_free_urb(urb);
...@@ -264,7 +264,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -264,7 +264,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
BT_DBG("bfusb %p hdr 0x%02x data %p len %d", bfusb, hdr, data, len); BT_DBG("bfusb %p hdr 0x%02x data %p len %d", bfusb, hdr, data, len);
if (hdr & 0x10) { if (hdr & 0x10) {
BT_ERR("%s error in block", bfusb->hdev.name); BT_ERR("%s error in block", bfusb->hdev->name);
if (bfusb->reassembly) if (bfusb->reassembly)
kfree_skb(bfusb->reassembly); kfree_skb(bfusb->reassembly);
bfusb->reassembly = NULL; bfusb->reassembly = NULL;
...@@ -277,13 +277,13 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -277,13 +277,13 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
int pkt_len = 0; int pkt_len = 0;
if (bfusb->reassembly) { if (bfusb->reassembly) {
BT_ERR("%s unexpected start block", bfusb->hdev.name); BT_ERR("%s unexpected start block", bfusb->hdev->name);
kfree_skb(bfusb->reassembly); kfree_skb(bfusb->reassembly);
bfusb->reassembly = NULL; bfusb->reassembly = NULL;
} }
if (len < 1) { if (len < 1) {
BT_ERR("%s no packet type found", bfusb->hdev.name); BT_ERR("%s no packet type found", bfusb->hdev->name);
return -EPROTO; return -EPROTO;
} }
...@@ -295,7 +295,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -295,7 +295,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
struct hci_event_hdr *hdr = (struct hci_event_hdr *) data; struct hci_event_hdr *hdr = (struct hci_event_hdr *) data;
pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen; pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
} else { } else {
BT_ERR("%s event block is too short", bfusb->hdev.name); BT_ERR("%s event block is too short", bfusb->hdev->name);
return -EILSEQ; return -EILSEQ;
} }
break; break;
...@@ -305,7 +305,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -305,7 +305,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) data; struct hci_acl_hdr *hdr = (struct hci_acl_hdr *) data;
pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen); pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
} else { } else {
BT_ERR("%s data block is too short", bfusb->hdev.name); BT_ERR("%s data block is too short", bfusb->hdev->name);
return -EILSEQ; return -EILSEQ;
} }
break; break;
...@@ -315,7 +315,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -315,7 +315,7 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) data; struct hci_sco_hdr *hdr = (struct hci_sco_hdr *) data;
pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen; pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
} else { } else {
BT_ERR("%s audio block is too short", bfusb->hdev.name); BT_ERR("%s audio block is too short", bfusb->hdev->name);
return -EILSEQ; return -EILSEQ;
} }
break; break;
...@@ -323,17 +323,17 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char * ...@@ -323,17 +323,17 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
skb = bt_skb_alloc(pkt_len, GFP_ATOMIC); skb = bt_skb_alloc(pkt_len, GFP_ATOMIC);
if (!skb) { if (!skb) {
BT_ERR("%s no memory for the packet", bfusb->hdev.name); BT_ERR("%s no memory for the packet", bfusb->hdev->name);
return -ENOMEM; return -ENOMEM;
} }
skb->dev = (void *) &bfusb->hdev; skb->dev = (void *) bfusb->hdev;
skb->pkt_type = pkt_type; skb->pkt_type = pkt_type;
bfusb->reassembly = skb; bfusb->reassembly = skb;
} else { } else {
if (!bfusb->reassembly) { if (!bfusb->reassembly) {
BT_ERR("%s unexpected continuation block", bfusb->hdev.name); BT_ERR("%s unexpected continuation block", bfusb->hdev->name);
return -EIO; return -EIO;
} }
} }
...@@ -359,7 +359,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -359,7 +359,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len); BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len);
if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags)) if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
return; return;
read_lock(&bfusb->lock); read_lock(&bfusb->lock);
...@@ -367,7 +367,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -367,7 +367,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
if (urb->status || !count) if (urb->status || !count)
goto resubmit; goto resubmit;
bfusb->hdev.stat.byte_rx += count; bfusb->hdev->stat.byte_rx += count;
skb_put(skb, count); skb_put(skb, count);
...@@ -386,7 +386,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -386,7 +386,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
if (count < len) { if (count < len) {
BT_ERR("%s block extends over URB buffer ranges", BT_ERR("%s block extends over URB buffer ranges",
bfusb->hdev.name); bfusb->hdev->name);
} }
if ((hdr & 0xe1) == 0xc1) if ((hdr & 0xe1) == 0xc1)
...@@ -411,7 +411,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -411,7 +411,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s bulk resubmit failed urb %p err %d", BT_ERR("%s bulk resubmit failed urb %p err %d",
bfusb->hdev.name, urb, err); bfusb->hdev->name, urb, err);
} }
read_unlock(&bfusb->lock); read_unlock(&bfusb->lock);
...@@ -698,7 +698,13 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -698,7 +698,13 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
release_firmware(firmware); release_firmware(firmware);
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = &bfusb->hdev; hdev = hci_alloc_dev();
if (!hdev) {
BT_ERR("Can't allocate HCI device");
goto error;
}
bfusb->hdev = hdev;
hdev->type = HCI_USB; hdev->type = HCI_USB;
hdev->driver_data = bfusb; hdev->driver_data = bfusb;
...@@ -715,6 +721,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -715,6 +721,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device"); BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
goto error; goto error;
} }
...@@ -735,7 +742,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -735,7 +742,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
static void bfusb_disconnect(struct usb_interface *intf) static void bfusb_disconnect(struct usb_interface *intf)
{ {
struct bfusb *bfusb = usb_get_intfdata(intf); struct bfusb *bfusb = usb_get_intfdata(intf);
struct hci_dev *hdev = &bfusb->hdev; struct hci_dev *hdev = bfusb->hdev;
BT_DBG("intf %p", intf); BT_DBG("intf %p", intf);
...@@ -748,6 +755,8 @@ static void bfusb_disconnect(struct usb_interface *intf) ...@@ -748,6 +755,8 @@ static void bfusb_disconnect(struct usb_interface *intf)
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
BT_ERR("Can't unregister HCI device %s", hdev->name); BT_ERR("Can't unregister HCI device %s", hdev->name);
hci_free_dev(hdev);
} }
static struct usb_driver bfusb_driver = { static struct usb_driver bfusb_driver = {
......
...@@ -72,7 +72,7 @@ typedef struct bluecard_info_t { ...@@ -72,7 +72,7 @@ typedef struct bluecard_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
struct hci_dev hdev; struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
struct timer_list timer; /* For LED control */ struct timer_list timer; /* For LED control */
...@@ -333,7 +333,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info) ...@@ -333,7 +333,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
skb_queue_head(&(info->txq), skb); skb_queue_head(&(info->txq), skb);
} }
info->hdev.stat.byte_tx += len; info->hdev->stat.byte_tx += len;
/* Change buffer */ /* Change buffer */
change_bit(XMIT_BUFFER_NUMBER, &(info->tx_state)); change_bit(XMIT_BUFFER_NUMBER, &(info->tx_state));
...@@ -404,7 +404,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) ...@@ -404,7 +404,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
info->rx_skb->dev = (void *)&(info->hdev); info->rx_skb->dev = (void *) info->hdev;
info->rx_skb->pkt_type = buf[i]; info->rx_skb->pkt_type = buf[i];
switch (info->rx_skb->pkt_type) { switch (info->rx_skb->pkt_type) {
...@@ -440,7 +440,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) ...@@ -440,7 +440,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
default: default:
/* unknown packet */ /* unknown packet */
printk(KERN_WARNING "bluecard_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type); printk(KERN_WARNING "bluecard_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
info->hdev.stat.err_rx++; info->hdev->stat.err_rx++;
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
info->rx_skb = NULL; info->rx_skb = NULL;
...@@ -495,7 +495,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset) ...@@ -495,7 +495,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
} }
info->hdev.stat.byte_rx += len; info->hdev->stat.byte_rx += len;
} }
...@@ -778,8 +778,13 @@ int bluecard_open(bluecard_info_t *info) ...@@ -778,8 +778,13 @@ int bluecard_open(bluecard_info_t *info)
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = hci_alloc_dev();
if (!hdev) {
printk(KERN_WARNING "bluecard_cs: Can't allocate HCI device.\n");
return -ENOMEM;
}
hdev = &(info->hdev); info->hdev = hdev;
hdev->type = HCI_PCCARD; hdev->type = HCI_PCCARD;
hdev->driver_data = info; hdev->driver_data = info;
...@@ -794,7 +799,8 @@ int bluecard_open(bluecard_info_t *info) ...@@ -794,7 +799,8 @@ int bluecard_open(bluecard_info_t *info)
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
printk(KERN_WARNING "bluecard_cs: Can't register HCI device %s.\n", hdev->name); printk(KERN_WARNING "bluecard_cs: Can't register HCI device.\n");
hci_free_dev(hdev);
return -ENODEV; return -ENODEV;
} }
...@@ -805,7 +811,7 @@ int bluecard_open(bluecard_info_t *info) ...@@ -805,7 +811,7 @@ int bluecard_open(bluecard_info_t *info)
int bluecard_close(bluecard_info_t *info) int bluecard_close(bluecard_info_t *info)
{ {
unsigned int iobase = info->link.io.BasePort1; unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev); struct hci_dev *hdev = info->hdev;
bluecard_hci_close(hdev); bluecard_hci_close(hdev);
...@@ -821,6 +827,8 @@ int bluecard_close(bluecard_info_t *info) ...@@ -821,6 +827,8 @@ int bluecard_close(bluecard_info_t *info)
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "bluecard_cs: Can't unregister HCI device %s.\n", hdev->name); printk(KERN_WARNING "bluecard_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0; return 0;
} }
...@@ -988,7 +996,7 @@ void bluecard_config(dev_link_t *link) ...@@ -988,7 +996,7 @@ void bluecard_config(dev_link_t *link)
if (bluecard_open(info) != 0) if (bluecard_open(info) != 0)
goto failed; goto failed;
strcpy(info->node.dev_name, info->hdev.name); strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node; link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
......
...@@ -79,7 +79,7 @@ typedef struct bt3c_info_t { ...@@ -79,7 +79,7 @@ typedef struct bt3c_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
struct hci_dev hdev; struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
...@@ -227,7 +227,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info, int from) ...@@ -227,7 +227,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info, int from)
kfree_skb(skb); kfree_skb(skb);
info->hdev.stat.byte_tx += len; info->hdev->stat.byte_tx += len;
} while (0); } while (0);
...@@ -253,7 +253,7 @@ static void bt3c_receive(bt3c_info_t *info) ...@@ -253,7 +253,7 @@ static void bt3c_receive(bt3c_info_t *info)
bt3c_address(iobase, 0x7480); bt3c_address(iobase, 0x7480);
while (size < avail) { while (size < avail) {
size++; size++;
info->hdev.stat.byte_rx++; info->hdev->stat.byte_rx++;
/* Allocate packet */ /* Allocate packet */
if (info->rx_skb == NULL) { if (info->rx_skb == NULL) {
...@@ -268,7 +268,7 @@ static void bt3c_receive(bt3c_info_t *info) ...@@ -268,7 +268,7 @@ static void bt3c_receive(bt3c_info_t *info)
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
info->rx_skb->dev = (void *)&(info->hdev); info->rx_skb->dev = (void *) info->hdev;
info->rx_skb->pkt_type = inb(iobase + DATA_L); info->rx_skb->pkt_type = inb(iobase + DATA_L);
inb(iobase + DATA_H); inb(iobase + DATA_H);
//printk("bt3c: PACKET_TYPE=%02x\n", info->rx_skb->pkt_type); //printk("bt3c: PACKET_TYPE=%02x\n", info->rx_skb->pkt_type);
...@@ -293,8 +293,8 @@ static void bt3c_receive(bt3c_info_t *info) ...@@ -293,8 +293,8 @@ static void bt3c_receive(bt3c_info_t *info)
default: default:
/* Unknown packet */ /* Unknown packet */
printk(KERN_WARNING "bt3c_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type); printk(KERN_WARNING "bt3c_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
info->hdev.stat.err_rx++; info->hdev->stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev.flags)); clear_bit(HCI_RUNNING, &(info->hdev->flags));
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
info->rx_skb = NULL; info->rx_skb = NULL;
...@@ -534,8 +534,13 @@ int bt3c_open(bt3c_info_t *info) ...@@ -534,8 +534,13 @@ int bt3c_open(bt3c_info_t *info)
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = hci_alloc_dev();
if (!hdev) {
printk(KERN_WARNING "bt3c_cs: Can't allocate HCI device.\n");
return -ENOMEM;
}
hdev = &(info->hdev); info->hdev = hdev;
hdev->type = HCI_PCCARD; hdev->type = HCI_PCCARD;
hdev->driver_data = info; hdev->driver_data = info;
...@@ -550,7 +555,8 @@ int bt3c_open(bt3c_info_t *info) ...@@ -550,7 +555,8 @@ int bt3c_open(bt3c_info_t *info)
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
printk(KERN_WARNING "bt3c_cs: Can't register HCI device %s.\n", hdev->name); printk(KERN_WARNING "bt3c_cs: Can't register HCI device.\n");
hci_free_dev(hdev);
return -ENODEV; return -ENODEV;
} }
...@@ -560,13 +566,15 @@ int bt3c_open(bt3c_info_t *info) ...@@ -560,13 +566,15 @@ int bt3c_open(bt3c_info_t *info)
int bt3c_close(bt3c_info_t *info) int bt3c_close(bt3c_info_t *info)
{ {
struct hci_dev *hdev = &(info->hdev); struct hci_dev *hdev = info->hdev;
bt3c_hci_close(hdev); bt3c_hci_close(hdev);
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "bt3c_cs: Can't unregister HCI device %s.\n", hdev->name); printk(KERN_WARNING "bt3c_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0; return 0;
} }
...@@ -781,7 +789,7 @@ void bt3c_config(dev_link_t *link) ...@@ -781,7 +789,7 @@ void bt3c_config(dev_link_t *link)
if (bt3c_open(info) != 0) if (bt3c_open(info) != 0)
goto failed; goto failed;
strcpy(info->node.dev_name, info->hdev.name); strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node; link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
......
...@@ -77,7 +77,7 @@ typedef struct btuart_info_t { ...@@ -77,7 +77,7 @@ typedef struct btuart_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
struct hci_dev hdev; struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
...@@ -181,7 +181,7 @@ static void btuart_write_wakeup(btuart_info_t *info) ...@@ -181,7 +181,7 @@ static void btuart_write_wakeup(btuart_info_t *info)
skb_queue_head(&(info->txq), skb); skb_queue_head(&(info->txq), skb);
} }
info->hdev.stat.byte_tx += len; info->hdev->stat.byte_tx += len;
} while (test_bit(XMIT_WAKEUP, &(info->tx_state))); } while (test_bit(XMIT_WAKEUP, &(info->tx_state)));
...@@ -202,7 +202,7 @@ static void btuart_receive(btuart_info_t *info) ...@@ -202,7 +202,7 @@ static void btuart_receive(btuart_info_t *info)
iobase = info->link.io.BasePort1; iobase = info->link.io.BasePort1;
do { do {
info->hdev.stat.byte_rx++; info->hdev->stat.byte_rx++;
/* Allocate packet */ /* Allocate packet */
if (info->rx_skb == NULL) { if (info->rx_skb == NULL) {
...@@ -216,7 +216,7 @@ static void btuart_receive(btuart_info_t *info) ...@@ -216,7 +216,7 @@ static void btuart_receive(btuart_info_t *info)
if (info->rx_state == RECV_WAIT_PACKET_TYPE) { if (info->rx_state == RECV_WAIT_PACKET_TYPE) {
info->rx_skb->dev = (void *)&(info->hdev); info->rx_skb->dev = (void *) info->hdev;
info->rx_skb->pkt_type = inb(iobase + UART_RX); info->rx_skb->pkt_type = inb(iobase + UART_RX);
switch (info->rx_skb->pkt_type) { switch (info->rx_skb->pkt_type) {
...@@ -239,8 +239,8 @@ static void btuart_receive(btuart_info_t *info) ...@@ -239,8 +239,8 @@ static void btuart_receive(btuart_info_t *info)
default: default:
/* Unknown packet */ /* Unknown packet */
printk(KERN_WARNING "btuart_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type); printk(KERN_WARNING "btuart_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
info->hdev.stat.err_rx++; info->hdev->stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev.flags)); clear_bit(HCI_RUNNING, &(info->hdev->flags));
kfree_skb(info->rx_skb); kfree_skb(info->rx_skb);
info->rx_skb = NULL; info->rx_skb = NULL;
...@@ -529,8 +529,13 @@ int btuart_open(btuart_info_t *info) ...@@ -529,8 +529,13 @@ int btuart_open(btuart_info_t *info)
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = hci_alloc_dev();
if (!hdev) {
printk(KERN_WARNING "btuart_cs: Can't allocate HCI device.\n");
return -ENOMEM;
}
hdev = &(info->hdev); info->hdev = hdev;
hdev->type = HCI_PCCARD; hdev->type = HCI_PCCARD;
hdev->driver_data = info; hdev->driver_data = info;
...@@ -545,7 +550,8 @@ int btuart_open(btuart_info_t *info) ...@@ -545,7 +550,8 @@ int btuart_open(btuart_info_t *info)
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
printk(KERN_WARNING "btuart_cs: Can't register HCI device %s.\n", hdev->name); printk(KERN_WARNING "btuart_cs: Can't register HCI device.\n");
hci_free_dev(hdev);
return -ENODEV; return -ENODEV;
} }
...@@ -557,7 +563,7 @@ int btuart_close(btuart_info_t *info) ...@@ -557,7 +563,7 @@ int btuart_close(btuart_info_t *info)
{ {
unsigned long flags; unsigned long flags;
unsigned int iobase = info->link.io.BasePort1; unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev); struct hci_dev *hdev = info->hdev;
btuart_hci_close(hdev); btuart_hci_close(hdev);
...@@ -574,6 +580,8 @@ int btuart_close(btuart_info_t *info) ...@@ -574,6 +580,8 @@ int btuart_close(btuart_info_t *info)
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "btuart_cs: Can't unregister HCI device %s.\n", hdev->name); printk(KERN_WARNING "btuart_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0; return 0;
} }
...@@ -789,7 +797,7 @@ void btuart_config(dev_link_t *link) ...@@ -789,7 +797,7 @@ void btuart_config(dev_link_t *link)
if (btuart_open(info) != 0) if (btuart_open(info) != 0)
goto failed; goto failed;
strcpy(info->node.dev_name, info->hdev.name); strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node; link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
......
...@@ -77,7 +77,7 @@ typedef struct dtl1_info_t { ...@@ -77,7 +77,7 @@ typedef struct dtl1_info_t {
dev_link_t link; dev_link_t link;
dev_node_t node; dev_node_t node;
struct hci_dev hdev; struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
...@@ -188,7 +188,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info) ...@@ -188,7 +188,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
skb_queue_head(&(info->txq), skb); skb_queue_head(&(info->txq), skb);
} }
info->hdev.stat.byte_tx += len; info->hdev->stat.byte_tx += len;
} while (test_bit(XMIT_WAKEUP, &(info->tx_state))); } while (test_bit(XMIT_WAKEUP, &(info->tx_state)));
...@@ -233,7 +233,7 @@ static void dtl1_receive(dtl1_info_t *info) ...@@ -233,7 +233,7 @@ static void dtl1_receive(dtl1_info_t *info)
iobase = info->link.io.BasePort1; iobase = info->link.io.BasePort1;
do { do {
info->hdev.stat.byte_rx++; info->hdev->stat.byte_rx++;
/* Allocate packet */ /* Allocate packet */
if (info->rx_skb == NULL) if (info->rx_skb == NULL)
...@@ -277,7 +277,7 @@ static void dtl1_receive(dtl1_info_t *info) ...@@ -277,7 +277,7 @@ static void dtl1_receive(dtl1_info_t *info)
case 0x83: case 0x83:
case 0x84: case 0x84:
/* send frame to the HCI layer */ /* send frame to the HCI layer */
info->rx_skb->dev = (void *)&(info->hdev); info->rx_skb->dev = (void *) info->hdev;
info->rx_skb->pkt_type &= 0x0f; info->rx_skb->pkt_type &= 0x0f;
hci_recv_frame(info->rx_skb); hci_recv_frame(info->rx_skb);
break; break;
...@@ -508,8 +508,13 @@ int dtl1_open(dtl1_info_t *info) ...@@ -508,8 +508,13 @@ int dtl1_open(dtl1_info_t *info)
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = hci_alloc_dev();
if (!hdev) {
printk(KERN_WARNING "dtl1_cs: Can't allocate HCI device.\n");
return -ENOMEM;
}
hdev = &(info->hdev); info->hdev = hdev;
hdev->type = HCI_PCCARD; hdev->type = HCI_PCCARD;
hdev->driver_data = info; hdev->driver_data = info;
...@@ -522,9 +527,10 @@ int dtl1_open(dtl1_info_t *info) ...@@ -522,9 +527,10 @@ int dtl1_open(dtl1_info_t *info)
hdev->ioctl = dtl1_hci_ioctl; hdev->ioctl = dtl1_hci_ioctl;
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
printk(KERN_WARNING "dtl1_cs: Can't register HCI device %s.\n", hdev->name); printk(KERN_WARNING "dtl1_cs: Can't register HCI device.\n");
hci_free_dev(hdev);
return -ENODEV; return -ENODEV;
} }
...@@ -536,7 +542,7 @@ int dtl1_close(dtl1_info_t *info) ...@@ -536,7 +542,7 @@ int dtl1_close(dtl1_info_t *info)
{ {
unsigned long flags; unsigned long flags;
unsigned int iobase = info->link.io.BasePort1; unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev); struct hci_dev *hdev = info->hdev;
dtl1_hci_close(hdev); dtl1_hci_close(hdev);
...@@ -553,6 +559,8 @@ int dtl1_close(dtl1_info_t *info) ...@@ -553,6 +559,8 @@ int dtl1_close(dtl1_info_t *info)
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "dtl1_cs: Can't unregister HCI device %s.\n", hdev->name); printk(KERN_WARNING "dtl1_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0; return 0;
} }
...@@ -741,7 +749,7 @@ void dtl1_config(dev_link_t *link) ...@@ -741,7 +749,7 @@ void dtl1_config(dev_link_t *link)
if (dtl1_open(info) != 0) if (dtl1_open(info) != 0)
goto failed; goto failed;
strcpy(info->node.dev_name, info->hdev.name); strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node; link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
......
...@@ -617,7 +617,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count) ...@@ -617,7 +617,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)
bcsp->rx_count = 0; bcsp->rx_count = 0;
return 0; return 0;
} }
bcsp->rx_skb->dev = (void *) &hu->hdev; bcsp->rx_skb->dev = (void *) hu->hdev;
break; break;
} }
break; break;
......
...@@ -229,7 +229,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) ...@@ -229,7 +229,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
default: default:
BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr); BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
hu->hdev.stat.err_rx++; hu->hdev->stat.err_rx++;
ptr++; count--; ptr++; count--;
continue; continue;
}; };
...@@ -243,7 +243,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count) ...@@ -243,7 +243,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
h4->rx_count = 0; h4->rx_count = 0;
return 0; return 0;
} }
h4->rx_skb->dev = (void *) &hu->hdev; h4->rx_skb->dev = (void *) hu->hdev;
h4->rx_skb->pkt_type = type; h4->rx_skb->pkt_type = type;
} }
return count; return count;
......
...@@ -96,7 +96,7 @@ static struct hci_uart_proto *hci_uart_get_proto(unsigned int id) ...@@ -96,7 +96,7 @@ static struct hci_uart_proto *hci_uart_get_proto(unsigned int id)
static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type) static inline void hci_uart_tx_complete(struct hci_uart *hu, int pkt_type)
{ {
struct hci_dev *hdev = &hu->hdev; struct hci_dev *hdev = hu->hdev;
/* Update HCI stat counters */ /* Update HCI stat counters */
switch (pkt_type) { switch (pkt_type) {
...@@ -127,7 +127,7 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) ...@@ -127,7 +127,7 @@ static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu)
int hci_uart_tx_wakeup(struct hci_uart *hu) int hci_uart_tx_wakeup(struct hci_uart *hu)
{ {
struct tty_struct *tty = hu->tty; struct tty_struct *tty = hu->tty;
struct hci_dev *hdev = &hu->hdev; struct hci_dev *hdev = hu->hdev;
struct sk_buff *skb; struct sk_buff *skb;
if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) { if (test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) {
...@@ -306,12 +306,13 @@ static void hci_uart_tty_close(struct tty_struct *tty) ...@@ -306,12 +306,13 @@ static void hci_uart_tty_close(struct tty_struct *tty)
tty->disc_data = NULL; tty->disc_data = NULL;
if (hu) { if (hu) {
struct hci_dev *hdev = &hu->hdev; struct hci_dev *hdev = hu->hdev;
hci_uart_close(hdev); hci_uart_close(hdev);
if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
hu->proto->close(hu); hu->proto->close(hu);
hci_unregister_dev(hdev); hci_unregister_dev(hdev);
hci_free_dev(hdev);
} }
} }
} }
...@@ -380,7 +381,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char ...@@ -380,7 +381,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const __u8 *data, char
spin_lock(&hu->rx_lock); spin_lock(&hu->rx_lock);
hu->proto->recv(hu, (void *) data, count); hu->proto->recv(hu, (void *) data, count);
hu->hdev.stat.byte_rx += count; hu->hdev->stat.byte_rx += count;
spin_unlock(&hu->rx_lock); spin_unlock(&hu->rx_lock);
if (test_and_clear_bit(TTY_THROTTLED,&tty->flags) && tty->driver->unthrottle) if (test_and_clear_bit(TTY_THROTTLED,&tty->flags) && tty->driver->unthrottle)
...@@ -394,7 +395,13 @@ static int hci_uart_register_dev(struct hci_uart *hu) ...@@ -394,7 +395,13 @@ static int hci_uart_register_dev(struct hci_uart *hu)
BT_DBG(""); BT_DBG("");
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = &hu->hdev; hdev = hci_alloc_dev();
if (!hdev) {
BT_ERR("Can't allocate HCI device");
return -ENOMEM;
}
hu->hdev = hdev;
hdev->type = HCI_UART; hdev->type = HCI_UART;
hdev->driver_data = hu; hdev->driver_data = hu;
...@@ -408,7 +415,8 @@ static int hci_uart_register_dev(struct hci_uart *hu) ...@@ -408,7 +415,8 @@ static int hci_uart_register_dev(struct hci_uart *hu)
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device %s", hdev->name); BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
return -ENODEV; return -ENODEV;
} }
......
...@@ -56,7 +56,7 @@ struct hci_uart_proto { ...@@ -56,7 +56,7 @@ struct hci_uart_proto {
struct hci_uart { struct hci_uart {
struct tty_struct *tty; struct tty_struct *tty;
struct hci_dev hdev; struct hci_dev *hdev;
unsigned long flags; unsigned long flags;
struct hci_uart_proto *proto; struct hci_uart_proto *proto;
......
...@@ -71,10 +71,10 @@ static struct usb_driver hci_usb_driver; ...@@ -71,10 +71,10 @@ static struct usb_driver hci_usb_driver;
static struct usb_device_id bluetooth_ids[] = { static struct usb_device_id bluetooth_ids[] = {
/* Broadcom BCM2033 without firmware */ /* Broadcom BCM2033 without firmware */
{ USB_DEVICE(0x0a5c, 0x2033), driver_info: HCI_IGNORE }, { USB_DEVICE(0x0a5c, 0x2033), .driver_info = HCI_IGNORE },
/* Digianswer device */ /* Digianswer device */
{ USB_DEVICE(0x08fd, 0x0001), driver_info: HCI_DIGIANSWER }, { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
/* Generic Bluetooth USB device */ /* Generic Bluetooth USB device */
{ USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) }, { USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) },
...@@ -108,8 +108,8 @@ struct _urb *_urb_alloc(int isoc, int gfp) ...@@ -108,8 +108,8 @@ struct _urb *_urb_alloc(int isoc, int gfp)
struct _urb *_urb_dequeue(struct _urb_queue *q) struct _urb *_urb_dequeue(struct _urb_queue *q)
{ {
struct _urb *_urb = NULL; struct _urb *_urb = NULL;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
{ {
struct list_head *head = &q->head; struct list_head *head = &q->head;
struct list_head *next = head->next; struct list_head *next = head->next;
...@@ -165,9 +165,9 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb) ...@@ -165,9 +165,9 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb)
int err, pipe, interval, size; int err, pipe, interval, size;
void *buf; void *buf;
BT_DBG("%s", husb->hdev.name); BT_DBG("%s", husb->hdev->name);
size = husb->intr_in_ep->desc.wMaxPacketSize; size = husb->intr_in_ep->desc.wMaxPacketSize;
buf = kmalloc(size, GFP_ATOMIC); buf = kmalloc(size, GFP_ATOMIC);
if (!buf) if (!buf)
...@@ -189,7 +189,7 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb) ...@@ -189,7 +189,7 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s intr rx submit failed urb %p err %d", BT_ERR("%s intr rx submit failed urb %p err %d",
husb->hdev.name, urb, err); husb->hdev->name, urb, err);
_urb_unlink(_urb); _urb_unlink(_urb);
_urb_free(_urb); _urb_free(_urb);
kfree(buf); kfree(buf);
...@@ -218,15 +218,15 @@ static int hci_usb_bulk_rx_submit(struct hci_usb *husb) ...@@ -218,15 +218,15 @@ static int hci_usb_bulk_rx_submit(struct hci_usb *husb)
urb = &_urb->urb; urb = &_urb->urb;
pipe = usb_rcvbulkpipe(husb->udev, husb->bulk_in_ep->desc.bEndpointAddress); pipe = usb_rcvbulkpipe(husb->udev, husb->bulk_in_ep->desc.bEndpointAddress);
usb_fill_bulk_urb(urb, husb->udev, pipe, buf, size, hci_usb_rx_complete, husb); usb_fill_bulk_urb(urb, husb->udev, pipe, buf, size, hci_usb_rx_complete, husb);
urb->transfer_flags = 0; urb->transfer_flags = 0;
BT_DBG("%s urb %p", husb->hdev.name, urb); BT_DBG("%s urb %p", husb->hdev->name, urb);
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s bulk rx submit failed urb %p err %d", BT_ERR("%s bulk rx submit failed urb %p err %d",
husb->hdev.name, urb, err); husb->hdev->name, urb, err);
_urb_unlink(_urb); _urb_unlink(_urb);
_urb_free(_urb); _urb_free(_urb);
kfree(buf); kfree(buf);
...@@ -243,7 +243,7 @@ static int hci_usb_isoc_rx_submit(struct hci_usb *husb) ...@@ -243,7 +243,7 @@ static int hci_usb_isoc_rx_submit(struct hci_usb *husb)
void *buf; void *buf;
mtu = husb->isoc_in_ep->desc.wMaxPacketSize; mtu = husb->isoc_in_ep->desc.wMaxPacketSize;
size = mtu * HCI_MAX_ISOC_FRAMES; size = mtu * HCI_MAX_ISOC_FRAMES;
buf = kmalloc(size, GFP_ATOMIC); buf = kmalloc(size, GFP_ATOMIC);
if (!buf) if (!buf)
...@@ -264,18 +264,20 @@ static int hci_usb_isoc_rx_submit(struct hci_usb *husb) ...@@ -264,18 +264,20 @@ static int hci_usb_isoc_rx_submit(struct hci_usb *husb)
urb->pipe = usb_rcvisocpipe(husb->udev, husb->isoc_in_ep->desc.bEndpointAddress); urb->pipe = usb_rcvisocpipe(husb->udev, husb->isoc_in_ep->desc.bEndpointAddress);
urb->complete = hci_usb_rx_complete; urb->complete = hci_usb_rx_complete;
urb->interval = husb->isoc_in_ep->desc.bInterval;
urb->transfer_buffer_length = size; urb->transfer_buffer_length = size;
urb->transfer_buffer = buf; urb->transfer_buffer = buf;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
__fill_isoc_desc(urb, size, mtu); __fill_isoc_desc(urb, size, mtu);
BT_DBG("%s urb %p", husb->hdev.name, urb); BT_DBG("%s urb %p", husb->hdev->name, urb);
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s isoc rx submit failed urb %p err %d", BT_ERR("%s isoc rx submit failed urb %p err %d",
husb->hdev.name, urb, err); husb->hdev->name, urb, err);
_urb_unlink(_urb); _urb_unlink(_urb);
_urb_free(_urb); _urb_free(_urb);
kfree(buf); kfree(buf);
...@@ -333,7 +335,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb) ...@@ -333,7 +335,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
{ {
int i; int i;
BT_DBG("%s", husb->hdev.name); BT_DBG("%s", husb->hdev->name);
for (i=0; i < 4; i++) { for (i=0; i < 4; i++) {
struct _urb *_urb; struct _urb *_urb;
...@@ -343,7 +345,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb) ...@@ -343,7 +345,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
while ((_urb = _urb_dequeue(&husb->pending_q[i]))) { while ((_urb = _urb_dequeue(&husb->pending_q[i]))) {
urb = &_urb->urb; urb = &_urb->urb;
BT_DBG("%s unlinking _urb %p type %d urb %p", BT_DBG("%s unlinking _urb %p type %d urb %p",
husb->hdev.name, _urb, _urb->type, urb); husb->hdev->name, _urb, _urb->type, urb);
usb_unlink_urb(urb); usb_unlink_urb(urb);
_urb_queue_tail(__completed_q(husb, _urb->type), _urb); _urb_queue_tail(__completed_q(husb, _urb->type), _urb);
} }
...@@ -352,7 +354,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb) ...@@ -352,7 +354,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
while ((_urb = _urb_dequeue(&husb->completed_q[i]))) { while ((_urb = _urb_dequeue(&husb->completed_q[i]))) {
urb = &_urb->urb; urb = &_urb->urb;
BT_DBG("%s freeing _urb %p type %d urb %p", BT_DBG("%s freeing _urb %p type %d urb %p",
husb->hdev.name, _urb, _urb->type, urb); husb->hdev->name, _urb, _urb->type, urb);
if (urb->setup_packet) if (urb->setup_packet)
kfree(urb->setup_packet); kfree(urb->setup_packet);
if (urb->transfer_buffer) if (urb->transfer_buffer)
...@@ -393,13 +395,13 @@ static int __tx_submit(struct hci_usb *husb, struct _urb *_urb) ...@@ -393,13 +395,13 @@ static int __tx_submit(struct hci_usb *husb, struct _urb *_urb)
struct urb *urb = &_urb->urb; struct urb *urb = &_urb->urb;
int err; int err;
BT_DBG("%s urb %p type %d", husb->hdev.name, urb, _urb->type); BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type);
_urb_queue_tail(__pending_q(husb, _urb->type), _urb); _urb_queue_tail(__pending_q(husb, _urb->type), _urb);
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) { if (err) {
BT_ERR("%s tx submit failed urb %p type %d err %d", BT_ERR("%s tx submit failed urb %p type %d err %d",
husb->hdev.name, urb, _urb->type, err); husb->hdev->name, urb, _urb->type, err);
_urb_unlink(_urb); _urb_unlink(_urb);
_urb_queue_tail(__completed_q(husb, _urb->type), _urb); _urb_queue_tail(__completed_q(husb, _urb->type), _urb);
} else } else
...@@ -415,8 +417,8 @@ static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb) ...@@ -415,8 +417,8 @@ static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb)
struct urb *urb; struct urb *urb;
if (!_urb) { if (!_urb) {
_urb = _urb_alloc(0, GFP_ATOMIC); _urb = _urb_alloc(0, GFP_ATOMIC);
if (!_urb) if (!_urb)
return -ENOMEM; return -ENOMEM;
_urb->type = skb->pkt_type; _urb->type = skb->pkt_type;
...@@ -438,7 +440,7 @@ static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb) ...@@ -438,7 +440,7 @@ static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb)
usb_fill_control_urb(urb, husb->udev, usb_sndctrlpipe(husb->udev, 0), usb_fill_control_urb(urb, husb->udev, usb_sndctrlpipe(husb->udev, 0),
(void *) dr, skb->data, skb->len, hci_usb_tx_complete, husb); (void *) dr, skb->data, skb->len, hci_usb_tx_complete, husb);
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len); BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
_urb->priv = skb; _urb->priv = skb;
return __tx_submit(husb, _urb); return __tx_submit(husb, _urb);
...@@ -451,8 +453,8 @@ static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb) ...@@ -451,8 +453,8 @@ static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb)
int pipe; int pipe;
if (!_urb) { if (!_urb) {
_urb = _urb_alloc(0, GFP_ATOMIC); _urb = _urb_alloc(0, GFP_ATOMIC);
if (!_urb) if (!_urb)
return -ENOMEM; return -ENOMEM;
_urb->type = skb->pkt_type; _urb->type = skb->pkt_type;
} }
...@@ -463,7 +465,7 @@ static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb) ...@@ -463,7 +465,7 @@ static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb)
hci_usb_tx_complete, husb); hci_usb_tx_complete, husb);
urb->transfer_flags = URB_ZERO_PACKET; urb->transfer_flags = URB_ZERO_PACKET;
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len); BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
_urb->priv = skb; _urb->priv = skb;
return __tx_submit(husb, _urb); return __tx_submit(husb, _urb);
...@@ -474,27 +476,29 @@ static inline int hci_usb_send_isoc(struct hci_usb *husb, struct sk_buff *skb) ...@@ -474,27 +476,29 @@ static inline int hci_usb_send_isoc(struct hci_usb *husb, struct sk_buff *skb)
{ {
struct _urb *_urb = __get_completed(husb, skb->pkt_type); struct _urb *_urb = __get_completed(husb, skb->pkt_type);
struct urb *urb; struct urb *urb;
if (!_urb) { if (!_urb) {
_urb = _urb_alloc(HCI_MAX_ISOC_FRAMES, GFP_ATOMIC); _urb = _urb_alloc(HCI_MAX_ISOC_FRAMES, GFP_ATOMIC);
if (!_urb) if (!_urb)
return -ENOMEM; return -ENOMEM;
_urb->type = skb->pkt_type; _urb->type = skb->pkt_type;
} }
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len); BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
urb = &_urb->urb; urb = &_urb->urb;
urb->context = husb; urb->context = husb;
urb->dev = husb->udev; urb->dev = husb->udev;
urb->pipe = usb_sndisocpipe(husb->udev, husb->isoc_out_ep->desc.bEndpointAddress); urb->pipe = usb_sndisocpipe(husb->udev, husb->isoc_out_ep->desc.bEndpointAddress);
urb->complete = hci_usb_tx_complete; urb->complete = hci_usb_tx_complete;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
urb->interval = husb->isoc_out_ep->desc.bInterval;
urb->transfer_buffer = skb->data; urb->transfer_buffer = skb->data;
urb->transfer_buffer_length = skb->len; urb->transfer_buffer_length = skb->len;
__fill_isoc_desc(urb, skb->len, husb->isoc_out_ep->desc.wMaxPacketSize); __fill_isoc_desc(urb, skb->len, husb->isoc_out_ep->desc.wMaxPacketSize);
_urb->priv = skb; _urb->priv = skb;
...@@ -507,7 +511,7 @@ static void hci_usb_tx_process(struct hci_usb *husb) ...@@ -507,7 +511,7 @@ static void hci_usb_tx_process(struct hci_usb *husb)
struct sk_buff_head *q; struct sk_buff_head *q;
struct sk_buff *skb; struct sk_buff *skb;
BT_DBG("%s", husb->hdev.name); BT_DBG("%s", husb->hdev->name);
do { do {
clear_bit(HCI_USB_TX_WAKEUP, &husb->state); clear_bit(HCI_USB_TX_WAKEUP, &husb->state);
...@@ -601,9 +605,9 @@ static int hci_usb_send_frame(struct sk_buff *skb) ...@@ -601,9 +605,9 @@ static int hci_usb_send_frame(struct sk_buff *skb)
static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int count) static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int count)
{ {
BT_DBG("%s type %d data %p count %d", husb->hdev.name, type, data, count); BT_DBG("%s type %d data %p count %d", husb->hdev->name, type, data, count);
husb->hdev.stat.byte_rx += count; husb->hdev->stat.byte_rx += count;
while (count) { while (count) {
struct sk_buff *skb = __reassembly(husb, type); struct sk_buff *skb = __reassembly(husb, type);
...@@ -643,10 +647,10 @@ static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int c ...@@ -643,10 +647,10 @@ static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int c
skb = bt_skb_alloc(len, GFP_ATOMIC); skb = bt_skb_alloc(len, GFP_ATOMIC);
if (!skb) { if (!skb) {
BT_ERR("%s no memory for the packet", husb->hdev.name); BT_ERR("%s no memory for the packet", husb->hdev->name);
return -ENOMEM; return -ENOMEM;
} }
skb->dev = (void *) &husb->hdev; skb->dev = (void *) husb->hdev;
skb->pkt_type = type; skb->pkt_type = type;
__reassembly(husb, type) = skb; __reassembly(husb, type) = skb;
...@@ -679,7 +683,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -679,7 +683,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs)
{ {
struct _urb *_urb = container_of(urb, struct _urb, urb); struct _urb *_urb = container_of(urb, struct _urb, urb);
struct hci_usb *husb = (void *) urb->context; struct hci_usb *husb = (void *) urb->context;
struct hci_dev *hdev = &husb->hdev; struct hci_dev *hdev = husb->hdev;
int err, count = urb->actual_length; int err, count = urb->actual_length;
BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb, BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
...@@ -714,7 +718,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -714,7 +718,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs)
err = __recv_frame(husb, _urb->type, urb->transfer_buffer, count); err = __recv_frame(husb, _urb->type, urb->transfer_buffer, count);
if (err < 0) { if (err < 0) {
BT_ERR("%s corrupted packet: type %d count %d", BT_ERR("%s corrupted packet: type %d count %d",
husb->hdev.name, _urb->type, count); husb->hdev->name, _urb->type, count);
hdev->stat.err_rx++; hdev->stat.err_rx++;
} }
} }
...@@ -732,7 +736,7 @@ static void hci_usb_tx_complete(struct urb *urb, struct pt_regs *regs) ...@@ -732,7 +736,7 @@ static void hci_usb_tx_complete(struct urb *urb, struct pt_regs *regs)
{ {
struct _urb *_urb = container_of(urb, struct _urb, urb); struct _urb *_urb = container_of(urb, struct _urb, urb);
struct hci_usb *husb = (void *) urb->context; struct hci_usb *husb = (void *) urb->context;
struct hci_dev *hdev = &husb->hdev; struct hci_dev *hdev = husb->hdev;
BT_DBG("%s urb %p status %d flags %x", hdev->name, urb, BT_DBG("%s urb %p status %d flags %x", hdev->name, urb,
urb->status, urb->transfer_flags); urb->status, urb->transfer_flags);
...@@ -904,9 +908,15 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -904,9 +908,15 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
} }
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = &husb->hdev; hdev = hci_alloc_dev();
if (!hdev) {
BT_ERR("Can't allocate HCI device");
goto probe_error;
}
husb->hdev = hdev;
hdev->type = HCI_USB; hdev->type = HCI_USB;
hdev->driver_data = husb; hdev->driver_data = husb;
SET_HCIDEV_DEV(hdev, &intf->dev); SET_HCIDEV_DEV(hdev, &intf->dev);
...@@ -920,6 +930,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -920,6 +930,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device"); BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
goto probe_error; goto probe_error;
} }
...@@ -936,7 +947,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -936,7 +947,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
static void hci_usb_disconnect(struct usb_interface *intf) static void hci_usb_disconnect(struct usb_interface *intf)
{ {
struct hci_usb *husb = usb_get_intfdata(intf); struct hci_usb *husb = usb_get_intfdata(intf);
struct hci_dev *hdev = &husb->hdev; struct hci_dev *hdev = husb->hdev;
if (!husb) if (!husb)
return; return;
...@@ -951,6 +962,8 @@ static void hci_usb_disconnect(struct usb_interface *intf) ...@@ -951,6 +962,8 @@ static void hci_usb_disconnect(struct usb_interface *intf)
if (hci_unregister_dev(hdev) < 0) if (hci_unregister_dev(hdev) < 0)
BT_ERR("Can't unregister HCI device %s", hdev->name); BT_ERR("Can't unregister HCI device %s", hdev->name);
hci_free_dev(hdev);
} }
static struct usb_driver hci_usb_driver = { static struct usb_driver hci_usb_driver = {
......
...@@ -112,7 +112,7 @@ struct _urb *_urb_dequeue(struct _urb_queue *q); ...@@ -112,7 +112,7 @@ struct _urb *_urb_dequeue(struct _urb_queue *q);
#endif #endif
struct hci_usb { struct hci_usb {
struct hci_dev hdev; struct hci_dev *hdev;
unsigned long state; unsigned long state;
......
...@@ -142,7 +142,7 @@ static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const ...@@ -142,7 +142,7 @@ static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const
return -EFAULT; return -EFAULT;
} }
skb->dev = (void *) &hci_vhci->hdev; skb->dev = (void *) hci_vhci->hdev;
skb->pkt_type = *((__u8 *) skb->data); skb->pkt_type = *((__u8 *) skb->data);
skb_pull(skb, 1); skb_pull(skb, 1);
...@@ -175,18 +175,18 @@ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci, ...@@ -175,18 +175,18 @@ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci,
return -EFAULT; return -EFAULT;
total += len; total += len;
hci_vhci->hdev.stat.byte_tx += len; hci_vhci->hdev->stat.byte_tx += len;
switch (skb->pkt_type) { switch (skb->pkt_type) {
case HCI_COMMAND_PKT: case HCI_COMMAND_PKT:
hci_vhci->hdev.stat.cmd_tx++; hci_vhci->hdev->stat.cmd_tx++;
break; break;
case HCI_ACLDATA_PKT: case HCI_ACLDATA_PKT:
hci_vhci->hdev.stat.acl_tx++; hci_vhci->hdev->stat.acl_tx++;
break; break;
case HCI_SCODATA_PKT: case HCI_SCODATA_PKT:
hci_vhci->hdev.stat.cmd_tx++; hci_vhci->hdev->stat.cmd_tx++;
break; break;
}; };
...@@ -275,7 +275,13 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file) ...@@ -275,7 +275,13 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file)
init_waitqueue_head(&hci_vhci->read_wait); init_waitqueue_head(&hci_vhci->read_wait);
/* Initialize and register HCI device */ /* Initialize and register HCI device */
hdev = &hci_vhci->hdev; hdev = hci_alloc_dev();
if (!hdev) {
kfree(hci_vhci);
return -ENOMEM;
}
hci_vhci->hdev = hdev;
hdev->type = HCI_VHCI; hdev->type = HCI_VHCI;
hdev->driver_data = hci_vhci; hdev->driver_data = hci_vhci;
...@@ -290,6 +296,7 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file) ...@@ -290,6 +296,7 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file)
if (hci_register_dev(hdev) < 0) { if (hci_register_dev(hdev) < 0) {
kfree(hci_vhci); kfree(hci_vhci);
hci_free_dev(hdev);
return -EBUSY; return -EBUSY;
} }
...@@ -301,10 +308,12 @@ static int hci_vhci_chr_close(struct inode *inode, struct file *file) ...@@ -301,10 +308,12 @@ static int hci_vhci_chr_close(struct inode *inode, struct file *file)
{ {
struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data; struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data;
if (hci_unregister_dev(&hci_vhci->hdev) < 0) { if (hci_unregister_dev(hci_vhci->hdev) < 0) {
BT_ERR("Can't unregister HCI device %s", hci_vhci->hdev.name); BT_ERR("Can't unregister HCI device %s", hci_vhci->hdev->name);
} }
hci_free_dev(hci_vhci->hdev);
file->private_data = NULL; file->private_data = NULL;
return 0; return 0;
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
struct hci_vhci_struct { struct hci_vhci_struct {
struct hci_dev hdev; struct hci_dev *hdev;
__u32 flags; __u32 flags;
wait_queue_head_t read_wait; wait_queue_head_t read_wait;
struct sk_buff_head readq; struct sk_buff_head readq;
......
...@@ -138,7 +138,7 @@ comment "Old SIR device drivers" ...@@ -138,7 +138,7 @@ comment "Old SIR device drivers"
config IRPORT_SIR config IRPORT_SIR
tristate "IrPORT (IrDA serial driver)" tristate "IrPORT (IrDA serial driver)"
depends on IRDA depends on IRDA && BROKEN_ON_SMP
---help--- ---help---
Say Y here if you want to build support for the IrPORT IrDA device Say Y here if you want to build support for the IrPORT IrDA device
driver. To compile it as a module, choose M here: the module will be driver. To compile it as a module, choose M here: the module will be
...@@ -156,7 +156,7 @@ comment "Old Serial dongle support" ...@@ -156,7 +156,7 @@ comment "Old Serial dongle support"
config DONGLE_OLD config DONGLE_OLD
bool "Old Serial dongle support" bool "Old Serial dongle support"
depends on IRTTY_OLD || IRPORT_SIR depends on (IRTTY_OLD || IRPORT_SIR) && BROKEN_ON_SMP
help help
Say Y here if you have an infrared device that connects to your Say Y here if you have an infrared device that connects to your
computer's serial port. These devices are called dongles. Then say Y computer's serial port. These devices are called dongles. Then say Y
......
...@@ -93,12 +93,12 @@ static struct dongle_driver act200l = { ...@@ -93,12 +93,12 @@ static struct dongle_driver act200l = {
.set_speed = act200l_change_speed, .set_speed = act200l_change_speed,
}; };
static int __init act200l_init(void) static int __init act200l_sir_init(void)
{ {
return irda_register_dongle(&act200l); return irda_register_dongle(&act200l);
} }
static void __exit act200l_cleanup(void) static void __exit act200l_sir_cleanup(void)
{ {
irda_unregister_dongle(&act200l); irda_unregister_dongle(&act200l);
} }
...@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver"); ...@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */ MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */
module_init(act200l_init); module_init(act200l_sir_init);
module_exit(act200l_cleanup); module_exit(act200l_sir_cleanup);
...@@ -299,8 +299,6 @@ static int ali_ircc_open(int i, chipio_t *info) ...@@ -299,8 +299,6 @@ static int ali_ircc_open(int i, chipio_t *info)
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO; // benjamin 2000/11/8 05:27PM
/* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
self->rx_buff.truesize = 14384; self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 14384; self->tx_buff.truesize = 14384;
...@@ -1573,10 +1571,10 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self) ...@@ -1573,10 +1571,10 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
self->io.direction = IO_XMIT; self->io.direction = IO_XMIT;
setup_dma(self->io.dma, irda_setup_dma(self->io.dma,
self->tx_fifo.queue[self->tx_fifo.ptr].start, self->tx_fifo.queue[self->tx_fifo.ptr].start,
self->tx_fifo.queue[self->tx_fifo.ptr].len, self->tx_fifo.queue[self->tx_fifo.ptr].len,
DMA_TX_MODE); DMA_TX_MODE);
/* Reset Tx FIFO */ /* Reset Tx FIFO */
switch_bank(iobase, BANK0); switch_bank(iobase, BANK0);
...@@ -1726,8 +1724,8 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self) ...@@ -1726,8 +1724,8 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
self->st_fifo.len = self->st_fifo.pending_bytes = 0; self->st_fifo.len = self->st_fifo.pending_bytes = 0;
self->st_fifo.tail = self->st_fifo.head = 0; self->st_fifo.tail = self->st_fifo.head = 0;
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, irda_setup_dma(self->io.dma, self->rx_buff.data,
DMA_RX_MODE); self->rx_buff.truesize, DMA_RX_MODE);
/* Set Receive Mode,Brick Wall */ /* Set Receive Mode,Brick Wall */
//switch_bank(iobase, BANK0); //switch_bank(iobase, BANK0);
......
...@@ -1646,13 +1646,11 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) ...@@ -1646,13 +1646,11 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
if (max_baud >= 1152000) if (max_baud >= 1152000)
{ {
self->qos.baud_rate.bits |= IR_1152000; self->qos.baud_rate.bits |= IR_1152000;
self->flags |= IFF_MIR;
} }
#endif #endif
if (max_baud >= 4000000) if (max_baud >= 4000000)
{ {
self->qos.baud_rate.bits |= (IR_4000000 << 8); self->qos.baud_rate.bits |= (IR_4000000 << 8);
self->flags |= IFF_FIR;
} }
/*FIXME: work this out... */ /*FIXME: work this out... */
...@@ -1660,8 +1658,6 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) ...@@ -1660,8 +1658,6 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
irda_qos_bits_to_value (&self->qos); irda_qos_bits_to_value (&self->qos);
self->flags = IFF_SIR | IFF_DMA | IFF_PIO;
/* Allocate twice the size to guarantee alignment */ /* Allocate twice the size to guarantee alignment */
self->ringbuf = (void *) kmalloc (OBOE_RING_LEN << 1, GFP_KERNEL); self->ringbuf = (void *) kmalloc (OBOE_RING_LEN << 1, GFP_KERNEL);
if (!self->ringbuf) if (!self->ringbuf)
......
...@@ -72,12 +72,12 @@ static struct dongle_driver girbil = { ...@@ -72,12 +72,12 @@ static struct dongle_driver girbil = {
.set_speed = girbil_change_speed, .set_speed = girbil_change_speed,
}; };
static int __init girbil_init(void) static int __init girbil_sir_init(void)
{ {
return irda_register_dongle(&girbil); return irda_register_dongle(&girbil);
} }
static void __exit girbil_cleanup(void) static void __exit girbil_sir_cleanup(void)
{ {
irda_unregister_dongle(&girbil); irda_unregister_dongle(&girbil);
} }
...@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver"); ...@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */ MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */
module_init(girbil_init); module_init(girbil_sir_init);
module_exit(girbil_cleanup); module_exit(girbil_sir_cleanup);
...@@ -68,10 +68,6 @@ ...@@ -68,10 +68,6 @@
static int qos_mtt_bits = 0; static int qos_mtt_bits = 0;
/* Master instance for each hardware found */
#define NIRUSB 4 /* Max number of USB-IrDA dongles */
static struct irda_usb_cb irda_instance[NIRUSB];
/* These are the currently known IrDA USB dongles. Add new dongles here */ /* These are the currently known IrDA USB dongles. Add new dongles here */
static struct usb_device_id dongles[] = { static struct usb_device_id dongles[] = {
/* ACTiSYS Corp., ACT-IR2000U FIR-USB Adapter */ /* ACTiSYS Corp., ACT-IR2000U FIR-USB Adapter */
...@@ -108,7 +104,7 @@ static void irda_usb_disconnect(struct usb_interface *intf); ...@@ -108,7 +104,7 @@ static void irda_usb_disconnect(struct usb_interface *intf);
static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self); static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *dev); static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *dev);
static int irda_usb_open(struct irda_usb_cb *self); static int irda_usb_open(struct irda_usb_cb *self);
static int irda_usb_close(struct irda_usb_cb *self); static void irda_usb_close(struct irda_usb_cb *self);
static void speed_bulk_callback(struct urb *urb, struct pt_regs *regs); static void speed_bulk_callback(struct urb *urb, struct pt_regs *regs);
static void write_bulk_callback(struct urb *urb, struct pt_regs *regs); static void write_bulk_callback(struct urb *urb, struct pt_regs *regs);
static void irda_usb_receive(struct urb *urb, struct pt_regs *regs); static void irda_usb_receive(struct urb *urb, struct pt_regs *regs);
...@@ -1140,14 +1136,6 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self) ...@@ -1140,14 +1136,6 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
* the transmit path will be set differently - Jean II * the transmit path will be set differently - Jean II
*/ */
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags |= IFF_SIR;
if (self->qos.baud_rate.value > 115200)
self->flags |= IFF_MIR;
if (self->qos.baud_rate.value > 1152000)
self->flags |= IFF_FIR;
if (self->qos.baud_rate.value > 4000000)
self->flags |= IFF_VFIR;
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
...@@ -1157,36 +1145,12 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self) ...@@ -1157,36 +1145,12 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
*/ */
static inline int irda_usb_open(struct irda_usb_cb *self) static inline int irda_usb_open(struct irda_usb_cb *self)
{ {
struct net_device *netdev; struct net_device *netdev = self->netdev;
int err;
IRDA_DEBUG(1, "%s()\n", __FUNCTION__); IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
spin_lock_init(&self->lock);
irda_usb_init_qos(self); irda_usb_init_qos(self);
/* Allocate the buffer for speed changes */
/* Don't change this buffer size and allocation without doing
* some heavy and complete testing. Don't ask why :-(
* Jean II */
self->speed_buff = (char *) kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (self->speed_buff == NULL)
return -1;
memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
/* Create a network device for us */
netdev = alloc_irdadev(0);
if (!netdev) {
ERROR("%s(), alloc_net_dev() failed!\n", __FUNCTION__);
return -ENOMEM;
}
SET_MODULE_OWNER(dev);
self->netdev = netdev;
netdev->priv = (void *) self;
/* Override the network functions we need to use */ /* Override the network functions we need to use */
netdev->hard_start_xmit = irda_usb_hard_xmit; netdev->hard_start_xmit = irda_usb_hard_xmit;
netdev->tx_timeout = irda_usb_net_timeout; netdev->tx_timeout = irda_usb_net_timeout;
...@@ -1196,16 +1160,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self) ...@@ -1196,16 +1160,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
netdev->get_stats = irda_usb_net_get_stats; netdev->get_stats = irda_usb_net_get_stats;
netdev->do_ioctl = irda_usb_net_ioctl; netdev->do_ioctl = irda_usb_net_ioctl;
err = register_netdev(netdev); return register_netdev(netdev);
if (err) {
ERROR("%s(), register_netdev() failed!\n", __FUNCTION__);
self->netdev = NULL;
free_netdev(netdev);
return err;
}
MESSAGE("IrDA: Registered device %s\n", netdev->name);
return 0;
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
...@@ -1213,26 +1168,18 @@ static inline int irda_usb_open(struct irda_usb_cb *self) ...@@ -1213,26 +1168,18 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
* Cleanup the network side of the irda-usb instance * Cleanup the network side of the irda-usb instance
* Called when a USB instance is removed in irda_usb_disconnect() * Called when a USB instance is removed in irda_usb_disconnect()
*/ */
static inline int irda_usb_close(struct irda_usb_cb *self) static inline void irda_usb_close(struct irda_usb_cb *self)
{ {
IRDA_DEBUG(1, "%s()\n", __FUNCTION__); IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
ASSERT(self != NULL, return -1;);
/* Remove netdevice */ /* Remove netdevice */
if (self->netdev) { unregister_netdev(self->netdev);
unregister_netdev(self->netdev);
free_netdev(self->netdev);
self->netdev = NULL;
}
/* Remove the speed buffer */ /* Remove the speed buffer */
if (self->speed_buff != NULL) { if (self->speed_buff != NULL) {
kfree(self->speed_buff); kfree(self->speed_buff);
self->speed_buff = NULL; self->speed_buff = NULL;
} }
return 0;
} }
/********************** USB CONFIG SUBROUTINES **********************/ /********************** USB CONFIG SUBROUTINES **********************/
...@@ -1402,11 +1349,12 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf ...@@ -1402,11 +1349,12 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
static int irda_usb_probe(struct usb_interface *intf, static int irda_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct net_device *net;
struct usb_device *dev = interface_to_usbdev(intf); struct usb_device *dev = interface_to_usbdev(intf);
struct irda_usb_cb *self = NULL; struct irda_usb_cb *self = NULL;
struct usb_host_interface *interface; struct usb_host_interface *interface;
struct irda_class_desc *irda_desc; struct irda_class_desc *irda_desc;
int ret; int ret = -ENOMEM;
int i; /* Driver instance index / Rx URB index */ int i; /* Driver instance index / Rx URB index */
/* Note : the probe make sure to call us only for devices that /* Note : the probe make sure to call us only for devices that
...@@ -1418,53 +1366,29 @@ static int irda_usb_probe(struct usb_interface *intf, ...@@ -1418,53 +1366,29 @@ static int irda_usb_probe(struct usb_interface *intf,
dev->devnum, dev->descriptor.idVendor, dev->devnum, dev->descriptor.idVendor,
dev->descriptor.idProduct); dev->descriptor.idProduct);
/* Try to cleanup all instance that have a pending disconnect net = alloc_irdadev(sizeof(*self));
* In theory, it can't happen any longer. if (!net)
* Jean II */ goto err_out;
for (i = 0; i < NIRUSB; i++) {
struct irda_usb_cb *irda = &irda_instance[i];
if((irda->usbdev != NULL) &&
(irda->present == 0) &&
(irda->netopen == 0)) {
IRDA_DEBUG(0, "%s(), found a zombie instance !!!\n", __FUNCTION__);
irda_usb_disconnect(irda->usbintf);
}
}
/* Find an free instance to handle this new device... */ self = net->priv;
self = NULL; self->netdev = net;
for (i = 0; i < NIRUSB; i++) { spin_lock_init(&self->lock);
if(irda_instance[i].usbdev == NULL) {
self = &irda_instance[i];
break;
}
}
if(self == NULL) {
WARNING("Too many USB IrDA devices !!! (max = %d)\n",
NIRUSB);
return -ENFILE;
}
/* Reset the instance */ SET_MODULE_OWNER(net);
self->present = 0;
self->netopen = 0;
/* Create all of the needed urbs */ /* Create all of the needed urbs */
for (i = 0; i < IU_MAX_RX_URBS; i++) { for (i = 0; i < IU_MAX_RX_URBS; i++) {
self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!self->rx_urb[i]) { if (!self->rx_urb[i]) {
ret = -ENOMEM;
goto err_out_1; goto err_out_1;
} }
} }
self->tx_urb = usb_alloc_urb(0, GFP_KERNEL); self->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!self->tx_urb) { if (!self->tx_urb) {
ret = -ENOMEM;
goto err_out_1; goto err_out_1;
} }
self->speed_urb = usb_alloc_urb(0, GFP_KERNEL); self->speed_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!self->speed_urb) { if (!self->speed_urb) {
ret = -ENOMEM;
goto err_out_2; goto err_out_2;
} }
...@@ -1517,13 +1441,27 @@ static int irda_usb_probe(struct usb_interface *intf, ...@@ -1517,13 +1441,27 @@ static int irda_usb_probe(struct usb_interface *intf,
self->capability = id->driver_info; self->capability = id->driver_info;
self->usbdev = dev; self->usbdev = dev;
self->usbintf = intf; self->usbintf = intf;
ret = irda_usb_open(self);
if (ret) /* Allocate the buffer for speed changes */
/* Don't change this buffer size and allocation without doing
* some heavy and complete testing. Don't ask why :-(
* Jean II */
self->speed_buff = (char *) kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
if (self->speed_buff == NULL)
goto err_out_3; goto err_out_3;
memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
ret = irda_usb_open(self);
if (ret)
goto err_out_4;
MESSAGE("IrDA: Registered device %s\n", net->name);
usb_set_intfdata(intf, self); usb_set_intfdata(intf, self);
return 0; return 0;
err_out_4:
kfree(self->speed_buff);
err_out_3: err_out_3:
/* Free all urbs that we may have created */ /* Free all urbs that we may have created */
usb_free_urb(self->speed_urb); usb_free_urb(self->speed_urb);
...@@ -1534,7 +1472,8 @@ static int irda_usb_probe(struct usb_interface *intf, ...@@ -1534,7 +1472,8 @@ static int irda_usb_probe(struct usb_interface *intf,
if (self->rx_urb[i]) if (self->rx_urb[i])
usb_free_urb(self->rx_urb[i]); usb_free_urb(self->rx_urb[i]);
} }
free_netdev(net);
err_out:
return ret; return ret;
} }
...@@ -1602,6 +1541,8 @@ static void irda_usb_disconnect(struct usb_interface *intf) ...@@ -1602,6 +1541,8 @@ static void irda_usb_disconnect(struct usb_interface *intf)
usb_free_urb(self->tx_urb); usb_free_urb(self->tx_urb);
usb_free_urb(self->speed_urb); usb_free_urb(self->speed_urb);
/* Free self and network device */
free_netdev(self->netdev);
IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __FUNCTION__); IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __FUNCTION__);
} }
...@@ -1646,20 +1587,6 @@ module_init(usb_irda_init); ...@@ -1646,20 +1587,6 @@ module_init(usb_irda_init);
*/ */
static void __exit usb_irda_cleanup(void) static void __exit usb_irda_cleanup(void)
{ {
struct irda_usb_cb *irda = NULL;
int i;
/* Find zombie instances and kill them...
* In theory, it can't happen any longer. Jean II */
for (i = 0; i < NIRUSB; i++) {
irda = &irda_instance[i];
/* If the Device is zombie */
if((irda->usbdev != NULL) && (irda->present == 0)) {
IRDA_DEBUG(0, "%s(), disconnect zombie now !\n", __FUNCTION__);
irda_usb_disconnect(irda->usbintf);
}
}
/* Deregister the driver and remove all pending instances */ /* Deregister the driver and remove all pending instances */
usb_deregister(&irda_driver); usb_deregister(&irda_driver);
} }
......
...@@ -178,9 +178,6 @@ irport_open(int i, unsigned int iobase, unsigned int irq) ...@@ -178,9 +178,6 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
self->qos.min_turn_time.bits = qos_mtt_bits; self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags = IFF_SIR|IFF_PIO;
self->mode = IRDA_IRLAP;
/* Bootstrap ZeroCopy Rx */ /* Bootstrap ZeroCopy Rx */
self->rx_buff.truesize = IRDA_SKB_MAX_MTU; self->rx_buff.truesize = IRDA_SKB_MAX_MTU;
self->rx_buff.skb = __dev_alloc_skb(self->rx_buff.truesize, self->rx_buff.skb = __dev_alloc_skb(self->rx_buff.truesize,
......
...@@ -353,7 +353,8 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) ...@@ -353,7 +353,8 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop)
/*****************************************************************/ /*****************************************************************/
DECLARE_MUTEX(irtty_sem); /* serialize ldisc open/close with sir_dev */ /* serialize ldisc open/close with sir_dev */
static DECLARE_MUTEX(irtty_sem);
/* notifier from sir_dev when irda% device gets opened (ifup) */ /* notifier from sir_dev when irda% device gets opened (ifup) */
......
...@@ -49,12 +49,12 @@ static struct dongle_driver mcp2120 = { ...@@ -49,12 +49,12 @@ static struct dongle_driver mcp2120 = {
.set_speed = mcp2120_change_speed, .set_speed = mcp2120_change_speed,
}; };
static int __init mcp2120_init(void) static int __init mcp2120_sir_init(void)
{ {
return irda_register_dongle(&mcp2120); return irda_register_dongle(&mcp2120);
} }
static void __exit mcp2120_cleanup(void) static void __exit mcp2120_sir_cleanup(void)
{ {
irda_unregister_dongle(&mcp2120); irda_unregister_dongle(&mcp2120);
} }
...@@ -226,5 +226,5 @@ MODULE_DESCRIPTION("Microchip MCP2120"); ...@@ -226,5 +226,5 @@ MODULE_DESCRIPTION("Microchip MCP2120");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */ MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */
module_init(mcp2120_init); module_init(mcp2120_sir_init);
module_exit(mcp2120_cleanup); module_exit(mcp2120_sir_cleanup);
...@@ -302,8 +302,6 @@ static int __init nsc_ircc_open(int i, chipio_t *info) ...@@ -302,8 +302,6 @@ static int __init nsc_ircc_open(int i, chipio_t *info)
self->qos.min_turn_time.bits = qos_mtt_bits; self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO|IFF_DONGLE;
/* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
self->rx_buff.truesize = 14384; self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 14384; self->tx_buff.truesize = 14384;
...@@ -1410,10 +1408,10 @@ static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase) ...@@ -1410,10 +1408,10 @@ static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase)
switch_bank(iobase, BANK2); switch_bank(iobase, BANK2);
outb(ECR1_DMASWP|ECR1_DMANF|ECR1_EXT_SL, iobase+ECR1); outb(ECR1_DMASWP|ECR1_DMANF|ECR1_EXT_SL, iobase+ECR1);
setup_dma(self->io.dma, irda_setup_dma(self->io.dma,
self->tx_fifo.queue[self->tx_fifo.ptr].start, self->tx_fifo.queue[self->tx_fifo.ptr].start,
self->tx_fifo.queue[self->tx_fifo.ptr].len, self->tx_fifo.queue[self->tx_fifo.ptr].len,
DMA_TX_MODE); DMA_TX_MODE);
/* Enable DMA and SIR interaction pulse */ /* Enable DMA and SIR interaction pulse */
switch_bank(iobase, BANK0); switch_bank(iobase, BANK0);
...@@ -1568,8 +1566,8 @@ static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self) ...@@ -1568,8 +1566,8 @@ static int nsc_ircc_dma_receive(struct nsc_ircc_cb *self)
self->st_fifo.len = self->st_fifo.pending_bytes = 0; self->st_fifo.len = self->st_fifo.pending_bytes = 0;
self->st_fifo.tail = self->st_fifo.head = 0; self->st_fifo.tail = self->st_fifo.head = 0;
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, irda_setup_dma(self->io.dma, self->rx_buff.data,
DMA_RX_MODE); self->rx_buff.truesize, DMA_RX_MODE);
/* Enable DMA */ /* Enable DMA */
switch_bank(iobase, BANK0); switch_bank(iobase, BANK0);
......
...@@ -78,12 +78,12 @@ static struct dongle_driver old_belkin = { ...@@ -78,12 +78,12 @@ static struct dongle_driver old_belkin = {
.set_speed = old_belkin_change_speed, .set_speed = old_belkin_change_speed,
}; };
static int __init old_belkin_init(void) static int __init old_belkin_sir_init(void)
{ {
return irda_register_dongle(&old_belkin); return irda_register_dongle(&old_belkin);
} }
static void __exit old_belkin_cleanup(void) static void __exit old_belkin_sir_cleanup(void)
{ {
irda_unregister_dongle(&old_belkin); irda_unregister_dongle(&old_belkin);
} }
...@@ -152,5 +152,5 @@ MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver"); ...@@ -152,5 +152,5 @@ MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */ MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */
module_init(old_belkin_init); module_init(old_belkin_sir_init);
module_exit(old_belkin_cleanup); module_exit(old_belkin_sir_cleanup);
...@@ -620,8 +620,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n ...@@ -620,8 +620,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
SET_MODULE_OWNER(ndev); SET_MODULE_OWNER(ndev);
dev->flags = IFF_SIR | IFF_PIO;
/* Override the network functions we need to use */ /* Override the network functions we need to use */
ndev->hard_start_xmit = sirdev_hard_xmit; ndev->hard_start_xmit = sirdev_hard_xmit;
ndev->open = sirdev_open; ndev->open = sirdev_open;
......
...@@ -441,8 +441,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u ...@@ -441,8 +441,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
smsc_ircc_setup_qos(self); smsc_ircc_setup_qos(self);
self->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO;
smsc_ircc_init_chip(self); smsc_ircc_init_chip(self);
if(ircc_transceiver > 0 && if(ircc_transceiver > 0 &&
...@@ -1161,8 +1159,8 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs) ...@@ -1161,8 +1159,8 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs)
IRCC_CFGB_DMA_BURST, iobase+IRCC_SCE_CFGB); IRCC_CFGB_DMA_BURST, iobase+IRCC_SCE_CFGB);
/* Setup DMA controller (must be done after enabling chip DMA) */ /* Setup DMA controller (must be done after enabling chip DMA) */
setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len,
DMA_TX_MODE); DMA_TX_MODE);
/* Enable interrupt */ /* Enable interrupt */
...@@ -1251,8 +1249,8 @@ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase) ...@@ -1251,8 +1249,8 @@ static int smsc_ircc_dma_receive(struct smsc_ircc_cb *self, int iobase)
outb(2050 & 0xff, iobase+IRCC_RX_SIZE_LO); outb(2050 & 0xff, iobase+IRCC_RX_SIZE_LO);
/* Setup DMA controller */ /* Setup DMA controller */
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, irda_setup_dma(self->io.dma, self->rx_buff.data,
DMA_RX_MODE); self->rx_buff.truesize, DMA_RX_MODE);
/* Enable burst mode chip Rx DMA */ /* Enable burst mode chip Rx DMA */
register_bank(iobase, 1); register_bank(iobase, 1);
...@@ -1387,11 +1385,12 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re ...@@ -1387,11 +1385,12 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re
struct net_device *dev = (struct net_device *) dev_id; struct net_device *dev = (struct net_device *) dev_id;
struct smsc_ircc_cb *self; struct smsc_ircc_cb *self;
int iobase, iir, lcra, lsr; int iobase, iir, lcra, lsr;
irqreturn_t ret = IRQ_NONE;
if (dev == NULL) { if (dev == NULL) {
printk(KERN_WARNING "%s: irq %d for unknown device.\n", printk(KERN_WARNING "%s: irq %d for unknown device.\n",
driver_name, irq); driver_name, irq);
return IRQ_NONE; goto irq_ret;
} }
self = (struct smsc_ircc_cb *) dev->priv; self = (struct smsc_ircc_cb *) dev->priv;
ASSERT(self != NULL, return IRQ_NONE;); ASSERT(self != NULL, return IRQ_NONE;);
...@@ -1401,14 +1400,18 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re ...@@ -1401,14 +1400,18 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re
/* Check if we should use the SIR interrupt handler */ /* Check if we should use the SIR interrupt handler */
if (self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED) { if (self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED) {
irqreturn_t ret = smsc_ircc_interrupt_sir(dev); ret = smsc_ircc_interrupt_sir(dev);
spin_unlock(&self->lock); goto irq_ret_unlock;
return ret;
} }
iobase = self->io.fir_base; iobase = self->io.fir_base;
register_bank(iobase, 0); register_bank(iobase, 0);
iir = inb(iobase+IRCC_IIR); iir = inb(iobase+IRCC_IIR);
if (iir == 0)
goto irq_ret_unlock;
ret = IRQ_HANDLED;
/* Disable interrupts */ /* Disable interrupts */
outb(0, iobase+IRCC_IER); outb(0, iobase+IRCC_IER);
lcra = inb(iobase+IRCC_LCR_A); lcra = inb(iobase+IRCC_LCR_A);
...@@ -1434,8 +1437,10 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re ...@@ -1434,8 +1437,10 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id, struct pt_regs *re
register_bank(iobase, 0); register_bank(iobase, 0);
outb(IRCC_IER_ACTIVE_FRAME|IRCC_IER_EOM, iobase+IRCC_IER); outb(IRCC_IER_ACTIVE_FRAME|IRCC_IER_EOM, iobase+IRCC_IER);
irq_ret_unlock:
spin_unlock(&self->lock); spin_unlock(&self->lock);
return IRQ_RETVAL(iir); irq_ret:
return ret;
} }
/* /*
...@@ -1456,6 +1461,8 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev) ...@@ -1456,6 +1461,8 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
iobase = self->io.sir_base; iobase = self->io.sir_base;
iir = inb(iobase+UART_IIR) & UART_IIR_ID; iir = inb(iobase+UART_IIR) & UART_IIR_ID;
if (iir == 0)
return IRQ_NONE;
while (iir) { while (iir) {
/* Clear interrupt */ /* Clear interrupt */
lsr = inb(iobase+UART_LSR); lsr = inb(iobase+UART_LSR);
...@@ -1489,7 +1496,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev) ...@@ -1489,7 +1496,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
iir = inb(iobase + UART_IIR) & UART_IIR_ID; iir = inb(iobase + UART_IIR) & UART_IIR_ID;
} }
/*spin_unlock(&self->lock);*/ /*spin_unlock(&self->lock);*/
return IRQ_RETVAL(iir); return IRQ_HANDLED;
} }
......
...@@ -103,14 +103,14 @@ static struct net_device_stats *via_ircc_net_get_stats(struct net_device ...@@ -103,14 +103,14 @@ static struct net_device_stats *via_ircc_net_get_stats(struct net_device
static void via_ircc_change_dongle_speed(int iobase, int speed, static void via_ircc_change_dongle_speed(int iobase, int speed,
int dongle_id); int dongle_id);
static int RxTimerHandler(struct via_ircc_cb *self, int iobase); static int RxTimerHandler(struct via_ircc_cb *self, int iobase);
void hwreset(struct via_ircc_cb *self); static void hwreset(struct via_ircc_cb *self);
static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase); static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase);
static int upload_rxdata(struct via_ircc_cb *self, int iobase); static int upload_rxdata(struct via_ircc_cb *self, int iobase);
static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_device_id *id); static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_device_id *id);
static void __exit via_remove_one (struct pci_dev *pdev); static void __exit via_remove_one (struct pci_dev *pdev);
/* Should use udelay() instead, even if we are x86 only - Jean II */ /* Should use udelay() instead, even if we are x86 only - Jean II */
void iodelay(int udelay) static void iodelay(int udelay)
{ {
u8 data; u8 data;
int i; int i;
...@@ -377,9 +377,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) ...@@ -377,9 +377,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
self->qos.min_turn_time.bits = qos_mtt_bits; self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags =
IFF_FIR | IFF_MIR | IFF_SIR | IFF_DMA | IFF_PIO | IFF_DONGLE;
/* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
self->rx_buff.truesize = 14384 + 2048; self->rx_buff.truesize = 14384 + 2048;
self->tx_buff.truesize = 14384 + 2048; self->tx_buff.truesize = 14384 + 2048;
...@@ -819,8 +816,8 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb, ...@@ -819,8 +816,8 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
EnTXDMA(iobase, ON); EnTXDMA(iobase, ON);
EnRXDMA(iobase, OFF); EnRXDMA(iobase, OFF);
setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len,
DMA_TX_MODE); DMA_TX_MODE);
SetSendByte(iobase, self->tx_buff.len); SetSendByte(iobase, self->tx_buff.len);
RXStart(iobase, OFF); RXStart(iobase, OFF);
...@@ -899,9 +896,9 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase) ...@@ -899,9 +896,9 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase)
EnAllInt(iobase, ON); EnAllInt(iobase, ON);
EnTXDMA(iobase, ON); EnTXDMA(iobase, ON);
EnRXDMA(iobase, OFF); EnRXDMA(iobase, OFF);
setup_dma(self->io.dma, irda_setup_dma(self->io.dma,
self->tx_fifo.queue[self->tx_fifo.ptr].start, self->tx_fifo.queue[self->tx_fifo.ptr].start,
self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE);
#ifdef DBGMSG #ifdef DBGMSG
DBG(printk DBG(printk
(KERN_INFO "dma_xmit:tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n", (KERN_INFO "dma_xmit:tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n",
...@@ -1025,8 +1022,8 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self) ...@@ -1025,8 +1022,8 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self)
EnAllInt(iobase, ON); EnAllInt(iobase, ON);
EnTXDMA(iobase, OFF); EnTXDMA(iobase, OFF);
EnRXDMA(iobase, ON); EnRXDMA(iobase, ON);
setup_dma(self->io.dma2, self->rx_buff.data, irda_setup_dma(self->io.dma2, self->rx_buff.data,
self->rx_buff.truesize, DMA_RX_MODE); self->rx_buff.truesize, DMA_RX_MODE);
TXStart(iobase, OFF); TXStart(iobase, OFF);
RXStart(iobase, ON); RXStart(iobase, ON);
...@@ -1397,7 +1394,7 @@ static irqreturn_t via_ircc_interrupt(int irq, void *dev_id, ...@@ -1397,7 +1394,7 @@ static irqreturn_t via_ircc_interrupt(int irq, void *dev_id,
return IRQ_RETVAL(iHostIntType); return IRQ_RETVAL(iHostIntType);
} }
void hwreset(struct via_ircc_cb *self) static void hwreset(struct via_ircc_cb *self)
{ {
int iobase; int iobase;
iobase = self->io.fir_base; iobase = self->io.fir_base;
......
...@@ -194,14 +194,7 @@ struct via_ircc_cb { ...@@ -194,14 +194,7 @@ struct via_ircc_cb {
#define Rd_Valid 0x08 #define Rd_Valid 0x08
#define RxBit 0x08 #define RxBit 0x08
__u8 ReadPCIByte(__u8, __u8, __u8, __u8); static void DisableDmaChannel(unsigned int channel)
__u32 ReadPCI(__u8, __u8, __u8, __u8);
void WritePCI(__u8, __u8, __u8, __u8, __u32);
void WritePCIByte(__u8, __u8, __u8, __u8, __u8);
int mySearchPCI(__u8 *, __u16, __u16);
void DisableDmaChannel(unsigned int channel)
{ {
switch (channel) { // 8 Bit DMA channels DMAC1 switch (channel) { // 8 Bit DMA channels DMAC1
case 0: case 0:
...@@ -230,7 +223,7 @@ void DisableDmaChannel(unsigned int channel) ...@@ -230,7 +223,7 @@ void DisableDmaChannel(unsigned int channel)
}; //Switch }; //Switch
} }
unsigned char ReadLPCReg(int iRegNum) static unsigned char ReadLPCReg(int iRegNum)
{ {
unsigned char iVal; unsigned char iVal;
...@@ -243,7 +236,7 @@ unsigned char ReadLPCReg(int iRegNum) ...@@ -243,7 +236,7 @@ unsigned char ReadLPCReg(int iRegNum)
return iVal; return iVal;
} }
void WriteLPCReg(int iRegNum, unsigned char iVal) static void WriteLPCReg(int iRegNum, unsigned char iVal)
{ {
outb(0x87, 0x2e); outb(0x87, 0x2e);
...@@ -253,17 +246,17 @@ void WriteLPCReg(int iRegNum, unsigned char iVal) ...@@ -253,17 +246,17 @@ void WriteLPCReg(int iRegNum, unsigned char iVal)
outb(0xAA, 0x2e); outb(0xAA, 0x2e);
} }
__u8 ReadReg(unsigned int BaseAddr, int iRegNum) static __u8 ReadReg(unsigned int BaseAddr, int iRegNum)
{ {
return ((__u8) inb(BaseAddr + iRegNum)); return ((__u8) inb(BaseAddr + iRegNum));
} }
void WriteReg(unsigned int BaseAddr, int iRegNum, unsigned char iVal) static void WriteReg(unsigned int BaseAddr, int iRegNum, unsigned char iVal)
{ {
outb(iVal, BaseAddr + iRegNum); outb(iVal, BaseAddr + iRegNum);
} }
int WriteRegBit(unsigned int BaseAddr, unsigned char RegNum, static int WriteRegBit(unsigned int BaseAddr, unsigned char RegNum,
unsigned char BitPos, unsigned char value) unsigned char BitPos, unsigned char value)
{ {
__u8 Rtemp, Wtemp; __u8 Rtemp, Wtemp;
...@@ -286,7 +279,7 @@ int WriteRegBit(unsigned int BaseAddr, unsigned char RegNum, ...@@ -286,7 +279,7 @@ int WriteRegBit(unsigned int BaseAddr, unsigned char RegNum,
return 0; return 0;
} }
__u8 CheckRegBit(unsigned int BaseAddr, unsigned char RegNum, static __u8 CheckRegBit(unsigned int BaseAddr, unsigned char RegNum,
unsigned char BitPos) unsigned char BitPos)
{ {
__u8 temp; __u8 temp;
...@@ -300,122 +293,7 @@ __u8 CheckRegBit(unsigned int BaseAddr, unsigned char RegNum, ...@@ -300,122 +293,7 @@ __u8 CheckRegBit(unsigned int BaseAddr, unsigned char RegNum,
return GetBit(temp, BitPos); return GetBit(temp, BitPos);
} }
__u8 ReadPCIByte(__u8 bus, __u8 device, __u8 fun, __u8 reg) static void SetMaxRxPacketSize(__u16 iobase, __u16 size)
{
__u32 dTmp;
__u8 bData, bTmp;
bTmp = reg & ~0x03;
dTmp = ReadPCI(bus, device, fun, bTmp);
bTmp = reg & 0x03;
bData = (__u8) (dTmp >> bTmp);
return bData;
}
__u32 ReadPCI(__u8 bus, __u8 device, __u8 fun, __u8 reg)
{
__u32 CONFIG_ADDR, temp, data;
if ((bus == 0xff) || (device == 0xff) || (fun == 0xff))
return 0xffffffff;
CONFIG_ADDR = 0x80000000;
temp = (__u32) reg << 2;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) fun << 8;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) device << 11;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) bus << 16;
CONFIG_ADDR = CONFIG_ADDR | temp;
outl(PCI_CONFIG_ADDRESS, CONFIG_ADDR);
data = inl(PCI_CONFIG_DATA);
return data;
}
void WritePCIByte(__u8 bus, __u8 device, __u8 fun, __u8 reg,
__u8 CONFIG_DATA)
{
__u32 dTmp, dTmp1 = 0;
__u8 bTmp;
bTmp = reg & ~0x03;
dTmp = ReadPCI(bus, device, fun, bTmp);
switch (reg & 0x03) {
case 0:
dTmp1 = (dTmp & ~0xff) | CONFIG_DATA;
break;
case 1:
dTmp = (dTmp & ~0x00ff00);
dTmp1 = CONFIG_DATA;
dTmp1 = dTmp1 << 8;
dTmp1 = dTmp1 | dTmp;
break;
case 2:
dTmp = (dTmp & ~0xff0000);
dTmp1 = CONFIG_DATA;
dTmp1 = dTmp1 << 16;
dTmp1 = dTmp1 | dTmp;
break;
case 3:
dTmp = (dTmp & ~0xff000000);
dTmp1 = CONFIG_DATA;
dTmp1 = dTmp1 << 24;
dTmp1 = dTmp1 | dTmp;
break;
}
WritePCI(bus, device, fun, bTmp, dTmp1);
}
//------------------
void WritePCI(__u8 bus, __u8 device, __u8 fun, __u8 reg, __u32 CONFIG_DATA)
{
__u32 CONFIG_ADDR, temp;
if ((bus == 0xff) || (device == 0xff) || (fun == 0xff))
return;
CONFIG_ADDR = 0x80000000;
temp = (__u32) reg << 2;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) fun << 8;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) device << 11;
CONFIG_ADDR = CONFIG_ADDR | temp;
temp = (__u32) bus << 16;
CONFIG_ADDR = CONFIG_ADDR | temp;
outl(PCI_CONFIG_ADDRESS, CONFIG_ADDR);
outl(PCI_CONFIG_DATA, CONFIG_DATA);
}
// find device with DeviceID and VenderID // if match return three byte buffer (bus,device,function) // no found, address={99,99,99}
int mySearchPCI(__u8 * SBridpos, __u16 VID, __u16 DID)
{
__u8 i, j, k;
__u16 FindDeviceID, FindVenderID;
for (k = 0; k < 8; k++) { //scan function
i = 0;
j = 0x11;
k = 0;
if (ReadPCI(i, j, k, 0) < 0xffffffff) { // not empty
FindDeviceID = (__u16) (ReadPCI(i, j, k, 0) >> 16);
FindVenderID =
(__u16) (ReadPCI(i, j, k, 0) & 0x0000ffff);
if ((VID == FindVenderID) && (DID == FindDeviceID)) {
SBridpos[0] = i; // bus
SBridpos[1] = j; //device
SBridpos[2] = k; //func
return 1;
}
}
}
return 0;
}
void SetMaxRxPacketSize(__u16 iobase, __u16 size)
{ {
__u16 low, high; __u16 low, high;
if ((size & 0xe000) == 0) { if ((size & 0xe000) == 0) {
...@@ -430,7 +308,7 @@ void SetMaxRxPacketSize(__u16 iobase, __u16 size) ...@@ -430,7 +308,7 @@ void SetMaxRxPacketSize(__u16 iobase, __u16 size)
//for both Rx and Tx //for both Rx and Tx
void SetFIFO(__u16 iobase, __u16 value) static void SetFIFO(__u16 iobase, __u16 value)
{ {
switch (value) { switch (value) {
case 128: case 128:
...@@ -541,7 +419,7 @@ void SetFIFO(__u16 iobase, __u16 value) ...@@ -541,7 +419,7 @@ void SetFIFO(__u16 iobase, __u16 value)
#define GetFIRVersion(BaseAddr) ReadReg(BaseAddr,VERSION) #define GetFIRVersion(BaseAddr) ReadReg(BaseAddr,VERSION)
void SetTimer(__u16 iobase, __u8 count) static void SetTimer(__u16 iobase, __u8 count)
{ {
EnTimerInt(iobase, OFF); EnTimerInt(iobase, OFF);
WriteReg(iobase, TIMER, count); WriteReg(iobase, TIMER, count);
...@@ -549,7 +427,7 @@ void SetTimer(__u16 iobase, __u8 count) ...@@ -549,7 +427,7 @@ void SetTimer(__u16 iobase, __u8 count)
} }
void SetSendByte(__u16 iobase, __u32 count) static void SetSendByte(__u16 iobase, __u32 count)
{ {
__u32 low, high; __u32 low, high;
...@@ -561,7 +439,7 @@ void SetSendByte(__u16 iobase, __u32 count) ...@@ -561,7 +439,7 @@ void SetSendByte(__u16 iobase, __u32 count)
} }
} }
void ResetChip(__u16 iobase, __u8 type) static void ResetChip(__u16 iobase, __u8 type)
{ {
__u8 value; __u8 value;
...@@ -569,16 +447,7 @@ void ResetChip(__u16 iobase, __u8 type) ...@@ -569,16 +447,7 @@ void ResetChip(__u16 iobase, __u8 type)
WriteReg(iobase, RESET, type); WriteReg(iobase, RESET, type);
} }
void SetAddrMode(__u16 iobase, __u8 mode) static int CkRxRecv(__u16 iobase, struct via_ircc_cb *self)
{
__u8 bTmp = 0;
if (mode < 3) {
bTmp = (ReadReg(iobase, RX_CT) & 0xcf) | (mode << 4);
WriteReg(iobase, RX_CT, bTmp);
}
}
int CkRxRecv(__u16 iobase, struct via_ircc_cb *self)
{ {
__u8 low, high; __u8 low, high;
__u16 wTmp = 0, wTmp1 = 0, wTmp_new = 0; __u16 wTmp = 0, wTmp1 = 0, wTmp_new = 0;
...@@ -599,7 +468,7 @@ int CkRxRecv(__u16 iobase, struct via_ircc_cb *self) ...@@ -599,7 +468,7 @@ int CkRxRecv(__u16 iobase, struct via_ircc_cb *self)
} }
__u16 RxCurCount(__u16 iobase, struct via_ircc_cb * self) static __u16 RxCurCount(__u16 iobase, struct via_ircc_cb * self)
{ {
__u8 low, high; __u8 low, high;
__u16 wTmp = 0, wTmp1 = 0; __u16 wTmp = 0, wTmp1 = 0;
...@@ -615,7 +484,7 @@ __u16 RxCurCount(__u16 iobase, struct via_ircc_cb * self) ...@@ -615,7 +484,7 @@ __u16 RxCurCount(__u16 iobase, struct via_ircc_cb * self)
* for it will update last count. * for it will update last count.
*/ */
__u16 GetRecvByte(__u16 iobase, struct via_ircc_cb * self) static __u16 GetRecvByte(__u16 iobase, struct via_ircc_cb * self)
{ {
__u8 low, high; __u8 low, high;
__u16 wTmp, wTmp1, ret; __u16 wTmp, wTmp1, ret;
...@@ -645,23 +514,7 @@ __u16 GetRecvByte(__u16 iobase, struct via_ircc_cb * self) ...@@ -645,23 +514,7 @@ __u16 GetRecvByte(__u16 iobase, struct via_ircc_cb * self)
return ret; return ret;
} }
static void Sdelay(__u16 scale)
__u16 GetRecvLen(__u16 iobase)
{
__u8 low, high;
__u16 temp;
low = ReadReg(iobase, RX_P_L);
high = ReadReg(iobase, RX_P_H);
if (!(high & 0xe000)) {
temp = (high << 8) + low;
return temp;
} else
return 0;
}
void Sdelay(__u16 scale)
{ {
__u8 bTmp; __u8 bTmp;
int i, j; int i, j;
...@@ -674,7 +527,7 @@ void Sdelay(__u16 scale) ...@@ -674,7 +527,7 @@ void Sdelay(__u16 scale)
} }
} }
void Tdelay(__u16 scale) static void Tdelay(__u16 scale)
{ {
__u8 bTmp; __u8 bTmp;
int i, j; int i, j;
...@@ -688,7 +541,7 @@ void Tdelay(__u16 scale) ...@@ -688,7 +541,7 @@ void Tdelay(__u16 scale)
} }
void ActClk(__u16 iobase, __u8 value) static void ActClk(__u16 iobase, __u8 value)
{ {
__u8 bTmp; __u8 bTmp;
bTmp = ReadReg(iobase, 0x34); bTmp = ReadReg(iobase, 0x34);
...@@ -698,18 +551,7 @@ void ActClk(__u16 iobase, __u8 value) ...@@ -698,18 +551,7 @@ void ActClk(__u16 iobase, __u8 value)
WriteReg(iobase, 0x34, bTmp & ~Clk_bit); WriteReg(iobase, 0x34, bTmp & ~Clk_bit);
} }
void ActTx(__u16 iobase, __u8 value) static void ClkTx(__u16 iobase, __u8 Clk, __u8 Tx)
{
__u8 bTmp;
bTmp = ReadReg(iobase, 0x34);
if (value)
WriteReg(iobase, 0x34, bTmp | Tx_bit);
else
WriteReg(iobase, 0x34, bTmp & ~Tx_bit);
}
void ClkTx(__u16 iobase, __u8 Clk, __u8 Tx)
{ {
__u8 bTmp; __u8 bTmp;
...@@ -731,7 +573,7 @@ void ClkTx(__u16 iobase, __u8 Clk, __u8 Tx) ...@@ -731,7 +573,7 @@ void ClkTx(__u16 iobase, __u8 Clk, __u8 Tx)
WriteReg(iobase, 0x34, bTmp); WriteReg(iobase, 0x34, bTmp);
} }
void Wr_Byte(__u16 iobase, __u8 data) static void Wr_Byte(__u16 iobase, __u8 data)
{ {
__u8 bData = data; __u8 bData = data;
// __u8 btmp; // __u8 btmp;
...@@ -757,7 +599,7 @@ void Wr_Byte(__u16 iobase, __u8 data) ...@@ -757,7 +599,7 @@ void Wr_Byte(__u16 iobase, __u8 data)
} }
} }
__u8 Rd_Indx(__u16 iobase, __u8 addr, __u8 index) static __u8 Rd_Indx(__u16 iobase, __u8 addr, __u8 index)
{ {
__u8 data = 0, bTmp, data_bit; __u8 data = 0, bTmp, data_bit;
int i; int i;
...@@ -821,7 +663,7 @@ __u8 Rd_Indx(__u16 iobase, __u8 addr, __u8 index) ...@@ -821,7 +663,7 @@ __u8 Rd_Indx(__u16 iobase, __u8 addr, __u8 index)
return data; return data;
} }
void Wr_Indx(__u16 iobase, __u8 addr, __u8 index, __u8 data) static void Wr_Indx(__u16 iobase, __u8 addr, __u8 index, __u8 data)
{ {
int i; int i;
__u8 bTmp; __u8 bTmp;
...@@ -842,7 +684,7 @@ void Wr_Indx(__u16 iobase, __u8 addr, __u8 index, __u8 data) ...@@ -842,7 +684,7 @@ void Wr_Indx(__u16 iobase, __u8 addr, __u8 index, __u8 data)
ActClk(iobase, 0); ActClk(iobase, 0);
} }
void ResetDongle(__u16 iobase) static void ResetDongle(__u16 iobase)
{ {
int i; int i;
ClkTx(iobase, 0, 0); ClkTx(iobase, 0, 0);
...@@ -856,7 +698,7 @@ void ResetDongle(__u16 iobase) ...@@ -856,7 +698,7 @@ void ResetDongle(__u16 iobase)
ActClk(iobase, 0); ActClk(iobase, 0);
} }
void SetSITmode(__u16 iobase) static void SetSITmode(__u16 iobase)
{ {
__u8 bTmp; __u8 bTmp;
...@@ -868,7 +710,7 @@ void SetSITmode(__u16 iobase) ...@@ -868,7 +710,7 @@ void SetSITmode(__u16 iobase)
WriteReg(iobase, 0x28, bTmp | 0x80); // enable All interrupt WriteReg(iobase, 0x28, bTmp | 0x80); // enable All interrupt
} }
void SI_SetMode(__u16 iobase, int mode) static void SI_SetMode(__u16 iobase, int mode)
{ {
//__u32 dTmp; //__u32 dTmp;
__u8 bTmp; __u8 bTmp;
...@@ -883,7 +725,7 @@ void SI_SetMode(__u16 iobase, int mode) ...@@ -883,7 +725,7 @@ void SI_SetMode(__u16 iobase, int mode)
bTmp = Rd_Indx(iobase, 0x40, 1); bTmp = Rd_Indx(iobase, 0x40, 1);
} }
void InitCard(__u16 iobase) static void InitCard(__u16 iobase)
{ {
ResetChip(iobase, 5); ResetChip(iobase, 5);
WriteReg(iobase, I_ST_CT_0, 0x00); // open CHIP on WriteReg(iobase, I_ST_CT_0, 0x00); // open CHIP on
...@@ -891,12 +733,7 @@ void InitCard(__u16 iobase) ...@@ -891,12 +733,7 @@ void InitCard(__u16 iobase)
SetSIREOF(iobase, 0xc1); SetSIREOF(iobase, 0xc1);
} }
void CommonShutDown(__u16 iobase, __u8 TxDMA) static void CommonInit(__u16 iobase)
{
DisableDmaChannel(TxDMA);
}
void CommonInit(__u16 iobase)
{ {
// EnTXCRC(iobase,0); // EnTXCRC(iobase,0);
SwapDMA(iobase, OFF); SwapDMA(iobase, OFF);
...@@ -921,7 +758,7 @@ void CommonInit(__u16 iobase) ...@@ -921,7 +758,7 @@ void CommonInit(__u16 iobase)
EnableDMA(iobase, ON); EnableDMA(iobase, ON);
} }
void SetBaudRate(__u16 iobase, __u32 rate) static void SetBaudRate(__u16 iobase, __u32 rate)
{ {
__u8 value = 11, temp; __u8 value = 11, temp;
...@@ -958,7 +795,7 @@ void SetBaudRate(__u16 iobase, __u32 rate) ...@@ -958,7 +795,7 @@ void SetBaudRate(__u16 iobase, __u32 rate)
WriteReg(iobase, I_CF_H_1, temp); WriteReg(iobase, I_CF_H_1, temp);
} }
void SetPulseWidth(__u16 iobase, __u8 width) static void SetPulseWidth(__u16 iobase, __u8 width)
{ {
__u8 temp, temp1, temp2; __u8 temp, temp1, temp2;
...@@ -972,7 +809,7 @@ void SetPulseWidth(__u16 iobase, __u8 width) ...@@ -972,7 +809,7 @@ void SetPulseWidth(__u16 iobase, __u8 width)
WriteReg(iobase, I_CF_H_1, temp1); WriteReg(iobase, I_CF_H_1, temp1);
} }
void SetSendPreambleCount(__u16 iobase, __u8 count) static void SetSendPreambleCount(__u16 iobase, __u8 count)
{ {
__u8 temp; __u8 temp;
...@@ -982,7 +819,7 @@ void SetSendPreambleCount(__u16 iobase, __u8 count) ...@@ -982,7 +819,7 @@ void SetSendPreambleCount(__u16 iobase, __u8 count)
} }
void SetVFIR(__u16 BaseAddr, __u8 val) static void SetVFIR(__u16 BaseAddr, __u8 val)
{ {
__u8 tmp; __u8 tmp;
...@@ -991,7 +828,7 @@ void SetVFIR(__u16 BaseAddr, __u8 val) ...@@ -991,7 +828,7 @@ void SetVFIR(__u16 BaseAddr, __u8 val)
WriteRegBit(BaseAddr, I_CF_H_0, 5, val); WriteRegBit(BaseAddr, I_CF_H_0, 5, val);
} }
void SetFIR(__u16 BaseAddr, __u8 val) static void SetFIR(__u16 BaseAddr, __u8 val)
{ {
__u8 tmp; __u8 tmp;
...@@ -1001,7 +838,7 @@ void SetFIR(__u16 BaseAddr, __u8 val) ...@@ -1001,7 +838,7 @@ void SetFIR(__u16 BaseAddr, __u8 val)
WriteRegBit(BaseAddr, I_CF_L_0, 6, val); WriteRegBit(BaseAddr, I_CF_L_0, 6, val);
} }
void SetMIR(__u16 BaseAddr, __u8 val) static void SetMIR(__u16 BaseAddr, __u8 val)
{ {
__u8 tmp; __u8 tmp;
...@@ -1011,7 +848,7 @@ void SetMIR(__u16 BaseAddr, __u8 val) ...@@ -1011,7 +848,7 @@ void SetMIR(__u16 BaseAddr, __u8 val)
WriteRegBit(BaseAddr, I_CF_L_0, 5, val); WriteRegBit(BaseAddr, I_CF_L_0, 5, val);
} }
void SetSIR(__u16 BaseAddr, __u8 val) static void SetSIR(__u16 BaseAddr, __u8 val)
{ {
__u8 tmp; __u8 tmp;
...@@ -1021,24 +858,4 @@ void SetSIR(__u16 BaseAddr, __u8 val) ...@@ -1021,24 +858,4 @@ void SetSIR(__u16 BaseAddr, __u8 val)
WriteRegBit(BaseAddr, I_CF_L_0, 4, val); WriteRegBit(BaseAddr, I_CF_L_0, 4, val);
} }
void ClrHBusy(__u16 iobase)
{
EnableDMA(iobase, OFF);
EnableDMA(iobase, ON);
RXStart(iobase, OFF);
RXStart(iobase, ON);
RXStart(iobase, OFF);
EnableDMA(iobase, OFF);
EnableDMA(iobase, ON);
}
void SetFifo64(__u16 iobase)
{
WriteRegBit(iobase, I_CF_H_0, 0, 0);
WriteRegBit(iobase, I_CF_H_0, 7, 0);
}
#endif /* via_IRCC_H */ #endif /* via_IRCC_H */
...@@ -202,8 +202,6 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq, ...@@ -202,8 +202,6 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
self->qos.min_turn_time.bits = qos_mtt_bits; self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos); irda_qos_bits_to_value(&self->qos);
self->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO;
/* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */ /* Max DMA buffer size needed = (data_size + 6) * (window_size) + 6; */
self->rx_buff.truesize = 14384; self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 4000; self->tx_buff.truesize = 4000;
...@@ -611,8 +609,8 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase) ...@@ -611,8 +609,8 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
set_dma_addr(self->io.dma, isa_virt_to_bus(self->tx_buff.data)); set_dma_addr(self->io.dma, isa_virt_to_bus(self->tx_buff.data));
set_dma_count(self->io.dma, self->tx_buff.len); set_dma_count(self->io.dma, self->tx_buff.len);
#else #else
setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len, irda_setup_dma(self->io.dma, self->tx_buff.data, self->tx_buff.len,
DMA_MODE_WRITE); DMA_MODE_WRITE);
#endif #endif
self->io.direction = IO_XMIT; self->io.direction = IO_XMIT;
...@@ -679,7 +677,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size) ...@@ -679,7 +677,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
* *
* *
*/ */
void w83977af_dma_xmit_complete(struct w83977af_ir *self) static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
{ {
int iobase; int iobase;
__u8 set; __u8 set;
...@@ -768,8 +766,8 @@ int w83977af_dma_receive(struct w83977af_ir *self) ...@@ -768,8 +766,8 @@ int w83977af_dma_receive(struct w83977af_ir *self)
set_dma_addr(self->io.dma, isa_virt_to_bus(self->rx_buff.data)); set_dma_addr(self->io.dma, isa_virt_to_bus(self->rx_buff.data));
set_dma_count(self->io.dma, self->rx_buff.truesize); set_dma_count(self->io.dma, self->rx_buff.truesize);
#else #else
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize, irda_setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize,
DMA_MODE_READ); DMA_MODE_READ);
#endif #endif
/* /*
* Reset Rx FIFO. This will also flush the ST_FIFO, it's very * Reset Rx FIFO. This will also flush the ST_FIFO, it's very
......
...@@ -41,10 +41,10 @@ ...@@ -41,10 +41,10 @@
* of bytes. No alignment or length assumptions are made about * of bytes. No alignment or length assumptions are made about
* the input key. * the input key.
*/ */
static inline u32 jhash(void *key, u32 length, u32 initval) static inline u32 jhash(const void *key, u32 length, u32 initval)
{ {
u32 a, b, c, len; u32 a, b, c, len;
u8 *k = key; const u8 *k = key;
len = length; len = length;
a = b = JHASH_GOLDEN_RATIO; a = b = JHASH_GOLDEN_RATIO;
......
...@@ -348,6 +348,9 @@ static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) ...@@ -348,6 +348,9 @@ static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
struct hci_dev *hci_dev_get(int index); struct hci_dev *hci_dev_get(int index);
struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst); struct hci_dev *hci_get_route(bdaddr_t *src, bdaddr_t *dst);
struct hci_dev *hci_alloc_dev(void);
void hci_free_dev(struct hci_dev *hdev);
int hci_register_dev(struct hci_dev *hdev); int hci_register_dev(struct hci_dev *hdev);
int hci_unregister_dev(struct hci_dev *hdev); int hci_unregister_dev(struct hci_dev *hdev);
int hci_suspend_dev(struct hci_dev *hdev); int hci_suspend_dev(struct hci_dev *hdev);
......
...@@ -212,7 +212,6 @@ struct ali_ircc_cb { ...@@ -212,7 +212,6 @@ struct ali_ircc_cb {
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed; __u32 new_speed;
int index; /* Instance index */ int index; /* Instance index */
......
...@@ -115,7 +115,6 @@ struct au1k_private { ...@@ -115,7 +115,6 @@ struct au1k_private {
struct irlap_cb *irlap; struct irlap_cb *irlap;
u8 open; u8 open;
u32 flags; /* Interface flags */
u32 speed; u32 speed;
u32 newspeed; u32 newspeed;
......
...@@ -80,7 +80,7 @@ struct ircomm_tty_cb { ...@@ -80,7 +80,7 @@ struct ircomm_tty_cb {
LOCAL_FLOW flow; /* IrTTP flow status */ LOCAL_FLOW flow; /* IrTTP flow status */
int line; int line;
volatile unsigned long flags; unsigned long flags;
__u8 dlsap_sel; __u8 dlsap_sel;
__u8 slsap_sel; __u8 slsap_sel;
......
...@@ -159,6 +159,5 @@ struct irda_usb_cb { ...@@ -159,6 +159,5 @@ struct irda_usb_cb {
__s16 new_xbofs; /* xbofs we need to set */ __s16 new_xbofs; /* xbofs we need to set */
__u32 speed; /* Current speed */ __u32 speed; /* Current speed */
__s32 new_speed; /* speed we need to set */ __s32 new_speed; /* speed we need to set */
__u32 flags; /* Interface flags */
}; };
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <linux/skbuff.h> /* struct sk_buff */ #include <linux/skbuff.h> /* struct sk_buff */
#include <linux/irda.h> #include <linux/irda.h>
#include <net/pkt_sched.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/qos.h> /* struct qos_info */ #include <net/irda/qos.h> /* struct qos_info */
#include <net/irda/irqueue.h> /* irda_queue_t */ #include <net/irda/irqueue.h> /* irda_queue_t */
...@@ -219,7 +220,10 @@ int irda_device_is_media_busy(struct net_device *dev); ...@@ -219,7 +220,10 @@ int irda_device_is_media_busy(struct net_device *dev);
int irda_device_is_receiving(struct net_device *dev); int irda_device_is_receiving(struct net_device *dev);
/* Interface for internal use */ /* Interface for internal use */
int irda_device_txqueue_empty(struct net_device *dev); static inline int irda_device_txqueue_empty(const struct net_device *dev)
{
return (skb_queue_len(&dev->qdisc->q) == 0);
}
int irda_device_set_raw_mode(struct net_device* self, int status); int irda_device_set_raw_mode(struct net_device* self, int status);
int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts); int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts);
int irda_device_change_speed(struct net_device *dev, __u32 speed); int irda_device_change_speed(struct net_device *dev, __u32 speed);
...@@ -233,19 +237,16 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type); ...@@ -233,19 +237,16 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type);
int irda_device_dongle_cleanup(dongle_t *dongle); int irda_device_dongle_cleanup(dongle_t *dongle);
#ifdef CONFIG_ISA #ifdef CONFIG_ISA
void setup_dma(int channel, char *buffer, int count, int mode); void irda_setup_dma(int channel, char *buffer, int count, int mode);
#endif #endif
void irda_task_delete(struct irda_task *task); void irda_task_delete(struct irda_task *task);
int irda_task_kick(struct irda_task *task);
struct irda_task *irda_task_execute(void *instance, struct irda_task *irda_task_execute(void *instance,
IRDA_TASK_CALLBACK function, IRDA_TASK_CALLBACK function,
IRDA_TASK_CALLBACK finished, IRDA_TASK_CALLBACK finished,
struct irda_task *parent, void *param); struct irda_task *parent, void *param);
void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state);
extern const char *infrared_mode[];
/* /*
* Function irda_get_mtt (skb) * Function irda_get_mtt (skb)
* *
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
*/ */
#define HB_NOLOCK 0 /* No concurent access prevention */ #define HB_NOLOCK 0 /* No concurent access prevention */
#define HB_LOCK 1 /* Prevent concurent write with global lock */ #define HB_LOCK 1 /* Prevent concurent write with global lock */
#define HB_SORTED 4 /* Not yet supported */
/* /*
* Hash defines * Hash defines
...@@ -81,13 +80,13 @@ hashbin_t *hashbin_new(int type); ...@@ -81,13 +80,13 @@ hashbin_t *hashbin_new(int type);
int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func); int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func);
int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func); int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func);
void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
char* name); const char* name);
void* hashbin_remove(hashbin_t* hashbin, long hashv, char* name); void* hashbin_remove(hashbin_t* hashbin, long hashv, const char* name);
void* hashbin_remove_first(hashbin_t *hashbin); void* hashbin_remove_first(hashbin_t *hashbin);
void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry); void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry);
void* hashbin_find(hashbin_t* hashbin, long hashv, char* name); void* hashbin_find(hashbin_t* hashbin, long hashv, const char* name);
void* hashbin_lock_find(hashbin_t* hashbin, long hashv, char* name); void* hashbin_lock_find(hashbin_t* hashbin, long hashv, const char* name);
void* hashbin_find_next(hashbin_t* hashbin, long hashv, char* name, void* hashbin_find_next(hashbin_t* hashbin, long hashv, const char* name,
void ** pnext); void ** pnext);
irda_queue_t *hashbin_get_first(hashbin_t *hashbin); irda_queue_t *hashbin_get_first(hashbin_t *hashbin);
irda_queue_t *hashbin_get_next(hashbin_t *hashbin); irda_queue_t *hashbin_get_next(hashbin_t *hashbin);
......
...@@ -263,7 +263,6 @@ struct nsc_ircc_cb { ...@@ -263,7 +263,6 @@ struct nsc_ircc_cb {
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed; __u32 new_speed;
int index; /* Instance index */ int index; /* Instance index */
......
...@@ -170,7 +170,6 @@ struct ircc_cb { ...@@ -170,7 +170,6 @@ struct ircc_cb {
* synchronised - Jean II */ * synchronised - Jean II */
__u32 new_speed; __u32 new_speed;
__u32 flags; /* Interface flags */
int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */ int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */
int tx_len; /* Number of frames in tx_buff */ int tx_len; /* Number of frames in tx_buff */
......
...@@ -146,7 +146,6 @@ struct toshoboe_cb ...@@ -146,7 +146,6 @@ struct toshoboe_cb
chipio_t io; /* IrDA controller information */ chipio_t io; /* IrDA controller information */
__u32 flags; /* Interface flags */
__u32 new_speed; __u32 new_speed;
struct pci_dev *pdev; /*PCI device */ struct pci_dev *pdev; /*PCI device */
......
...@@ -185,7 +185,6 @@ struct w83977af_ir { ...@@ -185,7 +185,6 @@ struct w83977af_ir {
* locking strategy. - Jean II */ * locking strategy. - Jean II */
spinlock_t lock; /* For serializing operations */ spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed; __u32 new_speed;
}; };
......
...@@ -67,7 +67,7 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); ...@@ -67,7 +67,7 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
single destination while waiting for SVC */ single destination while waiting for SVC */
static int lec_open(struct net_device *dev); static int lec_open(struct net_device *dev);
static int lec_send_packet(struct sk_buff *skb, struct net_device *dev); static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev);
static int lec_close(struct net_device *dev); static int lec_close(struct net_device *dev);
static struct net_device_stats *lec_get_stats(struct net_device *dev); static struct net_device_stats *lec_get_stats(struct net_device *dev);
static void lec_init(struct net_device *dev); static void lec_init(struct net_device *dev);
...@@ -211,26 +211,34 @@ lec_open(struct net_device *dev) ...@@ -211,26 +211,34 @@ lec_open(struct net_device *dev)
static __inline__ void static __inline__ void
lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv) lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
{ {
if (atm_may_send(vcc, skb->len)) { ATM_SKB(skb)->vcc = vcc;
atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc); ATM_SKB(skb)->atm_options = vcc->atm_options;
ATM_SKB(skb)->vcc = vcc;
ATM_SKB(skb)->atm_options = vcc->atm_options; atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);
priv->stats.tx_packets++; if (vcc->send(vcc, skb) < 0) {
priv->stats.tx_bytes += skb->len;
vcc->send(vcc, skb);
} else {
priv->stats.tx_dropped++; priv->stats.tx_dropped++;
dev_kfree_skb(skb); return;
} }
priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
}
static void
lec_tx_timeout(struct net_device *dev)
{
printk(KERN_INFO "%s: tx timeout\n", dev->name);
dev->trans_start = jiffies;
netif_wake_queue(dev);
} }
static int static int
lec_send_packet(struct sk_buff *skb, struct net_device *dev) lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
struct lec_priv *priv = (struct lec_priv *)dev->priv; struct lec_priv *priv = (struct lec_priv *)dev->priv;
struct lecdatahdr_8023 *lec_h; struct lecdatahdr_8023 *lec_h;
struct atm_vcc *send_vcc; struct atm_vcc *vcc;
struct lec_arp_table *entry; struct lec_arp_table *entry;
unsigned char *dst; unsigned char *dst;
int min_frame_size; int min_frame_size;
...@@ -243,7 +251,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -243,7 +251,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
int i=0; int i=0;
#endif /* DUMP_PACKETS >0 */ #endif /* DUMP_PACKETS >0 */
DPRINTK("Lec_send_packet called\n"); DPRINTK("lec_start_xmit called\n");
if (!priv->lecd) { if (!priv->lecd) {
printk("%s:No lecd attached\n",dev->name); printk("%s:No lecd attached\n",dev->name);
priv->stats.tx_errors++; priv->stats.tx_errors++;
...@@ -262,7 +270,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -262,7 +270,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
/* Make sure we have room for lec_id */ /* Make sure we have room for lec_id */
if (skb_headroom(skb) < 2) { if (skb_headroom(skb) < 2) {
DPRINTK("lec_send_packet: reallocating skb\n"); DPRINTK("lec_start_xmit: reallocating skb\n");
skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN); skb2 = skb_realloc_headroom(skb, LEC_HEADER_LEN);
kfree_skb(skb); kfree_skb(skb);
if (skb2 == NULL) return 0; if (skb2 == NULL) return 0;
...@@ -337,18 +345,18 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -337,18 +345,18 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
} }
#endif #endif
entry = NULL; entry = NULL;
send_vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry); vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
DPRINTK("%s:send_vcc:%p vcc_flags:%x, entry:%p\n", dev->name, DPRINTK("%s:vcc:%p vcc_flags:%x, entry:%p\n", dev->name,
send_vcc, send_vcc?send_vcc->flags:0, entry); vcc, vcc?vcc->flags:0, entry);
if (!send_vcc || !test_bit(ATM_VF_READY,&send_vcc->flags)) { if (!vcc || !test_bit(ATM_VF_READY,&vcc->flags)) {
if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
DPRINTK("%s:lec_send_packet: queuing packet, ", dev->name); DPRINTK("%s:lec_start_xmit: queuing packet, ", dev->name);
DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n", DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2], lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2],
lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]); lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]);
skb_queue_tail(&entry->tx_wait, skb); skb_queue_tail(&entry->tx_wait, skb);
} else { } else {
DPRINTK("%s:lec_send_packet: tx queue full or no arp entry, dropping, ", dev->name); DPRINTK("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", dev->name);
DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n", DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2], lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2],
lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]); lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]);
...@@ -360,7 +368,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -360,7 +368,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
#if DUMP_PACKETS > 0 #if DUMP_PACKETS > 0
printk("%s:sending to vpi:%d vci:%d\n", dev->name, printk("%s:sending to vpi:%d vci:%d\n", dev->name,
send_vcc->vpi, send_vcc->vci); vcc->vpi, vcc->vci);
#endif /* DUMP_PACKETS > 0 */ #endif /* DUMP_PACKETS > 0 */
while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
...@@ -368,15 +376,28 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -368,15 +376,28 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n", DPRINTK("MAC address 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2], lec_h->h_dest[0], lec_h->h_dest[1], lec_h->h_dest[2],
lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]); lec_h->h_dest[3], lec_h->h_dest[4], lec_h->h_dest[5]);
lec_send(send_vcc, skb2, priv); lec_send(vcc, skb2, priv);
} }
lec_send(send_vcc, skb, priv); lec_send(vcc, skb, priv);
#if 0 if (!atm_may_send(vcc, 0)) {
/* Should we wait for card's device driver to notify us? */ struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
dev->tbusy=0;
#endif vpriv->xoff = 1;
netif_stop_queue(dev);
/*
* vcc->pop() might have occurred in between, making
* the vcc usuable again. Since xmit is serialized,
* this is the only situation we have to re-test.
*/
if (atm_may_send(vcc, 0))
netif_wake_queue(dev);
}
dev->trans_start = jiffies;
return 0; return 0;
} }
...@@ -635,7 +656,8 @@ lec_init(struct net_device *dev) ...@@ -635,7 +656,8 @@ lec_init(struct net_device *dev)
dev->change_mtu = lec_change_mtu; dev->change_mtu = lec_change_mtu;
dev->open = lec_open; dev->open = lec_open;
dev->stop = lec_close; dev->stop = lec_close;
dev->hard_start_xmit = lec_send_packet; dev->hard_start_xmit = lec_start_xmit;
dev->tx_timeout = lec_tx_timeout;
dev->get_stats = lec_get_stats; dev->get_stats = lec_get_stats;
dev->set_multicast_list = lec_set_multicast_list; dev->set_multicast_list = lec_set_multicast_list;
...@@ -731,9 +753,30 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -731,9 +753,30 @@ lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
} }
} }
void
lec_pop(struct atm_vcc *vcc, struct sk_buff *skb)
{
struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
struct net_device *dev = skb->dev;
if (vpriv == NULL) {
printk("lec_pop(): vpriv = NULL!?!?!?\n");
return;
}
vpriv->old_pop(vcc, skb);
if (vpriv->xoff && atm_may_send(vcc, 0)) {
vpriv->xoff = 0;
if (netif_running(dev) && netif_queue_stopped(dev))
netif_wake_queue(dev);
}
}
int int
lec_vcc_attach(struct atm_vcc *vcc, void *arg) lec_vcc_attach(struct atm_vcc *vcc, void *arg)
{ {
struct lec_vcc_priv *vpriv;
int bytes_left; int bytes_left;
struct atmlec_ioc ioc_data; struct atmlec_ioc ioc_data;
...@@ -746,6 +789,12 @@ lec_vcc_attach(struct atm_vcc *vcc, void *arg) ...@@ -746,6 +789,12 @@ lec_vcc_attach(struct atm_vcc *vcc, void *arg)
if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF || if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF ||
!dev_lec[ioc_data.dev_num]) !dev_lec[ioc_data.dev_num])
return -EINVAL; return -EINVAL;
if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL)))
return -ENOMEM;
vpriv->xoff = 0;
vpriv->old_pop = vcc->pop;
LEC_VCC_PRIV(vcc) = vpriv;
vcc->pop = lec_pop;
lec_vcc_added(dev_lec[ioc_data.dev_num]->priv, lec_vcc_added(dev_lec[ioc_data.dev_num]->priv,
&ioc_data, vcc, vcc->push); &ioc_data, vcc, vcc->push);
vcc->push = lec_push; vcc->push = lec_push;
...@@ -1363,22 +1412,21 @@ void ...@@ -1363,22 +1412,21 @@ void
lec_arp_clear_vccs(struct lec_arp_table *entry) lec_arp_clear_vccs(struct lec_arp_table *entry)
{ {
if (entry->vcc) { if (entry->vcc) {
entry->vcc->push = entry->old_push; struct atm_vcc *vcc = entry->vcc;
#if 0 /* August 6, 1998 */ struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
set_bit(ATM_VF_RELEASED,&entry->vcc->flags); struct net_device *dev = (struct net_device*) vcc->proto_data;
clear_bit(ATM_VF_READY,&entry->vcc->flags);
entry->vcc->push(entry->vcc, NULL); vcc->pop = vpriv->old_pop;
#endif if (vpriv->xoff)
vcc_release_async(entry->vcc, -EPIPE); netif_wake_queue(dev);
entry->vcc = NULL; kfree(vpriv);
LEC_VCC_PRIV(vcc) = NULL;
vcc->push = entry->old_push;
vcc_release_async(vcc, -EPIPE);
vcc = NULL;
} }
if (entry->recv_vcc) { if (entry->recv_vcc) {
entry->recv_vcc->push = entry->old_recv_push; entry->recv_vcc->push = entry->old_recv_push;
#if 0
set_bit(ATM_VF_RELEASED,&entry->recv_vcc->flags);
clear_bit(ATM_VF_READY,&entry->recv_vcc->flags);
entry->recv_vcc->push(entry->recv_vcc, NULL);
#endif
vcc_release_async(entry->recv_vcc, -EPIPE); vcc_release_async(entry->recv_vcc, -EPIPE);
entry->recv_vcc = NULL; entry->recv_vcc = NULL;
} }
...@@ -2320,11 +2368,20 @@ lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc) ...@@ -2320,11 +2368,20 @@ lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
unsigned char mac_addr[] = { unsigned char mac_addr[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct lec_arp_table *to_add; struct lec_arp_table *to_add;
struct lec_vcc_priv *vpriv;
if (!(vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL)))
return -ENOMEM;
vpriv->xoff = 0;
vpriv->old_pop = vcc->pop;
LEC_VCC_PRIV(vcc) = vpriv;
vcc->pop = lec_pop;
lec_arp_get(priv); lec_arp_get(priv);
to_add = make_entry(priv, mac_addr); to_add = make_entry(priv, mac_addr);
if (!to_add) { if (!to_add) {
lec_arp_put(priv); lec_arp_put(priv);
vcc->pop = vpriv->old_pop;
kfree(vpriv);
return -ENOMEM; return -ENOMEM;
} }
memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN); memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN);
......
...@@ -139,6 +139,13 @@ struct lec_priv { ...@@ -139,6 +139,13 @@ struct lec_priv {
int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */ int is_trdev; /* Device type, 0 = Ethernet, 1 = TokenRing */
}; };
struct lec_vcc_priv {
void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb);
int xoff;
};
#define LEC_VCC_PRIV(vcc) ((struct lec_vcc_priv *)((vcc)->user_back))
int lecd_attach(struct atm_vcc *vcc, int arg); int lecd_attach(struct atm_vcc *vcc, int arg);
int lec_vcc_attach(struct atm_vcc *vcc, void *arg); int lec_vcc_attach(struct atm_vcc *vcc, void *arg);
int lec_mcast_attach(struct atm_vcc *vcc, int arg); int lec_mcast_attach(struct atm_vcc *vcc, int arg);
......
...@@ -762,6 +762,27 @@ int hci_get_dev_info(unsigned long arg) ...@@ -762,6 +762,27 @@ int hci_get_dev_info(unsigned long arg)
/* ---- Interface to HCI drivers ---- */ /* ---- Interface to HCI drivers ---- */
/* Alloc HCI device */
struct hci_dev *hci_alloc_dev(void)
{
struct hci_dev *hdev;
hdev = kmalloc(sizeof(struct hci_dev), GFP_KERNEL);
if (!hdev)
return NULL;
memset(hdev, 0, sizeof(struct hci_dev));
return hdev;
}
/* Free HCI device */
void hci_free_dev(struct hci_dev *hdev)
{
/* will free via class release */
class_device_put(&hdev->class_dev);
}
/* Register HCI device */ /* Register HCI device */
int hci_register_dev(struct hci_dev *hdev) int hci_register_dev(struct hci_dev *hdev)
{ {
......
...@@ -96,6 +96,9 @@ static int bt_hotplug(struct class_device *cdev, char **envp, int num_envp, char ...@@ -96,6 +96,9 @@ static int bt_hotplug(struct class_device *cdev, char **envp, int num_envp, char
static void bt_release(struct class_device *cdev) static void bt_release(struct class_device *cdev)
{ {
struct hci_dev *hdev = class_get_devdata(cdev);
kfree(hdev);
} }
static struct class bt_class = { static struct class bt_class = {
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_core.h>
/* HCI Core */ /* HCI Core */
EXPORT_SYMBOL(hci_alloc_dev);
EXPORT_SYMBOL(hci_free_dev);
EXPORT_SYMBOL(hci_register_dev); EXPORT_SYMBOL(hci_register_dev);
EXPORT_SYMBOL(hci_unregister_dev); EXPORT_SYMBOL(hci_unregister_dev);
EXPORT_SYMBOL(hci_suspend_dev); EXPORT_SYMBOL(hci_suspend_dev);
......
...@@ -1691,7 +1691,7 @@ int netif_receive_skb(struct sk_buff *skb) ...@@ -1691,7 +1691,7 @@ int netif_receive_skb(struct sk_buff *skb)
{ {
struct packet_type *ptype, *pt_prev; struct packet_type *ptype, *pt_prev;
int ret = NET_RX_DROP; int ret = NET_RX_DROP;
unsigned short type = skb->protocol; unsigned short type;
if (!skb->stamp.tv_sec) if (!skb->stamp.tv_sec)
do_gettimeofday(&skb->stamp); do_gettimeofday(&skb->stamp);
...@@ -1725,6 +1725,7 @@ int netif_receive_skb(struct sk_buff *skb) ...@@ -1725,6 +1725,7 @@ int netif_receive_skb(struct sk_buff *skb)
if (__handle_bridge(skb, &pt_prev, &ret)) if (__handle_bridge(skb, &pt_prev, &ret))
goto out; goto out;
type = skb->protocol;
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) { list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
if (ptype->type == type && if (ptype->type == type &&
(!ptype->dev || ptype->dev == skb->dev)) { (!ptype->dev || ptype->dev == skb->dev)) {
......
...@@ -1196,6 +1196,7 @@ EXPORT_SYMBOL(sock_setsockopt); ...@@ -1196,6 +1196,7 @@ EXPORT_SYMBOL(sock_setsockopt);
EXPORT_SYMBOL(sock_wfree); EXPORT_SYMBOL(sock_wfree);
EXPORT_SYMBOL(sock_wmalloc); EXPORT_SYMBOL(sock_wmalloc);
#ifdef CONFIG_SYSCTL #ifdef CONFIG_SYSCTL
EXPORT_SYMBOL(sysctl_optmem_max);
EXPORT_SYMBOL(sysctl_rmem_max); EXPORT_SYMBOL(sysctl_rmem_max);
EXPORT_SYMBOL(sysctl_wmem_max); EXPORT_SYMBOL(sysctl_wmem_max);
#endif #endif
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/wireless.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <asm/ioctls.h> #include <asm/ioctls.h>
...@@ -48,8 +47,6 @@ ...@@ -48,8 +47,6 @@
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/io.h> #include <asm/io.h>
#include <net/pkt_sched.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
#include <net/irda/irlap.h> #include <net/irda/irlap.h>
#include <net/irda/timer.h> #include <net/irda/timer.h>
...@@ -60,13 +57,6 @@ static void __irda_task_delete(struct irda_task *task); ...@@ -60,13 +57,6 @@ static void __irda_task_delete(struct irda_task *task);
static hashbin_t *dongles = NULL; static hashbin_t *dongles = NULL;
static hashbin_t *tasks = NULL; static hashbin_t *tasks = NULL;
const char *infrared_mode[] = {
"IRDA_IRLAP",
"IRDA_RAW",
"SHARP_ASK",
"TV_REMOTE",
};
#ifdef CONFIG_IRDA_DEBUG #ifdef CONFIG_IRDA_DEBUG
static const char *task_state[] = { static const char *task_state[] = {
"IRDA_TASK_INIT", "IRDA_TASK_INIT",
...@@ -248,7 +238,7 @@ void irda_task_delete(struct irda_task *task) ...@@ -248,7 +238,7 @@ void irda_task_delete(struct irda_task *task)
* processing, and notify the parent task, that is waiting for this task * processing, and notify the parent task, that is waiting for this task
* to complete. * to complete.
*/ */
int irda_task_kick(struct irda_task *task) static int irda_task_kick(struct irda_task *task)
{ {
int finished = TRUE; int finished = TRUE;
int count = 0; int count = 0;
...@@ -406,22 +396,6 @@ struct net_device *alloc_irdadev(int sizeof_priv) ...@@ -406,22 +396,6 @@ struct net_device *alloc_irdadev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "irda%d", irda_device_setup); return alloc_netdev(sizeof_priv, "irda%d", irda_device_setup);
} }
/*
* Function irda_device_txqueue_empty (dev)
*
* Check if there is still some frames in the transmit queue for this
* device. Maybe we should use: q->q.qlen == 0.
*
*/
int irda_device_txqueue_empty(struct net_device *dev)
{
if (skb_queue_len(&dev->qdisc->q))
return FALSE;
return TRUE;
}
/* /*
* Function irda_device_init_dongle (self, type, qos) * Function irda_device_init_dongle (self, type, qos)
* *
...@@ -557,7 +531,7 @@ int irda_device_set_mode(struct net_device* dev, int mode) ...@@ -557,7 +531,7 @@ int irda_device_set_mode(struct net_device* dev, int mode)
* Setup the DMA channel. Commonly used by ISA FIR drivers * Setup the DMA channel. Commonly used by ISA FIR drivers
* *
*/ */
void setup_dma(int channel, char *buffer, int count, int mode) void irda_setup_dma(int channel, char *buffer, int count, int mode)
{ {
unsigned long flags; unsigned long flags;
...@@ -572,4 +546,5 @@ void setup_dma(int channel, char *buffer, int count, int mode) ...@@ -572,4 +546,5 @@ void setup_dma(int channel, char *buffer, int count, int mode)
release_dma_lock(flags); release_dma_lock(flags);
} }
EXPORT_SYMBOL(irda_setup_dma);
#endif #endif
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
* This function hash the input string 'name' using the ELF hash * This function hash the input string 'name' using the ELF hash
* function for strings. * function for strings.
*/ */
static __u32 hash( char* name) static __u32 hash( const char* name)
{ {
__u32 h = 0; __u32 h = 0;
__u32 g; __u32 g;
...@@ -254,105 +254,6 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element) ...@@ -254,105 +254,6 @@ static void enqueue_first(irda_queue_t **queue, irda_queue_t* element)
} }
} }
#ifdef HASHBIN_UNUSED
/*
* Function enqueue_last (queue, proc)
*
* Insert item into end of queue.
*
*/
static void __enqueue_last( irda_queue_t **queue, irda_queue_t* element)
{
IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
/*
* Check if queue is empty.
*/
if ( *queue == NULL ) {
/*
* Queue is empty. Insert one element into the queue.
*/
element->q_next = element->q_prev = *queue = element;
} else {
/*
* Queue is not empty. Insert element into end of queue.
*/
element->q_prev = (*queue)->q_prev;
element->q_prev->q_next = element;
(*queue)->q_prev = element;
element->q_next = *queue;
}
}
static inline void enqueue_last( irda_queue_t **queue, irda_queue_t* element)
{
unsigned long flags;
save_flags(flags);
cli();
__enqueue_last( queue, element);
restore_flags(flags);
}
/*
* Function enqueue_queue (queue, list)
*
* Insert a queue (list) into the start of the first queue
*
*/
static void enqueue_queue( irda_queue_t** queue, irda_queue_t** list )
{
irda_queue_t* tmp;
/*
* Check if queue is empty
*/
if ( *queue ) {
(*list)->q_prev->q_next = (*queue);
(*queue)->q_prev->q_next = (*list);
tmp = (*list)->q_prev;
(*list)->q_prev = (*queue)->q_prev;
(*queue)->q_prev = tmp;
} else {
*queue = (*list);
}
(*list) = NULL;
}
/*
* Function enqueue_second (queue, proc)
*
* Insert item behind head of queue.
*
*/
static void enqueue_second(irda_queue_t **queue, irda_queue_t* element)
{
IRDA_DEBUG( 0, "enqueue_second()\n");
/*
* Check if queue is empty.
*/
if ( *queue == NULL ) {
/*
* Queue is empty. Insert one element into the queue.
*/
element->q_next = element->q_prev = *queue = element;
} else {
/*
* Queue is not empty. Insert element into ..
*/
element->q_prev = (*queue);
(*queue)->q_next->q_prev = element;
element->q_next = (*queue)->q_next;
(*queue)->q_next = element;
}
}
#endif /* HASHBIN_UNUSED */
/* /*
* Function dequeue (queue) * Function dequeue (queue)
...@@ -474,38 +375,6 @@ hashbin_t *hashbin_new(int type) ...@@ -474,38 +375,6 @@ hashbin_t *hashbin_new(int type)
return hashbin; return hashbin;
} }
#ifdef HASHBIN_UNUSED
/*
* Function hashbin_clear (hashbin, free_func)
*
* Remove all entries from the hashbin, see also the comments in
* hashbin_delete() below
*/
int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func)
{
irda_queue_t* queue;
int i;
ASSERT(hashbin != NULL, return -1;);
ASSERT(hashbin->magic == HB_MAGIC, return -1;);
/*
* Free the entries in the hashbin
*/
for (i = 0; i < HASHBIN_SIZE; i ++ ) {
queue = dequeue_first( (irda_queue_t**) &hashbin->hb_queue[i]);
while (queue) {
if (free_func)
(*free_func)(queue);
queue = dequeue_first(
(irda_queue_t**) &hashbin->hb_queue[i]);
}
}
hashbin->hb_size = 0;
return 0;
}
#endif /* HASHBIN_UNUSED */
/* /*
* Function hashbin_delete (hashbin, free_func) * Function hashbin_delete (hashbin, free_func)
...@@ -567,7 +436,8 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) ...@@ -567,7 +436,8 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
* Insert an entry into the hashbin * Insert an entry into the hashbin
* *
*/ */
void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, char* name) void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
const char* name)
{ {
unsigned long flags = 0; unsigned long flags = 0;
int bin; int bin;
...@@ -598,14 +468,9 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, char* n ...@@ -598,14 +468,9 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, char* n
/* /*
* Insert new entry first * Insert new entry first
* TODO: Perhaps allow sorted lists?
* -> Merge sort if a sorted list should be created
*/ */
if ( hashbin->hb_type & HB_SORTED) { enqueue_first( (irda_queue_t**) &hashbin->hb_queue[ bin ],
} else { entry);
enqueue_first( (irda_queue_t**) &hashbin->hb_queue[ bin ],
entry);
}
hashbin->hb_size++; hashbin->hb_size++;
/* Release lock */ /* Release lock */
...@@ -683,7 +548,7 @@ void *hashbin_remove_first( hashbin_t *hashbin) ...@@ -683,7 +548,7 @@ void *hashbin_remove_first( hashbin_t *hashbin)
* In other case, you must think hard to guarantee unicity of the index. * In other case, you must think hard to guarantee unicity of the index.
* Jean II * Jean II
*/ */
void* hashbin_remove( hashbin_t* hashbin, long hashv, char* name) void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name)
{ {
int bin, found = FALSE; int bin, found = FALSE;
unsigned long flags = 0; unsigned long flags = 0;
...@@ -834,7 +699,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry) ...@@ -834,7 +699,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry)
* Find item with the given hashv or name * Find item with the given hashv or name
* *
*/ */
void* hashbin_find( hashbin_t* hashbin, long hashv, char* name ) void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name )
{ {
int bin; int bin;
irda_queue_t* entry; irda_queue_t* entry;
...@@ -888,7 +753,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, char* name ) ...@@ -888,7 +753,7 @@ void* hashbin_find( hashbin_t* hashbin, long hashv, char* name )
* I call it safe, but it's only safe with respect to the hashbin, not its * I call it safe, but it's only safe with respect to the hashbin, not its
* content. - Jean II * content. - Jean II
*/ */
void* hashbin_lock_find( hashbin_t* hashbin, long hashv, char* name ) void* hashbin_lock_find( hashbin_t* hashbin, long hashv, const char* name )
{ {
unsigned long flags = 0; unsigned long flags = 0;
irda_queue_t* entry; irda_queue_t* entry;
...@@ -917,7 +782,7 @@ void* hashbin_lock_find( hashbin_t* hashbin, long hashv, char* name ) ...@@ -917,7 +782,7 @@ void* hashbin_lock_find( hashbin_t* hashbin, long hashv, char* name )
* context of the search. On the other hand, it might fail and return * context of the search. On the other hand, it might fail and return
* NULL if the entry is removed. - Jean II * NULL if the entry is removed. - Jean II
*/ */
void* hashbin_find_next( hashbin_t* hashbin, long hashv, char* name, void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name,
void ** pnext) void ** pnext)
{ {
unsigned long flags = 0; unsigned long flags = 0;
......
...@@ -159,7 +159,6 @@ EXPORT_SYMBOL(irda_device_dongle_cleanup); ...@@ -159,7 +159,6 @@ EXPORT_SYMBOL(irda_device_dongle_cleanup);
EXPORT_SYMBOL(irda_device_register_dongle); EXPORT_SYMBOL(irda_device_register_dongle);
EXPORT_SYMBOL(irda_device_unregister_dongle); EXPORT_SYMBOL(irda_device_unregister_dongle);
EXPORT_SYMBOL(irda_task_execute); EXPORT_SYMBOL(irda_task_execute);
EXPORT_SYMBOL(irda_task_kick);
EXPORT_SYMBOL(irda_task_next_state); EXPORT_SYMBOL(irda_task_next_state);
EXPORT_SYMBOL(irda_task_delete); EXPORT_SYMBOL(irda_task_delete);
...@@ -168,10 +167,6 @@ EXPORT_SYMBOL(async_unwrap_char); ...@@ -168,10 +167,6 @@ EXPORT_SYMBOL(async_unwrap_char);
EXPORT_SYMBOL(irda_calc_crc16); EXPORT_SYMBOL(irda_calc_crc16);
EXPORT_SYMBOL(irda_crc16_table); EXPORT_SYMBOL(irda_crc16_table);
EXPORT_SYMBOL(irda_start_timer); EXPORT_SYMBOL(irda_start_timer);
#ifdef CONFIG_ISA
EXPORT_SYMBOL(setup_dma);
#endif
EXPORT_SYMBOL(infrared_mode);
#ifdef CONFIG_IRTTY #ifdef CONFIG_IRTTY
EXPORT_SYMBOL(irtty_set_dtr_rts); EXPORT_SYMBOL(irtty_set_dtr_rts);
......
...@@ -41,7 +41,7 @@ static void __rxrpc_conn_timeout(rxrpc_timer_t *timer) ...@@ -41,7 +41,7 @@ static void __rxrpc_conn_timeout(rxrpc_timer_t *timer)
} }
static const struct rxrpc_timer_ops rxrpc_conn_timer_ops = { static const struct rxrpc_timer_ops rxrpc_conn_timer_ops = {
timed_out: __rxrpc_conn_timeout, .timed_out = __rxrpc_conn_timeout,
}; };
/*****************************************************************************/ /*****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment