[svn-commits] tzafrir: linux/trunk r9705 - /linux/trunk/drivers/dahdi/xpp/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sun Jan 30 08:13:27 CST 2011
Author: tzafrir
Date: Sun Jan 30 08:13:22 2011
New Revision: 9705
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9705
Log:
xpp: More adaptations for non-PHONEDEV XPDs
* Add IS_PHONEDEV(xpd) macro
* Reject dahdi_register_xpd()/dahdi_unregister_xpd() for non-PHONEDEV
* Make sysfs 'offhook' attribute contain '\n' if empty (no channels)
* Skip PHONEDEV related xbus_tick() parts -- we still want to process
the end of it for the card_tick() calls.
* Remove BUG_ON() for missing phoneops
(also remove old duplicate test for XBUS_IS...)
* Call XPD_STATE method only for PHONEDEV XPD's
Signed-off-by: Oron Peled <oron at actcom.co.il>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Modified:
linux/trunk/drivers/dahdi/xpp/xbus-core.c
linux/trunk/drivers/dahdi/xpp/xbus-pcm.c
linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
linux/trunk/drivers/dahdi/xpp/xpd.h
linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c
linux/trunk/drivers/dahdi/xpp/xproto.h
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=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.c Sun Jan 30 08:13:22 2011
@@ -809,7 +809,6 @@
subunits,
port_dir
);
- BUG_ON(!proto_table->phoneops);
xbus->worker.num_units += subunits - 1;
for(i = 0; i < subunits; i++) {
int subunit_ports = proto_table->ports_per_subunit;
@@ -841,12 +840,6 @@
i,
type,
subtype, subunit_ports);
- if(!XBUS_IS(xbus, RECVD_DESC)) {
- XBUS_ERR(xbus, "Aborting creation -- In bad state %s\n",
- xbus_statename(XBUS_STATE(xbus)));
- ret = -ENODEV;
- goto out;
- }
ret = create_xpd(xbus, proto_table, unit, i, type, subtype, subunits, subunit_ports, port_dir);
if(ret < 0) {
XBUS_ERR(xbus, "Creation of XPD=%d%d failed %d\n",
@@ -913,7 +906,9 @@
}
//CALL_XMETHOD(XPD_STATE, xpd->xbus, xpd, 0); /* Turn off all channels */
xpd->card_present = 1;
- PHONE_METHOD(xpd, XPD_STATE)(xpd->xbus, xpd, 1); /* Turn on all channels */
+ if (IS_PHONEDEV(xpd)) {
+ PHONE_METHOD(xpd, XPD_STATE)(xpd->xbus, xpd, 1); /* Turn on all channels */
+ }
if(!xpd_setstate(xpd, XPD_STATE_READY)) {
goto out;
}
Modified: linux/trunk/drivers/dahdi/xpp/xbus-pcm.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-pcm.c?view=diff&rev=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-pcm.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-pcm.c Sun Jan 30 08:13:22 2011
@@ -628,7 +628,7 @@
xpd_t *xpd = xpd_of(xbus, j);
int prio;
- if(!xpd || !xpd->card_present)
+ if(!xpd || !xpd->card_present || !IS_PHONEDEV(xpd))
continue;
prio = PHONE_METHOD(xpd, card_timing_priority)(xbus, xpd);
if (prio < 0) {
@@ -1045,12 +1045,13 @@
* Fill xframes
*/
for(i = 0; i < MAX_XPDS; i++) {
- size_t pcm_len;
-
if((xpd = xpd_of(xbus, i)) == NULL)
continue;
- pcm_len = PHONEDEV(xpd).pcm_len;
+ if (!IS_PHONEDEV(xpd))
+ continue;
if(SPAN_REGISTERED(xpd)) {
+ size_t pcm_len = PHONEDEV(xpd).pcm_len;
+
if(pcm_len && xpd->card_present) {
do {
// pack = NULL; /* FORCE single packet frames */
@@ -1118,11 +1119,13 @@
xpd = xpd_of(xbus, i);
if(!xpd || !xpd->card_present)
continue;
- if(SPAN_REGISTERED(xpd)) {
- do_ec(xpd);
- dahdi_receive(&PHONEDEV(xpd).span);
- }
- PHONEDEV(xpd).silence_pcm = 0; /* silence was injected */
+ if (IS_PHONEDEV(xpd)) {
+ if(SPAN_REGISTERED(xpd)) {
+ do_ec(xpd);
+ dahdi_receive(&PHONEDEV(xpd).span);
+ }
+ PHONEDEV(xpd).silence_pcm = 0; /* silence was injected */
+ }
xpd->timer_count = xbus->global_counter;
/*
* Must be called *after* tx/rx so
Modified: linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c?view=diff&rev=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c Sun Jan 30 08:13:22 2011
@@ -677,8 +677,8 @@
}
if(len) {
len--; /* backout last space */
- len += sprintf(buf + len, "\n");
- }
+ }
+ len += sprintf(buf + len, "\n");
return len;
}
Modified: linux/trunk/drivers/dahdi/xpp/xpd.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xpd.h?view=diff&rev=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xpd.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xpd.h Sun Jan 30 08:13:22 2011
@@ -149,7 +149,8 @@
bool xpd_setstate(xpd_t *xpd, enum xpd_state newstate);
const char *xpd_statename(enum xpd_state st);
-#define PHONEDEV(xpd) ((xpd)->phonedev)
+#define PHONEDEV(xpd) ((xpd)->phonedev)
+#define IS_PHONEDEV(xpd) (PHONEDEV(xpd).phoneops)
struct phonedev {
const struct phoneops *phoneops; /* Card level operations */
Modified: linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c?view=diff&rev=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xpp_dahdi.c Sun Jan 30 08:13:22 2011
@@ -1066,6 +1066,10 @@
BUG_ON(!xpd);
spin_lock_irqsave(&xpd->lock, flags);
+ if (!IS_PHONEDEV(xpd)) {
+ XPD_ERR(xpd, "Not a telephony device\n");
+ return -EBADF;
+ }
if(!SPAN_REGISTERED(xpd)) {
XPD_NOTICE(xpd, "Already unregistered\n");
spin_unlock_irqrestore(&xpd->lock, flags);
@@ -1118,6 +1122,10 @@
xbus = xpd->xbus;
+ if (!IS_PHONEDEV(xpd)) {
+ XPD_ERR(xpd, "Not a telephony device\n");
+ return -EBADF;
+ }
if (SPAN_REGISTERED(xpd)) {
XPD_ERR(xpd, "Already registered\n");
return -EEXIST;
Modified: linux/trunk/drivers/dahdi/xpp/xproto.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xproto.h?view=diff&rev=9705&r1=9704&r2=9705
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xproto.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xproto.h Sun Jan 30 08:13:22 2011
@@ -255,7 +255,6 @@
xproto_entry_t entries[256]; /* Indexed by opcode */
const struct xops *xops; /* Card level operations */
const struct phoneops *phoneops; /* DAHDI operations */
- //const struct echoops *echo;
xpd_type_t type;
byte ports_per_subunit;
const char *name;
More information about the svn-commits
mailing list