hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/dma-buf/sync_file.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * drivers/dma-buf/sync_file.c
34 *
45 * Copyright (C) 2012 Google, Inc.
5
- *
6
- * This software is licensed under the terms of the GNU General Public
7
- * License version 2, as published by the Free Software Foundation, and
8
- * may be copied, distributed, and modified under those terms.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
156 */
167
178 #include <linux/export.h>
....@@ -102,39 +93,6 @@
10293 }
10394
10495 /**
105
- * sync_file_get - returns the sync_file structure related to an fd
106
- * @fd: [in] fd associated with the sync_file to be returned
107
- *
108
- * On success, returns the sync_file structure associated with an fd; uses
109
- * file's refcounting done by fget to increase refcount. returns NULL
110
- * otherwise.
111
- */
112
-struct sync_file *sync_file_get(int fd)
113
-{
114
- return sync_file_fdget(fd);
115
-}
116
-EXPORT_SYMBOL(sync_file_get);
117
-
118
-/**
119
- * sync_file_put - decreases refcount of the sync_file
120
- * @sync_file: [in] sync_file to reduce refcount of
121
- *
122
- * Uses file's refcounting done implicitly by fput().
123
- *
124
- * If, as a result of this call, the refcount becomes 0, the 'release' file
125
- * operation related to this fd is called. It calls &sync_file_ops.release vfunc
126
- * in turn.
127
- */
128
-void sync_file_put(struct sync_file *sync_file)
129
-{
130
- if (WARN_ON(!sync_file || !sync_file->file))
131
- return;
132
-
133
- fput(sync_file->file);
134
-}
135
-EXPORT_SYMBOL(sync_file_put);
136
-
137
-/**
13896 * sync_file_get_fence - get the fence related to the sync_file fd
13997 * @fd: sync_file fd to get the fence from
14098 *
....@@ -177,7 +135,7 @@
177135 } else {
178136 struct dma_fence *fence = sync_file->fence;
179137
180
- snprintf(buf, len, "%s-%s%llu-%d",
138
+ snprintf(buf, len, "%s-%s%llu-%lld",
181139 fence->ops->get_driver_name(fence),
182140 fence->ops->get_timeline_name(fence),
183141 fence->context,
....@@ -291,7 +249,8 @@
291249
292250 i_b++;
293251 } else {
294
- if (pt_a->seqno - pt_b->seqno <= INT_MAX)
252
+ if (__dma_fence_is_later(pt_a->seqno, pt_b->seqno,
253
+ pt_a->ops))
295254 add_fence(fences, &i, pt_a);
296255 else
297256 add_fence(fences, &i, pt_b);
....@@ -461,7 +420,7 @@
461420 * info->num_fences.
462421 */
463422 if (!info.num_fences) {
464
- info.status = dma_fence_is_signaled(sync_file->fence);
423
+ info.status = dma_fence_get_status(sync_file->fence);
465424 goto no_fences;
466425 } else {
467426 info.status = 1;
....@@ -522,5 +481,5 @@
522481 .release = sync_file_release,
523482 .poll = sync_file_poll,
524483 .unlocked_ioctl = sync_file_ioctl,
525
- .compat_ioctl = sync_file_ioctl,
484
+ .compat_ioctl = compat_ptr_ioctl,
526485 };