]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
Bluetooth: 6LoWPAN: Count module usage
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Wed, 18 Jun 2014 13:37:10 +0000 (16:37 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:44 +0000 (17:42 +0200)
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>
net/bluetooth/6lowpan.c

index ceffe20fcbaa4a4a24c37e97636e4142d1567c19..ba6c641636852119c69991d13d537d917d7372d5 100644 (file)
@@ -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);
 }