diff options
Diffstat (limited to 'drivers/infiniband/hw/qib/qib_file_ops.c')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_file_ops.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 14046f5a37fa..9ea6c440a00c 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/pgtable.h> | 43 | #include <asm/pgtable.h> |
44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
45 | #include <linux/export.h> | 45 | #include <linux/export.h> |
46 | #include <linux/uio.h> | ||
46 | 47 | ||
47 | #include "qib.h" | 48 | #include "qib.h" |
48 | #include "qib_common.h" | 49 | #include "qib_common.h" |
@@ -54,15 +55,19 @@ | |||
54 | static int qib_open(struct inode *, struct file *); | 55 | static int qib_open(struct inode *, struct file *); |
55 | static int qib_close(struct inode *, struct file *); | 56 | static int qib_close(struct inode *, struct file *); |
56 | static ssize_t qib_write(struct file *, const char __user *, size_t, loff_t *); | 57 | static ssize_t qib_write(struct file *, const char __user *, size_t, loff_t *); |
57 | static ssize_t qib_aio_write(struct kiocb *, const struct iovec *, | 58 | static ssize_t qib_write_iter(struct kiocb *, struct iov_iter *); |
58 | unsigned long, loff_t); | ||
59 | static unsigned int qib_poll(struct file *, struct poll_table_struct *); | 59 | static unsigned int qib_poll(struct file *, struct poll_table_struct *); |
60 | static int qib_mmapf(struct file *, struct vm_area_struct *); | 60 | static int qib_mmapf(struct file *, struct vm_area_struct *); |
61 | 61 | ||
62 | /* | ||
63 | * This is really, really weird shit - write() and writev() here | ||
64 | * have completely unrelated semantics. Sucky userland ABI, | ||
65 | * film at 11. | ||
66 | */ | ||
62 | static const struct file_operations qib_file_ops = { | 67 | static const struct file_operations qib_file_ops = { |
63 | .owner = THIS_MODULE, | 68 | .owner = THIS_MODULE, |
64 | .write = qib_write, | 69 | .write = qib_write, |
65 | .aio_write = qib_aio_write, | 70 | .write_iter = qib_write_iter, |
66 | .open = qib_open, | 71 | .open = qib_open, |
67 | .release = qib_close, | 72 | .release = qib_close, |
68 | .poll = qib_poll, | 73 | .poll = qib_poll, |
@@ -2248,17 +2253,16 @@ bail: | |||
2248 | return ret; | 2253 | return ret; |
2249 | } | 2254 | } |
2250 | 2255 | ||
2251 | static ssize_t qib_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2256 | static ssize_t qib_write_iter(struct kiocb *iocb, struct iov_iter *from) |
2252 | unsigned long dim, loff_t off) | ||
2253 | { | 2257 | { |
2254 | struct qib_filedata *fp = iocb->ki_filp->private_data; | 2258 | struct qib_filedata *fp = iocb->ki_filp->private_data; |
2255 | struct qib_ctxtdata *rcd = ctxt_fp(iocb->ki_filp); | 2259 | struct qib_ctxtdata *rcd = ctxt_fp(iocb->ki_filp); |
2256 | struct qib_user_sdma_queue *pq = fp->pq; | 2260 | struct qib_user_sdma_queue *pq = fp->pq; |
2257 | 2261 | ||
2258 | if (!dim || !pq) | 2262 | if (!iter_is_iovec(from) || !from->nr_segs || !pq) |
2259 | return -EINVAL; | 2263 | return -EINVAL; |
2260 | 2264 | ||
2261 | return qib_user_sdma_writev(rcd, pq, iov, dim); | 2265 | return qib_user_sdma_writev(rcd, pq, from->iov, from->nr_segs); |
2262 | } | 2266 | } |
2263 | 2267 | ||
2264 | static struct class *qib_class; | 2268 | static struct class *qib_class; |