[PATCH v2 01/11] staging/android: remove SYNC_WAIT ioctl

From: Gustavo Padovan
Date: Tue Feb 02 2016 - 08:23:43 EST


From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>

This ioctl is replicating the work of poll() syscall so let's take the
opportunity that this is still on staging tree and remove the duplication
and force new users to use the poll() standard interface.

Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
drivers/staging/android/sync.c | 52 ------------------------------------
drivers/staging/android/sync.h | 13 ---------
drivers/staging/android/trace/sync.h | 44 ------------------------------
drivers/staging/android/uapi/sync.h | 7 -----
4 files changed, 116 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 5fa4779..381209a 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -300,44 +300,6 @@ struct sync_file *sync_file_merge(const char *name,
}
EXPORT_SYMBOL(sync_file_merge);

-int sync_file_wait(struct sync_file *sync_file, long timeout)
-{
- long ret;
- int i;
-
- if (timeout < 0)
- timeout = MAX_SCHEDULE_TIMEOUT;
- else
- timeout = msecs_to_jiffies(timeout);
-
- trace_sync_wait(sync_file, 1);
- for (i = 0; i < sync_file->num_fences; ++i)
- trace_fence(sync_file->cbs[i].fence);
- ret = wait_event_interruptible_timeout(sync_file->wq,
- atomic_read(&sync_file->status) <= 0,
- timeout);
- trace_sync_wait(sync_file, 0);
-
- if (ret < 0) {
- return ret;
- } else if (ret == 0) {
- if (timeout) {
- pr_info("sync_file timeout on [%p] after %dms\n",
- sync_file, jiffies_to_msecs(timeout));
- sync_dump();
- }
- return -ETIME;
- }
-
- ret = atomic_read(&sync_file->status);
- if (ret) {
- pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
- sync_dump();
- }
- return ret;
-}
-EXPORT_SYMBOL(sync_file_wait);
-
static const char *android_fence_get_driver_name(struct fence *fence)
{
struct sync_timeline *parent = fence_parent(fence);
@@ -478,17 +440,6 @@ static unsigned int sync_file_poll(struct file *file, poll_table *wait)
return 0;
}

-static long sync_file_ioctl_wait(struct sync_file *sync_file,
- unsigned long arg)
-{
- __s32 value;
-
- if (copy_from_user(&value, (void __user *)arg, sizeof(value)))
- return -EFAULT;
-
- return sync_file_wait(sync_file, value);
-}
-
static long sync_file_ioctl_merge(struct sync_file *sync_file,
unsigned long arg)
{
@@ -629,9 +580,6 @@ static long sync_file_ioctl(struct file *file, unsigned int cmd,
struct sync_file *sync_file = file->private_data;

switch (cmd) {
- case SYNC_IOC_WAIT:
- return sync_file_ioctl_wait(sync_file, arg);
-
case SYNC_IOC_MERGE:
return sync_file_ioctl_merge(sync_file, arg);

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 8980b55..af1af99 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -18,7 +18,6 @@
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/spinlock.h>
-#include <linux/wait.h>
#include <linux/fence.h>

#include "uapi/sync.h"
@@ -230,18 +229,6 @@ void sync_file_put(struct sync_file *sync_file);
*/
void sync_file_install(struct sync_file *sync_file, int fd);

-/**
- * sync_file_wait() - wait on sync file
- * @sync_file: file to wait on
- * @tiemout: timeout in ms
- *
- * Wait for @sync_file to be signaled or have an error. Waits indefinitely
- * if @timeout < 0.
- *
- * Returns 0 if fence signaled, > 0 if it is still active and <0 on error
- */
-int sync_file_wait(struct sync_file *sync_file, long timeout);
-
#ifdef CONFIG_DEBUG_FS

void sync_timeline_debug_add(struct sync_timeline *obj);
diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h
index 87c60e9..a0f80f4 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -32,50 +32,6 @@ TRACE_EVENT(sync_timeline,
TP_printk("name=%s value=%s", __get_str(name), __entry->value)
);

-TRACE_EVENT(sync_wait,
- TP_PROTO(struct sync_file *sync_file, int begin),
-
- TP_ARGS(sync_file, begin),
-
- TP_STRUCT__entry(
- __string(name, sync_file->name)
- __field(s32, status)
- __field(u32, begin)
- ),
-
- TP_fast_assign(
- __assign_str(name, sync_file->name);
- __entry->status = atomic_read(&sync_file->status);
- __entry->begin = begin;
- ),
-
- TP_printk("%s name=%s state=%d", __entry->begin ? "begin" : "end",
- __get_str(name), __entry->status)
-);
-
-TRACE_EVENT(fence,
- TP_PROTO(struct fence *fence),
-
- TP_ARGS(fence),
-
- TP_STRUCT__entry(
- __string(timeline, fence->ops->get_timeline_name(fence))
- __array(char, value, 32)
- ),
-
- TP_fast_assign(
- __assign_str(timeline, fence->ops->get_timeline_name(fence));
- if (fence->ops->fence_value_str) {
- fence->ops->fence_value_str(fence, __entry->value,
- sizeof(__entry->value));
- } else {
- __entry->value[0] = '\0';
- }
- ),
-
- TP_printk("name=%s value=%s", __get_str(timeline), __entry->value)
-);
-
#endif /* if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ) */

/* This part must be outside protection */
diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h
index 73deb69..6c88c80 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -65,13 +65,6 @@ struct sync_file_info_data {
#define SYNC_IOC_MAGIC '>'

/**
- * DOC: SYNC_IOC_WAIT - wait for a fence to signal
- *
- * pass timeout in milliseconds. Waits indefinitely timeout < 0.
- */
-#define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32)
-
-/**
* DOC: SYNC_IOC_MERGE - merge two fences
*
* Takes a struct sync_merge_data. Creates a new fence containing copies of
--
2.5.0