Commit db78e720 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.davemloft.net:/disk1/BK/net-2.6

into kernel.bkbits.net:/home/davem/net-2.6
parents 047c4ecd e4c4449e
...@@ -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;
......
This diff is collapsed.
...@@ -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;
......
This diff is collapsed.
...@@ -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