Re: [PATCH v2 06/13] Bluetooth: Use HCI request in interleaved discovery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Johan,

On Tue, Apr 30, 2013 at 5:34 AM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
> Hi Andre,
>
> On Tue, Apr 30, 2013, Andre Guedes wrote:
>> +     case DISCOV_TYPE_INTERLEAVED:
>> +             hci_dev_lock(hdev);
>> +             hci_inquiry_cache_flush(hdev);
>> +             hci_dev_unlock(hdev);
>> +
>> +             hci_req_init(&req, hdev);
>> +
>> +             memset(&cp, 0, sizeof(cp));
>> +             memcpy(&cp.lap, lap, sizeof(cp.lap));
>> +             cp.length = DISCOV_INTERLEAVED_INQUIRY_LEN;
>> +             hci_req_add(&req, HCI_OP_INQUIRY, sizeof(cp), &cp);
>> +
>> +             err = hci_req_run(&req, inquiry_complete);
>> +             if (err) {
>> +                     BT_ERR("Inquiry request failed: err %d", err);
>> +                     hci_dev_lock(hdev);
>> +                     hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
>> +                     hci_dev_unlock(hdev);
>> +             }
>> +             break;
>
> The locking here seems a bit needlessly fine grained. I know hci_req_run
> doesn't strictly speaking need the hdev lock but you could simplify this
> a bit by moving the inquiry cache flush right before hci_req_run and
> doing
>
>         hci_dev_lock(hdev);
>
>         hci_inquiry_cache_flush(hdev);
>
>         err = hci_req_run(..);
>         if (err) {
>                 ...
>         }
>
>         hci_dev_unlock(hdev);

Ok, I'll change this.

Regards,

Andre
--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux