nvme: introduce helper function to get ctrl state
authorKeith Busch <kbusch@kernel.org>
Mon, 30 Oct 2023 15:13:09 +0000 (08:13 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 4 Dec 2023 16:39:03 +0000 (08:39 -0800)
commit5c687c287c46fadb14644091823298875a5216aa
tree128648783e08c11c1c5ebff84928547f7656cb69
parenta134cd8dfb8cdfd8f019a7ec2ad5cb8e855f0245
nvme: introduce helper function to get ctrl state

The controller state is typically written by another CPU, so reading it
should ensure no optimizations are taken. This is a repeated pattern in
the driver, so start with adding a convenience function that returns the
controller state with READ_ONCE().

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/nvme.h