From: Johan Hedberg <johan.hedberg@gmail.com>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC v11 01/15] Bluetooth: Create hci_req_add_le_scan_disable helper
Date: Tue, 25 Feb 2014 07:57:17 +0200 [thread overview]
Message-ID: <20140225055717.GA776@localhost.P-661HNU-F1> (raw)
In-Reply-To: <1393281061-14320-2-git-send-email-andre.guedes@openbossa.org>
Hi Andre,
On Mon, Feb 24, 2014, Andre Guedes wrote:
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -1128,6 +1128,7 @@ void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
> void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
> const void *param, u8 event);
> void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
> +void hci_req_add_le_scan_disable(struct hci_request *req);
It doesn't feel right to put this straight next to the generic async
request API. I'd at least have an empty line between the generic API and
this new function.
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -3318,7 +3318,6 @@ static void le_scan_disable_work(struct work_struct *work)
> {
> struct hci_dev *hdev = container_of(work, struct hci_dev,
> le_scan_disable.work);
> - struct hci_cp_le_set_scan_enable cp;
> struct hci_request req;
> int err;
>
> @@ -3326,9 +3325,7 @@ static void le_scan_disable_work(struct work_struct *work)
>
> hci_req_init(&req, hdev);
>
> - memset(&cp, 0, sizeof(cp));
> - cp.enable = LE_SCAN_DISABLE;
> - hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> + hci_req_add_le_scan_disable(&req);
>
> err = hci_req_run(&req, le_scan_disable_work_complete);
> if (err)
> @@ -4872,3 +4869,12 @@ static void hci_cmd_work(struct work_struct *work)
> }
> }
> }
> +
> +void hci_req_add_le_scan_disable(struct hci_request *req)
> +{
> + struct hci_cp_le_set_scan_enable cp;
> +
> + memset(&cp, 0, sizeof(cp));
> + cp.enable = LE_SCAN_DISABLE;
> + hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> +}
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 25b8b27..c722914 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3526,7 +3526,6 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
> struct hci_cp_remote_name_req_cancel cp;
> struct inquiry_entry *e;
> struct hci_request req;
> - struct hci_cp_le_set_scan_enable enable_cp;
> int err;
>
> BT_DBG("%s", hdev->name);
> @@ -3562,10 +3561,7 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
> } else {
> cancel_delayed_work(&hdev->le_scan_disable);
>
> - memset(&enable_cp, 0, sizeof(enable_cp));
> - enable_cp.enable = LE_SCAN_DISABLE;
> - hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE,
> - sizeof(enable_cp), &enable_cp);
> + hci_req_add_le_scan_disable(&req);
> }
>
> break;
You've missed one place in clean_up_hci_state() in mgmt.c (which was
added by the recent "graceful power down" patch set.
Johan
next prev parent reply other threads:[~2014-02-25 5:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-24 22:30 [RFC v11 00/15] LE auto connection Andre Guedes
2014-02-24 22:30 ` [RFC v11 01/15] Bluetooth: Create hci_req_add_le_scan_disable helper Andre Guedes
2014-02-25 5:57 ` Johan Hedberg [this message]
2014-02-25 17:16 ` Andre Guedes
2014-02-24 22:30 ` [RFC v11 02/15] Bluetooth: Declare le_conn_failed in hci_core.h Andre Guedes
2014-02-24 22:30 ` [RFC v11 03/15] Bluetooth: Stop scanning on LE connection Andre Guedes
2014-02-24 22:30 ` [RFC v11 04/15] Bluetooth: Remove unused function Andre Guedes
2014-02-24 22:30 ` [RFC v11 05/15] Bluetooth: Introduce hdev->pend_le_conn list Andre Guedes
2014-02-24 22:30 ` [RFC v11 06/15] Bluetooth: Introduce LE auto connection infrastructure Andre Guedes
2014-02-25 4:23 ` Johan Hedberg
2014-02-25 17:16 ` Andre Guedes
2014-02-25 17:43 ` Marcel Holtmann
2014-02-24 22:30 ` [RFC v11 07/15] Bluetooth: Introduce LE auto connect options Andre Guedes
2014-02-24 22:30 ` [RFC v11 08/15] Bluetooth: Connection parameters and auto connection Andre Guedes
2014-02-24 22:30 ` [RFC v11 09/15] Bluetooth: Temporarily stop background scanning on discovery Andre Guedes
2014-02-24 22:30 ` [RFC v11 10/15] Bluetooth: Auto connection and power on Andre Guedes
2014-02-24 22:30 ` [RFC v11 11/15] Bluetooth: Connection parameters and resolvable address Andre Guedes
2014-02-24 22:30 ` [RFC v11 12/15] Bluetooth: Support resolvable private addresses Andre Guedes
2014-02-24 22:30 ` [RFC v11 13/15] Bluetooth: Add le_auto_conn file on debugfs Andre Guedes
2014-02-24 22:31 ` [RFC v11 14/15] Bluetooth: Create hci_req_add_le_passive_scan helper Andre Guedes
2014-02-24 22:31 ` [RFC v11 15/15] Bluetooth: Update background scan parameters Andre Guedes
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=20140225055717.GA776@localhost.P-661HNU-F1 \
--to=johan.hedberg@gmail.com \
--cc=andre.guedes@openbossa.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