summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2012-01-10 22:09:29 +0000
committerShaun Ruffell <sruffell@digium.com>2012-01-10 22:09:29 +0000
commit90bc4a1a828fb8feeeb3d35e7371ca4f8089f77d (patch)
treeaf401ca0ed9679f9cd7f3bb8ae4671f7979b9e83
parent9ef16c6d861f3df1315c2985c1433671263c541f (diff)
xpp: Don't deactivate XPDs on unregistration
* A bug was introduced during migration to dahdi_device code: http://svnview.digium.com/svn/dahdi?view=rev&rev=10273 * Marking XPDs as non-functional (card_present=0, XPD_STATE_NOHW) was moved from xbus_request_removal() into xpd_dahdi_preunregister() * As a result, unregistering an Astribank, made it non-functional so trying to re-register it later caused errors (e.g: "Cannot open" error message from xpp_open()) * This fix move XPD deactivation into the proper location (during xbus_deactivate() Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10409 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.6@10418 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/xpp/xbus-core.c24
-rw-r--r--drivers/dahdi/xpp/xpp_dahdi.c5
2 files changed, 24 insertions, 5 deletions
diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c
index 5175665..0226b4c 100644
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -811,6 +811,29 @@ static int xbus_echocancel(xbus_t *xbus, int on)
return 0;
}
+static void xbus_deactivate_xpds(xbus_t *xbus)
+{
+ unsigned long flags;
+ int unit;
+ int subunit;
+ xpd_t *xpd;
+
+ for (unit = 0; unit < MAX_UNIT; unit++) {
+ xpd = xpd_byaddr(xbus, unit, 0);
+ if (!xpd)
+ continue;
+ for (subunit = 0; subunit < MAX_SUBUNIT; subunit++) {
+ xpd = xpd_byaddr(xbus, unit, subunit);
+ if (!xpd)
+ continue;
+ spin_lock_irqsave(&xpd->lock, flags);
+ xpd->card_present = 0;
+ xpd_setstate(xpd, XPD_STATE_NOHW);
+ spin_unlock_irqrestore(&xpd->lock, flags);
+ }
+ }
+}
+
static int xbus_initialize(xbus_t *xbus)
{
int unit;
@@ -1303,6 +1326,7 @@ void xbus_deactivate(xbus_t *xbus)
xbus_request_sync(xbus, SYNC_MODE_NONE); /* no more ticks */
elect_syncer("deactivate");
xbus_echocancel(xbus, 0);
+ xbus_deactivate_xpds(xbus);
XBUS_DBG(DEVICES, xbus, "[%s] Waiting for queues\n", xbus->label);
xbus_command_queue_clean(xbus);
xbus_command_queue_waitempty(xbus);
diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c
index a53f2d2..1bfed84 100644
--- a/drivers/dahdi/xpp/xpp_dahdi.c
+++ b/drivers/dahdi/xpp/xpp_dahdi.c
@@ -1082,14 +1082,9 @@ int xpd_dahdi_postregister(xpd_t *xpd)
*/
void xpd_dahdi_preunregister(xpd_t *xpd)
{
- unsigned long flags;
if (!xpd)
return;
XPD_DBG(DEVICES, xpd, "\n");
- spin_lock_irqsave(&xpd->lock, flags);
- xpd->card_present = 0;
- xpd_setstate(xpd, XPD_STATE_NOHW);
- spin_unlock_irqrestore(&xpd->lock, flags);
update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
if(xpd->card_present)
CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 0);