USB generic driver binding when new device plugged in - linux-kernel

I am trying to understand first sentence of the commit message.
It says, when a new device whose new driver is available in kernel is plugged in then the new drivers probe will be called but driver core will attach generic driver to the new device.
My question if the new driver probe called when new device plugged in then how this new device will be attached to the generic driver.
Can you guide me to understand this behavior in the kernel source.

Related

Does device driver works without calling probe function

Recently I was Trying to work with Qualcomm platform device. I was looking at Flow of touchscreen hbtp_input device driver, the driver is getting registered and calling init function but it doesn't call probe function.Does drivers work without probe functions?

How does USB core decides which HCI driver to use for a USB device driver?

I am looking into USB device driver code. looks like all it does is to fill a URB message then calls usb_submit_urb() to pass the message to USB core functions once probe() is called upon matching PCI vendor/product ID.
However I am not able to figure out how USB core relates the device driver to correct HCI driver (xHCI, eHCI etc.)... what I found is most of HCI drivers register themselves as a platform driver which has a unique name, is that the identifier for usb core to correlate the device driver and host driver?
When you have usb 3.0 - then kernel uses xhci driver and doesn't need uhci, ohci or ehci drivers. In such configuration you have got only one hci driver and one hci host. Earlier in the USB 2.0 era there were 2 possible configurations:
ehci with companion controller (ohci or uhci)
ehci with transaction translator (TT)
In the first situation you need to have both drivers installed - for example ehci and uhci. In the second one only dedicated ehci driver was needed.
So currently when you have only xhci - it registers itself as the only usb host driver in linux system. Second thing - it is host driver function to request anything from usb devices - so usb host generates any requests to devices and it is responsible for maintenance of the answers from device. The xhci host driver registers his interrupt and memory area for request maintenance.
I think you need to take a look at this problem from the host (xhci) point of view, not from device point of view, because the host is the master in usb communication and the host initiates any requests. Device is only answering those requests.

Linux device driver char device synchronization between unregister and release

I have a device driver with misc_register() API being called to create a serial device. Now, I want to call misc_deregister() because the device does not function any more due to hardware change (for example removal of cable of the serial port). Now the application has opened this device and performing operations on it, so there is an open file descriptor for this device.
I want to know if the driver wait for the application to call release (or close() API) on the device before calling misc_deregister()? Or can the driver call misc_deregister() and then it can still receive a (last) release callback?

How spi client driver is registered

I am new to Linux Device driver and trying to understand Linux device driver model which says a device must registered with its respected bus, be it the platform bus or real spi/i2c bus.
I could see the following macro which registered the i2c client device to its i2c bus.
module_i2c_driver(lm73_driver);
But I am not sure how it happen for a spi client device for example a CPLD/FPGA device sits on the spi bus.
Is such registrations based on the type of device?(block device or char device)

How the 1st PDO is created in case of toaster bus driver (virtual )in wdm?

I am very new in wdm , so as a beginner i started with toaster sample (virtual device). During studying this , I found there is a toaster device which is connected to its bus (toaster bus) and this bus(toaster bus) is attached to root bus ... now as a bus driver for its attached device(toaster bus) , root driver has responsibility to detect the device and create PDO and then PnP manager will extract information by this pdo like h/w id etc. But here since it is a virtual so we did it by add new h/w wizard prompt , so after the device installation I can find the h/w id and other attribute in registry but i m not able to see it after device installation ... Instead i found it after INF file loading (driver installation by manually).

Resources