[PATCH 03/11] staging/android: remove .fill_driver_data() timeline ops

From: Gustavo Padovan
Date: Tue Jan 26 2016 - 13:31:14 EST


From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>

The .fill_driver_data() ops was just a useless abstraction for
fence_ops op of the same name.

Now that we use fence->seqno to store the value it is cleaner to
remove the abstraction and fill the data directly.

Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
drivers/staging/android/sw_sync.c | 14 --------------
drivers/staging/android/sync.c | 9 +++++----
drivers/staging/android/sync.h | 7 -------
3 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index b9d53d3..428e22c 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,19 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
}
EXPORT_SYMBOL(sw_sync_pt_create);

-static int sw_sync_fill_driver_data(struct fence *fence,
- void *data, int size)
-{
- struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
- if (size < sizeof(pt->value))
- return -ENOMEM;
-
- memcpy(data, &pt->value, sizeof(pt->value));
-
- return sizeof(pt->value);
-}
-
static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
char *str, int size)
{
@@ -68,7 +55,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char *str, int size)

static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
- .fill_driver_data = sw_sync_fill_driver_data,
.timeline_value_str = sw_sync_timeline_value_str,
.fence_value_str = sw_sync_fence_value_str,
};
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 4eea5c3..39af5fb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -185,11 +185,12 @@ static bool android_fence_enable_signaling(struct fence *fence)
static int android_fence_fill_driver_data(struct fence *fence,
void *data, int size)
{
- struct sync_timeline *parent = fence_parent(fence);
+ if (size < sizeof(fence->seqno))
+ return -ENOMEM;
+
+ memcpy(data, &fence->seqno, sizeof(fence->seqno));

- if (!parent->ops->fill_driver_data)
- return 0;
- return parent->ops->fill_driver_data(fence, data, size);
+ return sizeof(fence->seqno);
}

static void android_fence_value_str(struct fence *fence,
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 4d3dfbf..500838b 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
/**
* struct sync_timeline_ops - sync object implementation ops
* @driver_name: name of the implementation
- * @fill_driver_data: write implementation specific driver data to data.
- * should return an error if there is not enough room
- * as specified by size. This information is returned
- * to userspace by SYNC_IOC_FENCE_INFO.
* @timeline_value_str: fill str with the value of the sync_timeline's counter
* @fence_value_str: fill str with the value of the fence
*/
@@ -38,9 +34,6 @@ struct sync_timeline_ops {
const char *driver_name;

/* optional */
- int (*fill_driver_data)(struct fence *fence, void *data, int size);
-
- /* optional */
void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
int size);

--
2.5.0