Commit 31e624a7 authored by Dan Williams's avatar Dan Williams

cxl/mem: Rename cxl_dvsec_decode_init() to cxl_hdm_decode_init()

cxl_dvsec_decode_init() is tasked with checking whether legacy DVSEC
range based decode is in effect, or whether HDM can be enabled / already
is enabled. As such it either succeeds or fails and that result is the
return value. The @do_hdm_init variable is misleading in the case where
HDM operation is already found to be active, so just call it @retval.
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/164730736435.3806189.2537160791687837469.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 36bfc6ad
...@@ -68,7 +68,7 @@ static int create_endpoint(struct cxl_memdev *cxlmd, ...@@ -68,7 +68,7 @@ static int create_endpoint(struct cxl_memdev *cxlmd,
} }
/** /**
* cxl_dvsec_decode_init() - Setup HDM decoding for the endpoint * cxl_hdm_decode_init() - Setup HDM decoding for the endpoint
* @cxlds: Device state * @cxlds: Device state
* *
* Additionally, enables global HDM decoding. Warning: don't call this outside * Additionally, enables global HDM decoding. Warning: don't call this outside
...@@ -79,12 +79,12 @@ static int create_endpoint(struct cxl_memdev *cxlmd, ...@@ -79,12 +79,12 @@ static int create_endpoint(struct cxl_memdev *cxlmd,
* decoders, or if it can not be determined if DVSEC Ranges are in use. * decoders, or if it can not be determined if DVSEC Ranges are in use.
* Otherwise, returns true. * Otherwise, returns true.
*/ */
__mock bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds) __mock bool cxl_hdm_decode_init(struct cxl_dev_state *cxlds)
{ {
struct cxl_endpoint_dvsec_info *info = &cxlds->info; struct cxl_endpoint_dvsec_info *info = &cxlds->info;
struct cxl_register_map map; struct cxl_register_map map;
struct cxl_component_reg_map *cmap = &map.component_map; struct cxl_component_reg_map *cmap = &map.component_map;
bool global_enable, do_hdm_init = false; bool global_enable, retval = false;
void __iomem *crb; void __iomem *crb;
u32 global_ctrl; u32 global_ctrl;
...@@ -113,7 +113,7 @@ __mock bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds) ...@@ -113,7 +113,7 @@ __mock bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds)
goto out; goto out;
} }
do_hdm_init = true; retval = true;
/* /*
* Permanently (for this boot at least) opt the device into HDM * Permanently (for this boot at least) opt the device into HDM
...@@ -129,7 +129,7 @@ __mock bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds) ...@@ -129,7 +129,7 @@ __mock bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds)
out: out:
iounmap(crb); iounmap(crb);
return do_hdm_init; return retval;
} }
static int cxl_mem_probe(struct device *dev) static int cxl_mem_probe(struct device *dev)
...@@ -160,7 +160,7 @@ static int cxl_mem_probe(struct device *dev) ...@@ -160,7 +160,7 @@ static int cxl_mem_probe(struct device *dev)
* If DVSEC ranges are being used instead of HDM decoder registers there * If DVSEC ranges are being used instead of HDM decoder registers there
* is no use in trying to manage those. * is no use in trying to manage those.
*/ */
if (!cxl_dvsec_decode_init(cxlds)) { if (!cxl_hdm_decode_init(cxlds)) {
dev_err(dev, dev_err(dev,
"Legacy range registers configuration prevents HDM operation.\n"); "Legacy range registers configuration prevents HDM operation.\n");
return -EBUSY; return -EBUSY;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <linux/types.h> #include <linux/types.h>
struct cxl_dev_state; struct cxl_dev_state;
bool cxl_dvsec_decode_init(struct cxl_dev_state *cxlds) bool cxl_hdm_decode_init(struct cxl_dev_state *cxlds)
{ {
return true; return true;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment