All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb()
@ 2012-04-06 23:15 Gustavo Padovan
  2012-04-06 23:15 ` [PATCH 2/2] Bluetooth: rename parameter of alloc_skb Gustavo Padovan
  2012-04-07 11:44 ` [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo Padovan @ 2012-04-06 23:15 UTC (permalink / raw)
  To: linux-bluetooth

Use ERR_PTR maginc instead.

Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
---
 include/net/bluetooth/l2cap.h |    2 +-
 net/bluetooth/l2cap_core.c    |   30 +++++++++++++-----------------
 net/bluetooth/l2cap_sock.c    |   12 ++++++++----
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 09cbd33..b74b3f9 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -522,7 +522,7 @@ struct l2cap_ops {
 	void			(*close) (void *data);
 	void			(*state_change) (void *data, int state);
 	struct sk_buff		*(*alloc_skb) (struct l2cap_chan *chan,
-					unsigned long len, int nb, int *err);
+					unsigned long len, int nb);
 
 };
 
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a080b00..ab8d522 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1563,7 +1563,7 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
 {
 	struct l2cap_conn *conn = chan->conn;
 	struct sk_buff **frag;
-	int err, sent = 0;
+	int sent = 0;
 
 	if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count))
 		return -EFAULT;
@@ -1577,11 +1577,10 @@ static inline int l2cap_skbuff_fromiovec(struct l2cap_chan *chan,
 		count = min_t(unsigned int, conn->mtu, len);
 
 		*frag = chan->ops->alloc_skb(chan, count,
-					     msg->msg_flags & MSG_DONTWAIT,
-					     &err);
+					     msg->msg_flags & MSG_DONTWAIT);
 
-		if (!*frag)
-			return err;
+		if (IS_ERR(*frag))
+			return PTR_ERR(*frag);
 		if (memcpy_fromiovec(skb_put(*frag, count), msg->msg_iov, count))
 			return -EFAULT;
 
@@ -1610,10 +1609,9 @@ static struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan,
 	count = min_t(unsigned int, (conn->mtu - hlen), len);
 
 	skb = chan->ops->alloc_skb(chan, count + hlen,
-				   msg->msg_flags & MSG_DONTWAIT, &err);
-
-	if (!skb)
-		return ERR_PTR(err);
+				   msg->msg_flags & MSG_DONTWAIT);
+	if (IS_ERR(skb))
+		return skb;
 
 	skb->priority = priority;
 
@@ -1645,10 +1643,9 @@ static struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan,
 	count = min_t(unsigned int, (conn->mtu - hlen), len);
 
 	skb = chan->ops->alloc_skb(chan, count + hlen,
-				   msg->msg_flags & MSG_DONTWAIT, &err);
-
-	if (!skb)
-		return ERR_PTR(err);
+				   msg->msg_flags & MSG_DONTWAIT);
+	if (IS_ERR(skb))
+		return skb;
 
 	skb->priority = priority;
 
@@ -1693,10 +1690,9 @@ static struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan,
 	count = min_t(unsigned int, (conn->mtu - hlen), len);
 
 	skb = chan->ops->alloc_skb(chan, count + hlen,
-					msg->msg_flags & MSG_DONTWAIT, &err);
-
-	if (!skb)
-		return ERR_PTR(err);
+				   msg->msg_flags & MSG_DONTWAIT);
+	if (IS_ERR(skb))
+		return skb;
 
 	/* Create L2CAP header */
 	lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index ae1d78e..1463b5d 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -927,12 +927,16 @@ static void l2cap_sock_state_change_cb(void *data, int state)
 }
 
 static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
