Errors in Linux Device Drivers book
I have been reading “Linux Device Drivers: Second Edition“, and noticed a couple of problems on page 286.
There is no “atomic_add_and_test” in the 2.4 kernel. Also, the book claims that the _test functions return the previous value of the atomic type. Unfortunately, this isn’t how they behave.
atomic_sub_and_test, atomic_dec_and_test, atomic_inc_and_test returns true if the result is zero, false otherwise.
atomic_add_negative returns true if the value is negative, false if it is greater than or equal to zero.