Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does the probe function for a Linux kernel driver gets called?

I am trying to update a kernel driver for Android, I have added some printk's to debug it, the _init function is invoked, but the probe function is not. What I am missing ? When/how is the probe function invoked ?

The code is available at: https://github.com/lamegopinto/kernel-2.6.32.27-M722HC/blob/master/drivers/power/rk2918_battery.c

like image 629
João Pinto Avatar asked Feb 06 '12 23:02

João Pinto


People also ask

What is probe function in Linux driver?

The probe routine specifies a physical device ID as a device node property so that the bus driver can find the appropriate device driver for this device node.

What is probe in Linux kernel?

Kernel probes are a set of tools to collect Linux kernel debugging and performance information. Developers and system administrators usually use them either to debug the kernel, or to find system performance bottlenecks. The reported data can then be used to tune the system for better performance.

How does a kernel call a device driver?

The kernel calls device drivers during system initialization to determine which devices are available and to initialize those devices. System calls from user processes. The kernel calls a device driver to perform I/O operations on the device such as open(2), read(2), and ioctl(2). User-level requests.

How do Linux kernel drivers work?

The Linux kernel device drivers are, essentially, a shared library of privileged, memory resident, low level hardware handling routines. It is Linux's device drivers that handle the peculiarities of the devices they are managing. One of the basic features of is that it abstracts the handling of devices.


1 Answers

Found the answer after some research, For a "platform" device the probe function is invoked when a platform device is registered and it's device name matchs the name specified on the device driver.

More details here: http://comments.gmane.org/gmane.linux.kernel.kernelnewbies/37050

Now I just need to figure why the device is not being registered :\

like image 179
João Pinto Avatar answered Nov 03 '22 00:11

João Pinto