aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/cxl/core
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2021-09-08 22:12:44 -0700
committerDan Williams <dan.j.williams@intel.com>2021-09-21 13:44:57 -0700
commitff56ab9e164d71c4a6ae33fc61ae856faec265a1 (patch)
treeea60c66550721dd3e30a8c8d1092168aca880cca /drivers/cxl/core
parentcxl/pci: Use module_pci_driver (diff)
downloadwireguard-linux-ff56ab9e164d71c4a6ae33fc61ae856faec265a1.tar.xz
wireguard-linux-ff56ab9e164d71c4a6ae33fc61ae856faec265a1.zip
cxl/mbox: Convert 'enabled_cmds' to DECLARE_BITMAP
Define enabled_cmds as an embedded member of 'struct cxl_mem' rather than a pointer to another dynamic allocation. As this leaves only one user of cxl_cmd_count, just open code it and delete the helper. Acked-by: Ben Widawsky <ben.widawsky@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/163116436415.2460985.10101824045493194813.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/core')
-rw-r--r--drivers/cxl/core/mbox.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 31e183991726..422999740649 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -315,8 +315,6 @@ static int cxl_validate_cmd_from_user(struct cxl_mem *cxlm,
return 0;
}
-#define cxl_cmd_count ARRAY_SIZE(cxl_mem_commands)
-
int cxl_query_cmd(struct cxl_memdev *cxlmd,
struct cxl_mem_query_commands __user *q)
{
@@ -332,7 +330,7 @@ int cxl_query_cmd(struct cxl_memdev *cxlmd,
/* returns the total number if 0 elements are requested. */
if (n_commands == 0)
- return put_user(cxl_cmd_count, &q->n_commands);
+ return put_user(ARRAY_SIZE(cxl_mem_commands), &q->n_commands);
/*
* otherwise, return max(n_commands, total commands) cxl_command_info
@@ -794,14 +792,6 @@ struct cxl_mem *cxl_mem_create(struct device *dev)
mutex_init(&cxlm->mbox_mutex);
cxlm->dev = dev;
- cxlm->enabled_cmds =
- devm_kmalloc_array(dev, BITS_TO_LONGS(cxl_cmd_count),
- sizeof(unsigned long),
- GFP_KERNEL | __GFP_ZERO);
- if (!cxlm->enabled_cmds) {
- dev_err(dev, "No memory available for bitmap\n");
- return ERR_PTR(-ENOMEM);
- }
return cxlm;
}