From: Szymon Janc Date: Wed, 11 Jan 2012 09:59:45 +0000 (+0100) Subject: Bluetooth: Make l2cap_clear_timer return if timer was running or not X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=75b93b59ad625d734b1c7d7e05bf6b9898c8c28f;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Bluetooth: Make l2cap_clear_timer return if timer was running or not 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 Acked-by: Marcel Holtmann Signed-off-by: Johan Hedberg --- diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 26486e182f55..238daf84184c 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -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))