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?
The current Linux source code is always available in both a complete tarball (an archive created with the tar command) and an incremental patch from the official home of the Linux kernel, http://www.kernel.org.
The Linux kernel 5.7 is finally here as the latest stable version of kernel for Unix-like operating systems. The new kernel comes with many significant updates and new features.
To check which kernel is currently running on your system, use the uname command with the “release” or -r switch. This will output the kernel version (release) number.
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}()
Use mutex_init() instead:
struct scull_pipe {
...
struct mutex mutex;
...
};
mutex_init(&(lptr->device.mutex));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With