From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: Re: [RFC 12/16] Bluetooth: Use abstract chan->data in comparison
Date: Wed, 12 Dec 2012 10:20:11 +0200 [thread overview]
Message-ID: <20121212082009.GA7034@aemeltch-MOBL1> (raw)
In-Reply-To: <1355285624-25811-13-git-send-email-gustavo@padovan.org>
Hi Gustavo,
On Wed, Dec 12, 2012 at 02:13:40AM -0200, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> If the L2CAP user is l2cap_sock.c chan->data is a pointer to the l2cap
> socket so chan->sk and chan->data are the same thing. Then we can just
> compare with chan->data instead.
>
> Non-socket users will have skb->sk = NULL, thus this change does not
> interfere in other users.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> net/bluetooth/l2cap_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 934ac1b..92936db 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -2682,12 +2682,11 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
> mutex_lock(&conn->chan_lock);
>
> list_for_each_entry(chan, &conn->chan_l, list) {
> - struct sock *sk = chan->sk;
> if (chan->chan_type != L2CAP_CHAN_RAW)
> continue;
>
> /* Don't send frame to the socket it came from */
> - if (skb->sk == sk)
> + if (skb->sk && skb->sk == chan->data)
In the other patch you delete chan->sk pointer and then we have only
chan->data which points to sk. What is the reason for that? This would
confuse people reading chan->data guessing what the hell is this.
I really think we can leave chan->sk if it is needed and it is better to
remove chan->data.
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2012-12-12 8:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 4:13 [RFC 00/16] Completely remove socket dependency from l2cap_core.c Gustavo Padovan
2012-12-12 4:13 ` [RFC 01/16] Bluetooth: Add src and dst info to struct l2cap_chan Gustavo Padovan
2012-12-12 4:13 ` [RFC 02/16] Bluetooth: Remove sk_sndtimeo from l2cap_core.c Gustavo Padovan
2012-12-12 4:13 ` [RFC 03/16] Bluetooth: extend state_change() call to report errors too Gustavo Padovan
2012-12-12 13:25 ` Anderson Lizardo
2012-12-12 4:13 ` [RFC 04/16] Bluetooth: add l2cap_state_change_and_error() Gustavo Padovan
2012-12-12 13:40 ` Anderson Lizardo
2012-12-12 19:26 ` Gustavo Padovan
2012-12-12 4:13 ` [RFC 05/16] Bluetooth: Add missing braces to an "else if" Gustavo Padovan
2012-12-12 4:13 ` [RFC 06/16] Bluetooth: use l2cap_chan_ready() instead of duplicate code Gustavo Padovan
2012-12-12 4:13 ` [RFC 07/16] Bluetooth: duplicate DEFER_SETUP flag on l2cap_chan Gustavo Padovan
2012-12-12 4:13 ` [RFC 08/16] Bluetooth: Improving locking in l2cap_conn_start() Gustavo Padovan
2012-12-12 4:13 ` [RFC 09/16] Bluetooth: lock socket in defer_cb call Gustavo Padovan
2012-12-12 4:13 ` [RFC 10/16] Bluetooth: Remove socket lock from state_change() in l2cap_core Gustavo Padovan
2012-12-12 4:13 ` [RFC 11/16] Bluetooth: remove parent socket usage from l2cap_core.c Gustavo Padovan
2012-12-12 4:13 ` [RFC 12/16] Bluetooth: Use abstract chan->data in comparison Gustavo Padovan
2012-12-12 8:20 ` Andrei Emeltchenko [this message]
2012-12-12 19:57 ` Gustavo Padovan
2012-12-12 4:13 ` [RFC 13/16] Bluetooth: Move l2cap_wait_ack() to l2cap_sock.c Gustavo Padovan
2012-12-12 4:13 ` [RFC 14/16] Bluetooth: Create l2cap->ops->resume() Gustavo Padovan
2012-12-12 4:13 ` [RFC 15/16] Bluetooth: Create l2cap->ops->set_shutdown() Gustavo Padovan
2012-12-12 4:13 ` [RFC 16/16] Bluetooth: Remove sk member from struct l2cap_chan Gustavo Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121212082009.GA7034@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=gustavo.padovan@collabora.co.uk \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).