All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Remove double check for BT_CONNECTED
@ 2012-05-21 16:58 Gustavo Padovan
  2012-05-21 16:58 ` [PATCH 2/2] Bluetooth: Remove dead int returns Gustavo Padovan
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo Padovan @ 2012-05-21 16:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

The same check is done just before call l2cap_streaming_send()

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 net/bluetooth/l2cap_core.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c85a3a2..5bf8287 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1693,9 +1693,6 @@ static int l2cap_streaming_send(struct l2cap_chan *chan,
 
 	BT_DBG("chan %p, skbs %p", chan, skbs);
 
-	if (chan->state != BT_CONNECTED)
-		return -ENOTCONN;
-
 	skb_queue_splice_tail_init(skbs, &chan->tx_q);
 
 	while (!skb_queue_empty(&chan->tx_q)) {
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Bluetooth: Remove dead int returns
  2012-05-21 16:58 [PATCH 1/2] Bluetooth: Remove double check for BT_CONNECTED Gustavo Padovan
@ 2012-05-21 16:58 ` Gustavo Padovan
  2012-05-21 18:05   ` Mat Martineau
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo Padovan @ 2012-05-21 16:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

These functions were returning always 0, we just make then void.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 net/bluetooth/l2cap_core.c |   48 +++++++++++++++-----------------------------
 1 file changed, 16 insertions(+), 32 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 5bf8287..b644f40 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -73,7 +73,7 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data);
 static void l2cap_send_disconn_req(struct l2cap_conn *conn,
 				   struct l2cap_chan *chan, int err);
 
-static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
+static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
 		    struct sk_buff_head *skbs, u8 event);
 
 /* ---- L2CAP channels ---- */
@@ -1685,8 +1685,8 @@ static void l2cap_retrans_timeout(struct work_struct *work)
 	l2cap_chan_put(chan);
 }
 
-static int l2cap_streaming_send(struct l2cap_chan *chan,
-				struct sk_buff_head *skbs)
+static void l2cap_streaming_send(struct l2cap_chan *chan,
+				 struct sk_buff_head *skbs)
 {
 	struct sk_buff *skb;
 	struct l2cap_ctrl *control;
@@ -1719,8 +1719,6 @@ static int l2cap_streaming_send(struct l2cap_chan *chan,
 		chan->next_tx_seq = __next_seq(chan, chan->next_tx_seq);
 		chan->frames_sent++;
 	}
-
-	return 0;
 }
 
 static int l2cap_ertm_send(struct l2cap_chan *chan)
@@ -2254,13 +2252,11 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
 			break;
 
 		if (chan->mode == L2CAP_MODE_ERTM)
-			err = l2cap_tx(chan, NULL, &seg_queue,
-				       L2CAP_EV_DATA_REQUEST);
+			l2cap_tx(chan, NULL, &seg_queue, L2CAP_EV_DATA_REQUEST);
 		else
-			err = l2cap_streaming_send(chan, &seg_queue);
+			l2cap_streaming_send(chan, &seg_queue);
 
-		if (!err)
-			err = len;
+		err = len;
 
 		/* If the skbs were not queued for sending, they'll still be in
 		 * seg_queue and need to be purged.
@@ -2383,12 +2379,10 @@ static void l2cap_abort_rx_srej_sent(struct l2cap_chan *chan)
 	chan->rx_state = L2CAP_RX_STATE_RECV;
 }
 
-static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
-			       struct l2cap_ctrl *control,
-			       struct sk_buff_head *skbs, u8 event)
+static void l2cap_tx_state_xmit(struct l2cap_chan *chan,
+				struct l2cap_ctrl *control,
+				struct sk_buff_head *skbs, u8 event)
 {
-	int err = 0;
-
 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
 	       event);
 
@@ -2455,16 +2449,12 @@ static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
 	default:
 		break;
 	}
-
-	return err;
 }
 
-static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
-				 struct l2cap_ctrl *control,
-				 struct sk_buff_head *skbs, u8 event)
+static void l2cap_tx_state_wait_f(struct l2cap_chan *chan,
+				  struct l2cap_ctrl *control,
+				  struct sk_buff_head *skbs, u8 event)
 {
-	int err = 0;
-
 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
 	       event);
 
@@ -2537,31 +2527,25 @@ static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
 	default:
 		break;
 	}
-
-	return err;
 }
 
-static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
-		    struct sk_buff_head *skbs, u8 event)
+static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
+		     struct sk_buff_head *skbs, u8 event)
 {
-	int err = 0;
-
 	BT_DBG("chan %p, control %p, skbs %p, event %d, state %d",
 	       chan, control, skbs, event, chan->tx_state);
 
 	switch (chan->tx_state) {
 	case L2CAP_TX_STATE_XMIT:
-		err = l2cap_tx_state_xmit(chan, control, skbs, event);
+		l2cap_tx_state_xmit(chan, control, skbs, event);
 		break;
 	case L2CAP_TX_STATE_WAIT_F:
-		err = l2cap_tx_state_wait_f(chan, control, skbs, event);
+		l2cap_tx_state_wait_f(chan, control, skbs, event);
 		break;
 	default:
 		/* Ignore event */
 		break;
 	}
-
-	return err;
 }
 
 static void l2cap_pass_to_tx(struct l2cap_chan *chan,
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Bluetooth: Remove dead int returns
  2012-05-21 16:58 ` [PATCH 2/2] Bluetooth: Remove dead int returns Gustavo Padovan
