Re: [RFC 06/22] Bluetooth: Move L2CAP timers to workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andrei,

On Mon, Dec 19, 2011 at 9:05 AM, Andrei Emeltchenko
<andrei.emeltchenko.news@xxxxxxxxx> wrote:
> Hi Gustavo,
>
> On Sat, Dec 17, 2011 at 07:29:26PM -0200, Gustavo F. Padovan wrote:
>> From: "Gustavo F. Padovan" <padovan@xxxxxxxxxxxxxx>
>>
>> L2CAP timers also need to run in process context. As the works in l2cap
>> are small we are using the system worqueue.
>>
>> Signed-off-by: Gustavo F. Padovan <padovan@xxxxxxxxxxxxxx>
>> ---
>>  include/net/bluetooth/l2cap.h |   17 +++++-----
>>  net/bluetooth/l2cap_core.c    |   70 ++++++++++++++++++-----------------------
>>  2 files changed, 40 insertions(+), 47 deletions(-)
>
> ...
>
>> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
>> index 0369a9b..89cda6d 100644
>> --- a/net/bluetooth/l2cap_core.c
>> +++ b/net/bluetooth/l2cap_core.c
>> @@ -213,20 +213,18 @@ static u16 l2cap_alloc_cid(struct l2cap_conn *conn)
>>       return 0;
>>  }
>>
>> -static void l2cap_set_timer(struct l2cap_chan *chan, struct timer_list *timer, long timeout)
>> +static void l2cap_set_timer(struct l2cap_chan *chan, struct delayed_work *work, long timeout)
>>  {
>>       BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout);
>>
>> -     if (!mod_timer(timer, jiffies + msecs_to_jiffies(timeout)))
>> -             chan_hold(chan);
>> +     cancel_delayed_work_sync(work);
>> +
>> +     schedule_delayed_work(work, timeout);
>>  }
>>
>> -static void l2cap_clear_timer(struct l2cap_chan *chan, struct timer_list *timer)
>> +static void l2cap_clear_timer(struct delayed_work *work)
>>  {
>> -     BT_DBG("chan %p state %d", chan, chan->state);
>> -
>> -     if (timer_pending(timer) && del_timer(timer))
>> -             chan_put(chan);
>> +     cancel_delayed_work_sync(work);
>>  }
>
>
> Do you think we do not need to use chan_hold / chan_put?

It's good you spotted it too. It's a known issue Padovan is looking at. Thanks.

Best regards,

-- 
Ulisses Furquim
ProFUSION embedded systems
http://profusion.mobi
Mobile: +55 19 9250 0942
Skype: ulissesffs
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux