[PATCH v2 09/11] dma-buf/sync_timeline: de-stage sync_timeline

From: Gustavo Padovan
Date: Wed Jan 27 2016 - 08:32:30 EST


From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>

De-stage the remaining bit of sync framework: sync_timeline and sw_sync
plus some debugging routines.

Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
drivers/dma-buf/Kconfig | 10 +++++++
drivers/dma-buf/Makefile | 3 +-
.../{staging/android/uapi => dma-buf}/sw_sync.h | 0
drivers/{staging/android => dma-buf}/sync_debug.c | 5 ++--
drivers/dma-buf/sync_debug.h | 35 ++++++++++++++++++++++
.../android/sync.c => dma-buf/sync_timeline.c} | 7 +++--
drivers/staging/android/Kconfig | 20 -------------
.../sync.h => include/linux/sync_timeline.h | 24 +++------------
.../sync.h => include/trace/events/sync_timeline.h | 9 +++---
9 files changed, 62 insertions(+), 51 deletions(-)
rename drivers/{staging/android/uapi => dma-buf}/sw_sync.h (100%)
rename drivers/{staging/android => dma-buf}/sync_debug.c (99%)
create mode 100644 drivers/dma-buf/sync_debug.h
rename drivers/{staging/android/sync.c => dma-buf/sync_timeline.c} (98%)
rename drivers/staging/android/sync.h => include/linux/sync_timeline.h (85%)
rename drivers/staging/android/trace/sync.h => include/trace/events/sync_timeline.h (73%)

diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index 9824bc4..73df024 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -8,4 +8,14 @@ config SYNC_FILE
---help---
This option enables the fence framework synchronization to export
sync_files to userspace that can represent one or more fences.
+
+config SW_SYNC
+ bool "Software synchronization objects"
+ default n
+ depends on SYNC_FILE
+ ---help---
+ A sync object driver that uses a 32bit counter to coordinate
+ synchronization. Useful when there is no hardware primitive backing
+ the synchronization.
+
endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 4a424ec..78d8ec4 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,2 +1,3 @@
obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
-obj-$(CONFIG_SYNC_FILE) += sync_file.o
+obj-$(CONFIG_SYNC_FILE) += sync_file.o sync_debug.o
+obj-$(CONFIG_SW_SYNC) += sync_timeline.o
diff --git a/drivers/staging/android/uapi/sw_sync.h b/drivers/dma-buf/sw_sync.h
similarity index 100%
rename from drivers/staging/android/uapi/sw_sync.h
rename to drivers/dma-buf/sw_sync.h
diff --git a/drivers/staging/android/sync_debug.c b/drivers/dma-buf/sync_debug.c
similarity index 99%
rename from drivers/staging/android/sync_debug.c
rename to drivers/dma-buf/sync_debug.c
index 9312e6f..7da9ff5 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -30,9 +30,10 @@
#include <linux/sync_file.h>
#include <linux/types.h>
#include <linux/kconfig.h>
+#include <linux/sync_timeline.h>

-#include "uapi/sw_sync.h"
-#include "sync.h"
+#include "sync_debug.h"
+#include "sw_sync.h"

#ifdef CONFIG_DEBUG_FS

diff --git a/drivers/dma-buf/sync_debug.h b/drivers/dma-buf/sync_debug.h
new file mode 100644
index 0000000..5b71685
--- /dev/null
+++ b/drivers/dma-buf/sync_debug.h
@@ -0,0 +1,35 @@
+/*
+ * drivers/dma-buf/sync_debug.h
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SYNC_DEBUG_H
+#define _LINUX_SYNC_DEBUG_H
+
+#include <linux/types.h>
+#include <linux/sync_timeline.h>
+#include <linux/sync_file.h>
+
+#ifdef CONFIG_DEBUG_FS
+void sync_timeline_debug_add(struct sync_timeline *obj);
+void sync_timeline_debug_remove(struct sync_timeline *obj);
+void sync_file_debug_add(struct sync_file *sync_file);
+void sync_file_debug_remove(struct sync_file *sync_file);
+void sync_dump(void);
+
+#else
+#define sync_timeline_debug_add(obj)
+#define sync_timeline_debug_remove(obj)
+#define sync_file_debug_add(fence)
+#define sync_file_debug_remove(fence)
+#define sync_dump()
+#endif
+
+#endif /* _LINUX_SYNC_DEBUG_H */
diff --git a/drivers/staging/android/sync.c b/drivers/dma-buf/sync_timeline.c
similarity index 98%
rename from drivers/staging/android/sync.c
rename to drivers/dma-buf/sync_timeline.c
index ea816dd..b354b0c 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/dma-buf/sync_timeline.c
@@ -22,11 +22,12 @@
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/anon_inodes.h>
-
-#include "sync.h"
+#include <linux/sync_timeline.h>

#define CREATE_TRACE_POINTS
-#include "trace/sync.h"
+#include <trace/events/sync_timeline.h>
+
+#include "sync_debug.h"

static const struct fence_ops timeline_fence_ops;

diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 2756988..4b18fee 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -38,26 +38,6 @@ config ANDROID_LOW_MEMORY_KILLER
scripts (/init.rc), and it defines priority values with minimum free memory size
for each priority.

-config SYNC
- bool "Synchronization framework"
- default n
- select ANON_INODES
- select DMA_SHARED_BUFFER
- ---help---
- This option enables the framework for synchronization between multiple
- drivers. Sync implementations can take advantage of hardware
- synchronization built into devices like GPUs.
-
-config SW_SYNC
- bool "Software synchronization objects"
- default n
- depends on SYNC
- depends on SYNC_FILE
- ---help---
- A sync object driver that uses a 32bit counter to coordinate
- synchronization. Useful when there is no hardware primitive backing
- the synchronization.
-
source "drivers/staging/android/ion/Kconfig"

endif # if ANDROID
diff --git a/drivers/staging/android/sync.h b/include/linux/sync_timeline.h
similarity index 85%
rename from drivers/staging/android/sync.h
rename to include/linux/sync_timeline.h
index be94a80..27a2eda 100644
--- a/drivers/staging/android/sync.h
+++ b/include/linux/sync_timeline.h
@@ -1,5 +1,5 @@
/*
- * include/linux/sync.h
+ * include/linux/sync_timeline.h
*
* Copyright (C) 2012 Google, Inc.
*
@@ -10,8 +10,8 @@
*
*/

-#ifndef _LINUX_SYNC_H
-#define _LINUX_SYNC_H
+#ifndef _LINUX_SYNC_TIMELINE_H
+#define _LINUX_SYNC_TIMELINE_H

#include <linux/types.h>
#include <linux/kref.h>
@@ -111,20 +111,4 @@ void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc);
struct fence *sync_pt_create(struct sync_timeline *parent, int size,
unsigned int inc);

-#ifdef CONFIG_DEBUG_FS
-
-void sync_timeline_debug_add(struct sync_timeline *obj);
-void sync_timeline_debug_remove(struct sync_timeline *obj);
-void sync_file_debug_add(struct sync_file *fence);
-void sync_file_debug_remove(struct sync_file *fence);
-void sync_dump(void);
-
-#else
-# define sync_timeline_debug_add(obj)
-# define sync_timeline_debug_remove(obj)
-# define sync_file_debug_add(fence)
-# define sync_file_debug_remove(fence)
-# define sync_dump()
-#endif
-
-#endif /* _LINUX_SYNC_H */
+#endif /* _LINUX_SYNC_TIMELINE_H */
diff --git a/drivers/staging/android/trace/sync.h b/include/trace/events/sync_timeline.h
similarity index 73%
rename from drivers/staging/android/trace/sync.h
rename to include/trace/events/sync_timeline.h
index d7f6457f..c4b769b 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/include/trace/events/sync_timeline.h
@@ -1,11 +1,10 @@
#undef TRACE_SYSTEM
-#define TRACE_INCLUDE_PATH ../../drivers/staging/android/trace
-#define TRACE_SYSTEM sync
+#define TRACE_SYSTEM sync_timeline

-#if !defined(_TRACE_SYNC_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_SYNC_H
+#if !defined(_TRACE_SYNC_TIMELINE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_SYNC_TIMELINE_H

-#include "../sync.h"
+#include <linux/sync_timeline.h>
#include <linux/tracepoint.h>

TRACE_EVENT(sync_timeline,
--
2.5.0