@ 2012-05-21 18:05   ` Mat Martineau
  2012-05-21 18:34     ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Mat Martineau @ 2012-05-21 18:05 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan


Hi Gustavo -

On Mon, 21 May 2012, Gustavo Padovan wrote:

> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> These functions were returning always 0, we just make then void.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> net/bluetooth/l2cap_core.c |   48 +++++++++++++++-----------------------------
> 1 file changed, 16 insertions(+), 32 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 5bf8287..b644f40 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -73,7 +73,7 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data);
> static void l2cap_send_disconn_req(struct l2cap_conn *conn,
> 				   struct l2cap_chan *chan, int err);
>
> -static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> +static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> 		    struct sk_buff_head *skbs, u8 event);
>
> /* ---- L2CAP channels ---- */
> @@ -1685,8 +1685,8 @@ static void l2cap_retrans_timeout(struct work_struct *work)
> 	l2cap_chan_put(chan);
> }
>
> -static int l2cap_streaming_send(struct l2cap_chan *chan,
> -				struct sk_buff_head *skbs)
> +static void l2cap_streaming_send(struct l2cap_chan *chan,
> +				 struct sk_buff_head *skbs)
> {
> 	struct sk_buff *skb;
> 	struct l2cap_ctrl *control;
> @@ -1719,8 +1719,6 @@ static int l2cap_streaming_send(struct l2cap_chan *chan,
> 		chan->next_tx_seq = __next_seq(chan, chan->next_tx_seq);
> 		chan->frames_sent++;
> 	}
> -
> -	return 0;
> }
>
> static int l2cap_ertm_send(struct l2cap_chan *chan)
> @@ -2254,13 +2252,11 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
> 			break;
>
> 		if (chan->mode == L2CAP_MODE_ERTM)
> -			err = l2cap_tx(chan, NULL, &seg_queue,
> -				       L2CAP_EV_DATA_REQUEST);
> +			l2cap_tx(chan, NULL, &seg_queue, L2CAP_EV_DATA_REQUEST);
> 		else
> -			err = l2cap_streaming_send(chan, &seg_queue);
> +			l2cap_streaming_send(chan, &seg_queue);
>
> -		if (!err)
> -			err = len;
> +		err = len;
>
> 		/* If the skbs were not queued for sending, they'll still be in
> 		 * seg_queue and need to be purged.
> @@ -2383,12 +2379,10 @@ static void l2cap_abort_rx_srej_sent(struct l2cap_chan *chan)
> 	chan->rx_state = L2CAP_RX_STATE_RECV;
> }
>
> -static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
> -			       struct l2cap_ctrl *control,
> -			       struct sk_buff_head *skbs, u8 event)
> +static void l2cap_tx_state_xmit(struct l2cap_chan *chan,
> +				struct l2cap_ctrl *control,
> +				struct sk_buff_head *skbs, u8 event)
> {
> -	int err = 0;
> -
> 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
> 	       event);
>
> @@ -2455,16 +2449,12 @@ static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
> 	default:
> 		break;
> 	}
> -
> -	return err;
> }
>
> -static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> -				 struct l2cap_ctrl *control,
> -				 struct sk_buff_head *skbs, u8 event)
> +static void l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> +				  struct l2cap_ctrl *control,
> +				  struct sk_buff_head *skbs, u8 event)
> {
> -	int err = 0;
> -
> 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
> 	       event);
>
> @@ -2537,31 +2527,25 @@ static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> 	default:
> 		break;
> 	}
> -
> -	return err;
> }
>
> -static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> -		    struct sk_buff_head *skbs, u8 event)
> +static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> +		     struct sk_buff_head *skbs, u8 event)
> {
> -	int err = 0;
> -
> 	BT_DBG("chan %p, control %p, skbs %p, event %d, state %d",
> 	       chan, control, skbs, event, chan->tx_state);
>
> 	switch (chan->tx_state) {
> 	case L2CAP_TX_STATE_XMIT:
> -		err = l2cap_tx_state_xmit(chan, control, skbs, event);
> +		l2cap_tx_state_xmit(chan, control, skbs, event);
> 		break;
> 	case L2CAP_TX_STATE_WAIT_F:
> -		err = l2cap_tx_state_wait_f(chan, control, skbs, event);
> +		l2cap_tx_state_wait_f(chan, control, skbs, event);
> 		break;
> 	default:
> 		/* Ignore event */
> 		break;
> 	}
> -
> -	return err;
> }
>
> static void l2cap_pass_to_tx(struct l2cap_chan *chan,
> -- 
> 1.7.10.1

Both patches look fine to me.


--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Bluetooth: Remove dead int returns
  2012-05-21 18:05   ` Mat Martineau
