From: Marcel Holtmann <marcel@holtmann.org>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFCv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout
Date: Tue, 09 Oct 2012 16:39:34 +0200 [thread overview]
Message-ID: <1349793574.27233.85.camel@aeonflux> (raw)
In-Reply-To: <1349707932-10006-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> When AMP_LINK timeouts execute HCI_OP_DISCONN_PHY_LINK as analog to
> HCI_OP_DISCONNECT for ACL_LINK.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_conn.c | 35 ++++++++++++++++++++++++++++++++---
> 1 file changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 53202f6..3584f58 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -130,6 +130,20 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
> hci_send_cmd(conn->hdev, HCI_OP_DISCONNECT, sizeof(cp), &cp);
> }
>
> +static void hci_amp_disconn(struct hci_conn *conn, __u8 reason)
> +{
> + struct hci_cp_disconn_phy_link cp;
> +
> + BT_DBG("hcon %p", conn);
> +
> + conn->state = BT_DISCONN;
> +
> + cp.phy_handle = (u8) conn->handle;
I rather not do this cast. Maybe having conn->phy_handle is cleaner or
some helper macro like HCI_PHY_HANDLE(conn->handle) or something. Or
just do conn->handle & 0xff.
> + cp.reason = reason;
> + hci_send_cmd(conn->hdev, HCI_OP_DISCONN_PHY_LINK,
> + sizeof(cp), &cp);
> +}
> +
> static void hci_add_sco(struct hci_conn *conn, __u16 handle)
> {
> struct hci_dev *hdev = conn->hdev;
> @@ -230,11 +244,27 @@ void hci_sco_setup(struct hci_conn *conn, __u8 status)
> }
> }
>
> +static void hci_conn_disconnect(struct hci_conn *conn)
> +{
> + u8 reason;
> +
> + reason = hci_proto_disconn_ind(conn);
Please keep using __u8 and in this case just make it one line.
__u8 reason = hci_proto_disconn_ind(conn);
> +
> + switch (conn->type) {
> + case ACL_LINK:
> + hci_acl_disconn(conn, reason);
> + break;
> +
Don't bother with this empty line.
> + case AMP_LINK:
> + hci_amp_disconn(conn, reason);
> + break;
> + }
> +}
> +
> static void hci_conn_timeout(struct work_struct *work)
> {
> struct hci_conn *conn = container_of(work, struct hci_conn,
> disc_work.work);
> - __u8 reason;
>
> BT_DBG("hcon %p state %s", conn, state_to_string(conn->state));
>
> @@ -253,8 +283,7 @@ static void hci_conn_timeout(struct work_struct *work)
> break;
> case BT_CONFIG:
> case BT_CONNECTED:
> - reason = hci_proto_disconn_ind(conn);
> - hci_acl_disconn(conn, reason);
> + hci_conn_disconnect(conn);
> break;
> default:
> conn->state = BT_CLOSED;
Regards
Marcel
next prev parent reply other threads:[~2012-10-09 14:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 14:52 [RFCv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-09 14:39 ` Marcel Holtmann [this message]
2012-10-08 14:52 ` [RFCv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-10-09 14:46 ` Marcel Holtmann
2012-10-10 8:34 ` Andrei Emeltchenko
2012-10-10 10:07 ` Marcel Holtmann
2012-10-10 10:12 ` Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 4/6] Bluetooth: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-09 14:49 ` Marcel Holtmann
2012-10-10 8:22 ` Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-08 14:52 ` [RFCv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 0/6] Handle AMP_LINK Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 1/6] Bluetooth: Allow to set flush timeout Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 2/6] Bluetooth: AMP: Handle AMP_LINK timeout Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 3/6] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 4/6] Bluetooth: AMP: Handle number of compl blocks for AMP_LINK Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 5/6] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-10-10 14:38 ` [PATCHv1 6/6] Bluetooth: AMP: Hanlde AMP_LINK case in conn_put Andrei Emeltchenko
2012-10-11 6:36 ` Gustavo Padovan
2012-10-10 15:28 ` [PATCHv1 0/6] Handle AMP_LINK Marcel Holtmann
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=1349793574.27233.85.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=Andrei.Emeltchenko.news@gmail.com \
--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