diff options
author | Uma Krishnan <ukrishn@linux.vnet.ibm.com> | 2018-03-26 11:34:27 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-04-18 19:32:50 -0400 |
commit | e117c3c731c26bae77b16707740876ede6f73a1b (patch) | |
tree | 7315cb0e6fdd532184917500ce9defaa07302482 /drivers | |
parent | 93b8f8df552c5a30bfddb75a632f1b2a436c2cae (diff) | |
download | linux-stable-e117c3c731c26bae77b16707740876ede6f73a1b.tar.gz linux-stable-e117c3c731c26bae77b16707740876ede6f73a1b.tar.bz2 linux-stable-e117c3c731c26bae77b16707740876ede6f73a1b.zip |
scsi: cxlflash: Support file descriptor mapping
The cxlflash core fop API requires a way to invoke the fault and release
handlers of underlying transports using their native file-based APIs. This
provides the core with the ability to insert selectively itself into the
processing stream of these operations for cleanup. Implement these two fops to
map and release when requested.
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/cxlflash/ocxl_hw.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c index 8a9f2f45a577..4bbc1d197a62 100644 --- a/drivers/scsi/cxlflash/ocxl_hw.c +++ b/drivers/scsi/cxlflash/ocxl_hw.c @@ -1267,6 +1267,30 @@ err: afu_unmap_irq(0, ctx, i, ctx); free_afu_irqs(ctx); goto out; +}; + +/** + * ocxlflash_fd_mmap() - mmap handler for adapter file descriptor + * @file: File installed with adapter file descriptor. + * @vma: VM area associated with mapping. + * + * Return: 0 on success, -errno on failure + */ +static int ocxlflash_fd_mmap(struct file *file, struct vm_area_struct *vma) +{ + return afu_mmap(file, vma); +} + +/** + * ocxlflash_fd_release() - release the context associated with the file + * @inode: File inode pointer. + * @file: File associated with the adapter context. + * + * Return: 0 on success, -errno on failure + */ +static int ocxlflash_fd_release(struct inode *inode, struct file *file) +{ + return afu_release(inode, file); } /* Backend ops to ocxlflash services */ @@ -1292,4 +1316,6 @@ const struct cxlflash_backend_ops cxlflash_ocxl_ops = { .get_fd = ocxlflash_get_fd, .fops_get_context = ocxlflash_fops_get_context, .start_work = ocxlflash_start_work, + .fd_mmap = ocxlflash_fd_mmap, + .fd_release = ocxlflash_fd_release, }; |