xpp: pre/post_unregister: not for the EC

Don't run the pre- and post-unregister hooks on a non-phone XPD
(practically: the echo canceller). This fixes a panic with manual
'dahdi_registertion off' as it is now called for the whole device
(regression of 2.6.x).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10735 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Tzafrir Cohen 2012-11-15 13:40:56 +00:00
parent 38bf049c45
commit 6a3163e05c

View File

@ -1125,7 +1125,7 @@ int xpd_dahdi_postregister(xpd_t *xpd)
*/
void xpd_dahdi_preunregister(xpd_t *xpd)
{
if (!xpd)
if (!xpd || !IS_PHONEDEV(xpd))
return;
XPD_DBG(DEVICES, xpd, "\n");
update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
@ -1148,7 +1148,7 @@ void xpd_dahdi_preunregister(xpd_t *xpd)
void xpd_dahdi_postunregister(xpd_t *xpd)
{
if (!xpd)
if (!xpd || !IS_PHONEDEV(xpd))
return;
atomic_dec(&PHONEDEV(xpd).dahdi_registered);
atomic_dec(&num_registered_spans);