Who calls the probe() of driver

Long story short: the probe() function of the driver is called as a result of calling the register_driver for that specific bus. More precisely, it’s called by the probe() of that bus_type structure. In your case: i2c_bus_type. Here’s the call chain in your I2C case: i2c_register_driver driver_register bus_add_driver driver_attach __driver_attach (for your device) driver_probe_device really_probe … Read more

What is the difference between a Linux platform driver and normal device driver?

Your references are good but lack a definition of what is a platform device. There is one on LWN. What we can learn from this page: Platform devices are inherently not discoverable, i.e. the hardware cannot say “Hey! I’m present!” to the software. Typical examples are i2c devices, kernel/Documentation/i2c/instantiating-devices states: Unlike PCI or USB devices, … Read more

How does the linux kernel manage less than 1GB physical memory?

Not all virtual (linear) addresses must be mapped to anything. If the code accesses unmapped page, the page fault is risen. The physical page can be mapped to several virtual addresses simultaneously. In the 4 GB virtual memory there are 2 sections: 0x0… 0xbfffffff – is process virtual memory and 0xc0000000 .. 0xffffffff is a … Read more

How to use netlink socket to communicate with a kernel module?

After reading kernel source I finally managed to make netlink sockets work for me. Below is an example of Netlink socket basics i.e opening a netlink socket, reading and writing to it and closing it. Kernel Module #include <linux/module.h> #include <net/sock.h> #include <linux/netlink.h> #include <linux/skbuff.h> #define NETLINK_USER 31 struct sock *nl_sk = NULL; static void … Read more

Learning Kernel Programming [closed]

**TODO** +editPic: Linux Kernel Developer -> (Ring Layer 0) +addSection: Kernel Virtualization Engine KERN_WARN_CODING_STYLE: Do not Loop unless you absolutely have to. Recommended Books for the Uninitialized void *i “Men do not understand books until they have a certain amount of life, or at any rate no man understands a deep book, until he has … Read more

How does Linux Kernel know where to look for driver firmware?

From the kernel’s perspective, see /usr/src/linux/Documentation/firmware_class/README: kernel(driver): calls request_firmware(&fw_entry, $FIRMWARE, device) userspace: – /sys/class/firmware/xxx/{loading,data} appear. – hotplug gets called with a firmware identifier in $FIRMWARE and the usual hotplug environment. – hotplug: echo 1 > /sys/class/firmware/xxx/loading kernel: Discard any previous partial load. userspace: – hotplug: cat appropriate_firmware_image > \ /sys/class/firmware/xxx/data kernel: grows a buffer in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)