Re: [PATCH 04/16] Bluetooth: add l2cap_state_change_and_error()

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

 



Hi Gustavo,

> Add helper to set both state and error at the same time.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
> ---
>  net/bluetooth/l2cap_core.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 775c83f..adf7fbb 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -228,9 +228,15 @@ static void l2cap_state_change(struct l2cap_chan *chan, int state)
>  	release_sock(sk);
>  }
>  
> -static inline void __l2cap_chan_set_err(struct l2cap_chan *chan, int err)
> +static void l2cap_state_change_and_error(struct l2cap_chan *chan, int state,
> +					 int err)
>  {
> -	chan->ops->state_change(chan, chan->state, err);
> +	struct sock *sk = chan->sk;
> +
> +	lock_sock(sk);
> +	chan->state = state;
> +	chan->ops->state_change(chan, state, err);
> +	release_sock(sk);
>  }

I really do not think this is a good idea. Why are we combining this.
You need to explain why this makes sense. Since I clearly do not see it
and would have kept it separate.

Regards

Marcel


--
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