* Michal Nazarewicz | 2011-06-01 01:30:12 [+0200]: >>So if you call usb_gadget_probe_driver() at post init time and >>composite_bind() is __init then it points to the function which is >>already discarded. > >Yes, but that's a problem with the gadget. The point of the commit >was that >most of the gadget called usb_gadget_register() in __init but the structure >with callbacks (including bind) was not (and could not be) __initdata. To >fix a warning, gadgets would add __refdata to the structure. no, you could rename the struct, for instance from printer_driver to printer_ops if it was all about shutting up the warning :) >It is my understanding that if you call usb_gadget_probe_driver() in a >function that is not __init and pass a pointer to an __init bind callback, >you'll get a warning since the function references __init function. You get a warning because you _may_ reference discarded data becauses variable name ended with _driver. It behaves like driver why not move it to __devinit? Still, it is a false postive if it is ensure that the pointer is never reached. >So, if my understanding is correct, the commit was a correct >implementation and made sense. Feel free to correct me if I'm wrong. If I look back at it, it looks like platform_driver_probe(). I don't like it because breaks hotplug in general and and the win are few bytes. So where do we go with this? The udc-core currently requires the udc to be loaded before the gadget. The gadget will return with -ENODEV if this is not the case. The difference is that earlier the udc would be loaded automaticly due to required symbols. So we have load the udc driver first, followed by the gadget. Making possible to load them (udc & gadget) independently is nice I think. Having "bind" as argument and its code in __init makes it impossible. Also changing the gadget at runtime without rmmoding the gadget. So what do you think? >>If your only concern is section miss match I would let the warning >>pop-up and fix it by moving the "probe" function of the gadget into >>devinit. > >You cannot do that because FunctionFS requires the probe function to be >present at all times. __devinit is discarded only if hotplot is disabled. There is no need to mark everything __devinit or __init if the is required to remain during the driver's lifetime. Sebastian -- 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