Hi, Greg KH <greg@xxxxxxxxx> writes: >> Here's what we have for most UDCs (net2280.c included): >> >> struct my_udc { >> struct gadget gadget; >> [...] >> }; >> >> probe() >> { >> struct my_udc *u; >> >> u = kzalloc(sizeof(*u), GFP_KERNEL); >> [...] >> return 0; >> } >> >> Now, if this kzalloc() would be replaced with devm_kzalloc() wouldn't >> this result on a functionally equivalent execution to the patch I >> proposed above? >> >> Iff we change struct gadget to contain a struct device *dev instead of a >> struct device dev, then sure, we will need to cope with proper >> ->release() implementations. >> >> As it is, it brings nothing to the table, IMO. > > You always have to have a release function for a kobject, no matter > where it is, as it is being reference counted. To not do so, is a huge > indication of a problem in the design. okay, this goes all the way back to when Dave B wrote the API, it has always had empty ->release() functions (not all UDCs, though). I'll make sure to review all of this for v4.13. -- balbi
Attachment:
signature.asc
Description: PGP signature