.. | .. |
---|
48 | 48 | #include <linux/slab.h> |
---|
49 | 49 | #include <linux/vmalloc.h> |
---|
50 | 50 | #include <linux/mm.h> |
---|
51 | | -#include <asm/pgtable.h> |
---|
| 51 | +#include <rdma/uverbs_ioctl.h> |
---|
52 | 52 | #include "mmap.h" |
---|
53 | 53 | |
---|
54 | 54 | /** |
---|
.. | .. |
---|
150 | 150 | * rvt_create_mmap_info - allocate information for hfi1_mmap |
---|
151 | 151 | * @rdi: rvt dev struct |
---|
152 | 152 | * @size: size in bytes to map |
---|
153 | | - * @context: user context |
---|
| 153 | + * @udata: user data (must be valid!) |
---|
154 | 154 | * @obj: opaque pointer to a cq, wq etc |
---|
155 | 155 | * |
---|
156 | | - * Return: rvt_mmap struct on success |
---|
| 156 | + * Return: rvt_mmap struct on success, ERR_PTR on failure |
---|
157 | 157 | */ |
---|
158 | | -struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, |
---|
159 | | - u32 size, |
---|
160 | | - struct ib_ucontext *context, |
---|
161 | | - void *obj) |
---|
| 158 | +struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size, |
---|
| 159 | + struct ib_udata *udata, void *obj) |
---|
162 | 160 | { |
---|
163 | 161 | struct rvt_mmap_info *ip; |
---|
164 | 162 | |
---|
| 163 | + if (!udata) |
---|
| 164 | + return ERR_PTR(-EINVAL); |
---|
| 165 | + |
---|
165 | 166 | ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node); |
---|
166 | 167 | if (!ip) |
---|
167 | | - return ip; |
---|
| 168 | + return ERR_PTR(-ENOMEM); |
---|
168 | 169 | |
---|
169 | 170 | size = PAGE_ALIGN(size); |
---|
170 | 171 | |
---|
.. | .. |
---|
177 | 178 | |
---|
178 | 179 | INIT_LIST_HEAD(&ip->pending_mmaps); |
---|
179 | 180 | ip->size = size; |
---|
180 | | - ip->context = context; |
---|
| 181 | + ip->context = |
---|
| 182 | + container_of(udata, struct uverbs_attr_bundle, driver_udata) |
---|
| 183 | + ->context; |
---|
181 | 184 | ip->obj = obj; |
---|
182 | 185 | kref_init(&ip->ref); |
---|
183 | 186 | |
---|