Re: [PATCH] usb: dwc2: gadget: Update for new usb_endpoint_maxp()

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

 



Hi,

John Youn <John.Youn@xxxxxxxxxxxx> writes:
>>> @@ -1812,17 +1812,17 @@ static u32 dwc2_hsotg_ep0_mps(unsigned int mps)
>>>   * @hsotg: The driver state.
>>>   * @ep: The index number of the endpoint
>>>   * @mps: The maximum packet size in bytes
>>> + * @mc: The multicount value
>>>   *
>>>   * Configure the maximum packet size for the given endpoint, updating
>>>   * the hardware control registers to reflect this.
>>>   */
>>>  static void dwc2_hsotg_set_ep_maxpacket(struct dwc2_hsotg *hsotg,
>>> -			unsigned int ep, unsigned int mps, unsigned int dir_in)
>>> +					unsigned int ep, unsigned int mps,
>>> +					unsigned int mc, unsigned int dir_in)
>> 
>> this has an odd set of arguments. You pass the ep index, mps, direction
>> and mult value, when you could just pass hsotg_ep and descriptor instead.
>
> Yes looks like we can do some simplification here. And you probably
> don't need to pass a descriptor either since it must be set in the
> usb_ep before enable.
>
> However this is also called in some contexts where a descriptor is not
> available (initialization and ep0). So we have to think about this a
> bit.
>
> I think dwc3 can make similar simplification on the
> __dwc3_gadget_ep_enable().

__dwc3_gadget_ep_enable() takes the actual descriptors as arguments:

static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
		const struct usb_endpoint_descriptor *desc,
		const struct usb_ss_ep_comp_descriptor *comp_desc,
		bool modify, bool restore)

I fail to see how much simpler we can make this. Perhaps we can turn
bool and restore into a single argument if we use a bitfield instead of
a bool.

-- 
balbi
--
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