[svn-commits] fjoe: freebsd/trunk r9186 - in /freebsd/trunk: drivers/dahdi/voicebus/ driver...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 24 09:16:00 CDT 2010
Author: fjoe
Date: Tue Aug 24 09:15:58 2010
New Revision: 9186
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9186
Log:
- destroy vpmadt032_cmd structures properly
- fix completion API emulation
Modified:
freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c
freebsd/trunk/drivers/dahdi/voicebus/GpakCust.h
freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c
freebsd/trunk/drivers/dahdi/wcte12xp/base.c
freebsd/trunk/freebsd/dahdi/bsd-compat.c
freebsd/trunk/include/dahdi/compat/bsd.h
Modified: freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/GpakCust.c Tue Aug 24 09:15:58 2010
@@ -86,6 +86,12 @@
return cmd;
}
+void vpmadt032_free_cmd(struct vpmadt032_cmd *cmd)
+{
+ destroy_completion(&cmd->complete);
+ kfree(cmd);
+}
+
/* Wait for any outstanding commands to the VPMADT032 to complete */
static inline int vpmadt032_io_wait(struct vpmadt032 *vpm)
{
@@ -137,7 +143,7 @@
spin_lock_irqsave(&vpm->list_lock, flags);
list_del(&cmd->node);
spin_unlock_irqrestore(&vpm->list_lock, flags);
- kfree(cmd);
+ vpmadt032_free_cmd(cmd);
return -EIO;
}
@@ -148,7 +154,7 @@
}
list_del(&cmd->node);
- kfree(cmd);
+ vpmadt032_free_cmd(cmd);
return 0;
}
@@ -756,8 +762,7 @@
while (!list_empty(&local_list)) {
cmd = list_entry(local_list.next, struct vpmadt032_cmd, node);
list_del(&cmd->node);
- destroy_completion(&cmd->complete);
- kfree(cmd);
+ vpmadt032_free_cmd(cmd);
}
spin_lock(&vpm->change_list_lock);
Modified: freebsd/trunk/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/GpakCust.h Tue Aug 24 09:15:58 2010
@@ -182,6 +182,8 @@
return cmd;
}
+void vpmadt032_free_cmd(struct vpmadt032_cmd *cmd);
+
static inline void vpmadt032_resend(struct vpmadt032 *vpm)
{
unsigned long flags;
Modified: freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c Tue Aug 24 09:15:58 2010
@@ -785,7 +785,7 @@
cmd->data = (0xff & readchunk[CMD_BYTE(25, 1, 0)]) << 8;
cmd->data |= readchunk[CMD_BYTE(25, 2, 0)];
if (cmd->desc & __VPM150M_WR) {
- kfree(cmd);
+ vpmadt032_free_cmd(cmd);
} else {
cmd->desc |= __VPM150M_FIN;
complete(&cmd->complete);
Modified: freebsd/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wcte12xp/base.c Tue Aug 24 09:15:58 2010
@@ -298,7 +298,7 @@
cmd->data = (0xff & readchunk[CMD_BYTE(2, 1, 1)]) << 8;
cmd->data |= readchunk[CMD_BYTE(2, 2, 1)];
if (cmd->desc & __VPM150M_WR) {
- kfree(cmd);
+ vpmadt032_free_cmd(cmd);
} else {
cmd->desc |= __VPM150M_FIN;
complete(&cmd->complete);
Modified: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Tue Aug 24 09:15:58 2010
@@ -68,7 +68,6 @@
tasklet_hi_schedule(struct tasklet_struct *t)
{
taskqueue_enqueue(taskqueue_fast, &t->task);
-// wakeup_one(taskqueue_fast);
}
void
@@ -123,8 +122,10 @@
mtx_init(&t->mtx, "dahdi timer lock", NULL, MTX_SPIN);
callout_init(&t->callout, CALLOUT_MPSAFE);
t->expires = 0;
- // function and data are not initialized intentionally:
- // they are not initialized by Linux implementation too
+ /*
+ * function and data are not initialized intentionally:
+ * they are not initialized by Linux implementation too
+ */
}
void
@@ -175,6 +176,7 @@
{
cv_init(&c->cv, "DAHDI completion cv");
mtx_init(&c->lock, "DAHDI completion lock", "condvar", MTX_DEF);
+ c->done = 0;
}
void
@@ -188,17 +190,19 @@
wait_for_completion(struct completion *c)
{
mtx_lock(&c->lock);
- cv_wait(&c->cv, &c->lock);
+ if (!c->done)
+ cv_wait(&c->cv, &c->lock);
mtx_unlock(&c->lock);
}
int
wait_for_completion_timeout(struct completion *c, unsigned long timeout)
{
- int res;
+ int res = 0;
mtx_lock(&c->lock);
- res = cv_timedwait(&c->cv, &c->lock, timeout);
+ if (!c->done)
+ res = cv_timedwait(&c->cv, &c->lock, timeout);
mtx_unlock(&c->lock);
return res == 0;
}
@@ -206,7 +210,10 @@
void
complete(struct completion *c)
{
+ mtx_lock(&c->lock);
+ c->done = 1;
cv_signal(&c->cv);
+ mtx_unlock(&c->lock);
}
/*
@@ -264,7 +271,6 @@
{
work->tq = taskqueue_fast;
taskqueue_enqueue(taskqueue_fast, &work->task);
-// wakeup_one(taskqueue_fast);
}
void
@@ -316,7 +322,6 @@
{
work->tq = wq->tq;
taskqueue_enqueue(wq->tq, &work->task);
-// wakeup_one(wq->tq);
}
/*
Modified: freebsd/trunk/include/dahdi/compat/bsd.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/compat/bsd.h?view=diff&rev=9186&r1=9185&r2=9186
==============================================================================
--- freebsd/trunk/include/dahdi/compat/bsd.h (original)
+++ freebsd/trunk/include/dahdi/compat/bsd.h Tue Aug 24 09:15:58 2010
@@ -245,9 +245,9 @@
struct completion {
struct cv cv;
struct mtx lock;
-};
-
-#define INIT_COMPLETION(c)
+ int done;
+};
+
void init_completion(struct completion *c);
void destroy_completion(struct completion *c);
void wait_for_completion(struct completion *c);
More information about the svn-commits
mailing list