Bluetooth: ISO: use hci_sync for setting CIG parameters
[linux-2.6-microblaze.git] / io_uring / tctx.c
index 3a8d1dd..c043fe9 100644 (file)
@@ -208,31 +208,40 @@ void io_uring_unreg_ringfd(void)
        }
 }
 
-static int io_ring_add_registered_fd(struct io_uring_task *tctx, int fd,
+int io_ring_add_registered_file(struct io_uring_task *tctx, struct file *file,
                                     int start, int end)
 {
-       struct file *file;
        int offset;
-
        for (offset = start; offset < end; offset++) {
                offset = array_index_nospec(offset, IO_RINGFD_REG_MAX);
                if (tctx->registered_rings[offset])
                        continue;
 
-               file = fget(fd);
-               if (!file) {
-                       return -EBADF;
-               } else if (!io_is_uring_fops(file)) {
-                       fput(file);
-                       return -EOPNOTSUPP;
-               }
                tctx->registered_rings[offset] = file;
                return offset;
        }
-
        return -EBUSY;
 }
 
+static int io_ring_add_registered_fd(struct io_uring_task *tctx, int fd,
+                                    int start, int end)
+{
+       struct file *file;
+       int offset;
+
+       file = fget(fd);
+       if (!file) {
+               return -EBADF;
+       } else if (!io_is_uring_fops(file)) {
+               fput(file);
+               return -EOPNOTSUPP;
+       }
+       offset = io_ring_add_registered_file(tctx, file, start, end);
+       if (offset < 0)
+               fput(file);
+       return offset;
+}
+
 /*
  * Register a ring fd to avoid fdget/fdput for each io_uring_enter()
  * invocation. User passes in an array of struct io_uring_rsrc_update