In a Linux Kernel Module I am trying to change code that says:
down(&semaphore1);
down(&semaphore2);
critical code here!
up(&semaphore2);
up(&semaphore1);
To use down_interruptible();
if(down_interruptible(&semaphore1))
return -ERESTARTSYS;
if(down_interruptible(&semaphore2))
return -ERESTARTSYS;
critical code here!
up(&semaphore2);
up(&semaphore1);
Is this the correct way to switch from the "depricated" down
to down_interruptible
?
I don't understand what return -ERESTARTSYS;
does, but to me it seems that it makes my kernel module exit and allow the kernel to do some other stuff until my kernel module is awaken again, is that it?