summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcte12xp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-08-25 18:28:53 +0000
committerShaun Ruffell <sruffell@digium.com>2011-08-25 18:28:53 +0000
commit223bad536f58c788f005fcab873000708e760a31 (patch)
tree2adccc33b6d907d2630553d598402eba5f805aa3 /drivers/dahdi/wcte12xp
parent55221acb362755259ebf5ea181d63828ba5ee6fb (diff)
wcte12xp: Abort driver bind if read/write test fails.
When the driver begins to initialize a device it conducts a read/write test on one of the framer registers. The driver ignores the result of that test and results in much output spammed to the kernel logs for a failed card since the driver doesn't then try to unbind from the device. What was getting spammed: wcte12xp 0000:03:01.0: Timeout in t1_getreg wcte12xp 0000:03:01.0: Wrote '0' but read 'fffffffb' Now abort the bind if the read / write test fails. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10155 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcte12xp')
-rw-r--r--drivers/dahdi/wcte12xp/base.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 0d31350..aa9d019 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -1856,7 +1856,7 @@ static inline unsigned char t1_vpm_out(struct t1 *wc, int unit, const unsigned i
static int t1_hardware_post_init(struct t1 *wc)
{
int res;
- unsigned int reg;
+ int reg;
int x;
/* T1 or E1 */
@@ -1878,14 +1878,25 @@ static int t1_hardware_post_init(struct t1 *wc)
/* what version of the FALC are we using? */
reg = t1_setreg(wc, 0x4a, 0xaa);
reg = t1_getreg(wc, 0x4a);
+ if (reg < 0) {
+ t1_info(wc, "Failed to read FALC version (%d)\n", reg);
+ return -EIO;
+ }
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)
- t1_info(wc, "Wrote '%x' but read '%x'\n", x, reg);
+ if (reg < 0) {
+ t1_info(wc, "Failed register read (%d)\n", reg);
+ return -EIO;
+ }
+ if (reg != x) {
+ t1_info(wc, "Register test failed. "
+ "Wrote '%x' but read '%x'\n", x, reg);
+ return -EIO;
+ }
}
t1_setleds(wc, wc->ledstate);