Re: [PATCH v4] Bluetooth: Defer connection-parameter removal when unpairing

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

 



Hi Marcel,

>>       if (cp->addr.type == BDADDR_BREDR) {
>> +             if (cp->disconnect)
>> +                     conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK,
>> +                                                    &cp->addr.bdaddr);
>> +             else
>> +                     conn = NULL; /* Avoid disconnecting later on*/
>> +
>
> I do not think this is a comment style that is valid in the network subsystem coding style and even if it is valid, it would be pretty unusual.

Excuse my ignorance, but Where is the network subsystem coding style
documented? I haven't been able to find it.

> Generally I would do comment on the whole code. So something like this:
>         /* When disconnect of the the connection is requested,
>          * then look up the connection. If the remote device is
>          * connected, it will be later used to terminate the
>          * link.
>          *
>          * Setting it to NULL explicitly will cause no
>          * termination of the link.
>          */
>         if (cp->disconnect)
>                 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK,
>                                                &cp->addr.bdaddr);
>         else
>                 conn = NULL;
>
>>               err = hci_remove_link_key(hdev, &cp->addr.bdaddr);
>>       } else {
>>               u8 addr_type;
>>
>> +             conn = hci_conn_hash_lookup_ba(hdev, LE_LINK,
>> +                                            &cp->addr.bdaddr);
>> +             if (conn) {
>> +                     /* Defer clearing up the connection parameters
>> +                      * until closing to give a chance of keeping
>> +                      * them if a repairing happens.
>> +                      */
>> +                     set_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags);
>> +
>> +                     if (!cp->disconnect)
>> +                             conn = NULL; /* Avoid disconnecting later on*/
>
> And here I would do this:
>
>                 /* If disconnection is not requested, then clear the
>                  * connection variable so that that the link is not
>                  * terminated.
>                  */
>                 if (!cp->disconnect)
>                         conn = NULL;

Thanks, I submitted V5 to correct this.



-- 
Alfonso Acosta

Embedded Systems Engineer at Spotify
Birger Jarlsgatan 61, Stockholm, Sweden
http://www.spotify.com
--
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