aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/btmrvl_main.c107
-rw-r--r--drivers/bluetooth/btmrvl_sdio.c135
2 files changed, 23 insertions, 219 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index bbc4446c4b4b..e605563b4eaa 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -32,8 +32,6 @@
32 */ 32 */
33void btmrvl_interrupt(struct btmrvl_private *priv) 33void btmrvl_interrupt(struct btmrvl_private *priv)
34{ 34{
35 BT_DBG("Enter");
36
37 priv->adapter->ps_state = PS_AWAKE; 35 priv->adapter->ps_state = PS_AWAKE;
38 36
39 priv->adapter->wakeup_tries = 0; 37 priv->adapter->wakeup_tries = 0;
@@ -41,8 +39,6 @@ void btmrvl_interrupt(struct btmrvl_private *priv)
41 priv->adapter->int_count++; 39 priv->adapter->int_count++;
42 40
43 wake_up_interruptible(&priv->main_thread.wait_q); 41 wake_up_interruptible(&priv->main_thread.wait_q);
44
45 BT_DBG("Leave");
46} 42}
47EXPORT_SYMBOL_GPL(btmrvl_interrupt); 43EXPORT_SYMBOL_GPL(btmrvl_interrupt);
48 44
@@ -52,8 +48,6 @@ void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb)
52 struct hci_ev_cmd_complete *ec; 48 struct hci_ev_cmd_complete *ec;
53 u16 opcode, ocf; 49 u16 opcode, ocf;
54 50
55 BT_DBG("Enter");
56
57 if (hdr->evt == HCI_EV_CMD_COMPLETE) { 51 if (hdr->evt == HCI_EV_CMD_COMPLETE) {
58 ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); 52 ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE);
59 opcode = __le16_to_cpu(ec->opcode); 53 opcode = __le16_to_cpu(ec->opcode);
@@ -65,8 +59,6 @@ void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb)
65 wake_up_interruptible(&priv->adapter->cmd_wait_q); 59 wake_up_interruptible(&priv->adapter->cmd_wait_q);
66 } 60 }
67 } 61 }
68
69 BT_DBG("Leave");
70} 62}
71EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); 63EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt);
72 64
@@ -76,8 +68,6 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
76 struct btmrvl_event *event; 68 struct btmrvl_event *event;
77 u8 ret = 0; 69 u8 ret = 0;
78 70
79 BT_DBG("Enter");
80
81 event = (struct btmrvl_event *) skb->data; 71 event = (struct btmrvl_event *) skb->data;
82 if (event->ec != 0xff) { 72 if (event->ec != 0xff) {
83 BT_DBG("Not Marvell Event=%x", event->ec); 73 BT_DBG("Not Marvell Event=%x", event->ec);
@@ -151,8 +141,6 @@ exit:
151 if (!ret) 141 if (!ret)
152 kfree_skb(skb); 142 kfree_skb(skb);
153 143
154 BT_DBG("Leave");
155
156 return ret; 144 return ret;
157} 145}
158EXPORT_SYMBOL_GPL(btmrvl_process_event); 146EXPORT_SYMBOL_GPL(btmrvl_process_event);
@@ -161,15 +149,12 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd)
161{ 149{
162 struct sk_buff *skb; 150 struct sk_buff *skb;
163 struct btmrvl_cmd *cmd; 151 struct btmrvl_cmd *cmd;
164 u8 ret = 0; 152 int ret = 0;
165
166 BT_DBG("Enter");
167 153
168 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); 154 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
169 if (skb == NULL) { 155 if (skb == NULL) {
170 BT_ERR("No free skb"); 156 BT_ERR("No free skb");
171 ret = -ENOMEM; 157 return -ENOMEM;
172 goto exit;
173 } 158 }
174 159
175 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); 160 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
@@ -200,9 +185,6 @@ int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd)
200 185
201 BT_DBG("module cfg Command done"); 186 BT_DBG("module cfg Command done");
202 187
203exit:
204 BT_DBG("Leave");
205
206 return ret; 188 return ret;
207} 189}
208EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); 190EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd);
@@ -211,15 +193,12 @@ static int btmrvl_enable_hs(struct btmrvl_private *priv)
211{ 193{
212 struct sk_buff *skb; 194 struct sk_buff *skb;
213 struct btmrvl_cmd *cmd; 195 struct btmrvl_cmd *cmd;
214 u8 ret = 0; 196 int ret = 0;
215
216 BT_DBG("Enter");
217 197
218 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); 198 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
219 if (skb == NULL) { 199 if (skb == NULL) {
220 BT_ERR("No free skb"); 200 BT_ERR("No free skb");
221 ret = -ENOMEM; 201 return -ENOMEM;
222 goto exit;
223 } 202 }
224 203
225 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); 204 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
@@ -244,9 +223,6 @@ static int btmrvl_enable_hs(struct btmrvl_private *priv)
244 priv->adapter->wakeup_tries); 223 priv->adapter->wakeup_tries);
245 } 224 }
246 225
247exit:
248 BT_DBG("Leave");
249
250 return ret; 226 return ret;
251} 227}
252 228
@@ -254,9 +230,7 @@ int btmrvl_prepare_command(struct btmrvl_private *priv)
254{ 230{
255 struct sk_buff *skb = NULL; 231 struct sk_buff *skb = NULL;
256 struct btmrvl_cmd *cmd; 232 struct btmrvl_cmd *cmd;
257 u8 ret = 0; 233 int ret = 0;
258
259 BT_DBG("Enter");
260 234
261 if (priv->btmrvl_dev.hscfgcmd) { 235 if (priv->btmrvl_dev.hscfgcmd) {
262 priv->btmrvl_dev.hscfgcmd = 0; 236 priv->btmrvl_dev.hscfgcmd = 0;
@@ -264,8 +238,7 @@ int btmrvl_prepare_command(struct btmrvl_private *priv)
264 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); 238 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
265 if (skb == NULL) { 239 if (skb == NULL) {
266 BT_ERR("No free skb"); 240 BT_ERR("No free skb");
267 ret = -ENOMEM; 241 return -ENOMEM;
268 goto exit;
269 } 242 }
270 243
271 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); 244 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
@@ -289,8 +262,7 @@ int btmrvl_prepare_command(struct btmrvl_private *priv)
289 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC); 262 skb = bt_skb_alloc(sizeof(*cmd), GFP_ATOMIC);
290 if (skb == NULL) { 263 if (skb == NULL) {
291 BT_ERR("No free skb"); 264 BT_ERR("No free skb");
292 ret = -ENOMEM; 265 return -ENOMEM;
293 goto exit;
294 } 266 }
295 267
296 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd)); 268 cmd = (struct btmrvl_cmd *) skb_put(skb, sizeof(*cmd));
@@ -321,27 +293,19 @@ int btmrvl_prepare_command(struct btmrvl_private *priv)
321 } 293 }
322 } 294 }
323 295
324exit:
325 BT_DBG("Leave");
326
327 return ret; 296 return ret;
328} 297}
329 298
330static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb) 299static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
331{ 300{
332 u8 ret = 0; 301 int ret = 0;
333 302
334 BT_DBG("Enter"); 303 if (!skb || !skb->data)
335
336 if (!skb || !skb->data) {
337 BT_DBG("Leave");
338 return -EINVAL; 304 return -EINVAL;
339 }
340 305
341 if (!skb->len || ((skb->len + BTM_HEADER_LEN) > BTM_UPLD_SIZE)) { 306 if (!skb->len || ((skb->len + BTM_HEADER_LEN) > BTM_UPLD_SIZE)) {
342 BT_ERR("Tx Error: Bad skb length %d : %d", 307 BT_ERR("Tx Error: Bad skb length %d : %d",
343 skb->len, BTM_UPLD_SIZE); 308 skb->len, BTM_UPLD_SIZE);
344 BT_DBG("Leave");
345 return -EINVAL; 309 return -EINVAL;
346 } 310 }
347 311
@@ -353,7 +317,6 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
353 BT_ERR("Tx Error: realloc_headroom failed %d", 317 BT_ERR("Tx Error: realloc_headroom failed %d",
354 BTM_HEADER_LEN); 318 BTM_HEADER_LEN);
355 skb = tmp; 319 skb = tmp;
356 BT_DBG("Leave");
357 return -EINVAL; 320 return -EINVAL;
358 } 321 }
359 322
@@ -375,52 +338,35 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
375 if (priv->hw_host_to_card) 338 if (priv->hw_host_to_card)
376 ret = priv->hw_host_to_card(priv, skb->data, skb->len); 339 ret = priv->hw_host_to_card(priv, skb->data, skb->len);
377 340
378 BT_DBG("Leave");
379
380 return ret; 341 return ret;
381} 342}
382 343
383static void btmrvl_init_adapter(struct btmrvl_private *priv) 344static void btmrvl_init_adapter(struct btmrvl_private *priv)
384{ 345{
385 BT_DBG("Enter");
386
387 skb_queue_head_init(&priv->adapter->tx_queue); 346 skb_queue_head_init(&priv->adapter->tx_queue);
388 347
389 priv->adapter->ps_state = PS_AWAKE; 348 priv->adapter->ps_state = PS_AWAKE;
390 349
391 init_waitqueue_head(&priv->adapter->cmd_wait_q); 350 init_waitqueue_head(&priv->adapter->cmd_wait_q);
392
393 BT_DBG("Leave");
394} 351}
395 352
396static void btmrvl_free_adapter(struct btmrvl_private *priv) 353static void btmrvl_free_adapter(struct btmrvl_private *priv)
397{ 354{
398 BT_DBG("Enter");
399
400 skb_queue_purge(&priv->adapter->tx_queue); 355 skb_queue_purge(&priv->adapter->tx_queue);
401 356
402 kfree(priv->adapter); 357 kfree(priv->adapter);
403 358
404 priv->adapter = NULL; 359 priv->adapter = NULL;
405
406 BT_DBG("Leave");
407} 360}
408 361
409static int btmrvl_ioctl(struct hci_dev *hdev, 362static int btmrvl_ioctl(struct hci_dev *hdev,
410 unsigned int cmd, unsigned long arg) 363 unsigned int cmd, unsigned long arg)
411{ 364{
412 BT_DBG("Enter");
413
414 BT_DBG("Leave");
415
416 return -ENOIOCTLCMD; 365 return -ENOIOCTLCMD;
417} 366}
418 367
419static void btmrvl_destruct(struct hci_dev *hdev) 368static void btmrvl_destruct(struct hci_dev *hdev)
420{ 369{
421 BT_DBG("Enter");
422
423 BT_DBG("Leave");
424} 370}
425 371
426static int btmrvl_send_frame(struct sk_buff *skb) 372static int btmrvl_send_frame(struct sk_buff *skb)
@@ -428,11 +374,10 @@ static int btmrvl_send_frame(struct sk_buff *skb)
428 struct hci_dev *hdev = (struct hci_dev *) skb->dev; 374 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
429 struct btmrvl_private *priv = NULL; 375 struct btmrvl_private *priv = NULL;
430 376
431 BT_DBG("Enter: type=%d, len=%d", skb->pkt_type, skb->len); 377 BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
432 378
433 if (!hdev || !hdev->driver_data) { 379 if (!hdev || !hdev->driver_data) {
434 BT_ERR("Frame for unknown HCI device"); 380 BT_ERR("Frame for unknown HCI device");
435 BT_DBG("Leave");
436 return -ENODEV; 381 return -ENODEV;
437 } 382 }
438 383
@@ -441,7 +386,6 @@ static int btmrvl_send_frame(struct sk_buff *skb)
441 BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); 386 BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags);
442 print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET, 387 print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET,
443 skb->data, skb->len); 388 skb->data, skb->len);
444 BT_DBG("Leave");
445 return -EBUSY; 389 return -EBUSY;
446 } 390 }
447 391
@@ -463,8 +407,6 @@ static int btmrvl_send_frame(struct sk_buff *skb)
463 407
464 wake_up_interruptible(&priv->main_thread.wait_q); 408 wake_up_interruptible(&priv->main_thread.wait_q);
465 409
466 BT_DBG("Leave");
467
468 return 0; 410 return 0;
469} 411}
470 412
@@ -472,12 +414,8 @@ static int btmrvl_flush(struct hci_dev *hdev)
472{ 414{
473 struct btmrvl_private *priv = hdev->driver_data; 415 struct btmrvl_private *priv = hdev->driver_data;
474 416
475 BT_DBG("Enter");
476
477 skb_queue_purge(&priv->adapter->tx_queue); 417 skb_queue_purge(&priv->adapter->tx_queue);
478 418
479 BT_DBG("Leave");
480
481 return 0; 419 return 0;
482} 420}
483 421
@@ -485,28 +423,18 @@ static int btmrvl_close(struct hci_dev *hdev)
485{ 423{
486 struct btmrvl_private *priv = hdev->driver_data; 424 struct btmrvl_private *priv = hdev->driver_data;
487 425
488 BT_DBG("Enter"); 426 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
489
490 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) {
491 BT_DBG("Leave");
492 return 0; 427 return 0;
493 }
494 428
495 skb_queue_purge(&priv->adapter->tx_queue); 429 skb_queue_purge(&priv->adapter->tx_queue);
496 430
497 BT_DBG("Leave");
498
499 return 0; 431 return 0;
500} 432}
501 433
502static int btmrvl_open(struct hci_dev *hdev) 434static int btmrvl_open(struct hci_dev *hdev)
503{ 435{
504 BT_DBG("Enter");
505
506 set_bit(HCI_RUNNING, &hdev->flags); 436 set_bit(HCI_RUNNING, &hdev->flags);
507 437
508 BT_DBG("Leave");
509
510 return 0; 438 return 0;
511} 439}
512 440
@@ -523,8 +451,6 @@ static int btmrvl_service_main_thread(void *data)
523 struct sk_buff *skb; 451 struct sk_buff *skb;
524 ulong flags; 452 ulong flags;
525 453
526 BT_DBG("Enter");
527
528 init_waitqueue_entry(&wait, current); 454 init_waitqueue_entry(&wait, current);
529 455
530 current->flags |= PF_NOFREEZE; 456 current->flags |= PF_NOFREEZE;
@@ -582,8 +508,6 @@ static int btmrvl_service_main_thread(void *data)
582 } 508 }
583 } 509 }
584 510
585 BT_DBG("Leave");
586
587 return 0; 511 return 0;
588} 512}
589 513
@@ -593,8 +517,6 @@ struct btmrvl_private *btmrvl_add_card(void *card)
593 struct btmrvl_private *priv; 517 struct btmrvl_private *priv;
594 int ret; 518 int ret;
595 519
596 BT_DBG("Enter");
597
598 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 520 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
599 if (!priv) { 521 if (!priv) {
600 BT_ERR("Can not allocate priv"); 522 BT_ERR("Can not allocate priv");
@@ -649,7 +571,6 @@ struct btmrvl_private *btmrvl_add_card(void *card)
649 btmrvl_debugfs_init(hdev); 571 btmrvl_debugfs_init(hdev);
650#endif 572#endif
651 573
652 BT_DBG("Leave");
653 return priv; 574 return priv;
654 575
655err_hci_register_dev: 576err_hci_register_dev:
@@ -665,8 +586,6 @@ err_adapter:
665 kfree(priv); 586 kfree(priv);
666 587
667err_priv: 588err_priv:
668 BT_DBG("Leave");
669
670 return NULL; 589 return NULL;
671} 590}
672EXPORT_SYMBOL_GPL(btmrvl_add_card); 591EXPORT_SYMBOL_GPL(btmrvl_add_card);
@@ -675,8 +594,6 @@ int btmrvl_remove_card(struct btmrvl_private *priv)
675{ 594{
676 struct hci_dev *hdev; 595 struct hci_dev *hdev;
677 596
678 BT_DBG("Enter");
679
680 hdev = priv->btmrvl_dev.hcidev; 597 hdev = priv->btmrvl_dev.hcidev;
681 598
682 wake_up_interruptible(&priv->adapter->cmd_wait_q); 599 wake_up_interruptible(&priv->adapter->cmd_wait_q);
@@ -697,8 +614,6 @@ int btmrvl_remove_card(struct btmrvl_private *priv)
697 614
698 kfree(priv); 615 kfree(priv);
699 616
700 BT_DBG("Leave");
701
702 return 0; 617 return 0;
703} 618}
704EXPORT_SYMBOL_GPL(btmrvl_remove_card); 619EXPORT_SYMBOL_GPL(btmrvl_remove_card);
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 7638f62e8a06..224af53e0fae 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -67,23 +67,17 @@ static int btmrvl_sdio_get_rx_unit(struct btmrvl_sdio_card *card)
67 u8 reg; 67 u8 reg;
68 int ret; 68 int ret;
69 69
70 BT_DBG("Enter");
71
72 reg = sdio_readb(card->func, CARD_RX_UNIT_REG, &ret); 70 reg = sdio_readb(card->func, CARD_RX_UNIT_REG, &ret);
73 if (!ret) 71 if (!ret)
74 card->rx_unit = reg; 72 card->rx_unit = reg;
75 73
76 BT_DBG("Leave");
77
78 return ret; 74 return ret;
79} 75}
80 76
81static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat) 77static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat)
82{ 78{
83 int ret;
84 u8 fws0, fws1; 79 u8 fws0, fws1;
85 80 int ret;
86 BT_DBG("Enter");
87 81
88 *dat = 0; 82 *dat = 0;
89 83
@@ -92,31 +86,23 @@ static int btmrvl_sdio_read_fw_status(struct btmrvl_sdio_card *card, u16 *dat)
92 if (!ret) 86 if (!ret)
93 fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret); 87 fws1 = sdio_readb(card->func, CARD_FW_STATUS1_REG, &ret);
94 88
95 if (ret) { 89 if (ret)
96 BT_DBG("Leave");
97 return -EIO; 90 return -EIO;
98 }
99 91
100 *dat = (((u16) fws1) << 8) | fws0; 92 *dat = (((u16) fws1) << 8) | fws0;
101 93
102 BT_DBG("Leave");
103
104 return 0; 94 return 0;
105} 95}
106 96
107static int btmrvl_sdio_read_rx_len(struct btmrvl_sdio_card *card, u16 *dat) 97static int btmrvl_sdio_read_rx_len(struct btmrvl_sdio_card *card, u16 *dat)
108{ 98{
109 int ret;
110 u8 reg; 99 u8 reg;
111 100 int ret;
112 BT_DBG("Enter");
113 101
114 reg = sdio_readb(card->func, CARD_RX_LEN_REG, &ret); 102 reg = sdio_readb(card->func, CARD_RX_LEN_REG, &ret);
115 if (!ret) 103 if (!ret)
116 *dat = (u16) reg << card->rx_unit; 104 *dat = (u16) reg << card->rx_unit;
117 105
118 BT_DBG("Leave");
119
120 return ret; 106 return ret;
121} 107}
122 108
@@ -125,64 +111,48 @@ static int btmrvl_sdio_enable_host_int_mask(struct btmrvl_sdio_card *card,
125{ 111{
126 int ret; 112 int ret;
127 113
128 BT_DBG("Enter");
129
130 sdio_writeb(card->func, mask, HOST_INT_MASK_REG, &ret); 114 sdio_writeb(card->func, mask, HOST_INT_MASK_REG, &ret);
131 if (ret) { 115 if (ret) {
132 BT_ERR("Unable to enable the host interrupt!"); 116 BT_ERR("Unable to enable the host interrupt!");
133 ret = -EIO; 117 ret = -EIO;
134 } 118 }
135 119
136 BT_DBG("Leave");
137
138 return ret; 120 return ret;
139} 121}
140 122
141static int btmrvl_sdio_disable_host_int_mask(struct btmrvl_sdio_card *card, 123static int btmrvl_sdio_disable_host_int_mask(struct btmrvl_sdio_card *card,
142 u8 mask) 124 u8 mask)
143{ 125{
144 int ret;
145 u8 host_int_mask; 126 u8 host_int_mask;
146 127 int ret;
147 BT_DBG("Enter");
148 128
149 host_int_mask = sdio_readb(card->func, HOST_INT_MASK_REG, &ret); 129 host_int_mask = sdio_readb(card->func, HOST_INT_MASK_REG, &ret);
150 if (ret) { 130 if (ret)
151 ret = -EIO; 131 return -EIO;
152 goto done;
153 }
154 132
155 host_int_mask &= ~mask; 133 host_int_mask &= ~mask;
156 134
157 sdio_writeb(card->func, host_int_mask, HOST_INT_MASK_REG, &ret); 135 sdio_writeb(card->func, host_int_mask, HOST_INT_MASK_REG, &ret);
158 if (ret < 0) { 136 if (ret < 0) {
159 BT_ERR("Unable to disable the host interrupt!"); 137 BT_ERR("Unable to disable the host interrupt!");
160 ret = -EIO; 138 return -EIO;
161 goto done;
162 } 139 }
163 140
164 ret = 0; 141 return 0;
165
166done:
167 BT_DBG("Leave");
168
169 return ret;
170} 142}
171 143
172static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits) 144static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits)
173{ 145{
174 unsigned int tries; 146 unsigned int tries;
175 int ret;
176 u8 status; 147 u8 status;
177 148 int ret;
178 BT_DBG("Enter");
179 149
180 for (tries = 0; tries < MAX_POLL_TRIES * 1000; tries++) { 150 for (tries = 0; tries < MAX_POLL_TRIES * 1000; tries++) {
181 status = sdio_readb(card->func, CARD_STATUS_REG, &ret); 151 status = sdio_readb(card->func, CARD_STATUS_REG, &ret);
182 if (ret) 152 if (ret)
183 goto failed; 153 goto failed;
184 if ((status & bits) == bits) 154 if ((status & bits) == bits)
185 goto done; 155 return ret;
186 156
187 udelay(1); 157 udelay(1);
188 } 158 }
@@ -192,9 +162,6 @@ static int btmrvl_sdio_poll_card_status(struct btmrvl_sdio_card *card, u8 bits)
192failed: 162failed:
193 BT_ERR("FAILED! ret=%d", ret); 163 BT_ERR("FAILED! ret=%d", ret);
194 164
195done:
196 BT_DBG("Leave");
197
198 return ret; 165 return ret;
199} 166}
200 167
@@ -205,8 +172,6 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
205 u16 firmwarestat; 172 u16 firmwarestat;
206 unsigned int tries; 173 unsigned int tries;
207 174
208 BT_DBG("Enter");
209
210 /* Wait for firmware to become ready */ 175 /* Wait for firmware to become ready */
211 for (tries = 0; tries < pollnum; tries++) { 176 for (tries = 0; tries < pollnum; tries++) {
212 if (btmrvl_sdio_read_fw_status(card, &firmwarestat) < 0) 177 if (btmrvl_sdio_read_fw_status(card, &firmwarestat) < 0)
@@ -220,8 +185,6 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
220 } 185 }
221 } 186 }
222 187
223 BT_DBG("Leave");
224
225 return ret; 188 return ret;
226} 189}
227 190
@@ -235,8 +198,6 @@ static int btmrvl_sdio_download_helper(struct btmrvl_sdio_card *card)
235 u8 *helperbuf; 198 u8 *helperbuf;
236 u32 tx_len; 199 u32 tx_len;
237 200
238 BT_DBG("Enter");
239
240 ret = request_firmware(&fw_helper, card->helper, 201 ret = request_firmware(&fw_helper, card->helper,
241 &card->func->dev); 202 &card->func->dev);
242 if ((ret < 0) || !fw_helper) { 203 if ((ret < 0) || !fw_helper) {
@@ -326,8 +287,6 @@ done:
326 if (fw_helper) 287 if (fw_helper)
327 release_firmware(fw_helper); 288 release_firmware(fw_helper);
328 289
329 BT_DBG("Leave");
330
331 return ret; 290 return ret;
332} 291}
333 292
@@ -343,8 +302,6 @@ static int btmrvl_sdio_download_fw_w_helper(struct btmrvl_sdio_card *card)
343 u16 len; 302 u16 len;
344 int txlen = 0, tx_blocks = 0, count = 0; 303 int txlen = 0, tx_blocks = 0, count = 0;
345 304
346 BT_DBG("Enter");
347
348 ret = request_firmware(&fw_firmware, card->firmware, 305 ret = request_firmware(&fw_firmware, card->firmware,
349 &card->func->dev); 306 &card->func->dev);
350 if ((ret < 0) || !fw_firmware) { 307 if ((ret < 0) || !fw_firmware) {
@@ -479,8 +436,6 @@ done:
479 if (fw_firmware) 436 if (fw_firmware)
480 release_firmware(fw_firmware); 437 release_firmware(fw_firmware);
481 438
482 BT_DBG("Leave");
483
484 return ret; 439 return ret;
485} 440}
486 441
@@ -494,8 +449,6 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv)
494 struct hci_dev *hdev = priv->btmrvl_dev.hcidev; 449 struct hci_dev *hdev = priv->btmrvl_dev.hcidev;
495 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; 450 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
496 451
497 BT_DBG("Enter");
498
499 if (!card || !card->func) { 452 if (!card || !card->func) {
500 BT_ERR("card or function is NULL!"); 453 BT_ERR("card or function is NULL!");
501 ret = -EINVAL; 454 ret = -EINVAL;
@@ -596,8 +549,6 @@ exit:
596 kfree_skb(skb); 549 kfree_skb(skb);
597 } 550 }
598 551
599 BT_DBG("Leave");
600
601 return ret; 552 return ret;
602} 553}
603 554
@@ -607,8 +558,6 @@ static int btmrvl_sdio_get_int_status(struct btmrvl_private *priv, u8 * ireg)
607 u8 sdio_ireg = 0; 558 u8 sdio_ireg = 0;
608 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; 559 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
609 560
610 BT_DBG("Enter");
611
612 *ireg = 0; 561 *ireg = 0;
613 562
614 sdio_ireg = sdio_readb(card->func, HOST_INTSTATUS_REG, &ret); 563 sdio_ireg = sdio_readb(card->func, HOST_INTSTATUS_REG, &ret);
@@ -653,8 +602,6 @@ static int btmrvl_sdio_get_int_status(struct btmrvl_private *priv, u8 * ireg)
653 ret = 0; 602 ret = 0;
654 603
655done: 604done:
656 BT_DBG("Leave");
657
658 return ret; 605 return ret;
659} 606}
660 607
@@ -665,8 +612,6 @@ static void btmrvl_sdio_interrupt(struct sdio_func *func)
665 struct btmrvl_sdio_card *card; 612 struct btmrvl_sdio_card *card;
666 u8 ireg = 0; 613 u8 ireg = 0;
667 614
668 BT_DBG("Enter");
669
670 card = sdio_get_drvdata(func); 615 card = sdio_get_drvdata(func);
671 if (card && card->priv) { 616 if (card && card->priv) {
672 priv = card->priv; 617 priv = card->priv;
@@ -679,8 +624,6 @@ static void btmrvl_sdio_interrupt(struct sdio_func *func)
679 624
680 btmrvl_interrupt(priv); 625 btmrvl_interrupt(priv);
681 } 626 }
682
683 BT_DBG("Leave");
684} 627}
685 628
686static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card) 629static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
@@ -689,8 +632,6 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
689 u8 reg; 632 u8 reg;
690 int ret = 0; 633 int ret = 0;
691 634
692 BT_DBG("Enter");
693
694 if (!card || !card->func) { 635 if (!card || !card->func) {
695 BT_ERR("Error: card or function is NULL!"); 636 BT_ERR("Error: card or function is NULL!");
696 ret = -EINVAL; 637 ret = -EINVAL;
@@ -752,7 +693,6 @@ static int btmrvl_sdio_register_dev(struct btmrvl_sdio_card *card)
752 693
753 sdio_release_host(func); 694 sdio_release_host(func);
754 695
755 BT_DBG("Leave");
756 return 0; 696 return 0;
757 697
758release_irq: 698release_irq:
@@ -765,14 +705,11 @@ release_host:
765 sdio_release_host(func); 705 sdio_release_host(func);
766 706
767failed: 707failed:
768 BT_DBG("Leave");
769 return ret; 708 return ret;
770} 709}
771 710
772static int btmrvl_sdio_unregister_dev(struct btmrvl_sdio_card *card) 711static int btmrvl_sdio_unregister_dev(struct btmrvl_sdio_card *card)
773{ 712{
774 BT_DBG("Enter");
775
776 if (card && card->func) { 713 if (card && card->func) {
777 sdio_claim_host(card->func); 714 sdio_claim_host(card->func);
778 sdio_release_irq(card->func); 715 sdio_release_irq(card->func);
@@ -781,8 +718,6 @@ static int btmrvl_sdio_unregister_dev(struct btmrvl_sdio_card *card)
781 sdio_set_drvdata(card->func, NULL); 718 sdio_set_drvdata(card->func, NULL);
782 } 719 }
783 720
784 BT_DBG("Leave");
785
786 return 0; 721 return 0;
787} 722}
788 723
@@ -790,12 +725,8 @@ static int btmrvl_sdio_enable_host_int(struct btmrvl_sdio_card *card)
790{ 725{
791 int ret; 726 int ret;
792 727
793 BT_DBG("Enter"); 728 if (!card || !card->func)
794
795 if (!card || !card->func) {
796 BT_DBG("Leave");
797 return -EINVAL; 729 return -EINVAL;
798 }
799 730
800 sdio_claim_host(card->func); 731 sdio_claim_host(card->func);
801 732
@@ -805,8 +736,6 @@ static int btmrvl_sdio_enable_host_int(struct btmrvl_sdio_card *card)
805 736
806 sdio_release_host(card->func); 737 sdio_release_host(card->func);
807 738
808 BT_DBG("Leave");
809
810 return ret; 739 return ret;
811} 740}
812 741
@@ -814,12 +743,8 @@ static int btmrvl_sdio_disable_host_int(struct btmrvl_sdio_card *card)
814{ 743{
815 int ret; 744 int ret;
816 745
817 BT_DBG("Enter"); 746 if (!card || !card->func)
818
819 if (!card || !card->func) {
820 BT_DBG("Leave");
821 return -EINVAL; 747 return -EINVAL;
822 }
823 748
824 sdio_claim_host(card->func); 749 sdio_claim_host(card->func);
825 750
@@ -827,8 +752,6 @@ static int btmrvl_sdio_disable_host_int(struct btmrvl_sdio_card *card)
827 752
828 sdio_release_host(card->func); 753 sdio_release_host(card->func);
829 754
830 BT_DBG("Leave");
831
832 return ret; 755 return ret;
833} 756}
834 757
@@ -844,11 +767,8 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
844 void *tmpbuf = NULL; 767 void *tmpbuf = NULL;
845 int tmpbufsz; 768 int tmpbufsz;
846 769
847 BT_DBG("Enter");
848
849 if (!card || !card->func) { 770 if (!card || !card->func) {
850 BT_ERR("card or function is NULL!"); 771 BT_ERR("card or function is NULL!");
851 BT_DBG("Leave");
852 return -EINVAL; 772 return -EINVAL;
853 } 773 }
854 774
@@ -886,8 +806,6 @@ static int btmrvl_sdio_host_to_card(struct btmrvl_private *priv,
886exit: 806exit:
887 sdio_release_host(card->func); 807 sdio_release_host(card->func);
888 808
889 BT_DBG("Leave");
890
891 return ret; 809 return ret;
892} 810}
893 811
@@ -895,11 +813,8 @@ static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card)
895{ 813{
896 int ret = 0; 814 int ret = 0;
897 815
898 BT_DBG("Enter");
899
900 if (!card || !card->func) { 816 if (!card || !card->func) {
901 BT_ERR("card or function is NULL!"); 817 BT_ERR("card or function is NULL!");
902 BT_DBG("Leave");
903 return -EINVAL; 818 return -EINVAL;
904 } 819 }
905 sdio_claim_host(card->func); 820 sdio_claim_host(card->func);
@@ -931,8 +846,6 @@ static int btmrvl_sdio_download_fw(struct btmrvl_sdio_card *card)
931done: 846done:
932 sdio_release_host(card->func); 847 sdio_release_host(card->func);
933 848
934 BT_DBG("Leave");
935
936 return ret; 849 return ret;
937} 850}
938 851
@@ -941,11 +854,8 @@ static int btmrvl_sdio_wakeup_fw(struct btmrvl_private *priv)
941 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card; 854 struct btmrvl_sdio_card *card = priv->btmrvl_dev.card;
942 int ret = 0; 855 int ret = 0;
943 856
944 BT_DBG("Enter");
945
946 if (!card || !card->func) { 857 if (!card || !card->func) {
947 BT_ERR("card or function is NULL!"); 858 BT_ERR("card or function is NULL!");
948 BT_DBG("Leave");
949 return -EINVAL; 859 return -EINVAL;
950 } 860 }
951 861
@@ -957,8 +867,6 @@ static int btmrvl_sdio_wakeup_fw(struct btmrvl_private *priv)
957 867
958 BT_DBG("wake up firmware"); 868 BT_DBG("wake up firmware");
959 869
960 BT_DBG("Leave");
961
962 return ret; 870 return ret;
963} 871}
964 872
@@ -969,8 +877,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
969 struct btmrvl_private *priv = NULL; 877 struct btmrvl_private *priv = NULL;
970 struct btmrvl_sdio_card *card = NULL; 878 struct btmrvl_sdio_card *card = NULL;
971 879
972 BT_DBG("Enter");
973
974 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d", 880 BT_INFO("vendor=0x%x, device=0x%x, class=%d, fn=%d",
975 id->vendor, id->device, id->class, func->num); 881 id->vendor, id->device, id->class, func->num);
976 882
@@ -1022,8 +928,6 @@ static int btmrvl_sdio_probe(struct sdio_func *func,
1022 928
1023 btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); 929 btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
1024 930
1025 BT_DBG("Leave");
1026
1027 return 0; 931 return 0;
1028 932
1029disable_host_int: 933disable_host_int:
@@ -1033,8 +937,6 @@ unreg_dev:
1033free_card: 937free_card:
1034 kfree(card); 938 kfree(card);
1035done: 939done:
1036 BT_DBG("Leave");
1037
1038 return ret; 940 return ret;
1039} 941}
1040 942
@@ -1042,8 +944,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func)
1042{ 944{
1043 struct btmrvl_sdio_card *card; 945 struct btmrvl_sdio_card *card;
1044 946
1045 BT_DBG("Enter");
1046
1047 if (func) { 947 if (func) {
1048 card = sdio_get_drvdata(func); 948 card = sdio_get_drvdata(func);
1049 if (card) { 949 if (card) {
@@ -1061,8 +961,6 @@ static void btmrvl_sdio_remove(struct sdio_func *func)
1061 kfree(card); 961 kfree(card);
1062 } 962 }
1063 } 963 }
1064
1065 BT_DBG("Leave");
1066} 964}
1067 965
1068static struct sdio_driver bt_mrvl_sdio = { 966static struct sdio_driver bt_mrvl_sdio = {
@@ -1074,32 +972,23 @@ static struct sdio_driver bt_mrvl_sdio = {
1074 972
1075static int btmrvl_sdio_init_module(void) 973static int btmrvl_sdio_init_module(void)
1076{ 974{
1077 BT_DBG("Enter");
1078
1079 if (sdio_register_driver(&bt_mrvl_sdio) != 0) { 975 if (sdio_register_driver(&bt_mrvl_sdio) != 0) {
1080 BT_ERR("SDIO Driver Registration Failed"); 976 BT_ERR("SDIO Driver Registration Failed");
1081 BT_DBG("Leave");
1082 return -ENODEV; 977 return -ENODEV;
1083 } 978 }
1084 979
1085 /* Clear the flag in case user removes the card. */ 980 /* Clear the flag in case user removes the card. */
1086 user_rmmod = 0; 981 user_rmmod = 0;
1087 982
1088 BT_DBG("Leave");
1089
1090 return 0; 983 return 0;
1091} 984}
1092 985
1093static void btmrvl_sdio_exit_module(void) 986static void btmrvl_sdio_exit_module(void)
1094{ 987{
1095 BT_DBG("Enter");
1096
1097 /* Set the flag as user is removing this module. */ 988 /* Set the flag as user is removing this module. */
1098 user_rmmod = 1; 989 user_rmmod = 1;
1099 990
1100 sdio_unregister_driver(&bt_mrvl_sdio); 991 sdio_unregister_driver(&bt_mrvl_sdio);
1101
1102 BT_DBG("Leave");
1103} 992}
1104 993
1105module_init(btmrvl_sdio_init_module); 994module_init(btmrvl_sdio_init_module);