Re: usb driver - order of calling module init / probe

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

 



Greg KH <greg@...> writes:

> 
> On Wed, Feb 25, 2009 at 06:30:00AM +0000, Martin Willms wrote:
> > 
> > Hello,
> > 
> > I just saw something "unexpected" using our USB driver for our ADU-07 
> > measurement systems. We use a measurement hardware with Cypress EZ USB 
> > controller connected to an CPU board running an Linux system. As the EZ USB 
is 
> > soft booted, it is probed as Cypress device after power on. After software 
> > beeing downloaded to it it renumerates and probes as ADU-07.
> > 
> > So far so good. Now I had problems, if doing a warm start of the Linux 
system, 
> > not switching power off of the Cypress controller. In this case the Cypress 
> > controller would not renumerate as it does not change its VID/PID. As a 
result 
> > my USB driver did not work properly anymore.
> > 
> > After investigating this issue I found out, that the Linux kernel calls the 
> > probe function for the device before calling the init function of the 
module. 
> 
> That's impossible, how would the kernel know to call the probe function
> if it's not even registered yet?
> 
> Now the probe function can be called before the init function returns,
> right after usb_register_driver() is called, which is probably what
> happened here, right?  That's expected for devices that are already
> plugged in, and your driver should be able to handle it.
> 
> Do you have a pointer to your driver somewhere so that we can look at it
> to see if there are any other problems?
> 
> thanks,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@...
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

Hello,

Yes, you are right. usb_register is called right at the beginning of the init 
function. Afterwards I am doing my initialisations (allocating buffers, 
starting kernel thread, ...).

Is it OK to call the usb_register right at the end of the init function? In 
this case I would have to free up all allocated resources, if registering will 
fail, but I think that you are right that this will be the correct way to do 
this.

Up to now our driver is not part of the kernel. I am not shure, if it would 
help anyone as it only works with our devices. But maybe it would be a good 
idea to make it part of the new "scrap" tree of kernel modules. I will think 
about it.

thanks, 


Martin






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