Hi Jakub, On Sat, Nov 22, 2014, Jakub Pawlowski wrote: > Currently there is no way to restart le scan. It's needed in > preparation for new service scan method. The way it work: it disable, > and then enable le scan on controller. During this restart special flag > is set to make sure we won't remove disable scan work from workqueue. > > Signed-off-by: Jakub Pawlowski <jpawlowski@xxxxxxxxxx> > --- > include/net/bluetooth/hci.h | 1 + > include/net/bluetooth/hci_core.h | 3 +++ > net/bluetooth/hci_core.c | 43 ++++++++++++++++++++++++++++++++++++++++ > net/bluetooth/hci_event.c | 9 ++++++--- > 4 files changed, 53 insertions(+), 3 deletions(-) > > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h > index e56f909..2f0bce2 100644 > --- a/include/net/bluetooth/hci.h > +++ b/include/net/bluetooth/hci.h > @@ -203,6 +203,7 @@ enum { > HCI_FAST_CONNECTABLE, > HCI_BREDR_ENABLED, > HCI_LE_SCAN_INTERRUPTED, > + HCI_LE_SCAN_RESTARTING, > }; This should break 32-bit systems since we already have 32 flags for hdev->dev flags. The same goes for the HCI_SERVICE_FILTER you add in a later patch. One solution that comes to mind is to extend the discovery struct with its own unsigned long flags field - at least the second flag you're adding doesn't really belong in dev_flags anyway. > +static void le_scan_restart_work(struct work_struct *work) > +{ > + struct hci_dev *hdev = container_of(work, struct hci_dev, > + le_scan_restart.work); > + struct hci_request req; > + struct hci_cp_le_set_scan_enable cp; > + int err; > + > + BT_DBG("%s", hdev->name); > + > + hci_req_init(&req, hdev); > + > + hci_req_add_le_scan_disable(&req); > + > + memset(&cp, 0, sizeof(cp)); > + cp.enable = LE_SCAN_ENABLE; > + hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); > + > + set_bit(HCI_LE_SCAN_RESTARTING, &hdev->dev_flags); > + > + err = hci_req_run(&req, le_scan_restart_work_complete); > + if (err) > + BT_ERR("Disable LE scanning request failed: err %d", err); > +} Shouldn't you be checking the value of HCI_LE_SCAN before adding any HCI commands to the request (after all this function gets called with a delay and the state may have changed). Shouldn't the error log talk about restarting instead of disabling? Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html