Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: android: split uapi out of sync.h and sw_sync.h

Move the userspace interfaces of sync.h and sw_sync.h to
drivers/staging/android/uapi/

Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: Fixed up some conflicts from upstream spelling fixes]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Colin Cross and committed by
Greg Kroah-Hartman
64907b94 fe8a78e4

+133 -102
+2 -18
drivers/staging/android/sw_sync.h
··· 18 18 #define _LINUX_SW_SYNC_H 19 19 20 20 #include <linux/types.h> 21 - 22 - #ifdef __KERNEL__ 23 - 21 + #include <linux/kconfig.h> 24 22 #include "sync.h" 23 + #include "uapi/sw_sync.h" 25 24 26 25 struct sw_sync_timeline { 27 26 struct sync_timeline obj; ··· 55 56 return NULL; 56 57 } 57 58 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */ 58 - 59 - #endif /* __KERNEL __ */ 60 - 61 - struct sw_sync_create_fence_data { 62 - __u32 value; 63 - char name[32]; 64 - __s32 fence; /* fd of new fence */ 65 - }; 66 - 67 - #define SW_SYNC_IOC_MAGIC 'W' 68 - 69 - #define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\ 70 - struct sw_sync_create_fence_data) 71 - #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32) 72 - 73 59 74 60 #endif /* _LINUX_SW_SYNC_H */
+2 -84
drivers/staging/android/sync.h
··· 14 14 #define _LINUX_SYNC_H 15 15 16 16 #include <linux/types.h> 17 - #ifdef __KERNEL__ 18 - 19 17 #include <linux/kref.h> 20 18 #include <linux/ktime.h> 21 19 #include <linux/list.h> 22 20 #include <linux/spinlock.h> 23 21 #include <linux/wait.h> 22 + 23 + #include "uapi/sync.h" 24 24 25 25 struct sync_timeline; 26 26 struct sync_pt; ··· 340 340 * if @timeout < 0 341 341 */ 342 342 int sync_fence_wait(struct sync_fence *fence, long timeout); 343 - 344 - #endif /* __KERNEL__ */ 345 - 346 - /** 347 - * struct sync_merge_data - data passed to merge ioctl 348 - * @fd2: file descriptor of second fence 349 - * @name: name of new fence 350 - * @fence: returns the fd of the new fence to userspace 351 - */ 352 - struct sync_merge_data { 353 - __s32 fd2; /* fd of second fence */ 354 - char name[32]; /* name of new fence */ 355 - __s32 fence; /* fd on newly created fence */ 356 - }; 357 - 358 - /** 359 - * struct sync_pt_info - detailed sync_pt information 360 - * @len: length of sync_pt_info including any driver_data 361 - * @obj_name: name of parent sync_timeline 362 - * @driver_name: name of driver implementing the parent 363 - * @status: status of the sync_pt 0:active 1:signaled <0:error 364 - * @timestamp_ns: timestamp of status change in nanoseconds 365 - * @driver_data: any driver dependent data 366 - */ 367 - struct sync_pt_info { 368 - __u32 len; 369 - char obj_name[32]; 370 - char driver_name[32]; 371 - __s32 status; 372 - __u64 timestamp_ns; 373 - 374 - __u8 driver_data[0]; 375 - }; 376 - 377 - /** 378 - * struct sync_fence_info_data - data returned from fence info ioctl 379 - * @len: ioctl caller writes the size of the buffer its passing in. 380 - * ioctl returns length of sync_fence_data returned to userspace 381 - * including pt_info. 382 - * @name: name of fence 383 - * @status: status of fence. 1: signaled 0:active <0:error 384 - * @pt_info: a sync_pt_info struct for every sync_pt in the fence 385 - */ 386 - struct sync_fence_info_data { 387 - __u32 len; 388 - char name[32]; 389 - __s32 status; 390 - 391 - __u8 pt_info[0]; 392 - }; 393 - 394 - #define SYNC_IOC_MAGIC '>' 395 - 396 - /** 397 - * DOC: SYNC_IOC_WAIT - wait for a fence to signal 398 - * 399 - * pass timeout in milliseconds. Waits indefinitely timeout < 0. 400 - */ 401 - #define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32) 402 - 403 - /** 404 - * DOC: SYNC_IOC_MERGE - merge two fences 405 - * 406 - * Takes a struct sync_merge_data. Creates a new fence containing copies of 407 - * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the 408 - * new fence's fd in sync_merge_data.fence 409 - */ 410 - #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_merge_data) 411 - 412 - /** 413 - * DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence 414 - * 415 - * Takes a struct sync_fence_info_data with extra space allocated for pt_info. 416 - * Caller should write the size of the buffer into len. On return, len is 417 - * updated to reflect the total size of the sync_fence_info_data including 418 - * pt_info. 419 - * 420 - * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence. 421 - * To iterate over the sync_pt_infos, use the sync_pt_info.len field. 422 - */ 423 - #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ 424 - struct sync_fence_info_data) 425 343 426 344 #endif /* _LINUX_SYNC_H */
+32
drivers/staging/android/uapi/sw_sync.h
··· 1 + /* 2 + * Copyright (C) 2012 Google, Inc. 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + */ 14 + 15 + #ifndef _UAPI_LINUX_SW_SYNC_H 16 + #define _UAPI_LINUX_SW_SYNC_H 17 + 18 + #include <linux/types.h> 19 + 20 + struct sw_sync_create_fence_data { 21 + __u32 value; 22 + char name[32]; 23 + __s32 fence; /* fd of new fence */ 24 + }; 25 + 26 + #define SW_SYNC_IOC_MAGIC 'W' 27 + 28 + #define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0,\ 29 + struct sw_sync_create_fence_data) 30 + #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32) 31 + 32 + #endif /* _UAPI_LINUX_SW_SYNC_H */
+97
drivers/staging/android/uapi/sync.h
··· 1 + /* 2 + * Copyright (C) 2012 Google, Inc. 3 + * 4 + * This program is distributed in the hope that it will be useful, 5 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 6 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 7 + * GNU General Public License for more details. 8 + * 9 + */ 10 + 11 + #ifndef _UAPI_LINUX_SYNC_H 12 + #define _UAPI_LINUX_SYNC_H 13 + 14 + #include <linux/ioctl.h> 15 + #include <linux/types.h> 16 + 17 + /** 18 + * struct sync_merge_data - data passed to merge ioctl 19 + * @fd2: file descriptor of second fence 20 + * @name: name of new fence 21 + * @fence: returns the fd of the new fence to userspace 22 + */ 23 + struct sync_merge_data { 24 + __s32 fd2; /* fd of second fence */ 25 + char name[32]; /* name of new fence */ 26 + __s32 fence; /* fd on newly created fence */ 27 + }; 28 + 29 + /** 30 + * struct sync_pt_info - detailed sync_pt information 31 + * @len: length of sync_pt_info including any driver_data 32 + * @obj_name: name of parent sync_timeline 33 + * @driver_name: name of driver implementing the parent 34 + * @status: status of the sync_pt 0:active 1:signaled <0:error 35 + * @timestamp_ns: timestamp of status change in nanoseconds 36 + * @driver_data: any driver dependent data 37 + */ 38 + struct sync_pt_info { 39 + __u32 len; 40 + char obj_name[32]; 41 + char driver_name[32]; 42 + __s32 status; 43 + __u64 timestamp_ns; 44 + 45 + __u8 driver_data[0]; 46 + }; 47 + 48 + /** 49 + * struct sync_fence_info_data - data returned from fence info ioctl 50 + * @len: ioctl caller writes the size of the buffer its passing in. 51 + * ioctl returns length of sync_fence_data returned to userspace 52 + * including pt_info. 53 + * @name: name of fence 54 + * @status: status of fence. 1: signaled 0:active <0:error 55 + * @pt_info: a sync_pt_info struct for every sync_pt in the fence 56 + */ 57 + struct sync_fence_info_data { 58 + __u32 len; 59 + char name[32]; 60 + __s32 status; 61 + 62 + __u8 pt_info[0]; 63 + }; 64 + 65 + #define SYNC_IOC_MAGIC '>' 66 + 67 + /** 68 + * DOC: SYNC_IOC_WAIT - wait for a fence to signal 69 + * 70 + * pass timeout in milliseconds. Waits indefinitely timeout < 0. 71 + */ 72 + #define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32) 73 + 74 + /** 75 + * DOC: SYNC_IOC_MERGE - merge two fences 76 + * 77 + * Takes a struct sync_merge_data. Creates a new fence containing copies of 78 + * the sync_pts in both the calling fd and sync_merge_data.fd2. Returns the 79 + * new fence's fd in sync_merge_data.fence 80 + */ 81 + #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_merge_data) 82 + 83 + /** 84 + * DOC: SYNC_IOC_FENCE_INFO - get detailed information on a fence 85 + * 86 + * Takes a struct sync_fence_info_data with extra space allocated for pt_info. 87 + * Caller should write the size of the buffer into len. On return, len is 88 + * updated to reflect the total size of the sync_fence_info_data including 89 + * pt_info. 90 + * 91 + * pt_info is a buffer containing sync_pt_infos for every sync_pt in the fence. 92 + * To iterate over the sync_pt_infos, use the sync_pt_info.len field. 93 + */ 94 + #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,\ 95 + struct sync_fence_info_data) 96 + 97 + #endif /* _UAPI_LINUX_SYNC_H */