From: Mat Martineau <mathewm@codeaurora.org>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 3/6] Bluetooth: add close() callback to l2cap_chan_ops
Date: Thu, 2 Jun 2011 14:30:41 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1106021412530.3205@mathewm-linux> (raw)
In-Reply-To: <1307031329-8001-3-git-send-email-padovan@profusion.mobi>
Hi Gustavo -
On Thu, 2 Jun 2011, Gustavo F. Padovan wrote:
> close() calls l2cap_sock_kill() on l2cap_sock.c
>
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
> include/net/bluetooth/l2cap.h | 3 +--
> net/bluetooth/l2cap_core.c | 17 +++++++++--------
> net/bluetooth/l2cap_sock.c | 10 +++++++++-
> 3 files changed, 19 insertions(+), 11 deletions(-)
<snip>
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -679,7 +679,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms
> /* Kill socket (only if zapped and orphan)
> * Must be called on unlocked socket.
> */
> -void l2cap_sock_kill(struct sock *sk)
> +static void l2cap_sock_kill(struct sock *sk)
> {
> if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
> return;
> @@ -762,10 +762,18 @@ static int l2cap_chan_recv_cb(void *data, struct sk_buff *skb)
> return sock_queue_rcv_skb(sk, skb);
> }
>
> +static void l2cap_chan_close_cb(void *data)
> +{
> + struct sock *sk = data;
> +
> + l2cap_sock_kill(sk);
> +}
> +
> static struct l2cap_ops l2cap_chan_ops = {
> .name = "L2CAP Socket Interface",
> .new_connection = l2cap_chan_new_connection_cb,
> .recv = l2cap_chan_recv_cb,
> + .close = l2cap_chan_close_cb,
> };
>
> static void l2cap_sock_destruct(struct sock *sk)
It looks like we'll have l2cap_ops for sock, rfcomm, and AMP's A2MP
channel -- so I would suggest using unique names for the callbacks for
each of those modules:
l2cap_sock_new_connection_cb
l2cap_sock_recv_cb
l2cap_sock_close_cb
l2cap_a2mp_new_connection_cb
l2cap_a2mp_recv_cb
l2cap_a2mp_close_cb
etc., instead of "l2cap_chan_*_cb"
Even though the functions are (or will be) static within their
respective files, it will be less confusing if their names tie them
to the specific module.
I hope you can check these in to bluetooth-next soon, it would help
with the patch set I'm working on.
Regards,
--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
next prev parent reply other threads:[~2011-06-02 21:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-02 16:15 [PATCH 1/6] Bluetooth: Add l2cap_chan_ops abstraction Gustavo F. Padovan
2011-06-02 16:15 ` [PATCH 2/6] Bluetooth: add recv() callback to l2cap_chan_ops Gustavo F. Padovan
2011-06-02 16:15 ` [PATCH 3/6] Bluetooth: add close() " Gustavo F. Padovan
2011-06-02 16:15 ` [PATCH 4/6] Bluetooth: Add refcnt to struct l2cap_chan Gustavo F. Padovan
2011-06-02 16:15 ` [PATCH 5/6] Bluetooth: Make timer functions generic Gustavo F. Padovan
2011-06-02 16:15 ` [PATCH 6/6] Bluetooth: keep reference if any ERTM timer is enabled Gustavo F. Padovan
2011-06-02 21:30 ` Mat Martineau [this message]
2011-06-02 21:50 ` [PATCH 3/6] Bluetooth: add close() callback to l2cap_chan_ops Gustavo F. 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=alpine.DEB.2.02.1106021412530.3205@mathewm-linux \
--to=mathewm@codeaurora.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=padovan@profusion.mobi \
/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).