Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/vchiq/dist/interface Remove buggy linux com...
details: https://anonhg.NetBSD.org/src/rev/7959bfb68300
branches: trunk
changeset: 328661:7959bfb68300
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Apr 12 13:28:41 2014 +0000
description:
Remove buggy linux completion API emulation and use the common version.
diffstat:
sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.c | 119 +---------
sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h | 24 +-
sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c | 2 +
3 files changed, 5 insertions(+), 140 deletions(-)
diffs (189 lines):
diff -r 53d326d960e1 -r 7959bfb68300 sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.c
--- a/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.c Sat Apr 12 12:24:50 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.c Sat Apr 12 13:28:41 2014 +0000
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: vchi_bsd.c,v 1.6 2014/03/27 07:59:17 skrll Exp $
+ * $Id: vchi_bsd.c,v 1.7 2014/04/12 13:28:41 skrll Exp $
*/
#include <sys/types.h>
@@ -121,123 +121,6 @@
}
/*
- * Completion API
- */
-void
-init_completion(struct completion *c)
-{
- cv_init(&c->cv, "VCHI completion cv");
- mutex_init(&c->lock, MUTEX_DEFAULT, IPL_NONE);
- c->done = 0;
-}
-
-void
-destroy_completion(struct completion *c)
-{
- cv_destroy(&c->cv);
- mutex_destroy(&c->lock);
-}
-
-void
-wait_for_completion(struct completion *c)
-{
- mutex_enter(&c->lock);
- if (!c->done)
- cv_wait(&c->cv, &c->lock);
- c->done--;
- mutex_exit(&c->lock);
-}
-
-int
-try_wait_for_completion(struct completion *c)
-{
- int res = 0;
-
- mutex_enter(&c->lock);
- if (!c->done)
- c->done--;
- else
- res = 1;
- mutex_exit(&c->lock);
- return res != 0;
-}
-
-int
-wait_for_completion_timeout(struct completion *c, unsigned long timeout)
-{
- int res = 0;
-
- mutex_enter(&c->lock);
- if (!c->done)
- res = cv_timedwait(&c->cv, &c->lock, timeout);
- if (res == 0)
- c->done--;
- mutex_exit(&c->lock);
- return res != 0;
-}
-
-int
-wait_for_completion_interruptible_timeout(struct completion *c, unsigned long timeout)
-{
- int res = 0;
-
- mutex_enter(&c->lock);
- if (!c->done)
- res = cv_timedwait_sig(&c->cv, &c->lock, timeout);
- if (res == 0)
- c->done--;
- mutex_exit(&c->lock);
- return res != 0;
-}
-
-int
-wait_for_completion_interruptible(struct completion *c)
-{
- int res = 0;
-
- mutex_enter(&c->lock);
- if (!c->done)
- res = cv_wait_sig(&c->cv, &c->lock);
- if (res == 0)
- c->done--;
- mutex_exit(&c->lock);
- return res != 0;
-}
-
-int
-wait_for_completion_killable(struct completion *c)
-{
- int res = 0;
-
- mutex_enter(&c->lock);
- if (!c->done)
- res = cv_wait_sig(&c->cv, &c->lock);
- /* TODO: check actual signals here ? */
- if (res == 0)
- c->done--;
- mutex_exit(&c->lock);
- return res != 0;
-}
-
-void
-complete(struct completion *c)
-{
- mutex_enter(&c->lock);
- c->done++;
- cv_signal(&c->cv);
- mutex_exit(&c->lock);
-}
-
-void
-complete_all(struct completion *c)
-{
- mutex_enter(&c->lock);
- c->done++;
- cv_broadcast(&c->cv);
- mutex_exit(&c->lock);
-}
-
-/*
* Semaphore API
*/
diff -r 53d326d960e1 -r 7959bfb68300 sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h
--- a/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h Sat Apr 12 12:24:50 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/compat/vchi_bsd.h Sat Apr 12 13:28:41 2014 +0000
@@ -44,6 +44,8 @@
#include <sys/rwlock.h>
#include <sys/callout.h>
+#include <linux/completion.h>
+
/*
* Copy from/to user API
*/
@@ -178,28 +180,6 @@
int del_timer_sync(struct timer_list *t);
/*
- * Completion API
- */
-struct completion {
- kcondvar_t cv;
- kmutex_t lock;
- int done;
-};
-
-void init_completion(struct completion *c);
-void destroy_completion(struct completion *c);
-int try_wait_for_completion(struct completion *);
-int wait_for_completion_interruptible(struct completion *);
-int wait_for_completion_interruptible_timeout(struct completion *, unsigned long ticks);
-int wait_for_completion_killable(struct completion *);
-void wait_for_completion(struct completion *c);
-int wait_for_completion_timeout(struct completion *c, unsigned long timeout);
-void complete(struct completion *c);
-void complete_all(struct completion *c);
-
-#define INIT_COMPLETION(x) do {(x).done = 0;} while(0)
-
-/*
* Semaphore API
*/
struct semaphore {
diff -r 53d326d960e1 -r 7959bfb68300 sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c
--- a/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sat Apr 12 12:24:50 2014 +0000
+++ b/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_2835_arm.c Sat Apr 12 13:28:41 2014 +0000
@@ -38,6 +38,8 @@
#include <sys/bus.h>
#include <sys/kmem.h>
+#include <linux/completion.h>
+
#include <uvm/uvm_extern.h>
#include <arch/arm/broadcom/bcm2835_mbox.h>
Home |
Main Index |
Thread Index |
Old Index