@ 2012-05-21 18:34     ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-05-21 18:34 UTC (permalink / raw)
  To: Mat Martineau; +Cc: Gustavo Padovan, linux-bluetooth, Gustavo Padovan

Hi Mat,

> 
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > These functions were returning always 0, we just make then void.
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> > net/bluetooth/l2cap_core.c |   48 +++++++++++++++-----------------------------
> > 1 file changed, 16 insertions(+), 32 deletions(-)
> >
> > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > index 5bf8287..b644f40 100644
> > --- a/net/bluetooth/l2cap_core.c
> > +++ b/net/bluetooth/l2cap_core.c
> > @@ -73,7 +73,7 @@ static int l2cap_build_conf_req(struct l2cap_chan *chan, void *data);
> > static void l2cap_send_disconn_req(struct l2cap_conn *conn,
> > 				   struct l2cap_chan *chan, int err);
> >
> > -static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> > +static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> > 		    struct sk_buff_head *skbs, u8 event);
> >
> > /* ---- L2CAP channels ---- */
> > @@ -1685,8 +1685,8 @@ static void l2cap_retrans_timeout(struct work_struct *work)
> > 	l2cap_chan_put(chan);
> > }
> >
> > -static int l2cap_streaming_send(struct l2cap_chan *chan,
> > -				struct sk_buff_head *skbs)
> > +static void l2cap_streaming_send(struct l2cap_chan *chan,
> > +				 struct sk_buff_head *skbs)
> > {
> > 	struct sk_buff *skb;
> > 	struct l2cap_ctrl *control;
> > @@ -1719,8 +1719,6 @@ static int l2cap_streaming_send(struct l2cap_chan *chan,
> > 		chan->next_tx_seq = __next_seq(chan, chan->next_tx_seq);
> > 		chan->frames_sent++;
> > 	}
> > -
> > -	return 0;
> > }
> >
> > static int l2cap_ertm_send(struct l2cap_chan *chan)
> > @@ -2254,13 +2252,11 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
> > 			break;
> >
> > 		if (chan->mode == L2CAP_MODE_ERTM)
> > -			err = l2cap_tx(chan, NULL, &seg_queue,
> > -				       L2CAP_EV_DATA_REQUEST);
> > +			l2cap_tx(chan, NULL, &seg_queue, L2CAP_EV_DATA_REQUEST);
> > 		else
> > -			err = l2cap_streaming_send(chan, &seg_queue);
> > +			l2cap_streaming_send(chan, &seg_queue);
> >
> > -		if (!err)
> > -			err = len;
> > +		err = len;
> >
> > 		/* If the skbs were not queued for sending, they'll still be in
> > 		 * seg_queue and need to be purged.
> > @@ -2383,12 +2379,10 @@ static void l2cap_abort_rx_srej_sent(struct l2cap_chan *chan)
> > 	chan->rx_state = L2CAP_RX_STATE_RECV;
> > }
> >
> > -static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
> > -			       struct l2cap_ctrl *control,
> > -			       struct sk_buff_head *skbs, u8 event)
> > +static void l2cap_tx_state_xmit(struct l2cap_chan *chan,
> > +				struct l2cap_ctrl *control,
> > +				struct sk_buff_head *skbs, u8 event)
> > {
> > -	int err = 0;
> > -
> > 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
> > 	       event);
> >
> > @@ -2455,16 +2449,12 @@ static int l2cap_tx_state_xmit(struct l2cap_chan *chan,
> > 	default:
> > 		break;
> > 	}
> > -
> > -	return err;
> > }
> >
> > -static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> > -				 struct l2cap_ctrl *control,
> > -				 struct sk_buff_head *skbs, u8 event)
> > +static void l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> > +				  struct l2cap_ctrl *control,
> > +				  struct sk_buff_head *skbs, u8 event)
> > {
> > -	int err = 0;
> > -
> > 	BT_DBG("chan %p, control %p, skbs %p, event %d", chan, control, skbs,
> > 	       event);
> >
> > @@ -2537,31 +2527,25 @@ static int l2cap_tx_state_wait_f(struct l2cap_chan *chan,
> > 	default:
> > 		break;
> > 	}
> > -
> > -	return err;
> > }
> >
> > -static int l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> > -		    struct sk_buff_head *skbs, u8 event)
> > +static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
> > +		     struct sk_buff_head *skbs, u8 event)
> > {
> > -	int err = 0;
> > -
> > 	BT_DBG("chan %p, control %p, skbs %p, event %d, state %d",
> > 	       chan, control, skbs, event, chan->tx_state);
> >
> > 	switch (chan->tx_state) {
> > 	case L2CAP_TX_STATE_XMIT:
> > -		err = l2cap_tx_state_xmit(chan, control, skbs, event);
> > +		l2cap_tx_state_xmit(chan, control, skbs, event);
> > 		break;
> > 	case L2CAP_TX_STATE_WAIT_F:
> > -		err = l2cap_tx_state_wait_f(chan, control, skbs, event);
> > +		l2cap_tx_state_wait_f(chan, control, skbs, event);
> > 		break;
> > 	default:
> > 		/* Ignore event */
> > 		break;
> > 	}
> > -
> > -	return err;
> > }
> >
> > static void l2cap_pass_to_tx(struct l2cap_chan *chan,
> > -- 
> > 1.7.10.1
> 
> Both patches look fine to me.

I applied both patches with your Reviewed-by to bluetooth-next.

Regards

Marcel



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-21 18:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 16:58 [PATCH 1/2] Bluetooth: Remove double check for BT_CONNECTED Gustavo Padovan
2012-05-21 16:58 ` [PATCH 2/2] Bluetooth: Remove dead int returns Gustavo Padovan
2012-05-21 18:05   ` Mat Martineau
2012-05-21 18:34     ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.