[PATCH 4/6] staging: kpc2000_dma: replaced aio_(read|write) file-ops with (read|write)_iter ones.

Matt Sickler Matt.Sickler at daktronics.com
Tue Jun 11 23:48:12 UTC 2019


>-----Original Message-----
>From: Jeremy Sowden <jeremy at azazel.net>
>

>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 at daktronics.com>
>Signed-off-by: Jeremy Sowden <jeremy at azazel.net>
>---
> 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;
> }

This part was wrapped in the ifdef because aio_complete was removed some time
after 3.16 and I didn't bother with figuring out the replacement for it since
I figured the AIO functionality would be removed entirely.


As for the read_iter/write_iter, my understanding is that's for allowing
scatter-gather type buffers from userspace.  If so, that functionality could
be removed entirely.  Our use cases have zero need for it, which is why it's
not implemented right now.


More information about the devel mailing list