From: "Richard A. Holden III" <aciddeath@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "Richard A. Holden III" <aciddeath@gmail.com>, alan@lxorguk.ukuu.org.uk
Subject: [PATCH 01/10] ixj: Remove code duplication for processing codec names.
Date: Wed, 8 Oct 2008 14:41:36 -0600 [thread overview]
Message-ID: <b1f8a69aa47d6aab5d5a951bc78c99c26dd67658.1223497216.git.aciddeath@gmail.com> (raw)
In-Reply-To: <cover.1223497216.git.aciddeath@gmail.com>
In-Reply-To: <cover.1223497216.git.aciddeath@gmail.com>
Signed-off-by: Richard A. Holden III <aciddeath@gmail.com>
---
drivers/telephony/ixj.c | 124 ++++++++++++++---------------------------------
1 files changed, 36 insertions(+), 88 deletions(-)
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index ec7aeb5..1b2387e 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -7122,6 +7122,40 @@ IXJ *ixj_pcmcia_probe(unsigned long dsp, unsigned long xilinx)
EXPORT_SYMBOL(ixj_pcmcia_probe); /* Fpr PCMCIA */
+static int sprintf_codec_name(int len, char *buf, unsigned int codec)
+{
+ switch (codec) {
+ case G723_63:
+ return sprintf(buf + len, "G.723.1 6.3");
+ case G723_53:
+ return sprintf(buf + len, "G.723.1 5.3");
+ case TS85:
+ return sprintf(buf + len, "TrueSpeech 8.5");
+ case TS48:
+ return sprintf(buf + len, "TrueSpeech 4.8");
+ case TS41:
+ return sprintf(buf + len, "TrueSpeech 4.1");
+ case G728:
+ return sprintf(buf + len, "G.728");
+ case G729:
+ return sprintf(buf + len, "G.729");
+ case G729B:
+ return sprintf(buf + len, "G.729B");
+ case ULAW:
+ return sprintf(buf + len, "uLaw");
+ case ALAW:
+ return sprintf(buf + len, "aLaw");
+ case LINEAR16:
+ return sprintf(buf + len, "16 bit Linear");
+ case LINEAR8:
+ return sprintf(buf + len, "8 bit Linear");
+ case WSS:
+ return sprintf(buf + len, "Windows Sound System");
+ default:
+ return sprintf(buf + len, "NO CODEC CHOSEN");
+ }
+}
+
static int ixj_get_status_proc(char *buf)
{
int len;
@@ -7191,95 +7225,9 @@ static int ixj_get_status_proc(char *buf)
len += sprintf(buf + len, "\nCaller ID data not sent");
len += sprintf(buf + len, "\nPlay CODEC ");
- switch (j->play_codec) {
- case G723_63:
- len += sprintf(buf + len, "G.723.1 6.3");
- break;
- case G723_53:
- len += sprintf(buf + len, "G.723.1 5.3");
- break;
- case TS85:
- len += sprintf(buf + len, "TrueSpeech 8.5");
- break;
- case TS48:
- len += sprintf(buf + len, "TrueSpeech 4.8");
- break;
- case TS41:
- len += sprintf(buf + len, "TrueSpeech 4.1");
- break;
- case G728:
- len += sprintf(buf + len, "G.728");
- break;
- case G729:
- len += sprintf(buf + len, "G.729");
- break;
- case G729B:
- len += sprintf(buf + len, "G.729B");
- break;
- case ULAW:
- len += sprintf(buf + len, "uLaw");
- break;
- case ALAW:
- len += sprintf(buf + len, "aLaw");
- break;
- case LINEAR16:
- len += sprintf(buf + len, "16 bit Linear");
- break;
- case LINEAR8:
- len += sprintf(buf + len, "8 bit Linear");
- break;
- case WSS:
- len += sprintf(buf + len, "Windows Sound System");
- break;
- default:
- len += sprintf(buf + len, "NO CODEC CHOSEN");
- break;
- }
+ len += sprintf_codec_name(len, buf, j->play_codec);
len += sprintf(buf + len, "\nRecord CODEC ");
- switch (j->rec_codec) {
- case G723_63:
- len += sprintf(buf + len, "G.723.1 6.3");
- break;
- case G723_53:
- len += sprintf(buf + len, "G.723.1 5.3");
- break;
- case TS85:
- len += sprintf(buf + len, "TrueSpeech 8.5");
- break;
- case TS48:
- len += sprintf(buf + len, "TrueSpeech 4.8");
- break;
- case TS41:
- len += sprintf(buf + len, "TrueSpeech 4.1");
- break;
- case G728:
- len += sprintf(buf + len, "G.728");
- break;
- case G729:
- len += sprintf(buf + len, "G.729");
- break;
- case G729B:
- len += sprintf(buf + len, "G.729B");
- break;
- case ULAW:
- len += sprintf(buf + len, "uLaw");
- break;
- case ALAW:
- len += sprintf(buf + len, "aLaw");
- break;
- case LINEAR16:
- len += sprintf(buf + len, "16 bit Linear");
- break;
- case LINEAR8:
- len += sprintf(buf + len, "8 bit Linear");
- break;
- case WSS:
- len += sprintf(buf + len, "Windows Sound System");
- break;
- default:
- len += sprintf(buf + len, "NO CODEC CHOSEN");
- break;
- }
+ len += sprintf_codec_name(len, buf, j->rec_codec);
len += sprintf(buf + len, "\nAEC ");
switch (j->aec_level) {
case AEC_OFF:
--
1.5.6.4
next prev parent reply other threads:[~2008-10-08 19:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 20:41 [PATCH 00/10] ixj: Cleanup dead and duplicate code Richard A. Holden III
2008-10-08 20:12 ` Alan Cox
2008-10-08 20:41 ` Richard A. Holden III [this message]
2008-10-08 20:41 ` [PATCH 02/10] ixj: Remove dead code in preparation for consolidating " Richard A. Holden III
2008-10-08 20:41 ` [PATCH 03/10] ixj: Unify comments in preparation for pushing duplicate code into a function Richard A. Holden III
2008-10-08 20:41 ` [PATCH 04/10] ixj: Consolidate duplicate Ringer array initializers into common functions Richard A. Holden III
2008-10-08 20:41 ` [PATCH 05/10] ixj: Move duplicate code into well named zero_caller_id function Richard A. Holden III
2008-10-08 20:41 ` [PATCH 06/10] ixj: Caller ID Refactoring Richard A. Holden III
2008-10-08 20:41 ` [PATCH 07/10] ixj: Refactor DTMF tone setting Richard A. Holden III
2008-10-08 20:41 ` [PATCH 08/10] ixj: update quickly readable comments to match the data initializations Richard A. Holden III
2008-10-08 20:41 ` [PATCH 09/10] ixj: Remove unused macro Richard A. Holden III
2008-10-08 20:41 ` [PATCH 10/10] ixj: Remove dead code from ifdef IXJ_DYN_ALLOC Richard A. Holden III
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=b1f8a69aa47d6aab5d5a951bc78c99c26dd67658.1223497216.git.aciddeath@gmail.com \
--to=aciddeath@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
/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®