RE: gadget: f_fs: Accept up to 30 endpoints.

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

 



Hi,

David Laight <David.Laight@xxxxxxxxxx> writes:
> From: Of Vincent Pelletier
>> Sent: 23 January 2017 14:41
>> It is allowed by the USB specification to enabled same-address, opposite-
>> direction endpoints simultaneously, which means 30 non-zero endpoints
>> are allowed. So double eps_addrmap length to 30.
>> The original code only accepted 14 descriptors out of a likely intended 15
>> (as there are 15 endpoint addresses, ignoring direction), because the first
>> eps_addrmap entry is unused (it is a placeholder for endpoint zero). So
>> increase eps_addrmap length by one to 31.
>> 
>> Signed-off-by: Vincent Pelletier <plr.vincent@xxxxxxxxx>
>> ---
>>  drivers/usb/gadget/function/f_fs.c | 2 +-
>>  drivers/usb/gadget/function/u_fs.h | 3 ++-
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
>> index 5c91a6f4613b..c46666364c87 100644
>> --- a/drivers/usb/gadget/function/f_fs.c
>> +++ b/drivers/usb/gadget/function/f_fs.c
>> @@ -2101,7 +2101,7 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
>>  	case FFS_ENDPOINT:
>>  		d = (void *)desc;
>>  		helper->eps_count++;
>> -		if (helper->eps_count >= 15)
>> +		if (helper->eps_count >= FFS_MAX_EPS_COUNT)
>
> Use ARRAY_COUNT(helper->eps_addrmap)

what's the benefit here? We have a macro that defines the size of the
array. ARRAY_SIZE() is useful when we don't know the size of the array
ahead of time ;-)

-- 
balbi

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux