Commit d008b3d2 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

mISDN: Fix indenting in dsp_cmx.c

We used a script to indent this code back in 2012, but I guess it got
confused by the ifdefs and added some extra tabs.  This patch removes
them.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 40a1578d
...@@ -1676,9 +1676,9 @@ dsp_cmx_send(void *arg) ...@@ -1676,9 +1676,9 @@ dsp_cmx_send(void *arg)
#ifdef CMX_CONF_DEBUG #ifdef CMX_CONF_DEBUG
if (conf->software && members > 1) if (conf->software && members > 1)
#else #else
if (conf->software && members > 2) if (conf->software && members > 2)
#endif #endif
mustmix = 1; mustmix = 1;
} }
/* transmission required */ /* transmission required */
...@@ -1699,263 +1699,262 @@ dsp_cmx_send(void *arg) ...@@ -1699,263 +1699,262 @@ dsp_cmx_send(void *arg)
#ifdef CMX_CONF_DEBUG #ifdef CMX_CONF_DEBUG
if (conf->software && members > 1) { if (conf->software && members > 1) {
#else #else
if (conf->software && members > 2) { if (conf->software && members > 2) {
#endif #endif
/* check for hdlc conf */ /* check for hdlc conf */
member = list_entry(conf->mlist.next, member = list_entry(conf->mlist.next,
struct dsp_conf_member, list); struct dsp_conf_member, list);
if (member->dsp->hdlc) if (member->dsp->hdlc)
continue; continue;
/* mix all data */ /* mix all data */
memset(mixbuffer, 0, length * sizeof(s32)); memset(mixbuffer, 0, length * sizeof(s32));
list_for_each_entry(member, &conf->mlist, list) { list_for_each_entry(member, &conf->mlist, list) {
dsp = member->dsp; dsp = member->dsp;
/* get range of data to mix */ /* get range of data to mix */
c = mixbuffer; c = mixbuffer;
q = dsp->rx_buff; q = dsp->rx_buff;
r = dsp->rx_R; r = dsp->rx_R;
rr = (r + length) & CMX_BUFF_MASK; rr = (r + length) & CMX_BUFF_MASK;
/* add member's data */ /* add member's data */
while (r != rr) { while (r != rr) {
*c++ += dsp_audio_law_to_s32[q[r]]; *c++ += dsp_audio_law_to_s32[q[r]];
r = (r + 1) & CMX_BUFF_MASK; r = (r + 1) & CMX_BUFF_MASK;
}
} }
}
/* process each member */ /* process each member */
list_for_each_entry(member, &conf->mlist, list) { list_for_each_entry(member, &conf->mlist, list) {
/* transmission */ /* transmission */
dsp_cmx_send_member(member->dsp, length, dsp_cmx_send_member(member->dsp, length,
mixbuffer, members); mixbuffer, members);
} }
}
}
/* delete rx-data, increment buffers, change pointers */
list_for_each_entry(dsp, &dsp_ilist, list) {
if (dsp->hdlc)
continue;
p = dsp->rx_buff;
q = dsp->tx_buff;
r = dsp->rx_R;
/* move receive pointer when receiving */
if (!dsp->rx_is_off) {
rr = (r + length) & CMX_BUFF_MASK;
/* delete rx-data */
while (r != rr) {
p[r] = dsp_silence;
r = (r + 1) & CMX_BUFF_MASK;
} }
/* increment rx-buffer pointer */
dsp->rx_R = r; /* write incremented read pointer */
} }
/* delete rx-data, increment buffers, change pointers */ /* check current rx_delay */
list_for_each_entry(dsp, &dsp_ilist, list) { delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
if (dsp->hdlc) if (delay >= CMX_BUFF_HALF)
continue; delay = 0; /* will be the delay before next write */
p = dsp->rx_buff; /* check for lower delay */
q = dsp->tx_buff; if (delay < dsp->rx_delay[0])
r = dsp->rx_R; dsp->rx_delay[0] = delay;
/* move receive pointer when receiving */ /* check current tx_delay */
if (!dsp->rx_is_off) { delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
rr = (r + length) & CMX_BUFF_MASK; if (delay >= CMX_BUFF_HALF)
delay = 0; /* will be the delay before next write */
/* check for lower delay */
if (delay < dsp->tx_delay[0])
dsp->tx_delay[0] = delay;
if (jittercheck) {
/* find the lowest of all rx_delays */
delay = dsp->rx_delay[0];
i = 1;
while (i < MAX_SECONDS_JITTER_CHECK) {
if (delay > dsp->rx_delay[i])
delay = dsp->rx_delay[i];
i++;
}
/*
* remove rx_delay only if we have delay AND we
* have not preset cmx_delay AND
* the delay is greater dsp_poll
*/
if (delay > dsp_poll && !dsp->cmx_delay) {
if (dsp_debug & DEBUG_DSP_CLOCK)
printk(KERN_DEBUG
"%s lowest rx_delay of %d bytes for"
" dsp %s are now removed.\n",
__func__, delay,
dsp->name);
r = dsp->rx_R;
rr = (r + delay - (dsp_poll >> 1))
& CMX_BUFF_MASK;
/* delete rx-data */ /* delete rx-data */
while (r != rr) { while (r != rr) {
p[r] = dsp_silence; p[r] = dsp_silence;
r = (r + 1) & CMX_BUFF_MASK; r = (r + 1) & CMX_BUFF_MASK;
} }
/* increment rx-buffer pointer */ /* increment rx-buffer pointer */
dsp->rx_R = r; /* write incremented read pointer */ dsp->rx_R = r;
/* write incremented read pointer */
} }
/* find the lowest of all tx_delays */
/* check current rx_delay */ delay = dsp->tx_delay[0];
delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK; i = 1;
if (delay >= CMX_BUFF_HALF) while (i < MAX_SECONDS_JITTER_CHECK) {
delay = 0; /* will be the delay before next write */ if (delay > dsp->tx_delay[i])
/* check for lower delay */ delay = dsp->tx_delay[i];
if (delay < dsp->rx_delay[0]) i++;
dsp->rx_delay[0] = delay; }
/* check current tx_delay */ /*
delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK; * remove delay only if we have delay AND we
if (delay >= CMX_BUFF_HALF) * have enabled tx_dejitter
delay = 0; /* will be the delay before next write */ */
/* check for lower delay */ if (delay > dsp_poll && dsp->tx_dejitter) {
if (delay < dsp->tx_delay[0]) if (dsp_debug & DEBUG_DSP_CLOCK)
dsp->tx_delay[0] = delay; printk(KERN_DEBUG
if (jittercheck) { "%s lowest tx_delay of %d bytes for"
/* find the lowest of all rx_delays */ " dsp %s are now removed.\n",
delay = dsp->rx_delay[0]; __func__, delay,
i = 1; dsp->name);
while (i < MAX_SECONDS_JITTER_CHECK) { r = dsp->tx_R;
if (delay > dsp->rx_delay[i]) rr = (r + delay - (dsp_poll >> 1))
delay = dsp->rx_delay[i]; & CMX_BUFF_MASK;
i++; /* delete tx-data */
} while (r != rr) {
/* q[r] = dsp_silence;
* remove rx_delay only if we have delay AND we r = (r + 1) & CMX_BUFF_MASK;
* have not preset cmx_delay AND
* the delay is greater dsp_poll
*/
if (delay > dsp_poll && !dsp->cmx_delay) {
if (dsp_debug & DEBUG_DSP_CLOCK)
printk(KERN_DEBUG
"%s lowest rx_delay of %d bytes for"
" dsp %s are now removed.\n",
__func__, delay,
dsp->name);
r = dsp->rx_R;
rr = (r + delay - (dsp_poll >> 1))
& CMX_BUFF_MASK;
/* delete rx-data */
while (r != rr) {
p[r] = dsp_silence;
r = (r + 1) & CMX_BUFF_MASK;
}
/* increment rx-buffer pointer */
dsp->rx_R = r;
/* write incremented read pointer */
}
/* find the lowest of all tx_delays */
delay = dsp->tx_delay[0];
i = 1;
while (i < MAX_SECONDS_JITTER_CHECK) {
if (delay > dsp->tx_delay[i])
delay = dsp->tx_delay[i];
i++;
}
/*
* remove delay only if we have delay AND we
* have enabled tx_dejitter
*/
if (delay > dsp_poll && dsp->tx_dejitter) {
if (dsp_debug & DEBUG_DSP_CLOCK)
printk(KERN_DEBUG
"%s lowest tx_delay of %d bytes for"
" dsp %s are now removed.\n",
__func__, delay,
dsp->name);
r = dsp->tx_R;
rr = (r + delay - (dsp_poll >> 1))
& CMX_BUFF_MASK;
/* delete tx-data */
while (r != rr) {
q[r] = dsp_silence;
r = (r + 1) & CMX_BUFF_MASK;
}
/* increment rx-buffer pointer */
dsp->tx_R = r;
/* write incremented read pointer */
}
/* scroll up delays */
i = MAX_SECONDS_JITTER_CHECK - 1;
while (i) {
dsp->rx_delay[i] = dsp->rx_delay[i - 1];
dsp->tx_delay[i] = dsp->tx_delay[i - 1];
i--;
} }
dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ /* increment rx-buffer pointer */
dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */ dsp->tx_R = r;
/* write incremented read pointer */
} }
/* scroll up delays */
i = MAX_SECONDS_JITTER_CHECK - 1;
while (i) {
dsp->rx_delay[i] = dsp->rx_delay[i - 1];
dsp->tx_delay[i] = dsp->tx_delay[i - 1];
i--;
}
dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
} }
}
/* if next event would be in the past ... */ /* if next event would be in the past ... */
if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0) if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0)
dsp_spl_jiffies = jiffies + 1; dsp_spl_jiffies = jiffies + 1;
else else
dsp_spl_jiffies += dsp_tics; dsp_spl_jiffies += dsp_tics;
dsp_spl_tl.expires = dsp_spl_jiffies; dsp_spl_tl.expires = dsp_spl_jiffies;
add_timer(&dsp_spl_tl); add_timer(&dsp_spl_tl);
/* unlock */ /* unlock */
spin_unlock_irqrestore(&dsp_lock, flags); spin_unlock_irqrestore(&dsp_lock, flags);
} }
/* /*
* audio data is transmitted from upper layer to the dsp * audio data is transmitted from upper layer to the dsp
*/ */
void void
dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb) dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb)
{ {
u_int w, ww; u_int w, ww;
u8 *d, *p; u8 *d, *p;
int space; /* todo: , l = skb->len; */ int space; /* todo: , l = skb->len; */
#ifdef CMX_TX_DEBUG #ifdef CMX_TX_DEBUG
char debugbuf[256] = ""; char debugbuf[256] = "";
#endif #endif
/* check if there is enough space, and then copy */ /* check if there is enough space, and then copy */
w = dsp->tx_W; w = dsp->tx_W;
ww = dsp->tx_R; ww = dsp->tx_R;
p = dsp->tx_buff; p = dsp->tx_buff;
d = skb->data; d = skb->data;
space = (ww - w - 1) & CMX_BUFF_MASK; space = (ww - w - 1) & CMX_BUFF_MASK;
/* write-pointer should not overrun nor reach read pointer */ /* write-pointer should not overrun nor reach read pointer */
if (space < skb->len) { if (space < skb->len) {
/* write to the space we have left */ /* write to the space we have left */
ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */ ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */
if (dsp_debug & DEBUG_DSP_CLOCK) if (dsp_debug & DEBUG_DSP_CLOCK)
printk(KERN_DEBUG "%s: TX overflow space=%d skb->len=" printk(KERN_DEBUG "%s: TX overflow space=%d skb->len="
"%d, w=0x%04x, ww=0x%04x\n", __func__, space, "%d, w=0x%04x, ww=0x%04x\n", __func__, space,
skb->len, w, ww); skb->len, w, ww);
} else } else
/* write until all byte are copied */ /* write until all byte are copied */
ww = (w + skb->len) & CMX_BUFF_MASK; ww = (w + skb->len) & CMX_BUFF_MASK;
dsp->tx_W = ww; dsp->tx_W = ww;
/* show current buffer */ /* show current buffer */
#ifdef CMX_DEBUG #ifdef CMX_DEBUG
printk(KERN_DEBUG printk(KERN_DEBUG
"cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n", "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
(u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name); (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
#endif #endif
/* copy transmit data to tx-buffer */ /* copy transmit data to tx-buffer */
#ifdef CMX_TX_DEBUG #ifdef CMX_TX_DEBUG
sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p); sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p);
#endif #endif
while (w != ww) { while (w != ww) {
#ifdef CMX_TX_DEBUG #ifdef CMX_TX_DEBUG
if (strlen(debugbuf) < 48) if (strlen(debugbuf) < 48)
sprintf(debugbuf + strlen(debugbuf), " %02x", *d); sprintf(debugbuf + strlen(debugbuf), " %02x", *d);
#endif #endif
p[w] = *d++; p[w] = *d++;
w = (w + 1) & CMX_BUFF_MASK; w = (w + 1) & CMX_BUFF_MASK;
} }
#ifdef CMX_TX_DEBUG #ifdef CMX_TX_DEBUG
printk(KERN_DEBUG "%s\n", debugbuf); printk(KERN_DEBUG "%s\n", debugbuf);
#endif #endif
} }
/* /*
* hdlc data is received from card and sent to all members. * hdlc data is received from card and sent to all members.
*/ */
void void
dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb) dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb)
{ {
struct sk_buff *nskb = NULL; struct sk_buff *nskb = NULL;
struct dsp_conf_member *member; struct dsp_conf_member *member;
struct mISDNhead *hh; struct mISDNhead *hh;
/* not if not active */
if (!dsp->b_active)
return;
/* check if we have sompen */ /* not if not active */
if (skb->len < 1) if (!dsp->b_active)
return; return;
/* no conf */ /* check if we have sompen */
if (!dsp->conf) { if (skb->len < 1)
/* in case of software echo */ return;
if (dsp->echo.software) {
nskb = skb_clone(skb, GFP_ATOMIC); /* no conf */
if (nskb) { if (!dsp->conf) {
hh = mISDN_HEAD_P(nskb); /* in case of software echo */
hh->prim = PH_DATA_REQ; if (dsp->echo.software) {
hh->id = 0; nskb = skb_clone(skb, GFP_ATOMIC);
skb_queue_tail(&dsp->sendq, nskb); if (nskb) {
schedule_work(&dsp->workq); hh = mISDN_HEAD_P(nskb);
} hh->prim = PH_DATA_REQ;
hh->id = 0;
skb_queue_tail(&dsp->sendq, nskb);
schedule_work(&dsp->workq);
} }
return;
} }
/* in case of hardware conference */ return;
if (dsp->conf->hardware) }
return; /* in case of hardware conference */
list_for_each_entry(member, &dsp->conf->mlist, list) { if (dsp->conf->hardware)
if (dsp->echo.software || member->dsp != dsp) { return;
nskb = skb_clone(skb, GFP_ATOMIC); list_for_each_entry(member, &dsp->conf->mlist, list) {
if (nskb) { if (dsp->echo.software || member->dsp != dsp) {
hh = mISDN_HEAD_P(nskb); nskb = skb_clone(skb, GFP_ATOMIC);
hh->prim = PH_DATA_REQ; if (nskb) {
hh->id = 0; hh = mISDN_HEAD_P(nskb);
skb_queue_tail(&member->dsp->sendq, nskb); hh->prim = PH_DATA_REQ;
schedule_work(&member->dsp->workq); hh->id = 0;
} skb_queue_tail(&member->dsp->sendq, nskb);
schedule_work(&member->dsp->workq);
} }
} }
} }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment