From 5ad21bfc23dc09b0e2acd0763e83b107b4e1dc80 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sun, 30 Jan 2011 14:13:22 +0000 Subject: 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 Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9705 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/xpp_dahdi.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/dahdi/xpp/xpp_dahdi.c') diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c index c5e2f6f..0355bb1 100644 --- a/drivers/dahdi/xpp/xpp_dahdi.c +++ b/drivers/dahdi/xpp/xpp_dahdi.c @@ -1066,6 +1066,10 @@ int dahdi_unregister_xpd(xpd_t *xpd) 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 @@ int dahdi_register_xpd(xpd_t *xpd) 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; -- cgit v1.2.3