Mellanox / nv_peer_memory

305 stars 61 forks source link

Replace ACCESS_ONCE() by READ_ONCE() and WRITE_ONCE() #33

Closed ferasd closed 6 years ago

ferasd commented 6 years ago

Replace ACCESS_ONCE() macro by READ_ONCE() and WRITE_ONCE() since it was removed from the kernel.

Signed-off-by: Feras Daoud ferasda@mellanox.com

ferasd commented 6 years ago

@haggaie @drossetti for your review related to #32

alaahl commented 6 years ago

from a quick check i see that WRITE_ONCE was added to the kernel in version 3.19-rc5, before that it was called ASSIGN_ONCE which was added in 3.19-rc1. so, this patch will break compilation for older kernels.

i suggest to keep using ACCESS_ONCE (it's available since 2.6.26-rc2). for supporting new kernels where ACCESS_ONCE is removed, you can wrap the lines with something like this:

ifdef ACCESS_ONCE

old/current code

else

use WRITE_ONCE and READ_ONCE

endif

rleon commented 6 years ago

@alaahl you are right, but more popular solution will be ifndef WRITE_ONCE #define WRITE_ONCE ... but in the code use WRITE_ONCE only.