| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * drivers/dma-buf/sync_file.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include <linux/export.h> |
|---|
| .. | .. |
|---|
| 102 | 93 | } |
|---|
| 103 | 94 | |
|---|
| 104 | 95 | /** |
|---|
| 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 | | -/** |
|---|
| 138 | 96 | * sync_file_get_fence - get the fence related to the sync_file fd |
|---|
| 139 | 97 | * @fd: sync_file fd to get the fence from |
|---|
| 140 | 98 | * |
|---|
| .. | .. |
|---|
| 177 | 135 | } else { |
|---|
| 178 | 136 | struct dma_fence *fence = sync_file->fence; |
|---|
| 179 | 137 | |
|---|
| 180 | | - snprintf(buf, len, "%s-%s%llu-%d", |
|---|
| 138 | + snprintf(buf, len, "%s-%s%llu-%lld", |
|---|
| 181 | 139 | fence->ops->get_driver_name(fence), |
|---|
| 182 | 140 | fence->ops->get_timeline_name(fence), |
|---|
| 183 | 141 | fence->context, |
|---|
| .. | .. |
|---|
| 291 | 249 | |
|---|
| 292 | 250 | i_b++; |
|---|
| 293 | 251 | } 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)) |
|---|
| 295 | 254 | add_fence(fences, &i, pt_a); |
|---|
| 296 | 255 | else |
|---|
| 297 | 256 | add_fence(fences, &i, pt_b); |
|---|
| .. | .. |
|---|
| 461 | 420 | * info->num_fences. |
|---|
| 462 | 421 | */ |
|---|
| 463 | 422 | if (!info.num_fences) { |
|---|
| 464 | | - info.status = dma_fence_is_signaled(sync_file->fence); |
|---|
| 423 | + info.status = dma_fence_get_status(sync_file->fence); |
|---|
| 465 | 424 | goto no_fences; |
|---|
| 466 | 425 | } else { |
|---|
| 467 | 426 | info.status = 1; |
|---|
| .. | .. |
|---|
| 522 | 481 | .release = sync_file_release, |
|---|
| 523 | 482 | .poll = sync_file_poll, |
|---|
| 524 | 483 | .unlocked_ioctl = sync_file_ioctl, |
|---|
| 525 | | - .compat_ioctl = sync_file_ioctl, |
|---|
| 484 | + .compat_ioctl = compat_ptr_ioctl, |
|---|
| 526 | 485 | }; |
|---|