On 27 June 2011 15:44, Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote: > * Jassi Brar | 2011-06-25 01:34:11 [+0530]: > >> Currently there is no way for a gadget driver to save pointer to resources >>(which may be common to more than one function) that it allocates during >> config bind. >> >> Even single-function configurations have to free such data in function's >>unbind callback. Which isn't very correct, because we have a situation where >>call to a structure's member callback frees the space occupied by parent >>structure. > > Is it causing any harm somewhere? If so could you describe it / post an > example? > No harm yet. But it is the right way to go, IMHO. As I said, freeing resources in function-unbind that were allocated in config-bind isn't very neat. Ok, let me dig deeper... The definition of 'struct usb_function' specifies @unbind: Reverses @bind; called as a side effect of unregistering the driver which added this function. whereas currently it also un-does the config-bind - though it's not a problem because it is usually a simple matter of kfree(gadget_structure) b) Say if a configuration needs to have more than one function(composite device) that share a common resource. We don't have a place to free such a resource as the current situation is. That is without saving local static pointers during config-bind. I admit this scenario is a bit futuristic, but so is preparing for need to have multiple UDC drivers compiled in single kernel image :) >> Patch-1 adds a new hook to 'struct usb_configuration' >> Patch-2,3 converts Zero and Webcam gadget drivers for a start. >> >> Other gadgets could be converted(though not necessary) as and when >>interest arise. > > It would be nice to have consistent behaviour across a subsystem. Of course, I just wasn't sure if nobody would suggest 'Why bother if all is ok?' So I converted only two drivers as examples atm. Thanks, Jassi -- Linaro.org │ Open source software for ARM SoCs | Follow Linaro http://facebook.com/pages/Linaro/155974581091106 - http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog -- 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