From 821a2730fac7b7b13c8a6a77ef6238bc9628d0f8 Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Wed, 15 Aug 2012 14:10:34 -0500 Subject: [PATCH] wctc4xxp: Fail gracefully on "Failed to create channel" scenario. Sometimes the DTE device api returns a failure to create timeslot. When this happens, subsequent channel allocations will also continue to fail. This patch attempts to mark the channel as busy, so that further channel allocates might succeed and the device continue to operate. Internal-Issue-ID: DAHLIN-298 Internal-Issue-ID: DAHDI-990 Signed-off-by: Russ Meyerriecks --- drivers/dahdi/wctc4xxp/base.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index c88f7d7..71d6858 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -1782,6 +1782,15 @@ do_channel_allocate(struct dahdi_transcoder_channel *dtc) wctc4xxp_dstfmt); if (res) { /* There was a problem creating the channel.... */ + /* Sometimes the DTC device fails to setup a channel. + As a workaround, we mark that channel as perma-busy + so that subsequent allocates don't get stuck */ + if (-EBUSY == res) { + dahdi_tc_set_busy(dtc); + dev_err(&wc->pdev->dev, "Channel %p seems to be stuck"\ + " Permanently disabling channel"\ + " until driver is reloaded\n", dtc); + } up(&wc->chansem); return res; } @@ -3022,11 +3031,11 @@ wctc4xxp_create_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt, * encoder and another for the complex->simple decoder. */ if (send_create_channel_cmd(wc, cmd, encoder_timeslot, &encoder_channel)) - goto error_exit; + goto ebusy_exit; if (send_create_channel_cmd(wc, cmd, decoder_timeslot, &decoder_channel)) - goto error_exit; + goto ebusy_exit; DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP, "DTE is using the following channels encoder_channel: " \ @@ -3062,9 +3071,14 @@ wctc4xxp_create_channel_pair(struct wcdte *wc, struct channel_pvt *cpvt, free_cmd(cmd); return 0; + error_exit: free_cmd(cmd); return -EIO; + +ebusy_exit: + free_cmd(cmd); + return -EBUSY; } static int -- 1.7.5.4