Bluetooth: Make l2cap_clear_timer return if timer was running or not
authorSzymon Janc <szymon.janc@tieto.com>
Wed, 11 Jan 2012 09:59:45 +0000 (10:59 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:25 +0000 (17:01 +0200)
This is usefull when need to make action after timer was cleared
depending on if it was running or not.

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/l2cap.h

index 26486e182f550cf876e89fafe4b1b553dcc7dcdd..238daf84184c378594fff9d302af2aa3c3919555 100644 (file)
@@ -616,11 +616,16 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
        schedule_delayed_work(work, timeout);
 }
 
-static inline void l2cap_clear_timer(struct l2cap_chan *chan,
+static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
                                        struct delayed_work *work)
 {
-       if (__cancel_delayed_work(work))
+       bool ret;
+
+       ret = __cancel_delayed_work(work);
+       if (ret)
                l2cap_chan_put(chan);
+
+       return ret;
 }
 
 #define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))