module_init() vs. core_initcall() vs. early_initcall()

They determine the initialization order of built-in modules. Drivers will use device_initcall (or module_init; see below) most of the time. Early initialization (early_initcall) is normally used by architecture-specific code to initialize hardware subsystems (power management, DMAs, etc.) before any real driver gets initialized. Technical stuff for understanding below Look at init/main.c. After a few architecture-specific … Read more

spin_lock_irqsave vs spin_lock_irq

spin_lock_irqsave is basically used to save the interrupt state before taking the spin lock, this is because spin lock disables the interrupt, when the lock is taken in interrupt context, and re-enables it when while unlocking. The interrupt state is saved so that it should reinstate the interrupts again. Example: Lets say interrupt x was … Read more

What is the difference between FUTEX_WAIT and FUTEX_WAIT_PRIVATE?

This is an optimization done by linux/glibc to make futexes faster when they’re not shared between processes. Glibc will use the _PRIVATE versions of each of the futex calls unless the PTHREAD_PROCESS_SHARED attribute is set on your mutex It’s explained in more detail here: http://lwn.net/Articles/229668/ For the purposes of your debugging, you can just ignore … Read more

Difference between physical/logical/virtual memory address

My answer is true for Intel CPUs running on a modern Linux system, and I am speaking about user-level processes, not kernel code. Still, I think it’ll give you some insight enough to think about the other possibilities Address Types Regarding question 3: I have come across discussion that virtual and logical addresses/address space are … Read more

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

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