提交 d25442ba 编写于 作者: D David Herrmann 提交者: Johan Hedberg

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: NDavid Herrmann <dh.herrmann@googlemail.com>
Acked-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 8381088e
...@@ -432,17 +432,6 @@ static int bpa10x_send_frame(struct sk_buff *skb) ...@@ -432,17 +432,6 @@ static int bpa10x_send_frame(struct sk_buff *skb)
return 0; return 0;
} }
static void bpa10x_destruct(struct hci_dev *hdev)
{
struct bpa10x_data *data = hdev->driver_data;
BT_DBG("%s", hdev->name);
kfree_skb(data->rx_skb[0]);
kfree_skb(data->rx_skb[1]);
kfree(data);
}
static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id) static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id)
{ {
struct bpa10x_data *data; struct bpa10x_data *data;
...@@ -480,7 +469,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id * ...@@ -480,7 +469,6 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
hdev->close = bpa10x_close; hdev->close = bpa10x_close;
hdev->flush = bpa10x_flush; hdev->flush = bpa10x_flush;
hdev->send = bpa10x_send_frame; hdev->send = bpa10x_send_frame;
hdev->destruct = bpa10x_destruct;
hdev->owner = THIS_MODULE; hdev->owner = THIS_MODULE;
...@@ -512,6 +500,9 @@ static void bpa10x_disconnect(struct usb_interface *intf) ...@@ -512,6 +500,9 @@ static void bpa10x_disconnect(struct usb_interface *intf)
hci_unregister_dev(data->hdev); hci_unregister_dev(data->hdev);
hci_free_dev(data->hdev); hci_free_dev(data->hdev);
kfree_skb(data->rx_skb[0]);
kfree_skb(data->rx_skb[1]);
kfree(data);
} }
static struct usb_driver bpa10x_driver = { static struct usb_driver bpa10x_driver = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册