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);
#define BFUSB_MAX_BULK_RX 2
struct bfusb {
struct hci_dev hdev;
struct hci_dev *hdev;
unsigned long state;
......@@ -155,7 +155,7 @@ static int bfusb_send_bulk(struct bfusb *bfusb, struct sk_buff *skb)
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk tx submit failed urb %p err %d",
bfusb->hdev.name, urb, err);
bfusb->hdev->name, urb, err);
skb_unlink(skb);
usb_free_urb(urb);
} else
......@@ -200,13 +200,13 @@ static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs)
atomic_dec(&bfusb->pending_tx);
if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags))
if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
return;
if (!urb->status)
bfusb->hdev.stat.byte_tx += skb->len;
bfusb->hdev->stat.byte_tx += skb->len;
else
bfusb->hdev.stat.err_tx++;
bfusb->hdev->stat.err_tx++;
read_lock(&bfusb->lock);
......@@ -250,7 +250,7 @@ static int bfusb_rx_submit(struct bfusb *bfusb, struct urb *urb)
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk rx submit failed urb %p err %d",
bfusb->hdev.name, urb, err);
bfusb->hdev->name, urb, err);
skb_unlink(skb);
kfree_skb(skb);
usb_free_urb(urb);
......@@ -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);
if (hdr & 0x10) {
BT_ERR("%s error in block", bfusb->hdev.name);
BT_ERR("%s error in block", bfusb->hdev->name);
if (bfusb->reassembly)
kfree_skb(bfusb->reassembly);
bfusb->reassembly = NULL;
......@@ -277,13 +277,13 @@ static inline int bfusb_recv_block(struct bfusb *bfusb, int hdr, unsigned char *
int pkt_len = 0;
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);
bfusb->reassembly = NULL;
}
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;
}
......@@ -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;
pkt_len = HCI_EVENT_HDR_SIZE + hdr->plen;
} 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;
}
break;
......@@ -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;
pkt_len = HCI_ACL_HDR_SIZE + __le16_to_cpu(hdr->dlen);
} 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;
}
break;
......@@ -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;
pkt_len = HCI_SCO_HDR_SIZE + hdr->dlen;
} 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;
}
break;
......@@ -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);
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;
}
skb->dev = (void *) &bfusb->hdev;
skb->dev = (void *) bfusb->hdev;
skb->pkt_type = pkt_type;
bfusb->reassembly = skb;
} else {
if (!bfusb->reassembly) {
BT_ERR("%s unexpected continuation block", bfusb->hdev.name);
BT_ERR("%s unexpected continuation block", bfusb->hdev->name);
return -EIO;
}
}
......@@ -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);
if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags))
if (!test_bit(HCI_RUNNING, &bfusb->hdev->flags))
return;
read_lock(&bfusb->lock);
......@@ -367,7 +367,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
if (urb->status || !count)
goto resubmit;
bfusb->hdev.stat.byte_rx += count;
bfusb->hdev->stat.byte_rx += count;
skb_put(skb, count);
......@@ -386,7 +386,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
if (count < len) {
BT_ERR("%s block extends over URB buffer ranges",
bfusb->hdev.name);
bfusb->hdev->name);
}
if ((hdr & 0xe1) == 0xc1)
......@@ -411,7 +411,7 @@ static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs)
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk resubmit failed urb %p err %d",
bfusb->hdev.name, urb, err);
bfusb->hdev->name, urb, err);
}
read_unlock(&bfusb->lock);
......@@ -698,7 +698,13 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
release_firmware(firmware);
/* 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->driver_data = bfusb;
......@@ -715,6 +721,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
goto error;
}
......@@ -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)
{
struct bfusb *bfusb = usb_get_intfdata(intf);
struct hci_dev *hdev = &bfusb->hdev;
struct hci_dev *hdev = bfusb->hdev;
BT_DBG("intf %p", intf);
......@@ -748,6 +755,8 @@ static void bfusb_disconnect(struct usb_interface *intf)
if (hci_unregister_dev(hdev) < 0)
BT_ERR("Can't unregister HCI device %s", hdev->name);
hci_free_dev(hdev);
}
static struct usb_driver bfusb_driver = {
......
......@@ -72,7 +72,7 @@ typedef struct bluecard_info_t {
dev_link_t link;
dev_node_t node;
struct hci_dev hdev;
struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */
struct timer_list timer; /* For LED control */
......@@ -333,7 +333,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
skb_queue_head(&(info->txq), skb);
}
info->hdev.stat.byte_tx += len;
info->hdev->stat.byte_tx += len;
/* Change buffer */
change_bit(XMIT_BUFFER_NUMBER, &(info->tx_state));
......@@ -404,7 +404,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
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];
switch (info->rx_skb->pkt_type) {
......@@ -440,7 +440,7 @@ static void bluecard_receive(bluecard_info_t *info, unsigned int offset)
default:
/* unknown packet */
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);
info->rx_skb = NULL;
......@@ -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)
/* 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->driver_data = info;
......@@ -794,7 +799,8 @@ int bluecard_open(bluecard_info_t *info)
hdev->owner = THIS_MODULE;
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;
}
......@@ -805,7 +811,7 @@ int bluecard_open(bluecard_info_t *info)
int bluecard_close(bluecard_info_t *info)
{
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
struct hci_dev *hdev = info->hdev;
bluecard_hci_close(hdev);
......@@ -821,6 +827,8 @@ int bluecard_close(bluecard_info_t *info)
if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "bluecard_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0;
}
......@@ -988,7 +996,7 @@ void bluecard_config(dev_link_t *link)
if (bluecard_open(info) != 0)
goto failed;
strcpy(info->node.dev_name, info->hdev.name);
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
......
......@@ -79,7 +79,7 @@ typedef struct bt3c_info_t {
dev_link_t link;
dev_node_t node;
struct hci_dev hdev;
struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */
......@@ -227,7 +227,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info, int from)
kfree_skb(skb);
info->hdev.stat.byte_tx += len;
info->hdev->stat.byte_tx += len;
} while (0);
......@@ -253,7 +253,7 @@ static void bt3c_receive(bt3c_info_t *info)
bt3c_address(iobase, 0x7480);
while (size < avail) {
size++;
info->hdev.stat.byte_rx++;
info->hdev->stat.byte_rx++;
/* Allocate packet */
if (info->rx_skb == NULL) {
......@@ -268,7 +268,7 @@ static void bt3c_receive(bt3c_info_t *info)
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);
inb(iobase + DATA_H);
//printk("bt3c: PACKET_TYPE=%02x\n", info->rx_skb->pkt_type);
......@@ -293,8 +293,8 @@ static void bt3c_receive(bt3c_info_t *info)
default:
/* Unknown packet */
printk(KERN_WARNING "bt3c_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
info->hdev.stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev.flags));
info->hdev->stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev->flags));
kfree_skb(info->rx_skb);
info->rx_skb = NULL;
......@@ -534,8 +534,13 @@ int bt3c_open(bt3c_info_t *info)
/* 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->driver_data = info;
......@@ -550,7 +555,8 @@ int bt3c_open(bt3c_info_t *info)
hdev->owner = THIS_MODULE;
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;
}
......@@ -560,13 +566,15 @@ int bt3c_open(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);
if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "bt3c_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0;
}
......@@ -781,7 +789,7 @@ void bt3c_config(dev_link_t *link)
if (bt3c_open(info) != 0)
goto failed;
strcpy(info->node.dev_name, info->hdev.name);
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
......
......@@ -77,7 +77,7 @@ typedef struct btuart_info_t {
dev_link_t link;
dev_node_t node;
struct hci_dev hdev;
struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */
......@@ -181,7 +181,7 @@ static void btuart_write_wakeup(btuart_info_t *info)
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)));
......@@ -202,7 +202,7 @@ static void btuart_receive(btuart_info_t *info)
iobase = info->link.io.BasePort1;
do {
info->hdev.stat.byte_rx++;
info->hdev->stat.byte_rx++;
/* Allocate packet */
if (info->rx_skb == NULL) {
......@@ -216,7 +216,7 @@ static void btuart_receive(btuart_info_t *info)
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);
switch (info->rx_skb->pkt_type) {
......@@ -239,8 +239,8 @@ static void btuart_receive(btuart_info_t *info)
default:
/* Unknown packet */
printk(KERN_WARNING "btuart_cs: Unknown HCI packet with type 0x%02x received.\n", info->rx_skb->pkt_type);
info->hdev.stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev.flags));
info->hdev->stat.err_rx++;
clear_bit(HCI_RUNNING, &(info->hdev->flags));
kfree_skb(info->rx_skb);
info->rx_skb = NULL;
......@@ -529,8 +529,13 @@ int btuart_open(btuart_info_t *info)
/* 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->driver_data = info;
......@@ -545,7 +550,8 @@ int btuart_open(btuart_info_t *info)
hdev->owner = THIS_MODULE;
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;
}
......@@ -557,7 +563,7 @@ int btuart_close(btuart_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
struct hci_dev *hdev = info->hdev;
btuart_hci_close(hdev);
......@@ -574,6 +580,8 @@ int btuart_close(btuart_info_t *info)
if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "btuart_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0;
}
......@@ -789,7 +797,7 @@ void btuart_config(dev_link_t *link)
if (btuart_open(info) != 0)
goto failed;
strcpy(info->node.dev_name, info->hdev.name);
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
......
......@@ -77,7 +77,7 @@ typedef struct dtl1_info_t {
dev_link_t link;
dev_node_t node;
struct hci_dev hdev;
struct hci_dev *hdev;
spinlock_t lock; /* For serializing operations */
......@@ -188,7 +188,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
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)));
......@@ -233,7 +233,7 @@ static void dtl1_receive(dtl1_info_t *info)
iobase = info->link.io.BasePort1;
do {
info->hdev.stat.byte_rx++;
info->hdev->stat.byte_rx++;
/* Allocate packet */
if (info->rx_skb == NULL)
......@@ -277,7 +277,7 @@ static void dtl1_receive(dtl1_info_t *info)
case 0x83:
case 0x84:
/* 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;
hci_recv_frame(info->rx_skb);
break;
......@@ -508,8 +508,13 @@ int dtl1_open(dtl1_info_t *info)
/* 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->driver_data = info;
......@@ -524,7 +529,8 @@ int dtl1_open(dtl1_info_t *info)
hdev->owner = THIS_MODULE;
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;
}
......@@ -536,7 +542,7 @@ int dtl1_close(dtl1_info_t *info)
{
unsigned long flags;
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
struct hci_dev *hdev = info->hdev;
dtl1_hci_close(hdev);
......@@ -553,6 +559,8 @@ int dtl1_close(dtl1_info_t *info)
if (hci_unregister_dev(hdev) < 0)
printk(KERN_WARNING "dtl1_cs: Can't unregister HCI device %s.\n", hdev->name);
hci_free_dev(hdev);
return 0;
}
......@@ -741,7 +749,7 @@ void dtl1_config(dev_link_t *link)
if (dtl1_open(info) != 0)
goto failed;
strcpy(info->node.dev_name, info->hdev.name);
strcpy(info->node.dev_name, info->hdev->name);
link->dev = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
......
......@@ -617,7 +617,7 @@ static int bcsp_recv(struct hci_uart *hu, void *data, int count)
bcsp->rx_count = 0;
return 0;
}
bcsp->rx_skb->dev = (void *) &hu->hdev;
bcsp->rx_skb->dev = (void *) hu->hdev;
break;
}
break;
......
......@@ -229,7 +229,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
default:
BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
hu->hdev.stat.err_rx++;
hu->hdev->stat.err_rx++;
ptr++; count--;
continue;
};
......@@ -243,7 +243,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
h4->rx_count = 0;
return 0;
}
h4->rx_skb->dev = (void *) &hu->hdev;
h4->rx_skb->dev = (void *) hu->hdev;
h4->rx_skb->pkt_type = type;
}
return count;
......
......@@ -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)
{
struct hci_dev *hdev = &hu->hdev;
struct hci_dev *hdev = hu->hdev;
/* Update HCI stat counters */
switch (pkt_type) {
......@@ -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)
{
struct tty_struct *tty = hu->tty;
struct hci_dev *hdev = &hu->hdev;
struct hci_dev *hdev = hu->hdev;
struct sk_buff *skb;
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)
tty->disc_data = NULL;
if (hu) {
struct hci_dev *hdev = &hu->hdev;
struct hci_dev *hdev = hu->hdev;
hci_uart_close(hdev);
if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
hu->proto->close(hu);
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
spin_lock(&hu->rx_lock);
hu->proto->recv(hu, (void *) data, count);
hu->hdev.stat.byte_rx += count;
hu->hdev->stat.byte_rx += count;
spin_unlock(&hu->rx_lock);
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)
BT_DBG("");
/* 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->driver_data = hu;
......@@ -408,7 +415,8 @@ static int hci_uart_register_dev(struct hci_uart *hu)
hdev->owner = THIS_MODULE;
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;
}
......
......@@ -56,7 +56,7 @@ struct hci_uart_proto {
struct hci_uart {
struct tty_struct *tty;
struct hci_dev hdev;
struct hci_dev *hdev;
unsigned long flags;
struct hci_uart_proto *proto;
......
......@@ -71,10 +71,10 @@ static struct usb_driver hci_usb_driver;
static struct usb_device_id bluetooth_ids[] = {
/* Broadcom BCM2033 without firmware */
{ USB_DEVICE(0x0a5c, 0x2033), driver_info: HCI_IGNORE },
{ USB_DEVICE(0x0a5c, 0x2033), .driver_info = HCI_IGNORE },
/* Digianswer device */
{ USB_DEVICE(0x08fd, 0x0001), driver_info: HCI_DIGIANSWER },
{ USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
/* Generic Bluetooth USB device */
{ USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) },
......@@ -165,7 +165,7 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb)
int err, pipe, interval, size;
void *buf;
BT_DBG("%s", husb->hdev.name);
BT_DBG("%s", husb->hdev->name);
size = husb->intr_in_ep->desc.wMaxPacketSize;
......@@ -189,7 +189,7 @@ static int hci_usb_intr_rx_submit(struct hci_usb *husb)
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s intr rx submit failed urb %p err %d",
husb->hdev.name, urb, err);
husb->hdev->name, urb, err);
_urb_unlink(_urb);
_urb_free(_urb);
kfree(buf);
......@@ -221,12 +221,12 @@ static int hci_usb_bulk_rx_submit(struct hci_usb *husb)
usb_fill_bulk_urb(urb, husb->udev, pipe, buf, size, hci_usb_rx_complete, husb);
urb->transfer_flags = 0;
BT_DBG("%s urb %p", husb->hdev.name, urb);
BT_DBG("%s urb %p", husb->hdev->name, urb);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s bulk rx submit failed urb %p err %d",
husb->hdev.name, urb, err);
husb->hdev->name, urb, err);
_urb_unlink(_urb);
_urb_free(_urb);
kfree(buf);
......@@ -264,18 +264,20 @@ static int hci_usb_isoc_rx_submit(struct hci_usb *husb)
urb->pipe = usb_rcvisocpipe(husb->udev, husb->isoc_in_ep->desc.bEndpointAddress);
urb->complete = hci_usb_rx_complete;
urb->interval = husb->isoc_in_ep->desc.bInterval;
urb->transfer_buffer_length = size;
urb->transfer_buffer = buf;
urb->transfer_flags = URB_ISO_ASAP;
__fill_isoc_desc(urb, size, mtu);
BT_DBG("%s urb %p", husb->hdev.name, urb);
BT_DBG("%s urb %p", husb->hdev->name, urb);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s isoc rx submit failed urb %p err %d",
husb->hdev.name, urb, err);
husb->hdev->name, urb, err);
_urb_unlink(_urb);
_urb_free(_urb);
kfree(buf);
......@@ -333,7 +335,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
{
int i;
BT_DBG("%s", husb->hdev.name);
BT_DBG("%s", husb->hdev->name);
for (i=0; i < 4; i++) {
struct _urb *_urb;
......@@ -343,7 +345,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
while ((_urb = _urb_dequeue(&husb->pending_q[i]))) {
urb = &_urb->urb;
BT_DBG("%s unlinking _urb %p type %d urb %p",
husb->hdev.name, _urb, _urb->type, urb);
husb->hdev->name, _urb, _urb->type, urb);
usb_unlink_urb(urb);
_urb_queue_tail(__completed_q(husb, _urb->type), _urb);
}
......@@ -352,7 +354,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
while ((_urb = _urb_dequeue(&husb->completed_q[i]))) {
urb = &_urb->urb;
BT_DBG("%s freeing _urb %p type %d urb %p",
husb->hdev.name, _urb, _urb->type, urb);
husb->hdev->name, _urb, _urb->type, urb);
if (urb->setup_packet)
kfree(urb->setup_packet);
if (urb->transfer_buffer)
......@@ -393,13 +395,13 @@ static int __tx_submit(struct hci_usb *husb, struct _urb *_urb)
struct urb *urb = &_urb->urb;
int err;
BT_DBG("%s urb %p type %d", husb->hdev.name, urb, _urb->type);
BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type);
_urb_queue_tail(__pending_q(husb, _urb->type), _urb);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (err) {
BT_ERR("%s tx submit failed urb %p type %d err %d",
husb->hdev.name, urb, _urb->type, err);
husb->hdev->name, urb, _urb->type, err);
_urb_unlink(_urb);
_urb_queue_tail(__completed_q(husb, _urb->type), _urb);
} else
......@@ -438,7 +440,7 @@ static inline int hci_usb_send_ctrl(struct hci_usb *husb, struct sk_buff *skb)
usb_fill_control_urb(urb, husb->udev, usb_sndctrlpipe(husb->udev, 0),
(void *) dr, skb->data, skb->len, hci_usb_tx_complete, husb);
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len);
BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
_urb->priv = skb;
return __tx_submit(husb, _urb);
......@@ -463,7 +465,7 @@ static inline int hci_usb_send_bulk(struct hci_usb *husb, struct sk_buff *skb)
hci_usb_tx_complete, husb);
urb->transfer_flags = URB_ZERO_PACKET;
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len);
BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
_urb->priv = skb;
return __tx_submit(husb, _urb);
......@@ -482,7 +484,7 @@ static inline int hci_usb_send_isoc(struct hci_usb *husb, struct sk_buff *skb)
_urb->type = skb->pkt_type;
}
BT_DBG("%s skb %p len %d", husb->hdev.name, skb, skb->len);
BT_DBG("%s skb %p len %d", husb->hdev->name, skb, skb->len);
urb = &_urb->urb;
......@@ -492,6 +494,8 @@ static inline int hci_usb_send_isoc(struct hci_usb *husb, struct sk_buff *skb)
urb->complete = hci_usb_tx_complete;
urb->transfer_flags = URB_ISO_ASAP;
urb->interval = husb->isoc_out_ep->desc.bInterval;
urb->transfer_buffer = skb->data;
urb->transfer_buffer_length = skb->len;
......@@ -507,7 +511,7 @@ static void hci_usb_tx_process(struct hci_usb *husb)
struct sk_buff_head *q;
struct sk_buff *skb;
BT_DBG("%s", husb->hdev.name);
BT_DBG("%s", husb->hdev->name);
do {
clear_bit(HCI_USB_TX_WAKEUP, &husb->state);
......@@ -601,9 +605,9 @@ static int hci_usb_send_frame(struct sk_buff *skb)
static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int count)
{
BT_DBG("%s type %d data %p count %d", husb->hdev.name, type, data, count);
BT_DBG("%s type %d data %p count %d", husb->hdev->name, type, data, count);
husb->hdev.stat.byte_rx += count;
husb->hdev->stat.byte_rx += count;
while (count) {
struct sk_buff *skb = __reassembly(husb, type);
......@@ -643,10 +647,10 @@ static inline int __recv_frame(struct hci_usb *husb, int type, void *data, int c
skb = bt_skb_alloc(len, GFP_ATOMIC);
if (!skb) {
BT_ERR("%s no memory for the packet", husb->hdev.name);
BT_ERR("%s no memory for the packet", husb->hdev->name);
return -ENOMEM;
}
skb->dev = (void *) &husb->hdev;
skb->dev = (void *) husb->hdev;
skb->pkt_type = type;
__reassembly(husb, type) = skb;
......@@ -679,7 +683,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs)
{
struct _urb *_urb = container_of(urb, struct _urb, urb);
struct hci_usb *husb = (void *) urb->context;
struct hci_dev *hdev = &husb->hdev;
struct hci_dev *hdev = husb->hdev;
int err, count = urb->actual_length;
BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
......@@ -714,7 +718,7 @@ static void hci_usb_rx_complete(struct urb *urb, struct pt_regs *regs)
err = __recv_frame(husb, _urb->type, urb->transfer_buffer, count);
if (err < 0) {
BT_ERR("%s corrupted packet: type %d count %d",
husb->hdev.name, _urb->type, count);
husb->hdev->name, _urb->type, count);
hdev->stat.err_rx++;
}
}
......@@ -732,7 +736,7 @@ static void hci_usb_tx_complete(struct urb *urb, struct pt_regs *regs)
{
struct _urb *_urb = container_of(urb, struct _urb, urb);
struct hci_usb *husb = (void *) urb->context;
struct hci_dev *hdev = &husb->hdev;
struct hci_dev *hdev = husb->hdev;
BT_DBG("%s urb %p status %d flags %x", hdev->name, urb,
urb->status, urb->transfer_flags);
......@@ -904,7 +908,13 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
}
/* Initialize and register HCI device */
hdev = &husb->hdev;
hdev = hci_alloc_dev();
if (!hdev) {
BT_ERR("Can't allocate HCI device");
goto probe_error;
}
husb->hdev = hdev;
hdev->type = HCI_USB;
hdev->driver_data = husb;
......@@ -920,6 +930,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device");
hci_free_dev(hdev);
goto probe_error;
}
......@@ -936,7 +947,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
static void hci_usb_disconnect(struct usb_interface *intf)
{
struct hci_usb *husb = usb_get_intfdata(intf);
struct hci_dev *hdev = &husb->hdev;
struct hci_dev *hdev = husb->hdev;
if (!husb)
return;
......@@ -951,6 +962,8 @@ static void hci_usb_disconnect(struct usb_interface *intf)
if (hci_unregister_dev(hdev) < 0)
BT_ERR("Can't unregister HCI device %s", hdev->name);
hci_free_dev(hdev);
}
static struct usb_driver hci_usb_driver = {
......
......@@ -112,7 +112,7 @@ struct _urb *_urb_dequeue(struct _urb_queue *q);
#endif
struct hci_usb {
struct hci_dev hdev;
struct hci_dev *hdev;
unsigned long state;
......
......@@ -142,7 +142,7 @@ static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const
return -EFAULT;
}
skb->dev = (void *) &hci_vhci->hdev;
skb->dev = (void *) hci_vhci->hdev;
skb->pkt_type = *((__u8 *) skb->data);
skb_pull(skb, 1);
......@@ -175,18 +175,18 @@ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci,
return -EFAULT;
total += len;
hci_vhci->hdev.stat.byte_tx += len;
hci_vhci->hdev->stat.byte_tx += len;
switch (skb->pkt_type) {
case HCI_COMMAND_PKT:
hci_vhci->hdev.stat.cmd_tx++;
hci_vhci->hdev->stat.cmd_tx++;
break;
case HCI_ACLDATA_PKT:
hci_vhci->hdev.stat.acl_tx++;
hci_vhci->hdev->stat.acl_tx++;
break;
case HCI_SCODATA_PKT:
hci_vhci->hdev.stat.cmd_tx++;
hci_vhci->hdev->stat.cmd_tx++;
break;
};
......@@ -275,7 +275,13 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file)
init_waitqueue_head(&hci_vhci->read_wait);
/* 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->driver_data = hci_vhci;
......@@ -290,6 +296,7 @@ static int hci_vhci_chr_open(struct inode *inode, struct file * file)
if (hci_register_dev(hdev) < 0) {
kfree(hci_vhci);
hci_free_dev(hdev);
return -EBUSY;
}
......@@ -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;
if (hci_unregister_dev(&hci_vhci->hdev) < 0) {
BT_ERR("Can't unregister HCI device %s", hci_vhci->hdev.name);
if (hci_unregister_dev(hci_vhci->hdev) < 0) {
BT_ERR("Can't unregister HCI device %s", hci_vhci->hdev->name);
}
hci_free_dev(hci_vhci->hdev);
file->private_data = NULL;
return 0;
}
......
......@@ -32,7 +32,7 @@
#ifdef __KERNEL__
struct hci_vhci_struct {
struct hci_dev hdev;
struct hci_dev *hdev;
__u32 flags;
wait_queue_head_t read_wait;
struct sk_buff_head readq;
......
......@@ -138,7 +138,7 @@ comment "Old SIR device drivers"
config IRPORT_SIR
tristate "IrPORT (IrDA serial driver)"
depends on IRDA
depends on IRDA && BROKEN_ON_SMP
---help---
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
......@@ -156,7 +156,7 @@ comment "Old Serial dongle support"
config DONGLE_OLD
bool "Old Serial dongle support"
depends on IRTTY_OLD || IRPORT_SIR
depends on (IRTTY_OLD || IRPORT_SIR) && BROKEN_ON_SMP
help
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
......
......@@ -93,12 +93,12 @@ static struct dongle_driver act200l = {
.set_speed = act200l_change_speed,
};
static int __init act200l_init(void)
static int __init act200l_sir_init(void)
{
return irda_register_dongle(&act200l);
}
static void __exit act200l_cleanup(void)
static void __exit act200l_sir_cleanup(void)
{
irda_unregister_dongle(&act200l);
}
......@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("ACTiSYS ACT-IR200L dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-10"); /* IRDA_ACT200L_DONGLE */
module_init(act200l_init);
module_exit(act200l_cleanup);
module_init(act200l_sir_init);
module_exit(act200l_sir_cleanup);
......@@ -299,8 +299,6 @@ static int ali_ircc_open(int i, chipio_t *info)
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; */
self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 14384;
......@@ -1573,7 +1571,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
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].len,
DMA_TX_MODE);
......@@ -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.tail = self->st_fifo.head = 0;
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize,
DMA_RX_MODE);
irda_setup_dma(self->io.dma, self->rx_buff.data,
self->rx_buff.truesize, DMA_RX_MODE);
/* Set Receive Mode,Brick Wall */
//switch_bank(iobase, BANK0);
......
......@@ -1646,13 +1646,11 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
if (max_baud >= 1152000)
{
self->qos.baud_rate.bits |= IR_1152000;
self->flags |= IFF_MIR;
}
#endif
if (max_baud >= 4000000)
{
self->qos.baud_rate.bits |= (IR_4000000 << 8);
self->flags |= IFF_FIR;
}
/*FIXME: work this out... */
......@@ -1660,8 +1658,6 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
irda_qos_bits_to_value (&self->qos);
self->flags = IFF_SIR | IFF_DMA | IFF_PIO;
/* Allocate twice the size to guarantee alignment */
self->ringbuf = (void *) kmalloc (OBOE_RING_LEN << 1, GFP_KERNEL);
if (!self->ringbuf)
......
......@@ -72,12 +72,12 @@ static struct dongle_driver girbil = {
.set_speed = girbil_change_speed,
};
static int __init girbil_init(void)
static int __init girbil_sir_init(void)
{
return irda_register_dongle(&girbil);
}
static void __exit girbil_cleanup(void)
static void __exit girbil_sir_cleanup(void)
{
irda_unregister_dongle(&girbil);
}
......@@ -254,5 +254,5 @@ MODULE_DESCRIPTION("Greenwich GIrBIL dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-4"); /* IRDA_GIRBIL_DONGLE */
module_init(girbil_init);
module_exit(girbil_cleanup);
module_init(girbil_sir_init);
module_exit(girbil_sir_cleanup);
......@@ -68,10 +68,6 @@
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 */
static struct usb_device_id dongles[] = {
/* ACTiSYS Corp., ACT-IR2000U FIR-USB Adapter */
......@@ -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 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_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 write_bulk_callback(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)
* the transmit path will be set differently - Jean II
*/
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)
*/
static inline int irda_usb_open(struct irda_usb_cb *self)
{
struct net_device *netdev;
int err;
struct net_device *netdev = self->netdev;
IRDA_DEBUG(1, "%s()\n", __FUNCTION__);
spin_lock_init(&self->lock);
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 */
netdev->hard_start_xmit = irda_usb_hard_xmit;
netdev->tx_timeout = irda_usb_net_timeout;
......@@ -1196,16 +1160,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
netdev->get_stats = irda_usb_net_get_stats;
netdev->do_ioctl = irda_usb_net_ioctl;
err = 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;
return register_netdev(netdev);
}
/*------------------------------------------------------------------*/
......@@ -1213,26 +1168,18 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
* Cleanup the network side of the irda-usb instance
* 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__);
ASSERT(self != NULL, return -1;);
/* Remove netdevice */
if (self->netdev) {
unregister_netdev(self->netdev);
free_netdev(self->netdev);
self->netdev = NULL;
}
/* Remove the speed buffer */
if (self->speed_buff != NULL) {
kfree(self->speed_buff);
self->speed_buff = NULL;
}
return 0;
}
/********************** USB CONFIG SUBROUTINES **********************/
......@@ -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,
const struct usb_device_id *id)
{
struct net_device *net;
struct usb_device *dev = interface_to_usbdev(intf);
struct irda_usb_cb *self = NULL;
struct usb_host_interface *interface;
struct irda_class_desc *irda_desc;
int ret;
int ret = -ENOMEM;
int i; /* Driver instance index / Rx URB index */
/* 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,
dev->devnum, dev->descriptor.idVendor,
dev->descriptor.idProduct);
/* Try to cleanup all instance that have a pending disconnect
* In theory, it can't happen any longer.
* Jean II */
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);
}
}
net = alloc_irdadev(sizeof(*self));
if (!net)
goto err_out;
/* Find an free instance to handle this new device... */
self = NULL;
for (i = 0; i < NIRUSB; i++) {
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;
}
self = net->priv;
self->netdev = net;
spin_lock_init(&self->lock);
/* Reset the instance */
self->present = 0;
self->netopen = 0;
SET_MODULE_OWNER(net);
/* Create all of the needed urbs */
for (i = 0; i < IU_MAX_RX_URBS; i++) {
self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!self->rx_urb[i]) {
ret = -ENOMEM;
goto err_out_1;
}
}
self->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!self->tx_urb) {
ret = -ENOMEM;
goto err_out_1;
}
self->speed_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!self->speed_urb) {
ret = -ENOMEM;
goto err_out_2;
}
......@@ -1517,13 +1441,27 @@ static int irda_usb_probe(struct usb_interface *intf,
self->capability = id->driver_info;
self->usbdev = dev;
self->usbintf = intf;
/* 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;
memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
ret = irda_usb_open(self);
if (ret)
goto err_out_3;
goto err_out_4;
MESSAGE("IrDA: Registered device %s\n", net->name);
usb_set_intfdata(intf, self);
return 0;
err_out_4:
kfree(self->speed_buff);
err_out_3:
/* Free all urbs that we may have created */
usb_free_urb(self->speed_urb);
......@@ -1534,7 +1472,8 @@ static int irda_usb_probe(struct usb_interface *intf,
if (self->rx_urb[i])
usb_free_urb(self->rx_urb[i]);
}
free_netdev(net);
err_out:
return ret;
}
......@@ -1602,6 +1541,8 @@ static void irda_usb_disconnect(struct usb_interface *intf)
usb_free_urb(self->tx_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__);
}
......@@ -1646,20 +1587,6 @@ module_init(usb_irda_init);
*/
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 */
usb_deregister(&irda_driver);
}
......
......@@ -178,9 +178,6 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
self->qos.min_turn_time.bits = qos_mtt_bits;
irda_qos_bits_to_value(&self->qos);
self->flags = IFF_SIR|IFF_PIO;
self->mode = IRDA_IRLAP;
/* Bootstrap ZeroCopy Rx */
self->rx_buff.truesize = IRDA_SKB_MAX_MTU;
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)
/*****************************************************************/
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) */
......
......@@ -49,12 +49,12 @@ static struct dongle_driver mcp2120 = {
.set_speed = mcp2120_change_speed,
};
static int __init mcp2120_init(void)
static int __init mcp2120_sir_init(void)
{
return irda_register_dongle(&mcp2120);
}
static void __exit mcp2120_cleanup(void)
static void __exit mcp2120_sir_cleanup(void)
{
irda_unregister_dongle(&mcp2120);
}
......@@ -226,5 +226,5 @@ MODULE_DESCRIPTION("Microchip MCP2120");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-9"); /* IRDA_MCP2120_DONGLE */
module_init(mcp2120_init);
module_exit(mcp2120_cleanup);
module_init(mcp2120_sir_init);
module_exit(mcp2120_sir_cleanup);
......@@ -302,8 +302,6 @@ static int __init nsc_ircc_open(int i, chipio_t *info)
self->qos.min_turn_time.bits = qos_mtt_bits;
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; */
self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 14384;
......@@ -1410,7 +1408,7 @@ static void nsc_ircc_dma_xmit(struct nsc_ircc_cb *self, int iobase)
switch_bank(iobase, BANK2);
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].len,
DMA_TX_MODE);
......@@ -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.tail = self->st_fifo.head = 0;
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize,
DMA_RX_MODE);
irda_setup_dma(self->io.dma, self->rx_buff.data,
self->rx_buff.truesize, DMA_RX_MODE);
/* Enable DMA */
switch_bank(iobase, BANK0);
......
......@@ -78,12 +78,12 @@ static struct dongle_driver old_belkin = {
.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);
}
static void __exit old_belkin_cleanup(void)
static void __exit old_belkin_sir_cleanup(void)
{
irda_unregister_dongle(&old_belkin);
}
......@@ -152,5 +152,5 @@ MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */
module_init(old_belkin_init);
module_exit(old_belkin_cleanup);
module_init(old_belkin_sir_init);
module_exit(old_belkin_sir_cleanup);
......@@ -620,8 +620,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
SET_MODULE_OWNER(ndev);
dev->flags = IFF_SIR | IFF_PIO;
/* Override the network functions we need to use */
ndev->hard_start_xmit = sirdev_hard_xmit;
ndev->open = sirdev_open;
......
......@@ -441,8 +441,6 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
smsc_ircc_setup_qos(self);
self->flags = IFF_FIR|IFF_MIR|IFF_SIR|IFF_DMA|IFF_PIO;
smsc_ircc_init_chip(self);
if(ircc_transceiver > 0 &&
......@@ -1161,7 +1159,7 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int iobase, int bofs)
IRCC_CFGB_DMA_BURST, iobase+IRCC_SCE_CFGB);
/* 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);
/* Enable interrupt */
......@@ -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);
/* Setup DMA controller */
setup_dma(self->io.dma, self->rx_buff.data, self->rx_buff.truesize,
DMA_RX_MODE);
irda_setup_dma(self->io.dma, self->rx_buff.data,
self->rx_buff.truesize, DMA_RX_MODE);
/* Enable burst mode chip Rx DMA */
register_bank(iobase, 1);
......@@ -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 smsc_ircc_cb *self;
int iobase, iir, lcra, lsr;
irqreturn_t ret = IRQ_NONE;
if (dev == NULL) {
printk(KERN_WARNING "%s: irq %d for unknown device.\n",
driver_name, irq);
return IRQ_NONE;
goto irq_ret;
}
self = (struct smsc_ircc_cb *) dev->priv;
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
/* Check if we should use the SIR interrupt handler */
if (self->io.speed <= SMSC_IRCC2_MAX_SIR_SPEED) {
irqreturn_t ret = smsc_ircc_interrupt_sir(dev);
spin_unlock(&self->lock);
return ret;
ret = smsc_ircc_interrupt_sir(dev);
goto irq_ret_unlock;
}
iobase = self->io.fir_base;
register_bank(iobase, 0);
iir = inb(iobase+IRCC_IIR);
if (iir == 0)
goto irq_ret_unlock;
ret = IRQ_HANDLED;
/* Disable interrupts */
outb(0, iobase+IRCC_IER);
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
register_bank(iobase, 0);
outb(IRCC_IER_ACTIVE_FRAME|IRCC_IER_EOM, iobase+IRCC_IER);
irq_ret_unlock:
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)
iobase = self->io.sir_base;
iir = inb(iobase+UART_IIR) & UART_IIR_ID;
if (iir == 0)
return IRQ_NONE;
while (iir) {
/* Clear interrupt */
lsr = inb(iobase+UART_LSR);
......@@ -1489,7 +1496,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
iir = inb(iobase + UART_IIR) & UART_IIR_ID;
}
/*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
static void via_ircc_change_dongle_speed(int iobase, int speed,
int dongle_id);
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 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 void __exit via_remove_one (struct pci_dev *pdev);
/* Should use udelay() instead, even if we are x86 only - Jean II */
void iodelay(int udelay)
static void iodelay(int udelay)
{
u8 data;
int i;
......@@ -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;
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; */
self->rx_buff.truesize = 14384 + 2048;
self->tx_buff.truesize = 14384 + 2048;
......@@ -819,7 +816,7 @@ static int via_ircc_hard_xmit_sir(struct sk_buff *skb,
EnTXDMA(iobase, ON);
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);
SetSendByte(iobase, self->tx_buff.len);
......@@ -899,7 +896,7 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase)
EnAllInt(iobase, ON);
EnTXDMA(iobase, ON);
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].len, DMA_TX_MODE);
#ifdef DBGMSG
......@@ -1025,7 +1022,7 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self)
EnAllInt(iobase, ON);
EnTXDMA(iobase, OFF);
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);
TXStart(iobase, OFF);
RXStart(iobase, ON);
......@@ -1397,7 +1394,7 @@ static irqreturn_t via_ircc_interrupt(int irq, void *dev_id,
return IRQ_RETVAL(iHostIntType);
}
void hwreset(struct via_ircc_cb *self)
static void hwreset(struct via_ircc_cb *self)
{
int iobase;
iobase = self->io.fir_base;
......
This diff is collapsed.
......@@ -202,8 +202,6 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
self->qos.min_turn_time.bits = qos_mtt_bits;
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; */
self->rx_buff.truesize = 14384;
self->tx_buff.truesize = 4000;
......@@ -611,7 +609,7 @@ 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_count(self->io.dma, self->tx_buff.len);
#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);
#endif
self->io.direction = IO_XMIT;
......@@ -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;
__u8 set;
......@@ -768,7 +766,7 @@ int w83977af_dma_receive(struct w83977af_ir *self)
set_dma_addr(self->io.dma, isa_virt_to_bus(self->rx_buff.data));
set_dma_count(self->io.dma, self->rx_buff.truesize);
#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);
#endif
/*
......
......@@ -41,10 +41,10 @@
* of bytes. No alignment or length assumptions are made about
* 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;
u8 *k = key;
const u8 *k = key;
len = length;
a = b = JHASH_GOLDEN_RATIO;
......
......@@ -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_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_unregister_dev(struct hci_dev *hdev);
int hci_suspend_dev(struct hci_dev *hdev);
......
......@@ -212,7 +212,6 @@ struct ali_ircc_cb {
spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed;
int index; /* Instance index */
......
......@@ -115,7 +115,6 @@ struct au1k_private {
struct irlap_cb *irlap;
u8 open;
u32 flags; /* Interface flags */
u32 speed;
u32 newspeed;
......
......@@ -80,7 +80,7 @@ struct ircomm_tty_cb {
LOCAL_FLOW flow; /* IrTTP flow status */
int line;
volatile unsigned long flags;
unsigned long flags;
__u8 dlsap_sel;
__u8 slsap_sel;
......
......@@ -159,6 +159,5 @@ struct irda_usb_cb {
__s16 new_xbofs; /* xbofs we need to set */
__u32 speed; /* Current speed */
__s32 new_speed; /* speed we need to set */
__u32 flags; /* Interface flags */
};
......@@ -45,6 +45,7 @@
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/irda.h>
#include <net/pkt_sched.h>
#include <net/irda/irda.h>
#include <net/irda/qos.h> /* struct qos_info */
#include <net/irda/irqueue.h> /* irda_queue_t */
......@@ -219,7 +220,10 @@ int irda_device_is_media_busy(struct net_device *dev);
int irda_device_is_receiving(struct net_device *dev);
/* 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_dtr_rts(struct net_device *dev, int dtr, int rts);
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);
int irda_device_dongle_cleanup(dongle_t *dongle);
#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
void irda_task_delete(struct irda_task *task);
int irda_task_kick(struct irda_task *task);
struct irda_task *irda_task_execute(void *instance,
IRDA_TASK_CALLBACK function,
IRDA_TASK_CALLBACK finished,
struct irda_task *parent, void *param);
void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state);
extern const char *infrared_mode[];
/*
* Function irda_get_mtt (skb)
*
......
......@@ -41,7 +41,6 @@
*/
#define HB_NOLOCK 0 /* No concurent access prevention */
#define HB_LOCK 1 /* Prevent concurent write with global lock */
#define HB_SORTED 4 /* Not yet supported */
/*
* Hash defines
......@@ -81,13 +80,13 @@ hashbin_t *hashbin_new(int type);
int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func);
int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func);
void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
char* name);
void* hashbin_remove(hashbin_t* hashbin, long hashv, char* name);
const char* name);
void* hashbin_remove(hashbin_t* hashbin, long hashv, const char* name);
void* hashbin_remove_first(hashbin_t *hashbin);
void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry);
void* hashbin_find(hashbin_t* hashbin, long hashv, char* name);
void* hashbin_lock_find(hashbin_t* hashbin, long hashv, char* name);
void* hashbin_find_next(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, const char* name);
void* hashbin_find_next(hashbin_t* hashbin, long hashv, const char* name,
void ** pnext);
irda_queue_t *hashbin_get_first(hashbin_t *hashbin);
irda_queue_t *hashbin_get_next(hashbin_t *hashbin);
......
......@@ -263,7 +263,6 @@ struct nsc_ircc_cb {
spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed;
int index; /* Instance index */
......
......@@ -170,7 +170,6 @@ struct ircc_cb {
* synchronised - Jean II */
__u32 new_speed;
__u32 flags; /* Interface flags */
int tx_buff_offsets[10]; /* Offsets between frames in tx_buff */
int tx_len; /* Number of frames in tx_buff */
......
......@@ -146,7 +146,6 @@ struct toshoboe_cb
chipio_t io; /* IrDA controller information */
__u32 flags; /* Interface flags */
__u32 new_speed;
struct pci_dev *pdev; /*PCI device */
......
......@@ -185,7 +185,6 @@ struct w83977af_ir {
* locking strategy. - Jean II */
spinlock_t lock; /* For serializing operations */
__u32 flags; /* Interface flags */
__u32 new_speed;
};
......
......@@ -67,7 +67,7 @@ extern void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent);
single destination while waiting for SVC */
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 struct net_device_stats *lec_get_stats(struct net_device *dev);
static void lec_init(struct net_device *dev);
......@@ -211,26 +211,34 @@ lec_open(struct net_device *dev)
static __inline__ void
lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
{
if (atm_may_send(vcc, skb->len)) {
atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);
ATM_SKB(skb)->vcc = vcc;
ATM_SKB(skb)->atm_options = vcc->atm_options;
priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len;
vcc->send(vcc, skb);
} else {
atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);
if (vcc->send(vcc, skb) < 0) {
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
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 lec_priv *priv = (struct lec_priv *)dev->priv;
struct lecdatahdr_8023 *lec_h;
struct atm_vcc *send_vcc;
struct atm_vcc *vcc;
struct lec_arp_table *entry;
unsigned char *dst;
int min_frame_size;
......@@ -243,7 +251,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
int i=0;
#endif /* DUMP_PACKETS >0 */
DPRINTK("Lec_send_packet called\n");
DPRINTK("lec_start_xmit called\n");
if (!priv->lecd) {
printk("%s:No lecd attached\n",dev->name);
priv->stats.tx_errors++;
......@@ -262,7 +270,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
/* Make sure we have room for lec_id */
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);
kfree_skb(skb);
if (skb2 == NULL) return 0;
......@@ -337,18 +345,18 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
}
#endif
entry = NULL;
send_vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
DPRINTK("%s:send_vcc:%p vcc_flags:%x, entry:%p\n", dev->name,
send_vcc, send_vcc?send_vcc->flags:0, entry);
if (!send_vcc || !test_bit(ATM_VF_READY,&send_vcc->flags)) {
vcc = lec_arp_resolve(priv, dst, is_rdesc, &entry);
DPRINTK("%s:vcc:%p vcc_flags:%x, entry:%p\n", dev->name,
vcc, vcc?vcc->flags:0, entry);
if (!vcc || !test_bit(ATM_VF_READY,&vcc->flags)) {
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",
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]);
skb_queue_tail(&entry->tx_wait, skb);
} 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",
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]);
......@@ -360,7 +368,7 @@ lec_send_packet(struct sk_buff *skb, struct net_device *dev)
#if DUMP_PACKETS > 0
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 */
while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
......@@ -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",
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_send(send_vcc, skb2, priv);
lec_send(vcc, skb2, priv);
}
lec_send(send_vcc, skb, priv);
lec_send(vcc, skb, priv);
#if 0
/* Should we wait for card's device driver to notify us? */
dev->tbusy=0;
#endif
if (!atm_may_send(vcc, 0)) {
struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
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;
}
......@@ -635,7 +656,8 @@ lec_init(struct net_device *dev)
dev->change_mtu = lec_change_mtu;
dev->open = lec_open;
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->set_multicast_list = lec_set_multicast_list;
......@@ -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
lec_vcc_attach(struct atm_vcc *vcc, void *arg)
{
struct lec_vcc_priv *vpriv;
int bytes_left;
struct atmlec_ioc ioc_data;
......@@ -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 ||
!dev_lec[ioc_data.dev_num])
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,
&ioc_data, vcc, vcc->push);
vcc->push = lec_push;
......@@ -1363,22 +1412,21 @@ void
lec_arp_clear_vccs(struct lec_arp_table *entry)
{
if (entry->vcc) {
entry->vcc->push = entry->old_push;
#if 0 /* August 6, 1998 */
set_bit(ATM_VF_RELEASED,&entry->vcc->flags);
clear_bit(ATM_VF_READY,&entry->vcc->flags);
entry->vcc->push(entry->vcc, NULL);
#endif
vcc_release_async(entry->vcc, -EPIPE);
entry->vcc = NULL;
struct atm_vcc *vcc = entry->vcc;
struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
struct net_device *dev = (struct net_device*) vcc->proto_data;
vcc->pop = vpriv->old_pop;
if (vpriv->xoff)
netif_wake_queue(dev);
kfree(vpriv);
LEC_VCC_PRIV(vcc) = NULL;
vcc->push = entry->old_push;
vcc_release_async(vcc, -EPIPE);
vcc = NULL;
}
if (entry->recv_vcc) {
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);
entry->recv_vcc = NULL;
}
......@@ -2320,11 +2368,20 @@ lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
unsigned char mac_addr[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
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);
to_add = make_entry(priv, mac_addr);
if (!to_add) {
lec_arp_put(priv);
vcc->pop = vpriv->old_pop;
kfree(vpriv);
return -ENOMEM;
}
memcpy(to_add->atm_addr, vcc->remote.sas_addr.prv, ATM_ESA_LEN);
......
......@@ -139,6 +139,13 @@ struct lec_priv {
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 lec_vcc_attach(struct atm_vcc *vcc, void *arg);
int lec_mcast_attach(struct atm_vcc *vcc, int arg);
......
......@@ -762,6 +762,27 @@ int hci_get_dev_info(unsigned long arg)
/* ---- 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 */
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
static void bt_release(struct class_device *cdev)
{
struct hci_dev *hdev = class_get_devdata(cdev);
kfree(hdev);
}
static struct class bt_class = {
......
......@@ -42,6 +42,8 @@
#include <net/bluetooth/hci_core.h>
/* HCI Core */
EXPORT_SYMBOL(hci_alloc_dev);
EXPORT_SYMBOL(hci_free_dev);
EXPORT_SYMBOL(hci_register_dev);
EXPORT_SYMBOL(hci_unregister_dev);
EXPORT_SYMBOL(hci_suspend_dev);
......
......@@ -1691,7 +1691,7 @@ int netif_receive_skb(struct sk_buff *skb)
{
struct packet_type *ptype, *pt_prev;
int ret = NET_RX_DROP;
unsigned short type = skb->protocol;
unsigned short type;
if (!skb->stamp.tv_sec)
do_gettimeofday(&skb->stamp);
......@@ -1725,6 +1725,7 @@ int netif_receive_skb(struct sk_buff *skb)
if (__handle_bridge(skb, &pt_prev, &ret))
goto out;
type = skb->protocol;
list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type)&15], list) {
if (ptype->type == type &&
(!ptype->dev || ptype->dev == skb->dev)) {
......
......@@ -1196,6 +1196,7 @@ EXPORT_SYMBOL(sock_setsockopt);
EXPORT_SYMBOL(sock_wfree);
EXPORT_SYMBOL(sock_wmalloc);
#ifdef CONFIG_SYSCTL
EXPORT_SYMBOL(sysctl_optmem_max);
EXPORT_SYMBOL(sysctl_rmem_max);
EXPORT_SYMBOL(sysctl_wmem_max);
#endif
......@@ -40,7 +40,6 @@
#include <linux/init.h>
#include <linux/tty.h>
#include <linux/kmod.h>
#include <linux/wireless.h>
#include <linux/spinlock.h>
#include <asm/ioctls.h>
......@@ -48,8 +47,6 @@
#include <asm/dma.h>
#include <asm/io.h>
#include <net/pkt_sched.h>
#include <net/irda/irda_device.h>
#include <net/irda/irlap.h>
#include <net/irda/timer.h>
......@@ -60,13 +57,6 @@ static void __irda_task_delete(struct irda_task *task);
static hashbin_t *dongles = NULL;
static hashbin_t *tasks = NULL;
const char *infrared_mode[] = {
"IRDA_IRLAP",
"IRDA_RAW",
"SHARP_ASK",
"TV_REMOTE",
};
#ifdef CONFIG_IRDA_DEBUG
static const char *task_state[] = {
"IRDA_TASK_INIT",
......@@ -248,7 +238,7 @@ void irda_task_delete(struct irda_task *task)
* processing, and notify the parent task, that is waiting for this task
* to complete.
*/
int irda_task_kick(struct irda_task *task)
static int irda_task_kick(struct irda_task *task)
{
int finished = TRUE;
int count = 0;
......@@ -406,22 +396,6 @@ struct net_device *alloc_irdadev(int sizeof_priv)
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)
*
......@@ -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
*
*/
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;
......@@ -572,4 +546,5 @@ void setup_dma(int channel, char *buffer, int count, int mode)
release_dma_lock(flags);
}
EXPORT_SYMBOL(irda_setup_dma);
#endif
......@@ -208,7 +208,7 @@
* This function hash the input string 'name' using the ELF hash
* function for strings.
*/
static __u32 hash( char* name)
static __u32 hash( const char* name)
{
__u32 h = 0;
__u32 g;
......@@ -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)
......@@ -474,38 +375,6 @@ hashbin_t *hashbin_new(int type)
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)
......@@ -567,7 +436,8 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func)
* 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;
int bin;
......@@ -598,14 +468,9 @@ void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, char* n
/*
* Insert new entry first
* TODO: Perhaps allow sorted lists?
* -> Merge sort if a sorted list should be created
*/
if ( hashbin->hb_type & HB_SORTED) {
} else {
enqueue_first( (irda_queue_t**) &hashbin->hb_queue[ bin ],
entry);
}
hashbin->hb_size++;
/* Release lock */
......@@ -683,7 +548,7 @@ void *hashbin_remove_first( hashbin_t *hashbin)
* In other case, you must think hard to guarantee unicity of the index.
* 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;
unsigned long flags = 0;
......@@ -834,7 +699,7 @@ void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry)
* 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;
irda_queue_t* entry;
......@@ -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
* 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;
irda_queue_t* entry;
......@@ -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
* 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)
{
unsigned long flags = 0;
......
......@@ -159,7 +159,6 @@ EXPORT_SYMBOL(irda_device_dongle_cleanup);
EXPORT_SYMBOL(irda_device_register_dongle);
EXPORT_SYMBOL(irda_device_unregister_dongle);
EXPORT_SYMBOL(irda_task_execute);
EXPORT_SYMBOL(irda_task_kick);
EXPORT_SYMBOL(irda_task_next_state);
EXPORT_SYMBOL(irda_task_delete);
......@@ -168,10 +167,6 @@ EXPORT_SYMBOL(async_unwrap_char);
EXPORT_SYMBOL(irda_calc_crc16);
EXPORT_SYMBOL(irda_crc16_table);
EXPORT_SYMBOL(irda_start_timer);
#ifdef CONFIG_ISA
EXPORT_SYMBOL(setup_dma);
#endif
EXPORT_SYMBOL(infrared_mode);
#ifdef CONFIG_IRTTY
EXPORT_SYMBOL(irtty_set_dtr_rts);
......
......@@ -41,7 +41,7 @@ static void __rxrpc_conn_timeout(rxrpc_timer_t *timer)
}
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