On 07/28/2015 11:30 AM, Daniel Mack wrote:
> On 07/28/2015 03:38 AM, Peter Chen wrote:
>> +static void set_ep_max_packet_size (struct f_uac2_opts *uac2_opts,
>> +    struct usb_endpoint_descriptor *ep_desc, unsigned int factor)
>> +{
>> +    int chmask;
>> +    int srate;
>> +    int ssize;
>> +    u16 max_packet_size;
>> +
>> +    if (ep_desc == &fs_epin_desc || ep_desc == &hs_epin_desc) {
>> +            chmask = uac2_opts->p_chmask;   
>> +            srate = uac2_opts->p_srate;
>> +            ssize = uac2_opts->p_ssize;
>> +    } else {
>> +            WARN_ON (ep_desc != &fs_epout_desc && ep_desc != 
>> &hs_epout_desc);
>> +            chmask = uac2_opts->c_chmask;
>> +            srate = uac2_opts->c_srate;
>> +            ssize = uac2_opts->c_ssize;
>> +    }
>> +
>> +    max_packet_size = num_channels(chmask) * ssize *
>> +            DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)));
>> +    ep_desc->wMaxPacketSize = min(cpu_to_le16(max_packet_size),
>> +                            ep_desc->wMaxPacketSize);
>> +}
> 
> Thinking about it again, it would probably be nicer to make this
> function return wMaxPacketSize directly:

Ah, no, that doesn't make sense, sorry. We need bInterval and the
current value of wMaxPacketSize as well. Just stick with your current
approach then :)


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

Reply via email to