Commit b18718c6 authored by Uma Krishnan's avatar Uma Krishnan Committed by Martin K. Petersen

scsi: cxlflash: Support adapter context discovery

Provide means to obtain the process element of an adapter context as well as
locate an adapter context by file.
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 926a62f9
...@@ -150,6 +150,19 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name, ...@@ -150,6 +150,19 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
goto out; goto out;
} }
/**
* ocxlflash_process_element() - get process element of the adapter context
* @ctx_cookie: Adapter context associated with the process element.
*
* Return: process element of the adapter context
*/
static int ocxlflash_process_element(void *ctx_cookie)
{
struct ocxlflash_context *ctx = ctx_cookie;
return ctx->pe;
}
/** /**
* ocxlflash_set_master() - sets the context as master * ocxlflash_set_master() - sets the context as master
* @ctx_cookie: Adapter context to set as master. * @ctx_cookie: Adapter context to set as master.
...@@ -469,9 +482,21 @@ static struct file *ocxlflash_get_fd(void *ctx_cookie, ...@@ -469,9 +482,21 @@ static struct file *ocxlflash_get_fd(void *ctx_cookie,
goto out; goto out;
} }
/**
* ocxlflash_fops_get_context() - get the context associated with the file
* @file: File associated with the adapter context.
*
* Return: pointer to the context
*/
static void *ocxlflash_fops_get_context(struct file *file)
{
return file->private_data;
}
/* Backend ops to ocxlflash services */ /* Backend ops to ocxlflash services */
const struct cxlflash_backend_ops cxlflash_ocxl_ops = { const struct cxlflash_backend_ops cxlflash_ocxl_ops = {
.module = THIS_MODULE, .module = THIS_MODULE,
.process_element = ocxlflash_process_element,
.set_master = ocxlflash_set_master, .set_master = ocxlflash_set_master,
.get_context = ocxlflash_get_context, .get_context = ocxlflash_get_context,
.dev_context_init = ocxlflash_dev_context_init, .dev_context_init = ocxlflash_dev_context_init,
...@@ -479,4 +504,5 @@ const struct cxlflash_backend_ops cxlflash_ocxl_ops = { ...@@ -479,4 +504,5 @@ const struct cxlflash_backend_ops cxlflash_ocxl_ops = {
.create_afu = ocxlflash_create_afu, .create_afu = ocxlflash_create_afu,
.destroy_afu = ocxlflash_destroy_afu, .destroy_afu = ocxlflash_destroy_afu,
.get_fd = ocxlflash_get_fd, .get_fd = ocxlflash_get_fd,
.fops_get_context = ocxlflash_fops_get_context,
}; };
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