diff options
Diffstat (limited to 'drivers/bluetooth/btmrvl_main.c')
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 107 |
1 files changed, 11 insertions, 96 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 | */ |
33 | void btmrvl_interrupt(struct btmrvl_private *priv) | 33 | void 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 | } |
47 | EXPORT_SYMBOL_GPL(btmrvl_interrupt); | 43 | EXPORT_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 | } |
71 | EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); | 63 | EXPORT_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 | } |
158 | EXPORT_SYMBOL_GPL(btmrvl_process_event); | 146 | EXPORT_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 | ||
203 | exit: | ||
204 | BT_DBG("Leave"); | ||
205 | |||
206 | return ret; | 188 | return ret; |
207 | } | 189 | } |
208 | EXPORT_SYMBOL_GPL(btmrvl_send_module_cfg_cmd); | 190 | EXPORT_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 | ||
247 | exit: | ||
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 | ||
324 | exit: | ||
325 | BT_DBG("Leave"); | ||
326 | |||
327 | return ret; | 296 | return ret; |
328 | } | 297 | } |
329 | 298 | ||
330 | static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb) | 299 | static 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 | ||
383 | static void btmrvl_init_adapter(struct btmrvl_private *priv) | 344 | static 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 | ||
396 | static void btmrvl_free_adapter(struct btmrvl_private *priv) | 353 | static 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 | ||
409 | static int btmrvl_ioctl(struct hci_dev *hdev, | 362 | static 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 | ||
419 | static void btmrvl_destruct(struct hci_dev *hdev) | 368 | static void btmrvl_destruct(struct hci_dev *hdev) |
420 | { | 369 | { |
421 | BT_DBG("Enter"); | ||
422 | |||
423 | BT_DBG("Leave"); | ||
424 | } | 370 | } |
425 | 371 | ||
426 | static int btmrvl_send_frame(struct sk_buff *skb) | 372 | static 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 | ||
502 | static int btmrvl_open(struct hci_dev *hdev) | 434 | static 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 | ||
655 | err_hci_register_dev: | 576 | err_hci_register_dev: |
@@ -665,8 +586,6 @@ err_adapter: | |||
665 | kfree(priv); | 586 | kfree(priv); |
666 | 587 | ||
667 | err_priv: | 588 | err_priv: |
668 | BT_DBG("Leave"); | ||
669 | |||
670 | return NULL; | 589 | return NULL; |
671 | } | 590 | } |
672 | EXPORT_SYMBOL_GPL(btmrvl_add_card); | 591 | EXPORT_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 | } |
704 | EXPORT_SYMBOL_GPL(btmrvl_remove_card); | 619 | EXPORT_SYMBOL_GPL(btmrvl_remove_card); |