nvme: introduce helper function to get ctrl state
authorKeith Busch <kbusch@kernel.org>
Mon, 30 Oct 2023 15:13:09 +0000 (08:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jan 2024 10:51:41 +0000 (11:51 +0100)
commitcc5b051eeb486eddd2700e9eee07ccccbce71463
treef17d0e22545a59dacd8d894588d6dcaa0c43e4b9
parent8392d323472116d3ea430657fc66de51698a010d
nvme: introduce helper function to get ctrl state

[ Upstream commit 5c687c287c46fadb14644091823298875a5216aa ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/nvme.h