Where did init_MUTEX go to linux kernel version 3.2?

I am following Linux Device Drivers (3rd Edition). When I try to emulate the skull 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 init_MUTEX went? By the way, is there a list where I can check all the kernel API changes?

+3


source to share


2 answers


init_MUTEX{_LOCKED}()

was originally implemented as a semaphore
. Semaphores were only in older 2.6.16 kernels, now replaces the mutex using earlier semaphores, check the bottom api header andlinux/mutex.h



struct mutex { ...
};

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

      

+6


source


Use mutex_init () instead:



struct scull_pipe {
    ...
    struct mutex mutex;
    ...
};

mutex_init(&(lptr->device.mutex));

      

+2


source







All Articles