[dahdi-commits] sruffell: branch linux/2.6 r10418 - /linux/branches/2.6/drivers/dahdi/xpp/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Jan 10 16:09:33 CST 2012


Author: sruffell
Date: Tue Jan 10 16:09:29 2012
New Revision: 10418

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10418
Log:
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 at xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10409

Modified:
    linux/branches/2.6/drivers/dahdi/xpp/xbus-core.c
    linux/branches/2.6/drivers/dahdi/xpp/xpp_dahdi.c

Modified: linux/branches/2.6/drivers/dahdi/xpp/xbus-core.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.6/drivers/dahdi/xpp/xbus-core.c?view=diff&rev=10418&r1=10417&r2=10418
==============================================================================
--- linux/branches/2.6/drivers/dahdi/xpp/xbus-core.c (original)
+++ linux/branches/2.6/drivers/dahdi/xpp/xbus-core.c Tue Jan 10 16:09:29 2012
@@ -809,6 +809,29 @@
 		}
 	}
 	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)
@@ -1303,6 +1326,7 @@
 	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);

Modified: linux/branches/2.6/drivers/dahdi/xpp/xpp_dahdi.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.6/drivers/dahdi/xpp/xpp_dahdi.c?view=diff&rev=10418&r1=10417&r2=10418
==============================================================================
--- linux/branches/2.6/drivers/dahdi/xpp/xpp_dahdi.c (original)
+++ linux/branches/2.6/drivers/dahdi/xpp/xpp_dahdi.c Tue Jan 10 16:09:29 2012
@@ -1082,14 +1082,9 @@
  */
 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);




More information about the dahdi-commits mailing list