From 3de1002cb519310e930525bb9ce565ce55255421 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 4 Nov 2010 16:40:49 +0000 Subject: [PATCH] dahdi: Constify the dahdi_txlevelnames and return of dahdi_lboname(). Also moves the dahdi_txlevelnames array into the dahdi_lboname function, which is the only place it it used. Signed-off-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9468 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 36 ++++++++++++++++++++---------------- include/dahdi/kernel.h | 2 +- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 122c655..1e61272 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -96,18 +96,6 @@ /* macro-oni for determining a unit (channel) number */ #define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev) -/* names of tx level settings */ -static char *dahdi_txlevelnames[] = { -"0 db (CSU)/0-133 feet (DSX-1)", -"133-266 feet (DSX-1)", -"266-399 feet (DSX-1)", -"399-533 feet (DSX-1)", -"533-655 feet (DSX-1)", -"-7.5db (CSU)", -"-15db (CSU)", -"-22.5db (CSU)" -} ; - EXPORT_SYMBOL(dahdi_transcode_fops); EXPORT_SYMBOL(dahdi_init_tone_state); EXPORT_SYMBOL(dahdi_mf_tone); @@ -122,7 +110,6 @@ EXPORT_SYMBOL(__dahdi_lineartoalaw); EXPORT_SYMBOL(__dahdi_lin2mu); EXPORT_SYMBOL(__dahdi_lin2a); #endif -EXPORT_SYMBOL(dahdi_lboname); EXPORT_SYMBOL(dahdi_transmit); EXPORT_SYMBOL(dahdi_receive); EXPORT_SYMBOL(dahdi_rbsbits); @@ -1636,12 +1623,29 @@ static int dahdi_chan_reg(struct dahdi_chan *chan) return 0; } -char *dahdi_lboname(int x) +/** + * dahdi_lboname() - Convert line build out number to string. + * + */ +const char *dahdi_lboname(int lbo) { - if ((x < 0) || (x > 7)) + /* names of tx level settings */ + static const char *const dahdi_txlevelnames[] = { + "0 db (CSU)/0-133 feet (DSX-1)", + "133-266 feet (DSX-1)", + "266-399 feet (DSX-1)", + "399-533 feet (DSX-1)", + "533-655 feet (DSX-1)", + "-7.5db (CSU)", + "-15db (CSU)", + "-22.5db (CSU)" + }; + + if ((lbo < 0) || (lbo > 7)) return "Unknown"; - return dahdi_txlevelnames[x]; + return dahdi_txlevelnames[lbo]; } +EXPORT_SYMBOL(dahdi_lboname); #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP) static inline void print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff *skb, int oldbuf) diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index e784b34..9a21c63 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1060,7 +1060,7 @@ int dahdi_transcoder_alert(struct dahdi_transcoder_channel *ztc); int dahdi_unregister(struct dahdi_span *span); /*! \brief Gives a name to an LBO */ -char *dahdi_lboname(int lbo); +const char *dahdi_lboname(int lbo); /*! \brief Tell DAHDI about changes in received rbs bits */ void dahdi_rbsbits(struct dahdi_chan *chan, int bits);