diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-01-07 09:47:17 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-13 10:01:24 -0500 |
commit | d25442ba4b44bf1fad50c9c2156a4ca89f269713 (patch) | |
tree | 47ce9f59bd0175c15841a422942022c7f371a357 /drivers/bluetooth | |
parent | 8381088e39d03c55552b9dfb09b9b303e96acc78 (diff) |
Bluetooth: bpa10x: Free private driver data on usb shutdown
Instead of waiting for the hci-device to be destroyed we now free the
private driver data on driver shutdown right away. We call
hci_unregister_dev() on driver shutdown, that means, the hci-core will
never ever call our callbacks again except the destruct callback. It
also does not access hdev->driver_data so there is no reason to keep
that alive. We simply set the destruct cb to NULL to avoid getting
called again.
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/bpa10x.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 62831603de5e..29cd11d401e1 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c | |||
@@ -432,17 +432,6 @@ static int bpa10x_send_frame(struct sk_buff *skb) | |||
432 | return 0; | 432 | return 0; |
433 | } | 433 | } |
434 | 434 | ||
435 | static void bpa10x_destruct(struct hci_dev *hdev) | ||
436 | { | ||
437 | struct bpa10x_data *data = hdev->driver_data; | ||
438 | |||
439 | BT_DBG("%s", hdev->name); | ||
440 | |||
441 | kfree_skb(data->rx_skb[0]); | ||
442 | kfree_skb(data->rx_skb[1]); | ||
443 | kfree(data); | ||
444 | } | ||
445 | |||
446 | static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id) | 435 | static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id) |
447 | { | 436 | { |
448 | struct bpa10x_data *data; | 437 | struct bpa10x_data *data; |
@@ -480,7 +469,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * | |||
480 | hdev->close = bpa10x_close; | 469 | hdev->close = bpa10x_close; |
481 | hdev->flush = bpa10x_flush; | 470 | hdev->flush = bpa10x_flush; |
482 | hdev->send = bpa10x_send_frame; | 471 | hdev->send = bpa10x_send_frame; |
483 | hdev->destruct = bpa10x_destruct; | ||
484 | 472 | ||
485 | hdev->owner = THIS_MODULE; | 473 | hdev->owner = THIS_MODULE; |
486 | 474 | ||
@@ -512,6 +500,9 @@ static void bpa10x_disconnect(struct usb_interface *intf) | |||
512 | hci_unregister_dev(data->hdev); | 500 | hci_unregister_dev(data->hdev); |
513 | 501 | ||
514 | hci_free_dev(data->hdev); | 502 | hci_free_dev(data->hdev); |
503 | kfree_skb(data->rx_skb[0]); | ||
504 | kfree_skb(data->rx_skb[1]); | ||
505 | kfree(data); | ||
515 | } | 506 | } |
516 | 507 | ||
517 | static struct usb_driver bpa10x_driver = { | 508 | static struct usb_driver bpa10x_driver = { |