diff options
Diffstat (limited to 'drivers/bluetooth/bt3c_cs.c')
| -rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 82 | 
1 files changed, 20 insertions, 62 deletions
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 0c8a6558749..1d82721cf9c 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -39,7 +39,6 @@  #include <linux/serial.h>  #include <linux/serial_reg.h>  #include <linux/bitops.h> -#include <asm/system.h>  #include <asm/io.h>  #include <linux/device.h> @@ -187,15 +186,15 @@ static void bt3c_write_wakeup(bt3c_info_t *info)  		return;  	do { -		register unsigned int iobase = info->p_dev->resource[0]->start; +		unsigned int iobase = info->p_dev->resource[0]->start;  		register struct sk_buff *skb; -		register int len; +		int len;  		if (!pcmcia_dev_present(info->p_dev))  			break; - -		if (!(skb = skb_dequeue(&(info->txq)))) { +		skb = skb_dequeue(&(info->txq)); +		if (!skb) {  			clear_bit(XMIT_SENDING, &(info->tx_state));  			break;  		} @@ -239,7 +238,8 @@ static void bt3c_receive(bt3c_info_t *info)  		if (info->rx_skb == NULL) {  			info->rx_state = RECV_WAIT_PACKET_TYPE;  			info->rx_count = 0; -			if (!(info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC))) { +			info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); +			if (!info->rx_skb) {  				BT_ERR("Can't allocate mem for new packet");  				return;  			} @@ -248,7 +248,6 @@ static void bt3c_receive(bt3c_info_t *info)  		if (info->rx_state == RECV_WAIT_PACKET_TYPE) { -			info->rx_skb->dev = (void *) info->hdev;  			bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L);  			inb(iobase + DATA_H);  			//printk("bt3c: PACKET_TYPE=%02x\n", bt_cb(info->rx_skb)->pkt_type); @@ -319,7 +318,7 @@ static void bt3c_receive(bt3c_info_t *info)  					break;  				case RECV_WAIT_DATA: -					hci_recv_frame(info->rx_skb); +					hci_recv_frame(info->hdev, info->rx_skb);  					info->rx_skb = NULL;  					break; @@ -389,7 +388,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)  static int bt3c_hci_flush(struct hci_dev *hdev)  { -	bt3c_info_t *info = (bt3c_info_t *)(hdev->driver_data); +	bt3c_info_t *info = hci_get_drvdata(hdev);  	/* Drop TX queue */  	skb_queue_purge(&(info->txq)); @@ -417,19 +416,11 @@ static int bt3c_hci_close(struct hci_dev *hdev)  } -static int bt3c_hci_send_frame(struct sk_buff *skb) +static int bt3c_hci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)  { -	bt3c_info_t *info; -	struct hci_dev *hdev = (struct hci_dev *)(skb->dev); +	bt3c_info_t *info = hci_get_drvdata(hdev);  	unsigned long flags; -	if (!hdev) { -		BT_ERR("Frame for unknown HCI device (hdev=NULL)"); -		return -ENODEV; -	} - -	info = (bt3c_info_t *) (hdev->driver_data); -  	switch (bt_cb(skb)->pkt_type) {  	case HCI_COMMAND_PKT:  		hdev->stat.cmd_tx++; @@ -456,17 +447,6 @@ static int bt3c_hci_send_frame(struct sk_buff *skb)  } -static void bt3c_hci_destruct(struct hci_dev *hdev) -{ -} - - -static int bt3c_hci_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg) -{ -	return -ENOIOCTLCMD; -} - -  /* ======================== Card services HCI interaction ======================== */ @@ -580,17 +560,13 @@ static int bt3c_open(bt3c_info_t *info)  	info->hdev = hdev;  	hdev->bus = HCI_PCCARD; -	hdev->driver_data = info; +	hci_set_drvdata(hdev, info);  	SET_HCIDEV_DEV(hdev, &info->p_dev->dev); -	hdev->open     = bt3c_hci_open; -	hdev->close    = bt3c_hci_close; -	hdev->flush    = bt3c_hci_flush; -	hdev->send     = bt3c_hci_send_frame; -	hdev->destruct = bt3c_hci_destruct; -	hdev->ioctl    = bt3c_hci_ioctl; - -	hdev->owner = THIS_MODULE; +	hdev->open  = bt3c_hci_open; +	hdev->close = bt3c_hci_close; +	hdev->flush = bt3c_hci_flush; +	hdev->send  = bt3c_hci_send_frame;  	/* Load firmware */  	err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); @@ -636,9 +612,7 @@ static int bt3c_close(bt3c_info_t *info)  	bt3c_hci_close(hdev); -	if (hci_unregister_dev(hdev) < 0) -		BT_ERR("Can't unregister HCI device %s", hdev->name); - +	hci_unregister_dev(hdev);  	hci_free_dev(hdev);  	return 0; @@ -649,7 +623,7 @@ static int bt3c_probe(struct pcmcia_device *link)  	bt3c_info_t *info;  	/* Create new info device */ -	info = kzalloc(sizeof(*info), GFP_KERNEL); +	info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL);  	if (!info)  		return -ENOMEM; @@ -665,17 +639,14 @@ static int bt3c_probe(struct pcmcia_device *link)  static void bt3c_detach(struct pcmcia_device *link)  { -	bt3c_info_t *info = link->priv; -  	bt3c_release(link); -	kfree(info);  }  static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data)  {  	int *try = priv_data; -	if (try == 0) +	if (!try)  		p_dev->io_lines = 16;  	if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) @@ -761,7 +732,7 @@ static void bt3c_release(struct pcmcia_device *link)  } -static struct pcmcia_device_id bt3c_ids[] = { +static const struct pcmcia_device_id bt3c_ids[] = {  	PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02),  	PCMCIA_DEVICE_NULL  }; @@ -774,17 +745,4 @@ static struct pcmcia_driver bt3c_driver = {  	.remove		= bt3c_detach,  	.id_table	= bt3c_ids,  }; - -static int __init init_bt3c_cs(void) -{ -	return pcmcia_register_driver(&bt3c_driver); -} - - -static void __exit exit_bt3c_cs(void) -{ -	pcmcia_unregister_driver(&bt3c_driver); -} - -module_init(init_bt3c_cs); -module_exit(exit_bt3c_cs); +module_pcmcia_driver(bt3c_driver);  | 