-					       unsigned long len, int nb,
-					       int *err)
+					       unsigned long len, int nb)
 {
-	struct sock *sk = chan->sk;
+	struct sk_buff *skb;
+	int err;
+
+	skb = bt_skb_send_alloc(chan->sk, len, nb, &err);
+	if (!skb)
+		return (ERR_PTR(err));
 
-	return bt_skb_send_alloc(sk, len, nb, err);
+	return skb;
 }
 
 static struct l2cap_ops l2cap_chan_ops = {
-- 
1.7.7.6


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

* [PATCH 2/2] Bluetooth: rename parameter of alloc_skb
  2012-04-06 23:15 [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Gustavo Padovan
@ 2012-04-06 23:15 ` Gustavo Padovan
  2012-04-07 11:47   ` Marcel Holtmann
  2012-04-07 11:44 ` [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Gustavo Padovan @ 2012-04-06 23:15 UTC (permalink / raw)
  To: linux-bluetooth

'flags' makes much more sense than 'nb'.

Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
---
 include/net/bluetooth/l2cap.h |    2 +-
 net/bluetooth/l2cap_sock.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index b74b3f9..193d3a1 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -522,7 +522,7 @@ struct l2cap_ops {
 	void			(*close) (void *data);
 	void			(*state_change) (void *data, int state);
 	struct sk_buff		*(*alloc_skb) (struct l2cap_chan *chan,
-					unsigned long len, int nb);
+					unsigned long len, int flags);
 
 };
 
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 1463b5d..5d68b51 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -927,12 +927,12 @@ static void l2cap_sock_state_change_cb(void *data, int state)
 }
 
 static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
-					       unsigned long len, int nb)
+					       unsigned long len, int flags)
 {
 	struct sk_buff *skb;
 	int err;
 
-	skb = bt_skb_send_alloc(chan->sk, len, nb, &err);
+	skb = bt_skb_send_alloc(chan->sk, len, flags, &err);
 	if (!skb)
 		return (ERR_PTR(err));
 
-- 
1.7.7.6


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

* Re: [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb()
  2012-04-06 23:15 [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Gustavo Padovan
  2012-04-06 23:15 ` [PATCH 2/2] Bluetooth: rename parameter of alloc_skb Gustavo Padovan
@ 2012-04-07 11:44 ` Marcel Holtmann
  2012-04-12 11:51   ` Johan Hedberg
  1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2012-04-07 11:44 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-bluetooth

Hi Gustavo,

> Use ERR_PTR maginc instead.
> 
> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
> ---
>  include/net/bluetooth/l2cap.h |    2 +-
>  net/bluetooth/l2cap_core.c    |   30 +++++++++++++-----------------
>  net/bluetooth/l2cap_sock.c    |   12 ++++++++----
>  3 files changed, 22 insertions(+), 22 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



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

* Re: [PATCH 2/2] Bluetooth: rename parameter of alloc_skb
  2012-04-06 23:15 ` [PATCH 2/2] Bluetooth: rename parameter of alloc_skb Gustavo Padovan
@ 2012-04-07 11:47   ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-04-07 11:47 UTC (permalink / raw)
  To: Gustavo Padovan; +Cc: linux-bluetooth

Hi Gustavo,

> 'flags' makes much more sense than 'nb'.
> 
> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
> ---
>  include/net/bluetooth/l2cap.h |    2 +-
>  net/bluetooth/l2cap_sock.c    |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index b74b3f9..193d3a1 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -522,7 +522,7 @@ struct l2cap_ops {
>  	void			(*close) (void *data);
>  	void			(*state_change) (void *data, int state);
>  	struct sk_buff		*(*alloc_skb) (struct l2cap_chan *chan,
> -					unsigned long len, int nb);
> +					unsigned long len, int flags);
>  
>  };
>  
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 1463b5d..5d68b51 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -927,12 +927,12 @@ static void l2cap_sock_state_change_cb(void *data, int state)
>  }
>  
>  static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
> -					       unsigned long len, int nb)
> +					       unsigned long len, int flags)
>  {
>  	struct sk_buff *skb;
>  	int err;
>  
> -	skb = bt_skb_send_alloc(chan->sk, len, nb, &err);
> +	skb = bt_skb_send_alloc(chan->sk, len, flags, &err);
>  	if (!skb)
>  		return (ERR_PTR(err));
>  

actually sock_alloc_send_skb() uses noblock. So using the same would
make more sense to me than flags.

Regards

Marcel



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

* Re: [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb()
  2012-04-07 11:44 ` [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Marcel Holtmann
@ 2012-04-12 11:51   ` Johan Hedberg
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-04-12 11:51 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Gustavo Padovan, linux-bluetooth

Hi,

On Sat, Apr 07, 2012, Marcel Holtmann wrote:
> Hi Gustavo,
> 
> > Use ERR_PTR maginc instead.
> > 
> > Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
> > ---
> >  include/net/bluetooth/l2cap.h |    2 +-
> >  net/bluetooth/l2cap_core.c    |   30 +++++++++++++-----------------
> >  net/bluetooth/l2cap_sock.c    |   12 ++++++++----
> >  3 files changed, 22 insertions(+), 22 deletions(-)
> 
> Acked-by: Marcel Holtmann <marcel@holtmann.org>

Applied to bluetooth-next.

Johan

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

end of thread, other threads:[~2012-04-12 11:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 23:15 [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Gustavo Padovan
2012-04-06 23:15 ` [PATCH 2/2] Bluetooth: rename parameter of alloc_skb Gustavo Padovan
2012-04-07 11:47   ` Marcel Holtmann
2012-04-07 11:44 ` [PATCH 1/2] Bluetooth: Remove err parameter from alloc_skb() Marcel Holtmann
2012-04-12 11:51   ` Johan Hedberg

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.