The AIO API was implemented in terms of obsolete file-ops. Replaced the ->aio_read and ->aio_write call-backs with ->read_iter and ->write_iter ones. Replaced the call to aio_complete with a call to the ki_complete call-back of the kiocb object. Cc: Matt Sickler <matt.sickler@xxxxxxxxxxxxxx> Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- drivers/staging/kpc2000/kpc_dma/fileops.c | 40 +++++++++++++++-------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c index d74300f14dff..1e8f8c41f82a 100644 --- a/drivers/staging/kpc2000/kpc_dma/fileops.c +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c @@ -10,6 +10,7 @@ #include <linux/cdev.h> #include <linux/uaccess.h> /* copy_*_user */ #include <linux/aio.h> /* aio stuff */ +#include <linux/uio.h> #include <linux/highmem.h> #include <linux/pagemap.h> #include "kpc_dma_driver.h" @@ -243,7 +244,7 @@ void transfer_complete_cb(struct aio_cb_data *acd, size_t xfr_count, u32 flags) } } else { #ifdef CONFIG_KPC2000_DMA_AIO - aio_complete(acd->kcb, acd->len, acd->flags); + acd->kcb->ki_complete(acd->kcb, acd->len, acd->flags); #endif kfree(acd); } @@ -319,42 +320,54 @@ static int kpc_dma_aio_cancel(struct kiocb *kcb) return 0; } -static ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, - unsigned long iov_count, loff_t pos) +static ssize_t kpc_dma_read_iter(struct kiocb *kcb, struct iov_iter *to) { struct dev_private_data *priv = kcb->ki_filp->private_data; + struct iovec iov; if (priv->ldev->dir != DMA_FROM_DEVICE) return -EMEDIUMTYPE; - if (iov_count != 1) { + if (!iter_is_iovec(to)) + return -EINVAL; + + if (iov_iter_count(to) != 1) { dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 1!\n", __func__); return -EFAULT; } + iov = iov_iter_iovec(to); + if (!is_sync_kiocb(kcb)) kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel); - return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, iov->iov_len); + return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base, + iov.iov_len); } -static ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, - unsigned long iov_count, loff_t pos) +static ssize_t kpc_dma_write_iter(struct kiocb *kcb, struct iov_iter *from) { struct dev_private_data *priv = kcb->ki_filp->private_data; + struct iovec iov; if (priv->ldev->dir != DMA_TO_DEVICE) return -EMEDIUMTYPE; - if (iov_count != 1) { + if (!iter_is_iovec(from)) + return -EINVAL; + + if (iov_iter_count(from) != 1) { dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 1!\n", __func__); return -EFAULT; } + iov = iov_iter_iovec(from); + if (!is_sync_kiocb(kcb)) kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel); - return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, iov->iov_len); + return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base, + iov.iov_len); } #endif @@ -399,16 +412,15 @@ long kpc_dma_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long ioc return -ENOTTY; } -const struct file_operations kpc_dma_fops = { - .owner = THIS_MODULE, +const struct file_operations kpc_dma_fops = { + .owner = THIS_MODULE, .open = kpc_dma_open, .release = kpc_dma_close, .read = kpc_dma_read, .write = kpc_dma_write, #ifdef CONFIG_KPC2000_DMA_AIO - .aio_read = kpc_dma_aio_read, - .aio_write = kpc_dma_aio_write, + .read_iter = kpc_dma_read_iter, + .write_iter = kpc_dma_write_iter, #endif .unlocked_ioctl = kpc_dma_ioctl, }; - -- 2.20.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel