Douglas Su Douglas Su - 3 months ago 29
Linux Question

Where has init_MUTEX gone in linux kernel version 3.2?

I am following the Linux Device Drivers (3rd edition). When I try to imitate the scull example in chapter 6 , an error is reported. It says that:

error: implicit declaration of function ‘init_MUTEX’ [-Werror=implicit-function-declaration]


Can anyone tell me where has init_MUTEX gone?
By the way, Is there a list that I can check all the kernel API changes?

Answer

init_MUTEX{_LOCKED}() was initially implemented as a semaphore. Semaphores were only in older 2.6.16 kernels, now mutex replace with earlier semaphores implementation, check the below api's and linux/mutex.h header

struct mutex { ...
};

mutex_{init,lock,trylock,unlock,lock_interruptible}()