summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xpp_dahdi.c
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-01 13:56:23 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-01 13:56:23 +0000
commit7e6e55bbdcd0224bf07de8dd47e4f7a92e7d097f (patch)
tree34c04ea112c9587bbad7e0593119c09a53c43466 /drivers/dahdi/xpp/xpp_dahdi.c
parentac9297570200f1f21dff01043baabdba90516722 (diff)
New XPP code: xpp rev 6795:
* Fix cases where the command_queue overflowed during initialization. - Also add a 'command_queue_length' parameter to xpp.ko * More migrations to sysfs: - Add a 'transport' attribute to our astribank devices which points to the usb device we use. E.g: /sys/bus/astribanks/devices/xbus-00/transport is symlinked to ../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4 - Move /proc/xpp/XBUS-??/XPD-??/span to /sys/bus/xpds/devices/??:?:?/span - Migrate from /proc/xpp/sync to: /sys/bus/astribanks/drivers/xppdrv/sync - New 'offhook' attribute in: /sys/bus/xpds/devices/??:?:?/offhook * PRI: change the "timing" priority to match the convention used by other PRI cards -- I.e: lower numbers (not 0) have higher priority. * FXO: - Power denial: create two module parameters instead of hard-coded constants (power_denial_safezone, power_denial_minlen). For sites that get non-standard power-denial signals from central office on offhook. - Don't hangup on power-denial, just notify Dahdi and wait for - Fix caller-id detection for the case central office sends it before first ring without any indication before. Asterisk's desicion. * USB_FW.hex: - Fixes cases where firmware loading would fail. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6046 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xpp_dahdi.c')
-rw-r--r--drivers/dahdi/xpp/xpp_dahdi.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c
index b1ec98c..e7b024a 100644
--- a/drivers/dahdi/xpp/xpp_dahdi.c
+++ b/drivers/dahdi/xpp/xpp_dahdi.c
@@ -558,28 +558,45 @@ err:
return NULL;
}
-void xpd_unreg_request(xpd_t *xpd)
+/*
+ * Try our best to make asterisk close all channels related to
+ * this Astribank:
+ * - Set span state to DAHDI_ALARM_NOTOPEN in all relevant spans.
+ * - Notify dahdi afterwards about spans (so it can see all changes at once).
+ * - Also send DAHDI_EVENT_REMOVED on all channels.
+ */
+void xbus_request_removal(xbus_t *xbus)
{
unsigned long flags;
+ int i;
- BUG_ON(!xpd);
-
- XPD_DBG(DEVICES, xpd, "\n");
- spin_lock_irqsave(&xpd->lock, flags);
- xpd->card_present = 0;
- xpd_setstate(xpd, XPD_STATE_NOHW);
- if(SPAN_REGISTERED(xpd)) {
- int i;
-
- update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
- /* TODO: Should this be done before releasing the spinlock? */
- XPD_DBG(DEVICES, xpd, "Queuing DAHDI_EVENT_REMOVED on all channels to ask user to close them\n");
- for (i=0; i<xpd->span.channels; i++) {
- dahdi_qevent_lock(XPD_CHAN(xpd, i),DAHDI_EVENT_REMOVED);
+ for(i = 0; i < MAX_XPDS; i++) {
+ xpd_t *xpd = xpd_of(xbus, i);
+ if(xpd) {
+ XPD_DBG(DEVICES, xpd, "\n");
+ spin_lock_irqsave(&xpd->lock, flags);
+ xpd->card_present = 0;
+ xpd_setstate(xpd, XPD_STATE_NOHW);
+ xpd->span.alarms = DAHDI_ALARM_NOTOPEN;
+ spin_unlock_irqrestore(&xpd->lock, flags);
+ }
+ }
+ /* Now notify dahdi */
+ for(i = 0; i < MAX_XPDS; i++) {
+ xpd_t *xpd = xpd_of(xbus, i);
+ if(xpd) {
+ if(SPAN_REGISTERED(xpd)) {
+ int i;
+
+ dahdi_alarm_notify(&xpd->span);
+ XPD_DBG(DEVICES, xpd, "Queuing DAHDI_EVENT_REMOVED on all channels to ask user to release them\n");
+ for (i=0; i<xpd->span.channels; i++) {
+ dahdi_qevent_lock(XPD_CHAN(xpd, i),DAHDI_EVENT_REMOVED);
+ }
+ }
+ xpd_device_unregister(xpd);
}
}
- spin_unlock_irqrestore(&xpd->lock, flags);
- xpd_device_unregister(xpd);
}
/*
@@ -615,9 +632,9 @@ void update_xpd_status(xpd_t *xpd, int alarm_flag)
}
if(span->alarms == alarm_flag)
return;
+ XPD_DBG(GENERAL, xpd, "Update XPD alarms: %s -> %02X\n", xpd->span.name, alarm_flag);
span->alarms = alarm_flag;
dahdi_alarm_notify(span);
- XPD_DBG(GENERAL, xpd, "Update XPD alarms: %s -> %02X\n", xpd->span.name, alarm_flag);
}
/*
@@ -1189,7 +1206,7 @@ EXPORT_SYMBOL(get_xpd);
EXPORT_SYMBOL(put_xpd);
EXPORT_SYMBOL(xpd_alloc);
EXPORT_SYMBOL(xpd_free);
-EXPORT_SYMBOL(xpd_unreg_request);
+EXPORT_SYMBOL(xbus_request_removal);
EXPORT_SYMBOL(update_xpd_status);
EXPORT_SYMBOL(oht_pcm);
EXPORT_SYMBOL(mark_offhook);