drm_gem_object_put(gem_obj);
        return 0;
 }
+
+int
+v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
+                 struct drm_file *file_priv)
+{
+       int ret;
+       struct drm_v3d_wait_bo *args = data;
+       ktime_t start = ktime_get();
+       u64 delta_ns;
+       unsigned long timeout_jiffies =
+               nsecs_to_jiffies_timeout(args->timeout_ns);
+
+       if (args->pad != 0)
+               return -EINVAL;
+
+       ret = drm_gem_dma_resv_wait(file_priv, args->handle,
+                                   true, timeout_jiffies);
+
+       /* Decrement the user's timeout, in case we got interrupted
+        * such that the ioctl will be restarted.
+        */
+       delta_ns = ktime_to_ns(ktime_sub(ktime_get(), start));
+       if (delta_ns < args->timeout_ns)
+               args->timeout_ns -= delta_ns;
+       else
+               args->timeout_ns = 0;
+
+       /* Asked to wait beyond the jiffie/scheduler precision? */
+       if (ret == -ETIME && args->timeout_ns)
+               ret = -EAGAIN;
+
+       return ret;
+}
 
                      struct drm_file *file_priv);
 int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data,
                            struct drm_file *file_priv);
+int v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
+                     struct drm_file *file_priv);
 struct drm_gem_object *v3d_prime_import_sg_table(struct drm_device *dev,
                                                 struct dma_buf_attachment *attach,
                                                 struct sg_table *sgt);
                         struct drm_file *file_priv);
 int v3d_submit_csd_ioctl(struct drm_device *dev, void *data,
                         struct drm_file *file_priv);
-int v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
-                     struct drm_file *file_priv);
 void v3d_job_cleanup(struct v3d_job *job);
 void v3d_job_put(struct v3d_job *job);
 void v3d_reset(struct v3d_dev *v3d);
 
        kref_put(&job->refcount, job->free);
 }
 
-int
-v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
-                 struct drm_file *file_priv)
-{
-       int ret;
-       struct drm_v3d_wait_bo *args = data;
-       ktime_t start = ktime_get();
-       u64 delta_ns;
-       unsigned long timeout_jiffies =
-               nsecs_to_jiffies_timeout(args->timeout_ns);
-
-       if (args->pad != 0)
-               return -EINVAL;
-
-       ret = drm_gem_dma_resv_wait(file_priv, args->handle,
-                                   true, timeout_jiffies);
-
-       /* Decrement the user's timeout, in case we got interrupted
-        * such that the ioctl will be restarted.
-        */
-       delta_ns = ktime_to_ns(ktime_sub(ktime_get(), start));
-       if (delta_ns < args->timeout_ns)
-               args->timeout_ns -= delta_ns;
-       else
-               args->timeout_ns = 0;
-
-       /* Asked to wait beyond the jiffie/scheduler precision? */
-       if (ret == -ETIME && args->timeout_ns)
-               ret = -EAGAIN;
-
-       return ret;
-}
-
 static int
 v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
             void **container, size_t size, void (*free)(struct kref *ref),