Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)
In my Linux kernel, what does this probe() method, that this driver provides, do? How different is it from each driver's init function, i.e. why can't a probe() functions actions to be performed in this driver's init function?

1 Answer

0 votes
by (36.8k points)

Different device types can have the probe() functions. For example, PCI and USB devices both have the probe() functions.

If you're talking about the PCI devices, I would recommend you read chapter 12 of Linux Device Drivers, which covers this part of the driver initialization. USB topic is covered in the chapter-13.

The shorter answer, assuming the PCI: This driver's init function calls pci_register_driver() which gives a kernel the list of devices it is able to service, along with the pointer to a probe() function. The kernel then calls a driver's probe() function once for each device.

This probe function starts this per-device initialization: initializing hardware, allocating resources, and registering this device with this kernel as a block or network device or whatever it is.

That makes it easier for the device drivers because they never need to search for the devices or worry about finding the device that was hot-plugged. The kernel handles that part and notifies this right driver when it has the device for you to handle.

Come and join linux training to gain great knowledge.

Related questions

0 votes
1 answer
asked Nov 28, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer

Browse Categories

...