]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Remove HCI-owner field
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 7 Jan 2012 14:47:22 +0000 (15:47 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:24 +0000 (17:01 +0200)
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>
14 files changed:
drivers/bluetooth/bfusb.c
drivers/bluetooth/bluecard_cs.c
drivers/bluetooth/bpa10x.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/btmrvl_main.c
drivers/bluetooth/btsdio.c
drivers/bluetooth/btuart_cs.c
drivers/bluetooth/btusb.c
drivers/bluetooth/btwilink.c
drivers/bluetooth/dtl1_cs.c
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_vhci.c
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index e99ce89e1cadafa00f2435bd0b36a479da003c46..c7d6ff0ffcf1a2f93929b09f24a0836e5dca46c1 100644 (file)
@@ -705,8 +705,6 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
        hdev->send     = bfusb_send_frame;
        hdev->ioctl    = bfusb_ioctl;
 
-       hdev->owner = THIS_MODULE;
-
        if (hci_register_dev(hdev) < 0) {
                BT_ERR("Can't register HCI device");
                hci_free_dev(hdev);
index 5cb325a1374562cc3b39a741deee8a800d3b185d..6b1261f9deb08d7bc69100ca0f372366d3d90965 100644 (file)
@@ -738,8 +738,6 @@ static int bluecard_open(bluecard_info_t *info)
        hdev->send     = bluecard_hci_send_frame;
        hdev->ioctl    = bluecard_hci_ioctl;
 
-       hdev->owner = THIS_MODULE;
-
        id = inb(iobase + 0x30);
 
        if ((id & 0x0f) == 0x02)
index 29cd11d401e19452a22b86e925d3b5949fd897be..9d635148104c52fb5d9a0e3a8880d2f3ce5fb063 100644 (file)
@@ -470,8 +470,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
        hdev->flush    = bpa10x_flush;
        hdev->send     = bpa10x_send_frame;
 
-       hdev->owner = THIS_MODULE;
-
        set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
 
        err = hci_register_dev(hdev);
index e74334dfc77698cf93fcf7bb35759e43b40bf739..0e304cb4bdea4bedb00306236c797bf53c274412 100644 (file)
@@ -584,8 +584,6 @@ static int bt3c_open(bt3c_info_t *info)
        hdev->send     = bt3c_hci_send_frame;
        hdev->ioctl    = bt3c_hci_ioctl;
 
-       hdev->owner = THIS_MODULE;
-
        /* Load firmware */
        err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev);
        if (err < 0) {
index 995cf43f4bd25e96a10c8194e96fba74b689f4ca..66b58fd09fbe3946c73e8ced7a9710339c6215ed 100644 (file)
@@ -550,7 +550,6 @@ int btmrvl_register_hdev(struct btmrvl_private *priv)
        hdev->flush = btmrvl_flush;
        hdev->send = btmrvl_send_frame;
        hdev->ioctl = btmrvl_ioctl;
-       hdev->owner = THIS_MODULE;
 
        btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
 
index d38945cc9f05320ea7d951ad87badd829ec34605..2d6e4ed1637fb4b9ebb18f7f7146350f0880f5c6 100644 (file)
@@ -337,8 +337,6 @@ static int btsdio_probe(struct sdio_func *func,
        hdev->flush    = btsdio_flush;
        hdev->send     = btsdio_send_frame;
 
-       hdev->owner = THIS_MODULE;
-
        err = hci_register_dev(hdev);
        if (err < 0) {
                hci_free_dev(hdev);
index 84e02f1a45b9b79247bcc2fa95160dcb049ca351..80ad2b9b352ef97908f79d9c09e65fc6b42e68da 100644 (file)
@@ -502,8 +502,6 @@ static int btuart_open(btuart_info_t *info)
        hdev->send     = btuart_hci_send_frame;
        hdev->ioctl    = btuart_hci_ioctl;
 
-       hdev->owner = THIS_MODULE;
-
        spin_lock_irqsave(&(info->lock), flags);
 
        /* Reset UART */
index 44b5e736ddc3bf97e4cc6b3fa07e48234701a0e8..a36888a9c2051c4366b9a1110392c1debcf38064 100644 (file)
@@ -997,8 +997,6 @@ static int btusb_probe(struct usb_interface *intf,
        hdev->send     = btusb_send_frame;
        hdev->notify   = btusb_notify;
 
-       hdev->owner = THIS_MODULE;
-
        /* Interface numbers are hardcoded in the specification */
        data->isoc = usb_ifnum_to_if(data->udev, 1);
 
index da9cf6a6e8ac9de810022e7b4e245c431a3e7b1b..b81b32e4fa12df3070907653ccbcae7dec8ef507 100644 (file)
@@ -317,7 +317,6 @@ static int bt_ti_probe(struct platform_device *pdev)
        hdev->close = ti_st_close;
        hdev->flush = NULL;
        hdev->send = ti_st_send_frame;
-       hdev->owner = THIS_MODULE;
 
        err = hci_register_dev(hdev);
        if (err < 0) {
index aae40caaa1887213704343e8084e87dfa69c1217..295cf1b4a052654c0900ff3b6a42e5ddb9bc6bc2 100644 (file)
@@ -484,8 +484,6 @@ static int dtl1_open(dtl1_info_t *info)
        hdev->send     = dtl1_hci_send_frame;
        hdev->ioctl    = dtl1_hci_ioctl;
 
-       hdev->owner = THIS_MODULE;
-
        spin_lock_irqsave(&(info->lock), flags);
 
        /* Reset UART */
index 5ea49df3462bfa3cc69f700cecb10a7b0116031e..459ff0ba5a42d02c139fbe845115a77802adca65 100644 (file)
@@ -392,8 +392,6 @@ static int hci_uart_register_dev(struct hci_uart *hu)
        hdev->send  = hci_uart_send_frame;
        hdev->parent = hu->tty->dev;
 
-       hdev->owner = THIS_MODULE;
-
        if (!reset)
                set_bit(HCI_QUIRK_NO_RESET, &hdev->quirks);
 
index 44a801292d628d12a2a53a6bb3b7d1571198e65f..5f305c131a0d629bc2ffa35859988ce4e5734ee5 100644 (file)
@@ -244,8 +244,6 @@ static int vhci_open(struct inode *inode, struct file *file)
        hdev->flush    = vhci_flush;
        hdev->send     = vhci_send_frame;
 
-       hdev->owner = THIS_MODULE;
-
        if (hci_register_dev(hdev) < 0) {
                BT_ERR("Can't register HCI device");
                kfree(data);
index 935aca8783c4cb2bd5865b85c0acb9a73dfe99bf..99984688ccddb80e880e3a085f924ad6644422d1 100644 (file)
@@ -262,8 +262,6 @@ struct hci_dev {
 
        struct rfkill           *rfkill;
 
-       struct module           *owner;
-
        unsigned long           dev_flags;
 
        int (*open)(struct hci_dev *hdev);
@@ -601,11 +599,7 @@ static inline void __hci_dev_put(struct hci_dev *d)
  * hci_dev_put and hci_dev_hold are macros to avoid dragging all the
  * overhead of all the modular infrastructure into this header.
  */
-#define hci_dev_put(d)         \
-do {                           \
-       __hci_dev_put(d);       \
-       module_put(d->owner);   \
-} while (0)
+#define hci_dev_put(d) __hci_dev_put(d)
 
 static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
 {
@@ -613,10 +607,7 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
        return d;
 }
 
-#define hci_dev_hold(d)                                                \
-({                                                             \
-       try_module_get(d->owner) ? __hci_dev_hold(d) : NULL;    \
-})
+#define hci_dev_hold(d) __hci_dev_hold(d)
 
 #define hci_dev_lock(d)                mutex_lock(&d->lock)
 #define hci_dev_unlock(d)      mutex_unlock(&d->lock)
index f23e32a645c8881f97c2819ddc90ac13278cdf26..58392a6b48b59aee4396b60793a4d77ebd3c8e84 100644 (file)
@@ -1548,8 +1548,7 @@ int hci_register_dev(struct hci_dev *hdev)
        struct list_head *head = &hci_dev_list, *p;
        int i, id, error;
 
-       BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name,
-                                               hdev->bus, hdev->owner);
+       BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
 
        if (!hdev->open || !hdev->close)
                return -EINVAL;