aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-02-09 15:58:32 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-13 10:01:37 -0500
commit155961e8001719af6d87cbcc961111e8ce477843 (patch)
tree5b2485b5a7b2074f9e01111cf8539a34f34ce2d5 /drivers/bluetooth
parentaa2b86d761a95068354511de755695ef6b53afc7 (diff)
Bluetooth: Remove hci_dev->driver_data
The linux device model provides dev_set/get_drvdata so we can use this to save private driver data. This also removes several unnecessary casts. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bfusb.c10
-rw-r--r--drivers/bluetooth/bluecard_cs.c12
-rw-r--r--drivers/bluetooth/bpa10x.c18
-rw-r--r--drivers/bluetooth/bt3c_cs.c6
-rw-r--r--drivers/bluetooth/btmrvl_debugfs.c26
-rw-r--r--drivers/bluetooth/btmrvl_main.c11
-rw-r--r--drivers/bluetooth/btsdio.c10
-rw-r--r--drivers/bluetooth/btuart_cs.c6
-rw-r--r--drivers/bluetooth/btusb.c28
-rw-r--r--drivers/bluetooth/btwilink.c8
-rw-r--r--drivers/bluetooth/dtl1_cs.c6
-rw-r--r--drivers/bluetooth/hci_ldisc.c6
-rw-r--r--drivers/bluetooth/hci_vhci.c8
13 files changed, 77 insertions, 78 deletions
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index c7d6ff0ffcf1..b8ac1c549a1c 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -411,7 +411,7 @@ unlock:
411 411
412static int bfusb_open(struct hci_dev *hdev) 412static int bfusb_open(struct hci_dev *hdev)
413{ 413{
414 struct bfusb_data *data = hdev->driver_data; 414 struct bfusb_data *data = hci_get_drvdata(hdev);
415 unsigned long flags; 415 unsigned long flags;
416 int i, err; 416 int i, err;
417 417
@@ -437,7 +437,7 @@ static int bfusb_open(struct hci_dev *hdev)
437 437
438static int bfusb_flush(struct hci_dev *hdev) 438static int bfusb_flush(struct hci_dev *hdev)
439{ 439{
440 struct bfusb_data *data = hdev->driver_data; 440 struct bfusb_data *data = hci_get_drvdata(hdev);
441 441
442 BT_DBG("hdev %p bfusb %p", hdev, data); 442 BT_DBG("hdev %p bfusb %p", hdev, data);
443 443
@@ -448,7 +448,7 @@ static int bfusb_flush(struct hci_dev *hdev)
448 448
449static int bfusb_close(struct hci_dev *hdev) 449static int bfusb_close(struct hci_dev *hdev)
450{ 450{
451 struct bfusb_data *data = hdev->driver_data; 451 struct bfusb_data *data = hci_get_drvdata(hdev);
452 unsigned long flags; 452 unsigned long flags;
453 453
454 BT_DBG("hdev %p bfusb %p", hdev, data); 454 BT_DBG("hdev %p bfusb %p", hdev, data);
@@ -483,7 +483,7 @@ static int bfusb_send_frame(struct sk_buff *skb)
483 if (!test_bit(HCI_RUNNING, &hdev->flags)) 483 if (!test_bit(HCI_RUNNING, &hdev->flags))
484 return -EBUSY; 484 return -EBUSY;
485 485
486 data = hdev->driver_data; 486 data = hci_get_drvdata(hdev);
487 487
488 switch (bt_cb(skb)->pkt_type) { 488 switch (bt_cb(skb)->pkt_type) {
489 case HCI_COMMAND_PKT: 489 case HCI_COMMAND_PKT:
@@ -696,7 +696,7 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
696 data->hdev = hdev; 696 data->hdev = hdev;
697 697
698 hdev->bus = HCI_USB; 698 hdev->bus = HCI_USB;
699 hdev->driver_data = data; 699 hci_set_drvdata(hdev, data);
700 SET_HCIDEV_DEV(hdev, &intf->dev); 700 SET_HCIDEV_DEV(hdev, &intf->dev);
701 701
702 hdev->open = bfusb_open; 702 hdev->open = bfusb_open;
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
index 6b1261f9deb0..1fcd92380356 100644
--- a/drivers/bluetooth/bluecard_cs.c
+++ b/drivers/bluetooth/bluecard_cs.c
@@ -561,7 +561,7 @@ static irqreturn_t bluecard_interrupt(int irq, void *dev_inst)
561 561
562static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud) 562static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
563{ 563{
564 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 564 bluecard_info_t *info = hci_get_drvdata(hdev);
565 struct sk_buff *skb; 565 struct sk_buff *skb;
566 566
567 /* Ericsson baud rate command */ 567 /* Ericsson baud rate command */
@@ -609,7 +609,7 @@ static int bluecard_hci_set_baud_rate(struct hci_dev *hdev, int baud)
609 609
610static int bluecard_hci_flush(struct hci_dev *hdev) 610static int bluecard_hci_flush(struct hci_dev *hdev)
611{ 611{
612 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 612 bluecard_info_t *info = hci_get_drvdata(hdev);
613 613
614 /* Drop TX queue */ 614 /* Drop TX queue */
615 skb_queue_purge(&(info->txq)); 615 skb_queue_purge(&(info->txq));
@@ -620,7 +620,7 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
620 620
621static int bluecard_hci_open(struct hci_dev *hdev) 621static int bluecard_hci_open(struct hci_dev *hdev)
622{ 622{
623 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 623 bluecard_info_t *info = hci_get_drvdata(hdev);
624 unsigned int iobase = info->p_dev->resource[0]->start; 624 unsigned int iobase = info->p_dev->resource[0]->start;
625 625
626 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) 626 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
@@ -640,7 +640,7 @@ static int bluecard_hci_open(struct hci_dev *hdev)
640 640
641static int bluecard_hci_close(struct hci_dev *hdev) 641static int bluecard_hci_close(struct hci_dev *hdev)
642{ 642{
643 bluecard_info_t *info = (bluecard_info_t *)(hdev->driver_data); 643 bluecard_info_t *info = hci_get_drvdata(hdev);
644 unsigned int iobase = info->p_dev->resource[0]->start; 644 unsigned int iobase = info->p_dev->resource[0]->start;
645 645
646 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags))) 646 if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
@@ -667,7 +667,7 @@ static int bluecard_hci_send_frame(struct sk_buff *skb)
667 return -ENODEV; 667 return -ENODEV;
668 } 668 }
669 669
670 info = (bluecard_info_t *)(hdev->driver_data); 670 info = hci_get_drvdata(hdev);
671 671
672 switch (bt_cb(skb)->pkt_type) { 672 switch (bt_cb(skb)->pkt_type) {
673 case HCI_COMMAND_PKT: 673 case HCI_COMMAND_PKT:
@@ -729,7 +729,7 @@ static int bluecard_open(bluecard_info_t *info)
729 info->hdev = hdev; 729 info->hdev = hdev;
730 730
731 hdev->bus = HCI_PCCARD; 731 hdev->bus = HCI_PCCARD;
732 hdev->driver_data = info; 732 hci_set_drvdata(hdev, info);
733 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); 733 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
734 734
735 hdev->open = bluecard_hci_open; 735 hdev->open = bluecard_hci_open;
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 9d635148104c..d894340a7601 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -66,7 +66,7 @@ struct hci_vendor_hdr {
66 66
67static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count) 67static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
68{ 68{
69 struct bpa10x_data *data = hdev->driver_data; 69 struct bpa10x_data *data = hci_get_drvdata(hdev);
70 70
71 BT_DBG("%s queue %d buffer %p count %d", hdev->name, 71 BT_DBG("%s queue %d buffer %p count %d", hdev->name,
72 queue, buf, count); 72 queue, buf, count);
@@ -189,7 +189,7 @@ done:
189static void bpa10x_rx_complete(struct urb *urb) 189static void bpa10x_rx_complete(struct urb *urb)
190{ 190{
191 struct hci_dev *hdev = urb->context; 191 struct hci_dev *hdev = urb->context;
192 struct bpa10x_data *data = hdev->driver_data; 192 struct bpa10x_data *data = hci_get_drvdata(hdev);
193 int err; 193 int err;
194 194
195 BT_DBG("%s urb %p status %d count %d", hdev->name, 195 BT_DBG("%s urb %p status %d count %d", hdev->name,
@@ -219,7 +219,7 @@ static void bpa10x_rx_complete(struct urb *urb)
219 219
220static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev) 220static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
221{ 221{
222 struct bpa10x_data *data = hdev->driver_data; 222 struct bpa10x_data *data = hci_get_drvdata(hdev);
223 struct urb *urb; 223 struct urb *urb;
224 unsigned char *buf; 224 unsigned char *buf;
225 unsigned int pipe; 225 unsigned int pipe;
@@ -260,7 +260,7 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
260 260
261static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev) 261static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
262{ 262{
263 struct bpa10x_data *data = hdev->driver_data; 263 struct bpa10x_data *data = hci_get_drvdata(hdev);
264 struct urb *urb; 264 struct urb *urb;
265 unsigned char *buf; 265 unsigned char *buf;
266 unsigned int pipe; 266 unsigned int pipe;
@@ -301,7 +301,7 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
301 301
302static int bpa10x_open(struct hci_dev *hdev) 302static int bpa10x_open(struct hci_dev *hdev)
303{ 303{
304 struct bpa10x_data *data = hdev->driver_data; 304 struct bpa10x_data *data = hci_get_drvdata(hdev);
305 int err; 305 int err;
306 306
307 BT_DBG("%s", hdev->name); 307 BT_DBG("%s", hdev->name);
@@ -329,7 +329,7 @@ error:
329 329
330static int bpa10x_close(struct hci_dev *hdev) 330static int bpa10x_close(struct hci_dev *hdev)
331{ 331{
332 struct bpa10x_data *data = hdev->driver_data; 332 struct bpa10x_data *data = hci_get_drvdata(hdev);
333 333
334 BT_DBG("%s", hdev->name); 334 BT_DBG("%s", hdev->name);
335 335
@@ -343,7 +343,7 @@ static int bpa10x_close(struct hci_dev *hdev)
343 343
344static int bpa10x_flush(struct hci_dev *hdev) 344static int bpa10x_flush(struct hci_dev *hdev)
345{ 345{
346 struct bpa10x_data *data = hdev->driver_data; 346 struct bpa10x_data *data = hci_get_drvdata(hdev);
347 347
348 BT_DBG("%s", hdev->name); 348 BT_DBG("%s", hdev->name);
349 349
@@ -355,7 +355,7 @@ static int bpa10x_flush(struct hci_dev *hdev)
355static int bpa10x_send_frame(struct sk_buff *skb) 355static int bpa10x_send_frame(struct sk_buff *skb)
356{ 356{
357 struct hci_dev *hdev = (struct hci_dev *) skb->dev; 357 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
358 struct bpa10x_data *data = hdev->driver_data; 358 struct bpa10x_data *data = hci_get_drvdata(hdev);
359 struct usb_ctrlrequest *dr; 359 struct usb_ctrlrequest *dr;
360 struct urb *urb; 360 struct urb *urb;
361 unsigned int pipe; 361 unsigned int pipe;
@@ -459,7 +459,7 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
459 } 459 }
460 460
461 hdev->bus = HCI_USB; 461 hdev->bus = HCI_USB;
462 hdev->driver_data = data; 462 hci_set_drvdata(hdev, data);
463 463
464 data->hdev = hdev; 464 data->hdev = hdev;
465 465
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 0e304cb4bdea..9c09d6f05dc9 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -389,7 +389,7 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
389 389
390static int bt3c_hci_flush(struct hci_dev *hdev) 390static int bt3c_hci_flush(struct hci_dev *hdev)
391{ 391{
392 bt3c_info_t *info = (bt3c_info_t *)(hdev->driver_data); 392 bt3c_info_t *info = hci_get_drvdata(hdev);
393 393
394 /* Drop TX queue */ 394 /* Drop TX queue */
395 skb_queue_purge(&(info->txq)); 395 skb_queue_purge(&(info->txq));
@@ -428,7 +428,7 @@ static int bt3c_hci_send_frame(struct sk_buff *skb)
428 return -ENODEV; 428 return -ENODEV;
429 } 429 }
430 430
431 info = (bt3c_info_t *) (hdev->driver_data); 431 info = hci_get_drvdata(hdev);
432 432
433 switch (bt_cb(skb)->pkt_type) { 433 switch (bt_cb(skb)->pkt_type) {
434 case HCI_COMMAND_PKT: 434 case HCI_COMMAND_PKT:
@@ -575,7 +575,7 @@ static int bt3c_open(bt3c_info_t *info)
575 info->hdev = hdev; 575 info->hdev = hdev;
576 576
577 hdev->bus = HCI_PCCARD; 577 hdev->bus = HCI_PCCARD;
578 hdev->driver_data = info; 578 hci_set_drvdata(hdev, info);
579 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); 579 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
580 580
581 hdev->open = bt3c_hci_open; 581 hdev->open = bt3c_hci_open;
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c
index 8ecf4c6c2874..60fe333cfd40 100644
--- a/drivers/bluetooth/btmrvl_debugfs.c
+++ b/drivers/bluetooth/btmrvl_debugfs.c
@@ -384,7 +384,7 @@ static const struct file_operations btmrvl_txdnldready_fops = {
384 384
385void btmrvl_debugfs_init(struct hci_dev *hdev) 385void btmrvl_debugfs_init(struct hci_dev *hdev)
386{ 386{
387 struct btmrvl_private *priv = hdev->driver_data; 387 struct btmrvl_private *priv = hci_get_drvdata(hdev);
388 struct btmrvl_debugfs_data *dbg; 388 struct btmrvl_debugfs_data *dbg;
389 389
390 if (!hdev->debugfs) 390 if (!hdev->debugfs)
@@ -401,36 +401,34 @@ void btmrvl_debugfs_init(struct hci_dev *hdev)
401 dbg->config_dir = debugfs_create_dir("config", hdev->debugfs); 401 dbg->config_dir = debugfs_create_dir("config", hdev->debugfs);
402 402
403 dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, 403 dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir,
404 hdev->driver_data, &btmrvl_psmode_fops); 404 priv, &btmrvl_psmode_fops);
405 dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir, 405 dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir,
406 hdev->driver_data, &btmrvl_pscmd_fops); 406 priv, &btmrvl_pscmd_fops);
407 dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir, 407 dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir,
408 hdev->driver_data, &btmrvl_gpiogap_fops); 408 priv, &btmrvl_gpiogap_fops);
409 dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir, 409 dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir,
410 hdev->driver_data, &btmrvl_hsmode_fops); 410 priv, &btmrvl_hsmode_fops);
411 dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir, 411 dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir,
412 hdev->driver_data, &btmrvl_hscmd_fops); 412 priv, &btmrvl_hscmd_fops);
413 dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, 413 dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir,
414 hdev->driver_data, &btmrvl_hscfgcmd_fops); 414 priv, &btmrvl_hscfgcmd_fops);
415 415
416 dbg->status_dir = debugfs_create_dir("status", hdev->debugfs); 416 dbg->status_dir = debugfs_create_dir("status", hdev->debugfs);
417 dbg->curpsmode = debugfs_create_file("curpsmode", 0444, 417 dbg->curpsmode = debugfs_create_file("curpsmode", 0444,
418 dbg->status_dir, 418 dbg->status_dir, priv, &btmrvl_curpsmode_fops);
419 hdev->driver_data,
420 &btmrvl_curpsmode_fops);
421 dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir, 419 dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir,
422 hdev->driver_data, &btmrvl_psstate_fops); 420 priv, &btmrvl_psstate_fops);
423 dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir, 421 dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir,
424 hdev->driver_data, &btmrvl_hsstate_fops); 422 priv, &btmrvl_hsstate_fops);
425 dbg->txdnldready = debugfs_create_file("txdnldready", 0444, 423 dbg->txdnldready = debugfs_create_file("txdnldready", 0444,
426 dbg->status_dir, 424 dbg->status_dir,
427 hdev->driver_data, 425 priv,
428 &btmrvl_txdnldready_fops); 426 &btmrvl_txdnldready_fops);
429} 427}
430 428
431void btmrvl_debugfs_remove(struct hci_dev *hdev) 429void btmrvl_debugfs_remove(struct hci_dev *hdev)
432{ 430{
433 struct btmrvl_private *priv = hdev->driver_data; 431 struct btmrvl_private *priv = hci_get_drvdata(hdev);
434 struct btmrvl_debugfs_data *dbg = priv->debugfs_data; 432 struct btmrvl_debugfs_data *dbg = priv->debugfs_data;
435 433
436 if (!dbg) 434 if (!dbg)
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index 66b58fd09fbe..d1209adc882d 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -394,12 +394,13 @@ static int btmrvl_send_frame(struct sk_buff *skb)
394 394
395 BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len); 395 BT_DBG("type=%d, len=%d", skb->pkt_type, skb->len);
396 396
397 if (!hdev || !hdev->driver_data) { 397 if (!hdev) {
398 BT_ERR("Frame for unknown HCI device"); 398 BT_ERR("Frame for unknown HCI device");
399 return -ENODEV; 399 return -ENODEV;
400 } 400 }
401 401
402 priv = (struct btmrvl_private *) hdev->driver_data; 402 priv = hci_get_drvdata(hdev);
403
403 if (!test_bit(HCI_RUNNING, &hdev->flags)) { 404 if (!test_bit(HCI_RUNNING, &hdev->flags)) {
404 BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags); 405 BT_ERR("Failed testing HCI_RUNING, flags=%lx", hdev->flags);
405 print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET, 406 print_hex_dump_bytes("data: ", DUMP_PREFIX_OFFSET,
@@ -430,7 +431,7 @@ static int btmrvl_send_frame(struct sk_buff *skb)
430 431
431static int btmrvl_flush(struct hci_dev *hdev) 432static int btmrvl_flush(struct hci_dev *hdev)
432{ 433{
433 struct btmrvl_private *priv = hdev->driver_data; 434 struct btmrvl_private *priv = hci_get_drvdata(hdev);
434 435
435 skb_queue_purge(&priv->adapter->tx_queue); 436 skb_queue_purge(&priv->adapter->tx_queue);
436 437
@@ -439,7 +440,7 @@ static int btmrvl_flush(struct hci_dev *hdev)
439 440
440static int btmrvl_close(struct hci_dev *hdev) 441static int btmrvl_close(struct hci_dev *hdev)
441{ 442{
442 struct btmrvl_private *priv = hdev->driver_data; 443 struct btmrvl_private *priv = hci_get_drvdata(hdev);
443 444
444 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 445 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
445 return 0; 446 return 0;
@@ -542,7 +543,7 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
542 } 543 }
543 544
544 priv->btmrvl_dev.hcidev = hdev; 545 priv->btmrvl_dev.hcidev = hdev;
545 hdev->driver_data = priv; 546 hci_set_drvdata(hdev, priv);
546 547
547 hdev->bus = HCI_SDIO; 548 hdev->bus = HCI_SDIO;
548 hdev->open = btmrvl_open; 549 hdev->open = btmrvl_open;
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c
index 2d6e4ed1637f..e10ea0347051 100644
--- a/drivers/bluetooth/btsdio.c
+++ b/drivers/bluetooth/btsdio.c
@@ -189,7 +189,7 @@ static void btsdio_interrupt(struct sdio_func *func)
189 189
190static int btsdio_open(struct hci_dev *hdev) 190static int btsdio_open(struct hci_dev *hdev)
191{ 191{
192 struct btsdio_data *data = hdev->driver_data; 192 struct btsdio_data *data = hci_get_drvdata(hdev);
193 int err; 193 int err;
194 194
195 BT_DBG("%s", hdev->name); 195 BT_DBG("%s", hdev->name);
@@ -225,7 +225,7 @@ release:
225 225
226static int btsdio_close(struct hci_dev *hdev) 226static int btsdio_close(struct hci_dev *hdev)
227{ 227{
228 struct btsdio_data *data = hdev->driver_data; 228 struct btsdio_data *data = hci_get_drvdata(hdev);
229 229
230 BT_DBG("%s", hdev->name); 230 BT_DBG("%s", hdev->name);
231 231
@@ -246,7 +246,7 @@ static int btsdio_close(struct hci_dev *hdev)
246 246
247static int btsdio_flush(struct hci_dev *hdev) 247static int btsdio_flush(struct hci_dev *hdev)
248{ 248{
249 struct btsdio_data *data = hdev->driver_data; 249 struct btsdio_data *data = hci_get_drvdata(hdev);
250 250
251 BT_DBG("%s", hdev->name); 251 BT_DBG("%s", hdev->name);
252 252
@@ -258,7 +258,7 @@ static int btsdio_flush(struct hci_dev *hdev)
258static int btsdio_send_frame(struct sk_buff *skb) 258static int btsdio_send_frame(struct sk_buff *skb)
259{ 259{
260 struct hci_dev *hdev = (struct hci_dev *) skb->dev; 260 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
261 struct btsdio_data *data = hdev->driver_data; 261 struct btsdio_data *data = hci_get_drvdata(hdev);
262 262
263 BT_DBG("%s", hdev->name); 263 BT_DBG("%s", hdev->name);
264 264
@@ -321,7 +321,7 @@ static int btsdio_probe(struct sdio_func *func,
321 } 321 }
322 322
323 hdev->bus = HCI_SDIO; 323 hdev->bus = HCI_SDIO;
324 hdev->driver_data = data; 324 hci_set_drvdata(hdev, data);
325 325
326 if (id->class == SDIO_CLASS_BT_AMP) 326 if (id->class == SDIO_CLASS_BT_AMP)
327 hdev->dev_type = HCI_AMP; 327 hdev->dev_type = HCI_AMP;
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 80ad2b9b352e..194224d07f7c 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -397,7 +397,7 @@ static void btuart_change_speed(btuart_info_t *info, unsigned int speed)
397 397
398static int btuart_hci_flush(struct hci_dev *hdev) 398static int btuart_hci_flush(struct hci_dev *hdev)
399{ 399{
400 btuart_info_t *info = (btuart_info_t *)(hdev->driver_data); 400 btuart_info_t *info = hci_get_drvdata(hdev);
401 401
402 /* Drop TX queue */ 402 /* Drop TX queue */
403 skb_queue_purge(&(info->txq)); 403 skb_queue_purge(&(info->txq));
@@ -435,7 +435,7 @@ static int btuart_hci_send_frame(struct sk_buff *skb)
435 return -ENODEV; 435 return -ENODEV;
436 } 436 }
437 437
438 info = (btuart_info_t *)(hdev->driver_data); 438 info = hci_get_drvdata(hdev);
439 439
440 switch (bt_cb(skb)->pkt_type) { 440 switch (bt_cb(skb)->pkt_type) {
441 case HCI_COMMAND_PKT: 441 case HCI_COMMAND_PKT:
@@ -493,7 +493,7 @@ static int btuart_open(btuart_info_t *info)
493 info->hdev = hdev; 493 info->hdev = hdev;
494 494
495 hdev->bus = HCI_PCCARD; 495 hdev->bus = HCI_PCCARD;
496 hdev->driver_data = info; 496 hci_set_drvdata(hdev, info);
497 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); 497 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
498 498
499 hdev->open = btuart_hci_open; 499 hdev->open = btuart_hci_open;
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index afcd2816a24b..f4fb256d6ca6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -243,7 +243,7 @@ static int inc_tx(struct btusb_data *data)
243static void btusb_intr_complete(struct urb *urb) 243static void btusb_intr_complete(struct urb *urb)
244{ 244{
245 struct hci_dev *hdev = urb->context; 245 struct hci_dev *hdev = urb->context;
246 struct btusb_data *data = hdev->driver_data; 246 struct btusb_data *data = hci_get_drvdata(hdev);
247 int err; 247 int err;
248 248
249 BT_DBG("%s urb %p status %d count %d", hdev->name, 249 BT_DBG("%s urb %p status %d count %d", hdev->name,
@@ -282,7 +282,7 @@ static void btusb_intr_complete(struct urb *urb)
282 282
283static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags) 283static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
284{ 284{
285 struct btusb_data *data = hdev->driver_data; 285 struct btusb_data *data = hci_get_drvdata(hdev);
286 struct urb *urb; 286 struct urb *urb;
287 unsigned char *buf; 287 unsigned char *buf;
288 unsigned int pipe; 288 unsigned int pipe;
@@ -331,7 +331,7 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
331static void btusb_bulk_complete(struct urb *urb) 331static void btusb_bulk_complete(struct urb *urb)
332{ 332{
333 struct hci_dev *hdev = urb->context; 333 struct hci_dev *hdev = urb->context;
334 struct btusb_data *data = hdev->driver_data; 334 struct btusb_data *data = hci_get_drvdata(hdev);
335 int err; 335 int err;
336 336
337 BT_DBG("%s urb %p status %d count %d", hdev->name, 337 BT_DBG("%s urb %p status %d count %d", hdev->name,
@@ -370,7 +370,7 @@ static void btusb_bulk_complete(struct urb *urb)
370 370
371static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags) 371static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags)
372{ 372{
373 struct btusb_data *data = hdev->driver_data; 373 struct btusb_data *data = hci_get_drvdata(hdev);
374 struct urb *urb; 374 struct urb *urb;
375 unsigned char *buf; 375 unsigned char *buf;
376 unsigned int pipe; 376 unsigned int pipe;
@@ -417,7 +417,7 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev, gfp_t mem_flags)
417static void btusb_isoc_complete(struct urb *urb) 417static void btusb_isoc_complete(struct urb *urb)
418{ 418{
419 struct hci_dev *hdev = urb->context; 419 struct hci_dev *hdev = urb->context;
420 struct btusb_data *data = hdev->driver_data; 420 struct btusb_data *data = hci_get_drvdata(hdev);
421 int i, err; 421 int i, err;
422 422
423 BT_DBG("%s urb %p status %d count %d", hdev->name, 423 BT_DBG("%s urb %p status %d count %d", hdev->name,
@@ -484,7 +484,7 @@ static inline void __fill_isoc_descriptor(struct urb *urb, int len, int mtu)
484 484
485static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) 485static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags)
486{ 486{
487 struct btusb_data *data = hdev->driver_data; 487 struct btusb_data *data = hci_get_drvdata(hdev);
488 struct urb *urb; 488 struct urb *urb;
489 unsigned char *buf; 489 unsigned char *buf;
490 unsigned int pipe; 490 unsigned int pipe;
@@ -537,7 +537,7 @@ static void btusb_tx_complete(struct urb *urb)
537{ 537{
538 struct sk_buff *skb = urb->context; 538 struct sk_buff *skb = urb->context;
539 struct hci_dev *hdev = (struct hci_dev *) skb->dev; 539 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
540 struct btusb_data *data = hdev->driver_data; 540 struct btusb_data *data = hci_get_drvdata(hdev);
541 541
542 BT_DBG("%s urb %p status %d count %d", hdev->name, 542 BT_DBG("%s urb %p status %d count %d", hdev->name,
543 urb, urb->status, urb->actual_length); 543 urb, urb->status, urb->actual_length);
@@ -584,7 +584,7 @@ done:
584 584
585static int btusb_open(struct hci_dev *hdev) 585static int btusb_open(struct hci_dev *hdev)
586{ 586{
587 struct btusb_data *data = hdev->driver_data; 587 struct btusb_data *data = hci_get_drvdata(hdev);
588 int err; 588 int err;
589 589
590 BT_DBG("%s", hdev->name); 590 BT_DBG("%s", hdev->name);
@@ -634,7 +634,7 @@ static void btusb_stop_traffic(struct btusb_data *data)
634 634
635static int btusb_close(struct hci_dev *hdev) 635static int btusb_close(struct hci_dev *hdev)
636{ 636{
637 struct btusb_data *data = hdev->driver_data; 637 struct btusb_data *data = hci_get_drvdata(hdev);
638 int err; 638 int err;
639 639
640 BT_DBG("%s", hdev->name); 640 BT_DBG("%s", hdev->name);
@@ -664,7 +664,7 @@ failed:
664 664
665static int btusb_flush(struct hci_dev *hdev) 665static int btusb_flush(struct hci_dev *hdev)
666{ 666{
667 struct btusb_data *data = hdev->driver_data; 667 struct btusb_data *data = hci_get_drvdata(hdev);
668 668
669 BT_DBG("%s", hdev->name); 669 BT_DBG("%s", hdev->name);
670 670
@@ -676,7 +676,7 @@ static int btusb_flush(struct hci_dev *hdev)
676static int btusb_send_frame(struct sk_buff *skb) 676static int btusb_send_frame(struct sk_buff *skb)
677{ 677{
678 struct hci_dev *hdev = (struct hci_dev *) skb->dev; 678 struct hci_dev *hdev = (struct hci_dev *) skb->dev;
679 struct btusb_data *data = hdev->driver_data; 679 struct btusb_data *data = hci_get_drvdata(hdev);
680 struct usb_ctrlrequest *dr; 680 struct usb_ctrlrequest *dr;
681 struct urb *urb; 681 struct urb *urb;
682 unsigned int pipe; 682 unsigned int pipe;
@@ -786,7 +786,7 @@ done:
786 786
787static void btusb_notify(struct hci_dev *hdev, unsigned int evt) 787static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
788{ 788{
789 struct btusb_data *data = hdev->driver_data; 789 struct btusb_data *data = hci_get_drvdata(hdev);
790 790
791 BT_DBG("%s evt %d", hdev->name, evt); 791 BT_DBG("%s evt %d", hdev->name, evt);
792 792
@@ -798,7 +798,7 @@ static void btusb_notify(struct hci_dev *hdev, unsigned int evt)
798 798
799static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting) 799static inline int __set_isoc_interface(struct hci_dev *hdev, int altsetting)
800{ 800{
801 struct btusb_data *data = hdev->driver_data; 801 struct btusb_data *data = hci_get_drvdata(hdev);
802 struct usb_interface *intf = data->isoc; 802 struct usb_interface *intf = data->isoc;
803 struct usb_endpoint_descriptor *ep_desc; 803 struct usb_endpoint_descriptor *ep_desc;
804 int i, err; 804 int i, err;
@@ -986,7 +986,7 @@ static int btusb_probe(struct usb_interface *intf,
986 } 986 }
987 987
988 hdev->bus = HCI_USB; 988 hdev->bus = HCI_USB;
989 hdev->driver_data = data; 989 hci_set_drvdata(hdev, data);
990 990
991 data->hdev = hdev; 991 data->hdev = hdev;
992 992
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
index b81b32e4fa12..88694697f34f 100644
--- a/drivers/bluetooth/btwilink.c
+++ b/drivers/bluetooth/btwilink.c
@@ -161,7 +161,7 @@ static int ti_st_open(struct hci_dev *hdev)
161 return -EBUSY; 161 return -EBUSY;
162 162
163 /* provide contexts for callbacks from ST */ 163 /* provide contexts for callbacks from ST */
164 hst = hdev->driver_data; 164 hst = hci_get_drvdata(hdev);
165 165
166 for (i = 0; i < MAX_BT_CHNL_IDS; i++) { 166 for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
167 ti_st_proto[i].priv_data = hst; 167 ti_st_proto[i].priv_data = hst;
@@ -236,7 +236,7 @@ done:
236static int ti_st_close(struct hci_dev *hdev) 236static int ti_st_close(struct hci_dev *hdev)
237{ 237{
238 int err, i; 238 int err, i;
239 struct ti_st *hst = hdev->driver_data; 239 struct ti_st *hst = hci_get_drvdata(hdev);
240 240
241 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 241 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
242 return 0; 242 return 0;
@@ -264,7 +264,7 @@ static int ti_st_send_frame(struct sk_buff *skb)
264 if (!test_bit(HCI_RUNNING, &hdev->flags)) 264 if (!test_bit(HCI_RUNNING, &hdev->flags))
265 return -EBUSY; 265 return -EBUSY;
266 266
267 hst = hdev->driver_data; 267 hst = hci_get_drvdata(hdev);
268 268
269 /* Prepend skb with frame type */ 269 /* Prepend skb with frame type */
270 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); 270 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
@@ -312,7 +312,7 @@ static int bt_ti_probe(struct platform_device *pdev)
312 312
313 hst->hdev = hdev; 313 hst->hdev = hdev;
314 hdev->bus = HCI_UART; 314 hdev->bus = HCI_UART;
315 hdev->driver_data = hst; 315 hci_set_drvdata(hdev, hst);
316 hdev->open = ti_st_open; 316 hdev->open = ti_st_open;
317 hdev->close = ti_st_close; 317 hdev->close = ti_st_close;
318 hdev->flush = NULL; 318 hdev->flush = NULL;
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 295cf1b4a052..049c0594a76b 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -364,7 +364,7 @@ static int dtl1_hci_open(struct hci_dev *hdev)
364 364
365static int dtl1_hci_flush(struct hci_dev *hdev) 365static int dtl1_hci_flush(struct hci_dev *hdev)
366{ 366{
367 dtl1_info_t *info = (dtl1_info_t *)(hdev->driver_data); 367 dtl1_info_t *info = hci_get_drvdata(hdev);
368 368
369 /* Drop TX queue */ 369 /* Drop TX queue */
370 skb_queue_purge(&(info->txq)); 370 skb_queue_purge(&(info->txq));
@@ -396,7 +396,7 @@ static int dtl1_hci_send_frame(struct sk_buff *skb)
396 return -ENODEV; 396 return -ENODEV;
397 } 397 }
398 398
399 info = (dtl1_info_t *)(hdev->driver_data); 399 info = hci_get_drvdata(hdev);
400 400
401 switch (bt_cb(skb)->pkt_type) { 401 switch (bt_cb(skb)->pkt_type) {
402 case HCI_COMMAND_PKT: 402 case HCI_COMMAND_PKT:
@@ -475,7 +475,7 @@ static int dtl1_open(dtl1_info_t *info)
475 info->hdev = hdev; 475 info->hdev = hdev;
476 476
477 hdev->bus = HCI_PCCARD; 477 hdev->bus = HCI_PCCARD;
478 hdev->driver_data = info; 478 hci_set_drvdata(hdev, info);
479 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); 479 SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
480 480
481 hdev->open = dtl1_hci_open; 481 hdev->open = dtl1_hci_open;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 459ff0ba5a42..01c23dfe2a10 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -174,7 +174,7 @@ static int hci_uart_open(struct hci_dev *hdev)
174/* Reset device */ 174/* Reset device */
175static int hci_uart_flush(struct hci_dev *hdev) 175static int hci_uart_flush(struct hci_dev *hdev)
176{ 176{
177 struct hci_uart *hu = (struct hci_uart *) hdev->driver_data; 177 struct hci_uart *hu = hci_get_drvdata(hdev);
178 struct tty_struct *tty = hu->tty; 178 struct tty_struct *tty = hu->tty;
179 179
180 BT_DBG("hdev %p tty %p", hdev, tty); 180 BT_DBG("hdev %p tty %p", hdev, tty);
@@ -220,7 +220,7 @@ static int hci_uart_send_frame(struct sk_buff *skb)
220 if (!test_bit(HCI_RUNNING, &hdev->flags)) 220 if (!test_bit(HCI_RUNNING, &hdev->flags))
221 return -EBUSY; 221 return -EBUSY;
222 222
223 hu = (struct hci_uart *) hdev->driver_data; 223 hu = hci_get_drvdata(hdev);
224 224
225 BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); 225 BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len);
226 226
@@ -384,7 +384,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
384 hu->hdev = hdev; 384 hu->hdev = hdev;
385 385
386 hdev->bus = HCI_UART; 386 hdev->bus = HCI_UART;
387 hdev->driver_data = hu; 387 hci_set_drvdata(hdev, hu);
388 388
389 hdev->open = hci_uart_open; 389 hdev->open = hci_uart_open;
390 hdev->close = hci_uart_close; 390 hdev->close = hci_uart_close;
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 5f305c131a0d..158bfe507da7 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -61,7 +61,7 @@ static int vhci_open_dev(struct hci_dev *hdev)
61 61
62static int vhci_close_dev(struct hci_dev *hdev) 62static int vhci_close_dev(struct hci_dev *hdev)
63{ 63{
64 struct vhci_data *data = hdev->driver_data; 64 struct vhci_data *data = hci_get_drvdata(hdev);
65 65
66 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 66 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
67 return 0; 67 return 0;
@@ -73,7 +73,7 @@ static int vhci_close_dev(struct hci_dev *hdev)
73 73
74static int vhci_flush(struct hci_dev *hdev) 74static int vhci_flush(struct hci_dev *hdev)
75{ 75{
76 struct vhci_data *data = hdev->driver_data; 76 struct vhci_data *data = hci_get_drvdata(hdev);
77 77
78 skb_queue_purge(&data->readq); 78 skb_queue_purge(&data->readq);
79 79
@@ -93,7 +93,7 @@ static int vhci_send_frame(struct sk_buff *skb)
93 if (!test_bit(HCI_RUNNING, &hdev->flags)) 93 if (!test_bit(HCI_RUNNING, &hdev->flags))
94 return -EBUSY; 94 return -EBUSY;
95 95
96 data = hdev->driver_data; 96 data = hci_get_drvdata(hdev);
97 97
98 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); 98 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
99 skb_queue_tail(&data->readq, skb); 99 skb_queue_tail(&data->readq, skb);
@@ -234,7 +234,7 @@ static int vhci_open(struct inode *inode, struct file *file)
234 data->hdev = hdev; 234 data->hdev = hdev;
235 235
236 hdev->bus = HCI_VIRTUAL; 236 hdev->bus = HCI_VIRTUAL;
237 hdev->driver_data = data; 237 hci_set_drvdata(hdev, data);
238 238
239 if (amp) 239 if (amp)
240 hdev->dev_type = HCI_AMP; 240 hdev->dev_type = HCI_AMP;