Re: [PATCH v1 0/1] Bluetooth: mgmt: Add helper function for Address Type

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

 



Hi Johan,

On Mon, Apr 16, 2012 at 2:49 PM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
> Hi Hemant,
>
> On Mon, Apr 16, 2012, Hemant Gupta wrote:
>> +static u8 mgmt_to_link(u8 link_type, u8 addr_type)
>> +{
>> +     switch (link_type) {
>> +     case LE_LINK:
>> +             switch (addr_type) {
>> +             case MGMT_ADDR_LE_PUBLIC:
>> +                     return ADDR_LE_DEV_PUBLIC;
>> +
>> +             default:
>> +                     /* Fallback to LE Random address type */
>> +                     return ADDR_LE_DEV_RANDOM;
>> +             }
>> +
>> +     default:
>> +             /* Fallback to BR/EDR type */
>> +             return ACL_LINK;
>> +     }
>> +}
>
> This isn't right. The mgmt address type includes all possible address
> types in it, i.e. the input to this function should be a single value
> and the output should be two separate values (just like link_to_mgmt has
> two inputs and one output).
>
> However, I'm not sure you even need this generic helper here since you
> only have a single user for it and it's restricted to LE only. If we get
> more users then we can consider it, but for now either do the conversion
> inline or do an LE specific helper:
>
> static u8 mgmt_to_le(u8 mgmt_type)
> {
>        switch (mgmt_type) {
>        case MGMT_ADDR_LE_PUBLIC:
>                return ADDR_LE_DEV_PUBLIC;
>        case MGMT_ADDR_LE_RANDOM:
>        default:
>                return ADDR_LE_DEV_RANDOM;
> }
>
Thanks for the comemnts, will send new patch shortly.
> 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



-- 
Best Regards
Hemant Gupta
ST-Ericsson India
--
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