mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karsten Keil <keil@b1-systems.de>
To: linux-kernel@vger.kernel.org
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	i4ldeveloper@listserv.isdn4linux.de
Subject: [PATCH 11/19] Fix DTMF locking bug issue
Date: Tue, 19 May 2009 15:58:30 +0200	[thread overview]
Message-ID: <2837208d4d1efab3ee06d64ffa663c0cfb189c4e.1242739648.git.kkeil@pingi.linux-pingi.de> (raw)
In-Reply-To: <cover.1242739648.git.kkeil@pingi.linux-pingi.de>

From: Andreas Eversberg <andreas@eversberg.eu>

DTMF digits were sent up to socket in locked state.
Receive audio stream was not enabled in certain condition.

Signed-off-by: Andreas Eversberg <andreas@eversberg.eu>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
---
 drivers/isdn/hardware/mISDN/hfcmulti.c |    4 +-
 drivers/isdn/mISDN/dsp.h               |    2 +-
 drivers/isdn/mISDN/dsp_core.c          |   37 +++++++++++++++++--------------
 3 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 9d8c7ff..77bba63 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -1947,8 +1947,8 @@ hfcmulti_dtmf(struct hfc_multi *hc)
 			coeff[(co<<1)|1] = mantissa;
 		}
 		if (debug & DEBUG_HFCMULTI_DTMF)
-			printk("%s: DTMF ready %08x %08x %08x %08x "
-			    "%08x %08x %08x %08x\n", __func__,
+			printk(" DTMF ready %08x %08x %08x %08x "
+			    "%08x %08x %08x %08x\n",
 			    coeff[0], coeff[1], coeff[2], coeff[3],
 			    coeff[4], coeff[5], coeff[6], coeff[7]);
 		hc->chan[ch].coeff_count++;
diff --git a/drivers/isdn/mISDN/dsp.h b/drivers/isdn/mISDN/dsp.h
index 4a1c444..41c6cfd 100644
--- a/drivers/isdn/mISDN/dsp.h
+++ b/drivers/isdn/mISDN/dsp.h
@@ -124,7 +124,7 @@ struct dsp_dtmf {
 		/* buffers one full dtmf frame */
 	u8		lastwhat, lastdigit;
 	int		count;
-	u8		digits[16]; /* just the dtmf result */
+	u8		digits[16]; /* dtmf result */
 };
 
 
diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
index d3184a0..5195f86 100644
--- a/drivers/isdn/mISDN/dsp_core.c
+++ b/drivers/isdn/mISDN/dsp_core.c
@@ -311,6 +311,7 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb)
 
 		/* check dtmf hardware */
 		dsp_dtmf_hardware(dsp);
+		dsp_rx_off(dsp);
 		break;
 	case DTMF_TONE_STOP: /* turn off DTMF */
 		if (dsp_debug & DEBUG_DSP_CORE)
@@ -657,11 +658,10 @@ get_features(struct mISDNchannel *ch)
 static int
 dsp_function(struct mISDNchannel *ch,  struct sk_buff *skb)
 {
-	struct dsp			*dsp = container_of(ch, struct dsp, ch);
+	struct dsp		*dsp = container_of(ch, struct dsp, ch);
 	struct mISDNhead	*hh;
 	int			ret = 0;
-	u8			*digits;
-	int			cont;
+	u8			*digits = NULL;
 	u_long			flags;
 
 	hh = mISDN_HEAD_P(skb);
@@ -716,40 +716,43 @@ dsp_function(struct mISDNchannel *ch,  struct sk_buff *skb)
 		/* change volume if requested */
 		if (dsp->rx_volume)
 			dsp_change_volume(skb, dsp->rx_volume);
-
 		/* check if dtmf soft decoding is turned on */
 		if (dsp->dtmf.software) {
 			digits = dsp_dtmf_goertzel_decode(dsp, skb->data,
 				skb->len, (dsp_options&DSP_OPT_ULAW)?1:0);
+		}
+		/* we need to process receive data if software */
+		if (dsp->pcm_slot_tx < 0 && dsp->pcm_slot_rx < 0) {
+			/* process data from card at cmx */
+			dsp_cmx_receive(dsp, skb);
+		}
+
+		spin_unlock_irqrestore(&dsp_lock, flags);
+
+		/* send dtmf result, if any */
+		if (digits) {
 			while (*digits) {
+				int k;
 				struct sk_buff *nskb;
 				if (dsp_debug & DEBUG_DSP_DTMF)
 					printk(KERN_DEBUG "%s: digit"
 					    "(%c) to layer %s\n",
 					    __func__, *digits, dsp->name);
-				cont = DTMF_TONE_VAL | *digits;
+				k = *digits | DTMF_TONE_VAL;
 				nskb = _alloc_mISDN_skb(PH_CONTROL_IND,
-				    MISDN_ID_ANY, sizeof(int), &cont,
-				    GFP_ATOMIC);
+					MISDN_ID_ANY, sizeof(int), &k,
+					GFP_ATOMIC);
 				if (nskb) {
 					if (dsp->up) {
 						if (dsp->up->send(
 						    dsp->up, nskb))
-						dev_kfree_skb(nskb);
+							dev_kfree_skb(nskb);
 					} else
 						dev_kfree_skb(nskb);
 				}
 				digits++;
 			}
 		}
