diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2014-06-18 09:37:10 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-07-03 11:42:44 -0400 |
commit | 18d93c176641cf7a3c0c452a6f03f46b5373d370 (patch) | |
tree | b76fd4e1fb9628ec32662454f51cee99a56e5947 /net/bluetooth/6lowpan.c | |
parent | 5547e48c09d51ad21948c8090a34339939651450 (diff) |
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.c | 5 |
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) | |||
100 | { | 100 | { |
101 | list_del(&peer->list); | 101 | list_del(&peer->list); |
102 | 102 | ||
103 | module_put(THIS_MODULE); | ||
104 | |||
103 | if (atomic_dec_and_test(&dev->peer_count)) { | 105 | if (atomic_dec_and_test(&dev->peer_count)) { |
104 | BT_DBG("last peer"); | 106 | BT_DBG("last peer"); |
105 | return true; | 107 | return true; |
@@ -752,6 +754,9 @@ static inline void chan_ready_cb(struct l2cap_chan *chan) | |||
752 | } | 754 | } |
753 | } | 755 | } |
754 | 756 | ||
757 | if (!try_module_get(THIS_MODULE)) | ||
758 | return; | ||
759 | |||
755 | add_peer_chan(chan, dev); | 760 | add_peer_chan(chan, dev); |
756 | ifup(dev->netdev); | 761 | ifup(dev->netdev); |
757 | } | 762 | } |