* [PATCH] Bluetooth: Clean up l2cap_chan_connect
@ 2012-03-30 7:57 Andrei Emeltchenko
2012-03-30 8:54 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: Andrei Emeltchenko @ 2012-03-30 7:57 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Reduce number of arguments by two and in future by another one. All
those parameters are passed inside L2CAP sockaddr_l2 pointer.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/l2cap.h | 3 +--
net/bluetooth/l2cap_core.c | 5 ++++-
net/bluetooth/l2cap_sock.c | 3 +--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index f6f0500..c0f0b6d 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -909,8 +909,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
struct l2cap_chan *l2cap_chan_create(void);
void l2cap_chan_close(struct l2cap_chan *chan, int reason);
void l2cap_chan_destroy(struct l2cap_chan *chan);
-int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
- bdaddr_t *dst);
+int l2cap_chan_connect(struct l2cap_chan *chan, struct sockaddr_l2 *la);
int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
u32 priority);
void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3caff27..75bf88a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1131,10 +1131,13 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, bdaddr
return c1;
}
-int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdaddr_t *dst)
+int l2cap_chan_connect(struct l2cap_chan *chan, struct sockaddr_l2 *la)
{
struct sock *sk = chan->sk;
bdaddr_t *src = &bt_sk(sk)->src;
+ __le16 psm = la->l2_psm;
+ u16 cid = le16_to_cpu(la->l2_cid);
+ bdaddr_t *dst = &la->l2_bdaddr;
struct l2cap_conn *conn;
struct hci_conn *hcon;
struct hci_dev *hdev;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 1d3e9c3..085b4d3 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -123,8 +123,7 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
if (la.l2_cid && la.l2_psm)
return -EINVAL;
- err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
- &la.l2_bdaddr);
+ err = l2cap_chan_connect(chan, &la);
if (err)
return err;
--
1.7.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: Clean up l2cap_chan_connect
2012-03-30 7:57 [PATCH] Bluetooth: Clean up l2cap_chan_connect Andrei Emeltchenko
@ 2012-03-30 8:54 ` Marcel Holtmann
2012-03-30 10:18 ` Andrei Emeltchenko
2012-03-31 1:07 ` Gustavo Padovan
0 siblings, 2 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-03-30 8:54 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
Hi Andrei,
> Reduce number of arguments by two and in future by another one. All
> those parameters are passed inside L2CAP sockaddr_l2 pointer.
I am not sure that using sockaddr_l2 is a good idea. Are these socket
address structs used directly in other parts of the networking
subsystems anywhere?
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: Clean up l2cap_chan_connect
2012-03-30 8:54 ` Marcel Holtmann
@ 2012-03-30 10:18 ` Andrei Emeltchenko
2012-03-31 1:07 ` Gustavo Padovan
1 sibling, 0 replies; 4+ messages in thread
From: Andrei Emeltchenko @ 2012-03-30 10:18 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Fri, Mar 30, 2012 at 10:54:49AM +0200, Marcel Holtmann wrote:
> Hi Andrei,
>
> > Reduce number of arguments by two and in future by another one. All
> > those parameters are passed inside L2CAP sockaddr_l2 pointer.
>
> I am not sure that using sockaddr_l2 is a good idea. Are these socket
> address structs used directly in other parts of the networking
> subsystems anywhere?
Apparently not much.
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: Clean up l2cap_chan_connect
2012-03-30 8:54 ` Marcel Holtmann
2012-03-30 10:18 ` Andrei Emeltchenko
@ 2012-03-31 1:07 ` Gustavo Padovan
1 sibling, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2012-03-31 1:07 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Andrei Emeltchenko, linux-bluetooth
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2012-03-30 10:54:49 +0200]:
> Hi Andrei,
>
> > Reduce number of arguments by two and in future by another one. All
> > those parameters are passed inside L2CAP sockaddr_l2 pointer.
>
> I am not sure that using sockaddr_l2 is a good idea. Are these socket
> address structs used directly in other parts of the networking
> subsystems anywhere?
This code was using sockaddr_l2 before, I changed it in my separate core from
sock patches. If we are separating thing we won't want to have a sock related
struct there.
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-31 1:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-30 7:57 [PATCH] Bluetooth: Clean up l2cap_chan_connect Andrei Emeltchenko
2012-03-30 8:54 ` Marcel Holtmann
2012-03-30 10:18 ` Andrei Emeltchenko
2012-03-31 1:07 ` Gustavo Padovan
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.