Re: [RFC] usb: gadget: libcomposite: provide usb_get_cdesc()

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

 



On 11/27/2014 11:09 AM, Andrzej Pietrasiewicz wrote:
> Hi Sebastian,

Hi Andrzej,

>> +struct usb_descriptor_header *usb_get_cdesc(struct
>> usb_descriptor_header **hdr,
>> +                         struct usb_descriptor_header *desc,
>> +                         struct usb_descriptor_header **c)
>> +{
>> +    unsigned off;
>> +
>> +    for (off = 0; hdr[off] && c[off]; off++) {
>> +        if (hdr[off] == desc)
>> +            break;
>> +    }
>> +    if (!hdr[off] || !c[off])
>> +        return NULL;
>> +    return c[off];
>> +}
>> +EXPORT_SYMBOL_GPL(usb_get_cdesc);
>> +
> 
> If usb_get_cdesc() is newly added _and_ EXPORTed, it is intended for
> use by other modules, and if that is the case, the other modules should
> probably be able to see its prototype for compilation, shouldn't they?

This is correct, the header is missing. However this is RFC and meant
to talk about it and to apply as-is. I pointed out a problem and two
possible solutions. One would a global mutex and making sure the
gadgets "reverts" critical members of the descriptor to its initial
state if required. The way would be to copy the descriptors (before
touching them) and "taking" the appropriate copy of the descriptor
using this function.

> 
> AP

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux