From: Marcel Holtmann <marcel@holtmann.org>
To: "Frédéric Dalleau" <frederic.dalleau@linux.intel.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v3 1/5] Bluetooth: Move and rename hci_conn_accept
Date: Mon, 18 Feb 2013 23:58:03 +0100 [thread overview]
Message-ID: <1361228283.1583.42.camel@aeonflux> (raw)
In-Reply-To: <1359986188-24432-1-git-send-email-frederic.dalleau@linux.intel.com>
Hi Fred,
> Since this function is only used by sco, move it from hci_event.c to
> sco.c and rename to sco_conn_defer_accept.
>
> Signed-off-by: Frédéric Dalleau <frederic.dalleau@linux.intel.com>
> ---
> include/net/bluetooth/hci_core.h | 1 -
> net/bluetooth/hci_event.c | 36 ------------------------------------
> net/bluetooth/sco.c | 38 +++++++++++++++++++++++++++++++++++++-
> 3 files changed, 37 insertions(+), 38 deletions(-)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 90cf75a..f3be454 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -582,7 +582,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
> int hci_conn_del(struct hci_conn *conn);
> void hci_conn_hash_flush(struct hci_dev *hdev);
> void hci_conn_check_pending(struct hci_dev *hdev);
> -void hci_conn_accept(struct hci_conn *conn, int mask);
>
> struct hci_chan *hci_chan_create(struct hci_conn *conn);
> void hci_chan_del(struct hci_chan *chan);
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index d4fcba6..3fd0212 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2095,42 +2095,6 @@ unlock:
> hci_conn_check_pending(hdev);
> }
>
> -void hci_conn_accept(struct hci_conn *conn, int mask)
> -{
> - struct hci_dev *hdev = conn->hdev;
> -
> - BT_DBG("conn %p", conn);
> -
> - conn->state = BT_CONFIG;
> -
> - if (!lmp_esco_capable(hdev)) {
> - struct hci_cp_accept_conn_req cp;
> -
> - bacpy(&cp.bdaddr, &conn->dst);
> -
> - if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
> - cp.role = 0x00; /* Become master */
> - else
> - cp.role = 0x01; /* Remain slave */
> -
> - hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp);
> - } else /* lmp_esco_capable(hdev)) */ {
> - struct hci_cp_accept_sync_conn_req cp;
> -
> - bacpy(&cp.bdaddr, &conn->dst);
> - cp.pkt_type = cpu_to_le16(conn->pkt_type);
> -
> - cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> - cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> - cp.max_latency = __constant_cpu_to_le16(0xffff);
> - cp.content_format = cpu_to_le16(hdev->voice_setting);
> - cp.retrans_effort = 0xff;
> -
> - hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
> - sizeof(cp), &cp);
> - }
> -}
> -
> static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> struct hci_ev_conn_request *ev = (void *) skb->data;
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index e435641..97177be6 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -654,6 +654,42 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
> return err;
> }
>
> +static void sco_conn_defer_accept(struct hci_conn *conn, int mask)
> +{
> + struct hci_dev *hdev = conn->hdev;
> +
> + BT_DBG("conn %p", conn);
> +
> + conn->state = BT_CONFIG;
> +
> + if (!lmp_esco_capable(hdev)) {
> + struct hci_cp_accept_conn_req cp;
> +
> + bacpy(&cp.bdaddr, &conn->dst);
> +
> + if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
> + cp.role = 0x00; /* Become master */
> + else
> + cp.role = 0x01; /* Remain slave */
> +
> + hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp);
> + } else /* lmp_esco_capable(hdev)) */ {
I realize that you copied this, but just remove this pointless comment.
The if statement is less than 10 lines above, so no big deal.
> + struct hci_cp_accept_sync_conn_req cp;
> +
> + bacpy(&cp.bdaddr, &conn->dst);
> + cp.pkt_type = cpu_to_le16(conn->pkt_type);
> +
> + cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> + cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40);
> + cp.max_latency = __constant_cpu_to_le16(0xffff);
> + cp.content_format = cpu_to_le16(hdev->voice_setting);
> + cp.retrans_effort = 0xff;
> +
> + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
> + sizeof(cp), &cp);
> + }
> +}
> +
> static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
> struct msghdr *msg, size_t len, int flags)
> {
> @@ -664,7 +700,7 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
>
> if (sk->sk_state == BT_CONNECT2 &&
> test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
> - hci_conn_accept(pi->conn->hcon, 0);
> + sco_conn_defer_accept(pi->conn->hcon, 0);
> sk->sk_state = BT_CONFIG;
>
> release_sock(sk);
Regards
Marcel
prev parent reply other threads:[~2013-02-18 22:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 13:56 [PATCH v3 1/5] Bluetooth: Move and rename hci_conn_accept Frédéric Dalleau
2013-02-04 13:56 ` [PATCH v3 2/5] Bluetooth: Add option for SCO socket mode Frédéric Dalleau
2013-02-18 23:14 ` Marcel Holtmann
2013-03-13 13:24 ` Dalleau, Frederic
2013-03-13 16:26 ` Marcel Holtmann
2013-03-13 17:02 ` Dalleau, Frederic
2013-02-04 13:56 ` [PATCH v3 3/5] Bluetooth: Use mode to create SCO connection Frédéric Dalleau
2013-02-04 13:56 ` [PATCH v3 4/5] Bluetooth: Parameters for outgoing SCO connections Frédéric Dalleau
2013-02-18 23:18 ` Marcel Holtmann
2013-02-04 13:56 ` [PATCH v3 5/5] Bluetooth: Fallback transparent SCO from T2 to T1 Frédéric Dalleau
2013-02-18 23:22 ` Marcel Holtmann
2013-02-18 22:58 ` Marcel Holtmann [this message]
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=1361228283.1583.42.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=frederic.dalleau@linux.intel.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