Re: [PATCH] usb: gadget: hid: Fix static variable usage

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

 



On Thu, Mar 26, 2015 at 7:51 PM, Sergei Shtylyov
<sergei.shtylyov@xxxxxxxxxxxxxxxxxx> wrote:
> Hello.
>
> On 03/26/2015 06:03 PM, Krzysztof Opasiak wrote:
>
>> If we have multiple instances of hid function, each of
>> them may have different report descriptor, also their
>> length may be different.
>
>
>> Currently we are using static hidg_desc varable which
>> is being filled in hidg_bind(). Then we send its content
>> to host in hidg_setup() function. This content may
>> have been already overwriten if another instance
>> has executed hidg_bind().
>
>
>> Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
>> ---
>>   drivers/usb/gadget/function/f_hid.c | 13 +++++++++++--
>>   1 file changed, 11 insertions(+), 2 deletions(-)
>
>
>> diff --git a/drivers/usb/gadget/function/f_hid.c
>> b/drivers/usb/gadget/function/f_hid.c
>> index a2612fb..e3fb9ec 100644
>> --- a/drivers/usb/gadget/function/f_hid.c
>> +++ b/drivers/usb/gadget/function/f_hid.c
>
> [...]
>>
>> @@ -632,6 +639,8 @@ static int hidg_bind(struct usb_configuration *c,
>> struct usb_function *f)
>>         hidg_fs_in_ep_desc.wMaxPacketSize =
>> cpu_to_le16(hidg->report_length);
>>         hidg_hs_out_ep_desc.wMaxPacketSize =
>> cpu_to_le16(hidg->report_length);
>>         hidg_fs_out_ep_desc.wMaxPacketSize =
>> cpu_to_le16(hidg->report_length);
>> +       /* We can use hidg_desc struct here but we should not relay
>> +          that its content won't change after returning */
>
>
>    The preferred multi-line comment style is:
>
> /*
>  * bla
>  * bla
>  */
>

I have fixed this in v2, thank you for this remark.

Best regards,
Krzysztof Opasiak
--
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