linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/18] Cleanup HCI reference counts
@ 2012-01-07 14:47 David Herrmann
  2012-01-07 14:47 ` [PATCH 01/18] Bluetooth: Make hci-destruct callback optional David Herrmann
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: David Herrmann @ 2012-01-07 14:47 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: padovan, marcel, David Herrmann

Hi

This is the same as my previous patchset but split into sequential patches. The
first patch makes the destruct-cb optional so the patches 2-7 can remove the
empty callbacks.
Patches 8-14 make the remaining drivers drop the destruct-callback and directly
free the driver data.
Patches 15-18 then remove the (now unused!) destruct callback and then properly
fixes the reference counts (same patches as already posted).

I hope the first 14 patches make clear that half of our drivers already work
without the destruct callback and the other half can be safely converted into
not using it. In fact, the drivers that use it introduce some memleaks which are
fixed by simply dropping the callback and freeing everything right away.

I've added detailed commit messages to each driver. If a single step is unclear,
please point me to it.


By the way, this fixes several bugs we currently have, including some mem-leaks
as described in the commits and the fact that hci_free_dev() currently
*directly* destroys the hci object regardless of any previous calls to
hci_hold_dev/hci_put_dev(). This is because the hci->refcnt counter is in no way
linked to the lifetime of the hci object. See hci_sysfs the release_host
callback which actually frees the hci object. It is in no way triggered by
hci->refcnt.
This patchset fixes all this and introduces proper reference counting.

Cheers
David

David Herrmann (18):
  Bluetooth: Make hci-destruct callback optional
  Bluetooth: bluecard-cs: Remove empty destruct cb
  Bluetooth: bt3c-cs: Remove empty destruct cb
  Bluetooth: btmrvl: Remove empty destruct cb
  Bluetooth: btuart-cs: Remove empty destruct cb
  Bluetooth: btwilink: Remove empty destruct cb
  Bluetooth: dtl1-cs: Remove empty destruct cb
  Bluetooth: vhci: Free driver_data on file release
  Bluetooth: bfusb: Free driver_data on USB shutdown
  Bluetooth: btusb: Free driver data on USB shutdown
  Bluetooth: bpa10x: Free private driver data on usb shutdown
  Bluetooth: btsdio: Free driver data on SDIO shutdown
  Bluetooth: uart-ldisc: Fix memory leak and remove destruct cb
  Bluetooth: Remove unused hci-destruct cb
  Bluetooth: Correctly acquire module ref
  Bluetooth: Remove HCI-owner field
  Bluetooth: Correctly take hci_dev->dev refcount
  Bluetooth: Remove __hci_dev_put/hold

 drivers/bluetooth/bfusb.c        |   13 +------------
 drivers/bluetooth/bluecard_cs.c  |    8 --------
 drivers/bluetooth/bpa10x.c       |   17 +++--------------
 drivers/bluetooth/bt3c_cs.c      |    8 --------
 drivers/bluetooth/btmrvl_main.c  |    6 ------
 drivers/bluetooth/btsdio.c       |   13 +------------
 drivers/bluetooth/btuart_cs.c    |    8 --------
 drivers/bluetooth/btusb.c        |   17 +++--------------
 drivers/bluetooth/btwilink.c     |   10 ----------
 drivers/bluetooth/dtl1_cs.c      |    8 --------
 drivers/bluetooth/hci_ldisc.c    |   14 ++------------
 drivers/bluetooth/hci_vhci.c     |    9 +--------
 include/net/bluetooth/hci_core.h |   28 ++++------------------------
 net/bluetooth/hci_core.c         |    9 ++++-----
 net/bluetooth/hci_sysfs.c        |    2 ++
 15 files changed, 21 insertions(+), 149 deletions(-)

-- 
1.7.8.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-01-09 11:44 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-07 14:47 [PATCH 00/18] Cleanup HCI reference counts David Herrmann
2012-01-07 14:47 ` [PATCH 01/18] Bluetooth: Make hci-destruct callback optional David Herrmann
2012-01-07 14:47 ` [PATCH 02/18] Bluetooth: bluecard-cs: Remove empty destruct cb David Herrmann
2012-01-07 14:47 ` [PATCH 03/18] Bluetooth: bt3c-cs: " David Herrmann
2012-01-07 14:47 ` [PATCH 04/18] Bluetooth: btmrvl: " David Herrmann
2012-01-07 14:47 ` [PATCH 05/18] Bluetooth: btuart-cs: " David Herrmann
2012-01-07 14:47 ` [PATCH 06/18] Bluetooth: btwilink: " David Herrmann
2012-01-07 14:47 ` [PATCH 07/18] Bluetooth: dtl1-cs: " David Herrmann
2012-01-07 14:47 ` [PATCH 08/18] Bluetooth: vhci: Free driver_data on file release David Herrmann
2012-01-07 14:47 ` [PATCH 09/18] Bluetooth: bfusb: Free driver_data on USB shutdown David Herrmann
2012-01-07 14:47 ` [PATCH 10/18] Bluetooth: btusb: Free driver data " David Herrmann
2012-01-07 14:47 ` [PATCH 11/18] Bluetooth: bpa10x: Free private driver data on usb shutdown David Herrmann
2012-01-07 14:47 ` [PATCH 12/18] Bluetooth: btsdio: Free driver data on SDIO shutdown David Herrmann
2012-01-07 14:47 ` [PATCH 13/18] Bluetooth: uart-ldisc: Fix memory leak and remove destruct cb David Herrmann
2012-01-07 14:47 ` [PATCH 14/18] Bluetooth: Remove unused hci-destruct cb David Herrmann
2012-01-07 14:47 ` [PATCH 15/18] Bluetooth: Correctly acquire module ref David Herrmann
2012-01-07 14:47 ` [PATCH 16/18] Bluetooth: Remove HCI-owner field David Herrmann
2012-01-07 14:47 ` [PATCH 17/18] Bluetooth: Correctly take hci_dev->dev refcount David Herrmann
2012-01-07 14:47 ` [PATCH 18/18] Bluetooth: Remove __hci_dev_put/hold David Herrmann
2012-01-09  7:54 ` [PATCH 00/18] Cleanup HCI reference counts Marcel Holtmann
2012-01-09 11:44 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).