cxl: Introduce cxl_to_{ways,granularity}
authorDan Williams <dan.j.williams@intel.com>
Mon, 23 May 2022 00:04:27 +0000 (17:04 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sat, 9 Jul 2022 23:42:44 +0000 (16:42 -0700)
commit419af595b11891d632a31440b9ca5a3cdf93996d
treea2c62cf9ce94a628e1e45d434b5851e19f409263
parent885d3bed6de153bfeba40e4d25cc600bef8af1b8
cxl: Introduce cxl_to_{ways,granularity}

Interleave granularity and ways have CXL specification defined encodings.
Promote the conversion helpers to a common header, and use them to
replace other open-coded instances.

Force caller to consider the error case of the conversion similarly to
other conversion helpers like kstrto*().

Co-developed-by: Ben Widawsky <bwidawsk@kernel.org>
Signed-off-by: Ben Widawsky <bwidawsk@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/165603875016.551046.17236943065932132355.stgit@dwillia2-xfh
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/acpi.c
drivers/cxl/core/hdm.c
drivers/cxl/cxl.h