Re: [PATCH 2/2] Bluetooth: Fix usage of sk_sndtimeo value

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

 



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@xxxxxxxxx>
> ---
>  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 :-(

Best regards 
Andrei Emeltchenko 

>  			l2cap_send_disconn_req(conn, chan, reason);
>  		} else
>  			l2cap_chan_del(chan, reason);
> @@ -899,7 +899,7 @@ static void l2cap_le_conn_ready(struct l2cap_conn *conn)
>  
>  	__l2cap_chan_add(conn, chan);
>  
> -	__set_chan_timer(chan, sk->sk_sndtimeo);
> +	__set_chan_timer(chan, jiffies_to_msecs(sk->sk_sndtimeo));
>  
>  	l2cap_state_change(chan, BT_CONNECTED);
>  	parent->sk_data_ready(parent, 0);
> @@ -1176,7 +1176,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan)
>  	l2cap_chan_add(conn, chan);
>  
>  	l2cap_state_change(chan, BT_CONNECT);
> -	__set_chan_timer(chan, sk->sk_sndtimeo);
> +	__set_chan_timer(chan, jiffies_to_msecs(sk->sk_sndtimeo));
>  
>  	if (hcon->state == BT_CONNECTED) {
>  		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
> @@ -2601,7 +2601,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
>  
>  	dcid = chan->scid;
>  
> -	__set_chan_timer(chan, sk->sk_sndtimeo);
> +	__set_chan_timer(chan, jiffies_to_msecs(sk->sk_sndtimeo));
>  
>  	chan->ident = cmd->ident;
>  
> -- 
> on behalf of ST-Ericsson
> 
> --
> 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
--
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