Skip to content

Commit

Permalink
Bluetooth: Make l2cap_clear_timer return if timer was running or not
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Szymon Janc authored and Johan Hedberg committed Feb 13, 2012
1 parent 8b281b9 commit 75b93b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/net/bluetooth/l2cap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 75b93b5

Please sign in to comment.