file.c (3d6b040e73387570521da4aedfd03d2643acdae7) | file.c (0b3f9c757cabad4b8101c5fcddddd029ed5506a6) |
---|---|
1/* 2 * Copyright 2014 IBM Corp. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 */ --- 59 unchanged lines hidden (view full) --- 68 goto err_put_adapter; 69 } 70 get_device(&afu->dev); 71 spin_unlock(&adapter->afu_list_lock); 72 73 if (!afu->current_mode) 74 goto err_put_afu; 75 | 1/* 2 * Copyright 2014 IBM Corp. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 */ --- 59 unchanged lines hidden (view full) --- 68 goto err_put_adapter; 69 } 70 get_device(&afu->dev); 71 spin_unlock(&adapter->afu_list_lock); 72 73 if (!afu->current_mode) 74 goto err_put_afu; 75 |
76 if (!cxl_adapter_link_ok(adapter)) { 77 rc = -EIO; 78 goto err_put_afu; 79 } 80 |
|
76 if (!(ctx = cxl_context_alloc())) { 77 rc = -ENOMEM; 78 goto err_put_afu; 79 } 80 81 if ((rc = cxl_context_init(ctx, afu, master, inode->i_mapping))) 82 goto err_put_afu; 83 --- 149 unchanged lines hidden (view full) --- 233 234long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 235{ 236 struct cxl_context *ctx = file->private_data; 237 238 if (ctx->status == CLOSED) 239 return -EIO; 240 | 81 if (!(ctx = cxl_context_alloc())) { 82 rc = -ENOMEM; 83 goto err_put_afu; 84 } 85 86 if ((rc = cxl_context_init(ctx, afu, master, inode->i_mapping))) 87 goto err_put_afu; 88 --- 149 unchanged lines hidden (view full) --- 238 239long afu_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 240{ 241 struct cxl_context *ctx = file->private_data; 242 243 if (ctx->status == CLOSED) 244 return -EIO; 245 |
246 if (!cxl_adapter_link_ok(ctx->afu->adapter)) 247 return -EIO; 248 |
|
241 pr_devel("afu_ioctl\n"); 242 switch (cmd) { 243 case CXL_IOCTL_START_WORK: 244 return afu_ioctl_start_work(ctx, (struct cxl_ioctl_start_work __user *)arg); 245 case CXL_IOCTL_GET_PROCESS_ELEMENT: 246 return afu_ioctl_process_element(ctx, (__u32 __user *)arg); 247 case CXL_IOCTL_GET_AFU_ID: 248 return afu_ioctl_get_afu_id(ctx, (struct cxl_afu_id __user *) --- 11 unchanged lines hidden (view full) --- 260int afu_mmap(struct file *file, struct vm_area_struct *vm) 261{ 262 struct cxl_context *ctx = file->private_data; 263 264 /* AFU must be started before we can MMIO */ 265 if (ctx->status != STARTED) 266 return -EIO; 267 | 249 pr_devel("afu_ioctl\n"); 250 switch (cmd) { 251 case CXL_IOCTL_START_WORK: 252 return afu_ioctl_start_work(ctx, (struct cxl_ioctl_start_work __user *)arg); 253 case CXL_IOCTL_GET_PROCESS_ELEMENT: 254 return afu_ioctl_process_element(ctx, (__u32 __user *)arg); 255 case CXL_IOCTL_GET_AFU_ID: 256 return afu_ioctl_get_afu_id(ctx, (struct cxl_afu_id __user *) --- 11 unchanged lines hidden (view full) --- 268int afu_mmap(struct file *file, struct vm_area_struct *vm) 269{ 270 struct cxl_context *ctx = file->private_data; 271 272 /* AFU must be started before we can MMIO */ 273 if (ctx->status != STARTED) 274 return -EIO; 275 |
276 if (!cxl_adapter_link_ok(ctx->afu->adapter)) 277 return -EIO; 278 |
|
268 return cxl_context_iomap(ctx, vm); 269} 270 271unsigned int afu_poll(struct file *file, struct poll_table_struct *poll) 272{ 273 struct cxl_context *ctx = file->private_data; 274 int mask = 0; 275 unsigned long flags; --- 28 unchanged lines hidden (view full) --- 304 loff_t *off) 305{ 306 struct cxl_context *ctx = file->private_data; 307 struct cxl_event event; 308 unsigned long flags; 309 int rc; 310 DEFINE_WAIT(wait); 311 | 279 return cxl_context_iomap(ctx, vm); 280} 281 282unsigned int afu_poll(struct file *file, struct poll_table_struct *poll) 283{ 284 struct cxl_context *ctx = file->private_data; 285 int mask = 0; 286 unsigned long flags; --- 28 unchanged lines hidden (view full) --- 315 loff_t *off) 316{ 317 struct cxl_context *ctx = file->private_data; 318 struct cxl_event event; 319 unsigned long flags; 320 int rc; 321 DEFINE_WAIT(wait); 322 |
323 if (!cxl_adapter_link_ok(ctx->afu->adapter)) 324 return -EIO; 325 |
|
312 if (count < CXL_READ_MIN_SIZE) 313 return -EINVAL; 314 315 spin_lock_irqsave(&ctx->lock, flags); 316 317 for (;;) { 318 prepare_to_wait(&ctx->wq, &wait, TASK_INTERRUPTIBLE); 319 if (ctx_event_pending(ctx)) 320 break; 321 | 326 if (count < CXL_READ_MIN_SIZE) 327 return -EINVAL; 328 329 spin_lock_irqsave(&ctx->lock, flags); 330 331 for (;;) { 332 prepare_to_wait(&ctx->wq, &wait, TASK_INTERRUPTIBLE); 333 if (ctx_event_pending(ctx)) 334 break; 335 |
336 if (!cxl_adapter_link_ok(ctx->afu->adapter)) { 337 rc = -EIO; 338 goto out; 339 } 340 |
|
322 if (file->f_flags & O_NONBLOCK) { 323 rc = -EAGAIN; 324 goto out; 325 } 326 327 if (signal_pending(current)) { 328 rc = -ERESTARTSYS; 329 goto out; --- 226 unchanged lines hidden --- | 341 if (file->f_flags & O_NONBLOCK) { 342 rc = -EAGAIN; 343 goto out; 344 } 345 346 if (signal_pending(current)) { 347 rc = -ERESTARTSYS; 348 goto out; --- 226 unchanged lines hidden --- |