diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-01-07 09:47:22 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-13 10:01:24 -0500 |
commit | e9b9cfa1575e37cb2dbb5534aeaaa16814228887 (patch) | |
tree | 4f0a8e2a1c9b8776b1c637df081792b5dda88cd3 | |
parent | 46e06531a5ae13c66f774d3cb1ad78385618a5a2 (diff) |
Bluetooth: Remove HCI-owner field
After unregistering an hci_dev object a bluetooth driver does not have
any callbacks in the hci_dev structure left over. Therefore, there is no
need to keep a reference to the module.
Previously, we needed this to protect the hci-destruct callback.
However, this callback is no longer available so we do not need this
owner field, anymore. Drivers now call hci_unregister_dev() and they
are done with the object.
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>
-rw-r--r-- | drivers/bluetooth/bfusb.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/bluecard_cs.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/bpa10x.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 1 | ||||
-rw-r--r-- | drivers/bluetooth/btsdio.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/btuart_cs.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/btusb.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/btwilink.c | 1 | ||||
-rw-r--r-- | drivers/bluetooth/dtl1_cs.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 2 | ||||
-rw-r--r-- | drivers/bluetooth/hci_vhci.c | 2 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 13 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 3 |
14 files changed, 3 insertions, 35 deletions
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index e99ce89e1cad..c7d6ff0ffcf1 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c | |||
@@ -705,8 +705,6 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
705 | hdev->send = bfusb_send_frame; | 705 | hdev->send = bfusb_send_frame; |
706 | hdev->ioctl = bfusb_ioctl; | 706 | hdev->ioctl = bfusb_ioctl; |
707 | 707 | ||
708 | hdev->owner = THIS_MODULE; | ||
709 | |||
710 | if (hci_register_dev(hdev) < 0) { | 708 | if (hci_register_dev(hdev) < 0) { |
711 | BT_ERR("Can't register HCI device"); | 709 | BT_ERR("Can't register HCI device"); |
712 | hci_free_dev(hdev); | 710 | hci_free_dev(hdev); |
diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 5cb325a13745..6b1261f9deb0 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c | |||
@@ -738,8 +738,6 @@ static int bluecard_open(bluecard_info_t *info) | |||
738 | hdev->send = bluecard_hci_send_frame; | 738 | hdev->send = bluecard_hci_send_frame; |
739 | hdev->ioctl = bluecard_hci_ioctl; | 739 | hdev->ioctl = bluecard_hci_ioctl; |
740 | 740 | ||
741 | hdev->owner = THIS_MODULE; | ||
742 | |||
743 | id = inb(iobase + 0x30); | 741 | id = inb(iobase + 0x30); |
744 | 742 | ||
745 | if ((id & 0x0f) == 0x02) | 743 | if ((id & 0x0f) == 0x02) |
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 29cd11d401e1..9d635148104c 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -470,8 +470,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * | |||
470 | hdev->flush = bpa10x_flush; | 470 | hdev->flush = bpa10x_flush; |
471 | hdev->send = bpa10x_send_frame; | 471 | hdev->send = bpa10x_send_frame; |
472 | 472 | ||
473 | hdev->owner = THIS_MODULE; | ||
474 | |||
475 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | 473 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
476 | 474 | ||
477 | err = hci_register_dev(hdev); | 475 | err = hci_register_dev(hdev); |
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index e74334dfc776..0e304cb4bdea 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -584,8 +584,6 @@ static int bt3c_open(bt3c_info_t *info) | |||
584 | hdev->send = bt3c_hci_send_frame; | 584 | hdev->send = bt3c_hci_send_frame; |
585 | hdev->ioctl = bt3c_hci_ioctl; | 585 | hdev->ioctl = bt3c_hci_ioctl; |
586 | 586 | ||
587 | hdev->owner = THIS_MODULE; | ||
588 | |||
589 | /* Load firmware */ | 587 | /* Load firmware */ |
590 | err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); | 588 | err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); |
591 | if (err < 0) { | 589 | if (err < 0) { |
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 995cf43f4bd2..66b58fd09fbe 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -550,7 +550,6 @@ int btmrvl_register_hdev(struct btmrvl_private *priv) | |||
550 | hdev->flush = btmrvl_flush; | 550 | hdev->flush = btmrvl_flush; |
551 | hdev->send = btmrvl_send_frame; | 551 | hdev->send = btmrvl_send_frame; |
552 | hdev->ioctl = btmrvl_ioctl; | 552 | hdev->ioctl = btmrvl_ioctl; |
553 | hdev->owner = THIS_MODULE; | ||
554 | 553 | ||
555 | btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); | 554 | btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); |
556 | 555 | ||
diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index d38945cc9f05..2d6e4ed1637f 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c | |||
@@ -337,8 +337,6 @@ static int btsdio_probe(struct sdio_func *func, | |||
337 | hdev->flush = btsdio_flush; | 337 | hdev->flush = btsdio_flush; |
338 | hdev->send = btsdio_send_frame; | 338 | hdev->send = btsdio_send_frame; |
339 | 339 | ||
340 | hdev->owner = THIS_MODULE; | ||
341 | |||
342 | err = hci_register_dev(hdev); | 340 | err = hci_register_dev(hdev); |
343 | if (err < 0) { | 341 | if (err < 0) { |
344 | hci_free_dev(hdev); | 342 | hci_free_dev(hdev); |
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 84e02f1a45b9..80ad2b9b352e 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c | |||
@@ -502,8 +502,6 @@ static int btuart_open(btuart_info_t *info) | |||
502 | hdev->send = btuart_hci_send_frame; | 502 | hdev->send = btuart_hci_send_frame; |
503 | hdev->ioctl = btuart_hci_ioctl; | 503 | hdev->ioctl = btuart_hci_ioctl; |
504 | 504 | ||
505 | hdev->owner = THIS_MODULE; | ||
506 | |||
507 | spin_lock_irqsave(&(info->lock), flags); | 505 | spin_lock_irqsave(&(info->lock), flags); |
508 | 506 | ||
509 | /* Reset UART */ | 507 | /* Reset UART */ |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 44b5e736ddc3..a36888a9c205 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -997,8 +997,6 @@ static int btusb_probe(struct usb_interface *intf, | |||
997 | hdev->send = btusb_send_frame; | 997 | hdev->send = btusb_send_frame; |
998 | hdev->notify = btusb_notify; | 998 | hdev->notify = btusb_notify; |
999 | 999 | ||
1000 | hdev->owner = THIS_MODULE; | ||
1001 | |||
1002 | /* Interface numbers are hardcoded in the specification */ | 1000 | /* Interface numbers are hardcoded in the specification */ |
1003 | data->isoc = usb_ifnum_to_if(data->udev, 1); | 1001 | data->isoc = usb_ifnum_to_if(data->udev, 1); |
1004 | 1002 | ||
diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c index da9cf6a6e8ac..b81b32e4fa12 100644 --- a/drivers/bluetooth/btwilink.c +++ b/drivers/bluetooth/btwilink.c | |||
@@ -317,7 +317,6 @@ static int bt_ti_probe(struct platform_device *pdev) | |||
317 | hdev->close = ti_st_close; | 317 | hdev->close = ti_st_close; |
318 | hdev->flush = NULL; | 318 | hdev->flush = NULL; |
319 | hdev->send = ti_st_send_frame; | 319 | hdev->send = ti_st_send_frame; |
320 | hdev->owner = THIS_MODULE; | ||
321 | 320 | ||
322 | err = hci_register_dev(hdev); | 321 | err = hci_register_dev(hdev); |
323 | if (err < 0) { | 322 | if (err < 0) { |
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index aae40caaa188..295cf1b4a052 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c | |||
@@ -484,8 +484,6 @@ static int dtl1_open(dtl1_info_t *info) | |||
484 | hdev->send = dtl1_hci_send_frame; | 484 | hdev->send = dtl1_hci_send_frame; |
485 | hdev->ioctl = dtl1_hci_ioctl; | 485 | hdev->ioctl = dtl1_hci_ioctl; |
486 | 486 | ||
487 | hdev->owner = THIS_MODULE; | ||
488 | |||
489 | spin_lock_irqsave(&(info->lock), flags); | 487 | spin_lock_irqsave(&(info->lock), flags); |
490 | 488 | ||
491 | /* Reset UART */ | 489 | /* Reset UART */ |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 5ea49df3462b..459ff0ba5a42 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -392,8 +392,6 @@ static int hci_uart_register_dev(struct hci_uart *hu) | |||
392 | hdev->send = hci_uart_send_frame; | 392 | hdev->send = hci_uart_send_frame; |
393 | hdev->parent = hu->tty->dev; | 393 | hdev->parent = hu->tty->dev; |
394 | 394 | ||
395 | hdev->owner = THIS_MODULE; | ||
396 | |||
397 | if (!reset) | 395 | if (!reset) |
398 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); | 396 | set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks); |
399 | 397 | ||
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 44a801292d62..5f305c131a0d 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -244,8 +244,6 @@ static int vhci_open(struct inode *inode, struct file *file) | |||
244 | hdev->flush = vhci_flush; | 244 | hdev->flush = vhci_flush; |
245 | hdev->send = vhci_send_frame; | 245 | hdev->send = vhci_send_frame; |
246 | 246 | ||
247 | hdev->owner = THIS_MODULE; | ||
248 | |||
249 | if (hci_register_dev(hdev) < 0) { | 247 | if (hci_register_dev(hdev) < 0) { |
250 | BT_ERR("Can't register HCI device"); | 248 | BT_ERR("Can't register HCI device"); |
251 | kfree(data); | 249 | kfree(data); |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 935aca8783c4..99984688ccdd 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -262,8 +262,6 @@ struct hci_dev { | |||
262 | 262 | ||
263 | struct rfkill *rfkill; | 263 | struct rfkill *rfkill; |
264 | 264 | ||
265 | struct module *owner; | ||
266 | |||
267 | unsigned long dev_flags; | 265 | unsigned long dev_flags; |
268 | 266 | ||
269 | int (*open)(struct hci_dev *hdev); | 267 | int (*open)(struct hci_dev *hdev); |
@@ -601,11 +599,7 @@ static inline void __hci_dev_put(struct hci_dev *d) | |||
601 | * hci_dev_put and hci_dev_hold are macros to avoid dragging all the | 599 | * hci_dev_put and hci_dev_hold are macros to avoid dragging all the |
602 | * overhead of all the modular infrastructure into this header. | 600 | * overhead of all the modular infrastructure into this header. |
603 | */ | 601 | */ |
604 | #define hci_dev_put(d) \ | 602 | #define hci_dev_put(d) __hci_dev_put(d) |
605 | do { \ | ||
606 | __hci_dev_put(d); \ | ||
607 | module_put(d->owner); \ | ||
608 | } while (0) | ||
609 | 603 | ||
610 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | 604 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) |
611 | { | 605 | { |
@@ -613,10 +607,7 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | |||
613 | return d; | 607 | return d; |
614 | } | 608 | } |
615 | 609 | ||
616 | #define hci_dev_hold(d) \ | 610 | #define hci_dev_hold(d) __hci_dev_hold(d) |
617 | ({ \ | ||
618 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ | ||
619 | }) | ||
620 | 611 | ||
621 | #define hci_dev_lock(d) mutex_lock(&d->lock) | 612 | #define hci_dev_lock(d) mutex_lock(&d->lock) |
622 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) | 613 | #define hci_dev_unlock(d) mutex_unlock(&d->lock) |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f23e32a645c8..58392a6b48b5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1548,8 +1548,7 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1548 | struct list_head *head = &hci_dev_list, *p; | 1548 | struct list_head *head = &hci_dev_list, *p; |
1549 | int i, id, error; | 1549 | int i, id, error; |
1550 | 1550 | ||
1551 | BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name, | 1551 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
1552 | hdev->bus, hdev->owner); | ||
1553 | 1552 | ||
1554 | if (!hdev->open || !hdev->close) | 1553 | if (!hdev->open || !hdev->close) |
1555 | return -EINVAL; | 1554 | return -EINVAL; |