-		/* we need to process receive data if software */
-		if (dsp->pcm_slot_tx < 0 && dsp->pcm_slot_rx < 0) {
-			/* process data from card at cmx */
-			dsp_cmx_receive(dsp, skb);
-		}
-
-		spin_unlock_irqrestore(&dsp_lock, flags);
-
 		if (dsp->rx_disabled) {
 			/* if receive is not allowed */
 			break;
@@ -789,7 +792,7 @@ dsp_function(struct mISDNchannel *ch,  struct sk_buff *skb)
 					if (dsp->up) {
 						if (dsp->up->send(
 						    dsp->up, nskb))
-						dev_kfree_skb(nskb);
+							dev_kfree_skb(nskb);
 					} else
 						dev_kfree_skb(nskb);
 				}
-- 
1.6.0.2


  parent reply	other threads:[~2009-05-19 17:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 13:27 [PATCH 00/19] mISDN update for linux-next Karsten Keil
2009-05-19 13:58 ` [PATCH 01/19] Add XHFC support for embedded Speech-Design board to hfcmulti Karsten Keil
2009-05-19 19:11   ` David Miller
2009-05-20  3:13     ` Marcel Holtmann
2009-05-20  9:12       ` Karsten Keil
2009-05-20 19:38         ` David Miller
2009-05-20  7:56   ` Andi Kleen
2009-05-20  9:19     ` Karsten Keil
2009-05-20 11:38       ` Andi Kleen
2009-05-20 12:18         ` Karsten Keil
2009-05-20 16:59           ` Karsten Keil
2009-05-19 13:58 ` [PATCH 02/19] Fix bug in XHFC registering Karsten Keil
2009-05-19 13:58 ` [PATCH 03/19] Add PCI ID for Junghanns 8S card Karsten Keil
2009-05-19 13:58 ` [PATCH 04/19] Add watchdog functionality to hfcmulti driver Karsten Keil
2009-05-19 13:58 ` [PATCH 05/19] DSP now uses ring buffer for echo canceler Karsten Keil
2009-05-19 13:58 ` [PATCH 06/19] Fix hfcmulti's PCI IRQ bug during init Karsten Keil
2009-05-19 13:58 ` [PATCH 07/19] Echo canceler now gets delay information from hardware Karsten Keil
2009-05-19 13:58 ` [PATCH 09/19] Reduce stack size in dsp_cmx_send() Karsten Keil
2009-05-19 13:58 ` [PATCH 08/19] Fixed missing spin lock on pipeline process Karsten Keil
2009-05-19 13:58 ` [PATCH 10/19] Added layer-1-hold feature Karsten Keil
2009-05-19 13:58 ` [PATCH 12/19] Hardware acceleration is now possible in conjunction with audio recording Karsten Keil
2009-05-19 13:58 ` Karsten Keil [this message]
2009-05-19 13:58 ` [PATCH 13/19] Fix TEI and SAPI handling Karsten Keil
2009-05-19 13:58 ` [PATCH 14/19] Add "sapi" information to debug messages Karsten Keil
2009-05-19 13:58 ` [PATCH 16/19] Add allocation of recvbuf[1500] at run time to reduce stack size Karsten Keil
2009-05-19 13:58 ` [PATCH 15/19] Added PCI ID for new Junghanns.net Single E1 cards Karsten Keil
2009-05-19 13:58 ` [PATCH 17/19] Fix skb leak in error cases Karsten Keil
2009-05-19 13:58 ` [PATCH 18/19] Cleanup debug messages Karsten Keil
2009-05-19 13:58 ` [PATCH 19/19] isdn: get_free_devid() failure ignored Karsten Keil
2009-05-19 22:22 ` [PATCH 00/19] mISDN update for linux-next Stephen Rothwell
2009-05-20  1:42   ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2837208d4d1efab3ee06d64ffa663c0cfb189c4e.1242739648.git.kkeil@pingi.linux-pingi.de \
    --to=keil@b1-systems.de \
    --cc=i4ldeveloper@listserv.isdn4linux.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®