[svn-commits] tzafrir: linux/trunk r8905 - /linux/trunk/drivers/dahdi/xpp/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 13 12:25:10 CDT 2010
Author: tzafrir
Date: Tue Jul 13 12:25:06 2010
New Revision: 8905
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8905
Log:
prevent handling of duplicate Astribanks
Don't let AB which are unplugged/replugged create duplicate XBUS's (if
asterisk don't close the original channels).
Modified:
linux/trunk/drivers/dahdi/xpp/card_global.c
linux/trunk/drivers/dahdi/xpp/xbus-core.c
linux/trunk/drivers/dahdi/xpp/xbus-core.h
Modified: linux/trunk/drivers/dahdi/xpp/card_global.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_global.c?view=diff&rev=8905&r1=8904&r2=8905
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_global.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_global.c Tue Jul 13 12:25:06 2010
@@ -431,6 +431,8 @@
DBG(DEVICES, "NO XBUS\n");
return -EINVAL;
}
+ if (xbus_check_unique(xbus))
+ return -EBUSY;
XFRAME_NEW_CMD(xframe, pack, xbus, GLOBAL, AB_REQUEST, 0);
RPACKET_FIELD(pack, GLOBAL, AB_REQUEST, rev) = XPP_PROTOCOL_VERSION;
RPACKET_FIELD(pack, GLOBAL, AB_REQUEST, reserved) = 0;
@@ -614,6 +616,8 @@
goto proto_err;
}
XBUS_INFO(xbus, "DESCRIPTOR: %d cards, protocol revision %d\n", count_units, rev);
+ if (xbus_check_unique(xbus))
+ return -EBUSY;
xbus->revision = rev;
worker = &xbus->worker;
if (!worker->wq) {
Modified: linux/trunk/drivers/dahdi/xpp/xbus-core.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-core.c?view=diff&rev=8905&r1=8904&r2=8905
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.c Tue Jul 13 12:25:06 2010
@@ -86,6 +86,42 @@
static struct xbus_desc {
xbus_t *xbus;
} xbuses_array[MAX_BUSES];
+
+static xbus_t *xbus_byhwid(const char *hwid)
+{
+ int i;
+ xbus_t *xbus;
+
+ for (i = 0; i < ARRAY_SIZE(xbuses_array); i++) {
+ xbus = xbuses_array[i].xbus;
+ if (xbus && strcmp(hwid, xbus->label) == 0)
+ return xbus;
+ }
+ return NULL;
+}
+
+int xbus_check_unique(xbus_t *xbus)
+{
+ if (!xbus)
+ return -ENOENT;
+ if (xbus->label) {
+ xbus_t *xbus_old;
+
+ XBUS_DBG(DEVICES, xbus, "Checking LABEL='%s'\n", xbus->label);
+ xbus_old = xbus_byhwid(xbus->label);
+ if (xbus_old && xbus_old != xbus) {
+ XBUS_NOTICE(xbus_old,
+ "Duplicate LABEL='%s'. Leave %s unused. refcount_xbus=%d\n",
+ xbus_old->label,
+ xbus->busname,
+ refcount_xbus(xbus_old));
+ return -EBUSY;
+ }
+ } else {
+ XBUS_NOTICE(xbus, "MISSING BOARD LABEL!!!\n");
+ }
+ return 0;
+}
const char *xbus_statename(enum xbus_state st)
{
Modified: linux/trunk/drivers/dahdi/xpp/xbus-core.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-core.h?view=diff&rev=8905&r1=8904&r2=8905
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.h Tue Jul 13 12:25:06 2010
@@ -308,6 +308,7 @@
xpd_t *xpd_of(const xbus_t *xbus, int xpd_num);
xpd_t *xpd_byaddr(const xbus_t *xbus, uint unit, uint subunit);
+int xbus_check_unique(xbus_t *xbus);
bool xbus_setstate(xbus_t *xbus, enum xbus_state newstate);
bool xbus_setflags(xbus_t *xbus, int flagbit, bool on);
xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, struct device *transport_device, void *priv);
More information about the svn-commits
mailing list