summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/6lowpan.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2014-06-18 15:37:10 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 17:42:44 +0200
commit18d93c176641cf7a3c0c452a6f03f46b5373d370 (patch)
treeb76fd4e1fb9628ec32662454f51cee99a56e5947 /net/bluetooth/6lowpan.c
parentBluetooth: 6LoWPAN: Create a kernel module (diff)
downloadlinux-18d93c176641cf7a3c0c452a6f03f46b5373d370.tar.xz
linux-18d93c176641cf7a3c0c452a6f03f46b5373d370.zip
Bluetooth: 6LoWPAN: Count module usage
Count how many 6LoWPAN connections there exists so that we do not unload the module if there are still connections alive. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r--net/bluetooth/6lowpan.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index ceffe20fcbaa..ba6c64163685 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -100,6 +100,8 @@ static inline bool peer_del(struct lowpan_dev *dev, struct lowpan_peer *peer)
{
list_del(&peer->list);
+ module_put(THIS_MODULE);
+
if (atomic_dec_and_test(&dev->peer_count)) {
BT_DBG("last peer");
return true;
@@ -752,6 +754,9 @@ static inline void chan_ready_cb(struct l2cap_chan *chan)
}
}
+ if (!try_module_get(THIS_MODULE))
+ return;
+
add_peer_chan(chan, dev);
ifup(dev->netdev);
}