RE: Forward porting of the USB Driver Controller from 2.6.34.10 to 3.2.11

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

 



On Wed, 21 Mar 2012, Stojsavljevic, Zoran wrote:

> > > Some pointer went dangling around (with address udc_driver), probably!?
> >
> > It looks like your UDC's probe routine forgot to call
> > device_register(&gadget->dev) before passing the gadget structure to usb_add_gadget_udc().
> >
> > Can you post the source to your probe routine?
> >
> > Alan Stern
> 
> Experience speaks for itself! U R right. But it is not the only trouble this code has.
> 
> I can now register the gadget driver (g_zero for example), but could not unregister (it is crashing)!
> 
> In other words, modprobe works without problems, rmmod crashes. Here is the max_udc_remove() code:
> _______
> 
> /**
> * max_udc_remove - removes the udc device driver                                                                                                                                                                                   
>  * @_dev: platform device                                                                                                                                                                                                           
>  */
> static int __exit max_udc_remove(struct platform_device *_dev)
> {
>         struct max_udc *udc = platform_get_drvdata(_dev);
> 
>         usb_del_gadget_udc(&udc->gadget);
> 
>         BUG_ON(udc->driver);
> 
>         udc_disable(udc);
> 
>         usb_gadget_unregister_driver(udc->driver);

This line does not belong here.  usb_del_gadget_udc essentially does it 
for you.  If you prefer, you could put this line in place of the 
usb_del_gadget_udc call.

> 
> #if CONFIG_MAX_IRQ_SUPPORT
>         free_irq(udc->irq, udc);
> #endif
> 
>         max_cleanup_debugfs(udc);
> 
>         if (udc->spibar)
>                 iounmap(udc->spibar);
> 

You forgot to call device_unregister(&udc->gadget.dev).

>         platform_set_drvdata(_dev, NULL);
> 
>         dev_info (udc->dev, "unbind\n");
> 
>         return 0;
> }
> 
> I dug much deeper (making analogy with net2280 UDC), and I am not sure that what we have for now is entirely correct.
> 
> Let me try to think if I need to rewrite some of the things/interfaces...
> 
> I very much appreciate your help.
> 
> Thank you!

You're welcome.

Alan Stern

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