summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-02-08 22:49:34 +0000
committerShaun Ruffell <sruffell@digium.com>2010-02-08 22:49:34 +0000
commitf497e0eb03bcafc162d47f74b6b2e72b17c164de (patch)
treec7af9001a8cf35609294212fc5b7ff793d680d94
parent9c403912cd5ffdc975e6eaf15d835e60804af4c4 (diff)
wcte12xp: Identify the card that is printing to the kernel log.
Drops all users of module_printk in order to use 't1_info', which is a wrapper for dev_info. Also updates debug_printk to also print the bus location information. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8006 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wcte12xp/base.c116
-rw-r--r--drivers/dahdi/wcte12xp/wcte12xp.h2
2 files changed, 69 insertions, 49 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 4379600..e365845 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -339,15 +339,16 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
portconfig.EightSlotMask3 = 0x0000;
if ((configportstatus = gpakConfigurePorts(vpm->dspid, &portconfig, &pstatus))) {
- printk(KERN_NOTICE "Configuration of ports failed (%d)!\n", configportstatus);
+ t1_info(wc, "Configuration of ports failed (%d)!\n",
+ configportstatus);
return -1;
} else {
if (vpm->options.debug & DEBUG_ECHOCAN)
- printk(KERN_DEBUG "Configured McBSP ports successfully\n");
+ t1_info(wc, "Configured McBSP ports successfully\n");
}
if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
- printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+ t1_info(wc, "Error pinging DSP (%d)\n", res);
return -1;
}
@@ -362,22 +363,25 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
if ((res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus))) {
- printk(KERN_NOTICE "Unable to configure channel #%d (%d)", channel, res);
+ t1_info(wc, "Unable to configure channel #%d (%d)",
+ channel, res);
if (res == 1) {
- printk(", reason %d", cstatus);
+ printk(KERN_CONT ", reason %d", cstatus);
}
- printk("\n");
+ printk(KERN_CONT "\n");
return -1;
}
if ((res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &algstatus))) {
- printk(KERN_NOTICE "Unable to disable echo can on channel %d (reason %d:%d)\n", channel + 1, res, algstatus);
+ t1_info(wc, "Unable to disable echo can on channel %d "
+ "(reason %d:%d)\n", channel + 1, res,
+ algstatus);
return -1;
}
}
if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) {
- printk(KERN_NOTICE "Error pinging DSP (%d)\n", res);
+ t1_info(wc, "Error pinging DSP (%d)\n", res);
return -1;
}
@@ -386,6 +390,9 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
return 0;
}
+#define debug_printk(wc, lvl, fmt, args...) if (debug >= (lvl)) do { \
+ t1_info((wc), fmt , ## args); } while (0)
+
static void cmd_dequeue_vpmadt032(struct t1 *wc, unsigned char *writechunk, int whichframe)
{
struct vpmadt032_cmd *cmd;
@@ -397,7 +404,7 @@ static void cmd_dequeue_vpmadt032(struct t1 *wc, unsigned char *writechunk, int
writechunk += 66;
if (test_bit(VPM150M_SPIRESET, &vpm->control) || test_bit(VPM150M_HPIRESET, &vpm->control)) {
- debug_printk(1, "HW Resetting VPMADT032 ...\n");
+ debug_printk(wc, 1, "HW Resetting VPMADT032 ...\n");
for (x = 0; x < 4; x++) {
if (!x) {
if (test_and_clear_bit(VPM150M_SPIRESET, &vpm->control))
@@ -526,7 +533,9 @@ static void cmd_dequeue_vpmadt032(struct t1 *wc, unsigned char *writechunk, int
for (x = 0; x < 7; x++) {
for (y = 0; y < 3; y++) {
if (writechunk[CMD_BYTE(x, y, 1)] & 0x2) {
- module_printk("the test bit is high for byte %d\n", y);
+ t1_info(wc,
+ "the test bit is high for byte %d\n",
+ y);
}
}
}
@@ -636,8 +645,10 @@ static void __t1xxp_set_clear(struct t1 *wc, int channo)
((channo < 0) || /* channo=-1 means all channels */
(j == (channo-1)/8) )) { /* only the register for this channo */
ret = t1_setreg(wc, 0x2f + j, val);
- if (ret < 0)
- module_printk("set_clear failed for chan %d!\n",i);
+ if (ret < 0) {
+ t1_info(wc, "set_clear failed for chan %d!\n",
+ i);
+ }
val = 0;
}
}
@@ -670,14 +681,15 @@ static void free_wc(struct t1 *wc)
static void t1_release(struct t1 *wc)
{
dahdi_unregister(&wc->span);
- printk(KERN_INFO "Freed a Wildcard TE12xP.\n");
+ t1_info(wc, "Freed a Wildcard TE12xP.\n");
free_wc(wc);
}
static void t4_serial_setup(struct t1 *wc)
{
- module_printk("Setting up global serial parameters for %s\n",
- wc->spantype == TYPE_E1 ? (unchannelized ? "Unchannelized E1" : "E1") : "T1");
+ t1_info(wc, "Setting up global serial parameters for %s\n",
+ wc->spantype == TYPE_E1 ?
+ (unchannelized ? "Unchannelized E1" : "E1") : "T1");
t1_setreg(wc, 0x85, 0xe0); /* GPC1: Multiplex mode enabled, FSC is output, active low, RCLK from channel 0 */
t1_setreg(wc, 0x08, 0x05); /* IPC: Interrupt push/pull active low */
@@ -799,7 +811,7 @@ static void t1_configure_t1(struct t1 *wc, int lineconfig, int txlevel)
break;
}
- module_printk("Span configured for %s/%s\n", framing, line);
+ t1_info(wc, "Span configured for %s/%s\n", framing, line);
}
static void t1_configure_e1(struct t1 *wc, int lineconfig)
@@ -877,7 +889,8 @@ static void t1_configure_e1(struct t1 *wc, int lineconfig)
t1_setreg(wc, 0x26, 0x54); /* XPM0 */
t1_setreg(wc, 0x27, 0x02); /* XPM1 */
t1_setreg(wc, 0x28, 0x00); /* XPM2 */
- module_printk("Span configured for %s/%s%s\n", framing, line, crc4);
+
+ t1_info(wc, "Span configured for %s/%s%s\n", framing, line, crc4);
}
static void t1xxp_framer_start(struct t1 *wc, struct dahdi_span *span)
@@ -905,7 +918,7 @@ static int t1xxp_startup(struct dahdi_span *span)
/* Reset framer with proper parameters and start */
t1xxp_framer_start(wc, span);
- debug_printk(1, "Calling startup (flags is %lu)\n", span->flags);
+ debug_printk(wc, 1, "Calling startup (flags is %lu)\n", span->flags);
return 0;
}
@@ -955,7 +968,8 @@ static int t1xxp_rbsbits(struct dahdi_chan *chan, int bits)
struct t1 *wc = chan->pvt;
unsigned long flags;
- debug_printk(2, "Setting bits to %d on channel %s\n", bits, chan->name);
+ debug_printk(wc, 2, "Setting bits to %d on channel %s\n",
+ bits, chan->name);
if (wc->spantype == TYPE_E1) { /* do it E1 way */
if (chan->chanpos == 16)
return 0;
@@ -998,7 +1012,7 @@ static int t1xxp_rbsbits(struct dahdi_chan *chan, int bits)
/* output them to the chip */
t1_setreg(wc, 0x70 + b, c);
}
- debug_printk(2,"Finished setting RBS bits\n");
+ debug_printk(wc, 2, "Finished setting RBS bits\n");
return 0;
}
@@ -1088,37 +1102,40 @@ static int t1xxp_maint(struct dahdi_span *span, int cmd)
if (wc->spantype == TYPE_E1) {
switch (cmd) {
case DAHDI_MAINT_NONE:
- module_printk("XXX Turn off local and remote loops E1 XXX\n");
+ t1_info(wc, "XXX Turn off local and remote "
+ "loops E1 XXX\n");
break;
case DAHDI_MAINT_LOCALLOOP:
- module_printk("XXX Turn on local loopback E1 XXX\n");
+ t1_info(wc, "XXX Turn on local loopback E1 XXX\n");
break;
case DAHDI_MAINT_REMOTELOOP:
- module_printk("XXX Turn on remote loopback E1 XXX\n");
+ t1_info(wc, "XXX Turn on remote loopback E1 XXX\n");
break;
case DAHDI_MAINT_LOOPUP:
- module_printk("XXX Send loopup code E1 XXX\n");
+ t1_info(wc, "XXX Send loopup code E1 XXX\n");
break;
case DAHDI_MAINT_LOOPDOWN:
- module_printk("XXX Send loopdown code E1 XXX\n");
+ t1_info(wc, "XXX Send loopdown code E1 XXX\n");
break;
case DAHDI_MAINT_LOOPSTOP:
- module_printk("XXX Stop sending loop codes E1 XXX\n");
+ t1_info(wc, "XXX Stop sending loop codes E1 XXX\n");
break;
default:
- module_printk("Unknown E1 maint command: %d\n", cmd);
+ t1_info(wc, "Unknown E1 maint command: %d\n", cmd);
break;
}
} else {
switch (cmd) {
case DAHDI_MAINT_NONE:
- module_printk("XXX Turn off local and remote loops T1 XXX\n");
+ t1_info(wc, "XXX Turn off local and remote "
+ "loops T1 XXX\n");
break;
case DAHDI_MAINT_LOCALLOOP:
- module_printk("XXX Turn on local loop and no remote loop XXX\n");
+ t1_info(wc, "XXX Turn on local loop and no remote "
+ "loop XXX\n");
break;
case DAHDI_MAINT_REMOTELOOP:
- module_printk("XXX Turn on remote loopup XXX\n");
+ t1_info(wc, "XXX Turn on remote loopup XXX\n");
break;
case DAHDI_MAINT_LOOPUP:
t1_setreg(wc, 0x21, 0x50); /* FMR5: Nothing but RBS mode */
@@ -1130,7 +1147,7 @@ static int t1xxp_maint(struct dahdi_span *span, int cmd)
t1_setreg(wc, 0x21, 0x40); /* FMR5: Nothing but RBS mode */
break;
default:
- module_printk("Unknown T1 maint command: %d\n", cmd);
+ t1_info(wc, "Unknown T1 maint command: %d\n", cmd);
break;
}
}
@@ -1209,7 +1226,7 @@ static int t1_software_init(struct t1 *wc)
/* Find position */
for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) {
if (ifaces[x] == wc) {
- debug_printk(1, "software init for card %d\n",x);
+ debug_printk(wc, 1, "software init for card %d\n", x);
break;
}
}
@@ -1273,7 +1290,7 @@ static int t1_software_init(struct t1 *wc)
wc->chans[x]->chanpos = x + 1;
}
if (dahdi_register(&wc->span, 0)) {
- module_printk("Unable to register span with DAHDI\n");
+ t1_info(wc, "Unable to register span with DAHDI\n");
return -1;
}
@@ -1360,19 +1377,19 @@ static int t1_hardware_post_init(struct t1 *wc)
else
wc->spantype = TYPE_E1;
}
- debug_printk(1, "spantype: %s\n", wc->spantype==1 ? "T1" : "E1");
+ debug_printk(wc, 1, "spantype: %s\n", 1 == wc->spantype ? "T1" : "E1");
/* what version of the FALC are we using? */
reg = t1_setreg(wc, 0x4a, 0xaa);
reg = t1_getreg(wc, 0x4a);
- debug_printk(1, "FALC version: %08x\n", reg);
+ debug_printk(wc, 1, "FALC version: %08x\n", reg);
/* make sure reads and writes work */
for (x = 0; x < 256; x++) {
t1_setreg(wc, 0x14, x);
reg = t1_getreg(wc, 0x14);
if (reg != x)
- module_printk("Wrote '%x' but read '%x'\n", x, reg);
+ t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
}
t1_setleds(wc, wc->ledstate);
@@ -1402,14 +1419,15 @@ static int t1_hardware_post_init(struct t1 *wc)
config_vpmadt032(wc->vpmadt032, wc);
set_span_devicetype(wc);
- module_printk("VPM present and operational (Firmware version %x)\n", wc->vpmadt032->version);
+ t1_info(wc, "VPM present and operational "
+ "(Firmware version %x)\n", wc->vpmadt032->version);
wc->ctlreg |= 0x10; /* turn on vpm (RX audio from vpm module) */
if (vpmtsisupport) {
- debug_printk(1, "enabling VPM TSI pin\n");
+ debug_printk(wc, 1, "enabling VPM TSI pin\n");
wc->ctlreg |= 0x01; /* turn on vpm timeslot interchange pin */
}
} else {
- module_printk("VPM Support Disabled\n");
+ t1_info(wc, "VPM Support Disabled\n");
wc->vpmadt032 = NULL;
}
#endif
@@ -1444,7 +1462,7 @@ static inline void t1_check_alarms(struct t1 *wc)
if (!wc->flags.nmf) {
t1_setreg(wc, 0x20, 0x9f | 0x20); /* LIM0: Force RAI High */
wc->flags.nmf = 1;
- module_printk("NMF workaround on!\n");
+ t1_info(wc, "NMF workaround on!\n");
}
t1_setreg(wc, 0x1e, 0xc3); /* Reset to CRC4 mode */
t1_setreg(wc, 0x1c, 0xf2); /* Force Resync */
@@ -1453,7 +1471,7 @@ static inline void t1_check_alarms(struct t1 *wc)
if (wc->flags.nmf) {
t1_setreg(wc, 0x20, 0x9f); /* LIM0: Clear forced RAI */
wc->flags.nmf = 0;
- module_printk("NMF workaround off!\n");
+ t1_info(wc, "NMF workaround off!\n");
}
}
} else {
@@ -1539,13 +1557,13 @@ static inline void t1_check_alarms(struct t1 *wc)
/* If receiving alarms, go into Yellow alarm state */
if (alarms && !wc->flags.sendingyellow) {
- module_printk("Setting yellow alarm\n");
+ t1_info(wc, "Setting yellow alarm\n");
/* We manually do yellow alarm to handle RECOVER and NOTOPEN, otherwise it's auto anyway */
t1_setreg(wc, 0x20, fmr4 | 0x20);
wc->flags.sendingyellow = 1;
} else if (!alarms && wc->flags.sendingyellow) {
- module_printk("Clearing yellow alarm\n");
+ t1_info(wc, "Clearing yellow alarm\n");
/* We manually do yellow alarm to handle RECOVER */
t1_setreg(wc, 0x20, fmr4 & ~0x20);
wc->flags.sendingyellow = 0;
@@ -1683,8 +1701,11 @@ static inline void t1_receiveprep(struct t1 *wc, unsigned char* readchunk)
if (wc->rxident != expected) {
wc->span.irqmisses++;
resend_cmds(wc);
- if (unlikely(debug && test_bit(INITIALIZED, &wc->bit_flags)))
- module_printk("oops: rxident=%d expected=%d x=%d\n", wc->rxident, expected, x);
+ if (unlikely(debug)) {
+ t1_info(wc, "oops: rxident=%d "
+ "expected=%d x=%d\n",
+ wc->rxident, expected, x);
+ }
}
}
cmd_decipher(wc, readchunk);
@@ -1772,7 +1793,8 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
}
if (-1 == index) {
- module_printk("Too many interfaces\n");
+ printk(KERN_INFO "%s: Too many interfaces\n",
+ THIS_MODULE->name);
return -EIO;
}
@@ -1843,7 +1865,7 @@ static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_devi
mod_timer(&wc->timer, jiffies + HZ/5);
t1_software_init(wc);
- module_printk("Found a %s\n", wc->variety);
+ t1_info(wc, "Found a %s\n", wc->variety);
voicebus_unlock_latency(&wc->vb);
return 0;
}
diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h
index dd385bb..97c825b 100644
--- a/drivers/dahdi/wcte12xp/wcte12xp.h
+++ b/drivers/dahdi/wcte12xp/wcte12xp.h
@@ -77,8 +77,6 @@
#define TYPE_T1 1
#define TYPE_E1 2
-#define module_printk(fmt, args...) printk(KERN_INFO "%s: " fmt, THIS_MODULE->name, ## args)
-#define debug_printk(level, fmt, args...) if (debug >= level) printk(KERN_DEBUG "%s (%s): " fmt, THIS_MODULE->name, __FUNCTION__, ## args)
extern spinlock_t ifacelock;
struct command {