Re: UDC ep0 desc or no desc

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

 



Hi,

Benjamin Herrenschmidt <benh@xxxxxxxxxxx> writes:
> On Sat, 2018-06-23 at 11:07 -0400, Alan Stern wrote:
>> On Sat, 23 Jun 2018, Benjamin Herrenschmidt wrote:
>> 
>> > Hi folks !
>> > 
>> > I noticed some UDC drivers setup a "desc" pointer for ep0.desc for the
>> > driver, some don't.
>> > 
>> > Is it officially needed ?
>> 
>> No, it isn't.  The only "core" routine that requires a desc pointer in 
>> the endpoint structure is usb_ep_enable, and that routine explicitly 
>> says it may not be called for ep0.
>> 
>> > Additionally some UCDs NULL out the desc pointer in ep_disable, is that
>> > also a requirement ?
>> 
>> No.  A disabled endpoint doesn't have any requirements on its 
>> descriptor or lack thereof.
>> 
>> > I somewhat fear that if somebody calls stuff like usb_ep_align() on ep0
>> > it will crash without a valid desc pointer...
>> 
>> That would be a pretty strange thing to do.  I'd say it's not worth 
>> worrying about until somebody makes that mistake.
>
> Well, things like usb_endpoint_maxp() seem not *completely* far fetched
> but yeah EP0 is usually special enough that it should be ok. That said,
> I noticed some UDC drivers to setup a dummy desc there so I was
> wondering ...

dwc3 does that, but it's really just for convenience. It was easier to
have the descriptor and share the biggest part of the code for the code
of a tiny little descriptor data.

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