linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
To: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>,
	<linux-bluetooth@vger.kernel.org>, <kanak.gupta@stericsson.com>,
	<ulrik.lauren@stericsson.com>, <henrik.possung@stericsson.com>
Subject: Re: [PATCH 2/2] Bluetooth: Fix usage of sk_sndtimeo value
Date: Thu, 10 Nov 2011 13:09:52 +0100	[thread overview]
Message-ID: <4EBBBF10.6080403@tieto.com> (raw)
In-Reply-To: <20111110103506.GB8486@aemeltch-MOBL1>

Hi Andrei,

On 10.11.2011 11:35, Andrei Emeltchenko wrote:
> Hi Andrzej,
>
> On Thu, Nov 10, 2011 at 11:13:53AM +0100, Andrzej Kaczmarek wrote:
>> Hi Andrei,
>>
>> On 10.11.2011 10:57, Andrei Emeltchenko wrote:
>>> Hi Andrzej,
>>>
>>> On Thu, Nov 10, 2011 at 10:37:25AM +0100, Andrzej Kaczmarek wrote:
>>>> sk_sndtimeo timeout value is specified in jiffes and should be
>>>> converted to miliseconds when used as input to __set_chan_timer.
>>>>
>>>> Signed-off-by: Andrzej Kaczmarek<andrzej.kaczmarek@tieto.com>
>>>> ---
>>>>   net/bluetooth/l2cap_core.c |    8 ++++----
>>>>   1 files changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
>>>> index f850684..3b0f807 100644
>>>> --- a/net/bluetooth/l2cap_core.c
>>>> +++ b/net/bluetooth/l2cap_core.c
>>>> @@ -446,7 +446,7 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
>>>>   		if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED&&
>>>>   					conn->hcon->type == ACL_LINK) {
>>>>   			__clear_chan_timer(chan);
>>>> -			__set_chan_timer(chan, sk->sk_sndtimeo);
>>>> +			__set_chan_timer(chan, jiffies_to_msecs(sk->sk_sndtimeo));
>>>
>>> Then __set_chan_timer do reverse conversion:
>>> mod_timer(timer, jiffies + msecs_to_jiffies(timeout))
>>>
>>> Look ugly :-(
>>
>> Well, I agree. But problem here is that __set_chan_timer has
>> miliseconds as input and sk_sndtimeo has to be specified in jiffies
>> thus ugly double conversion.
>
> Maybe we can just use jiffies in  __set_chan_timer ?

This will actually move conversion one step further to underlying 
l2cap_set_timer :-) And moreover we'll need to change other 
__set_chan_timer calls to use jiffies again and put msecs_to_jiffies 
"everywhere".

Of course we can make also l2cap_set_timer to accept jiffies and set all 
timers (except sk_sndtimeo) with msecs_to_jiffies, but I think this will 
be even more ugly :-(

BR,
Andrzej

  reply	other threads:[~2011-11-10 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10  9:37 [PATCH 0/2] Fix usage of sk_sndtimeo value in l2cap Andrzej Kaczmarek
2011-11-10  9:37 ` [PATCH 1/2] Buetooth: Revert "Fixed wrong L2CAP Sock timer value" Andrzej Kaczmarek
2011-11-10  9:37 ` [PATCH 2/2] Bluetooth: Fix usage of sk_sndtimeo value Andrzej Kaczmarek
2011-11-10  9:57   ` Andrei Emeltchenko
2011-11-10 10:13     ` Andrzej Kaczmarek
2011-11-10 10:35       ` Andrei Emeltchenko
2011-11-10 12:09         ` Andrzej Kaczmarek [this message]
2011-12-18 23:31   ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EBBBF10.6080403@tieto.com \
    --to=andrzej.kaczmarek@tieto.com \
    --cc=andrei.emeltchenko.news@gmail.com \
    --cc=henrik.possung@stericsson.com \
    --cc=kanak.gupta@stericsson.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ulrik.lauren@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).