[svn-commits] tzafrir: linux/trunk r6640 - /linux/trunk/drivers/dahdi/xpp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 19 10:58:17 CDT 2009


Author: tzafrir
Date: Tue May 19 10:58:14 2009
New Revision: 6640

URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6640
Log:
xpp: report in sysfs if bri module uses hardhdlc support

Modified:
    linux/trunk/drivers/dahdi/xpp/card_bri.c
    linux/trunk/drivers/dahdi/xpp/xdefs.h

Modified: linux/trunk/drivers/dahdi/xpp/card_bri.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/card_bri.c?view=diff&rev=6640&r1=6639&r2=6640
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_bri.c Tue May 19 10:58:14 2009
@@ -443,7 +443,9 @@
 	priv = xpd->priv;
 	BUG_ON(!priv);
 #ifdef	CONFIG_DAHDI_BRI_DCHANS
-	dump_hex_buf(xpd, "D-Chan RX: dchan_rbuf", priv->dchan_rbuf, priv->dchan_r_idx);
+	if(debug & DBG_COMMANDS)
+		dump_hex_buf(xpd, "D-Chan(abort) RX: dchan_rbuf",
+			priv->dchan_rbuf, priv->dchan_r_idx);
 	priv->dchan_r_idx = 0;
 #else
 	dahdi_hdlc_abort(dchan, event);
@@ -1143,6 +1145,7 @@
 #ifdef	CONFIG_DAHDI_BRI_DCHANS
 	struct dahdi_chan	*chan = XPD_CHAN(xpd, pos);
 
+	/* Clear D-Channel pending data */
 	chan->bytes2receive = 0;
 	chan->eofrx = 0;
 	chan->bytes2transmit = 0;
@@ -1753,6 +1756,22 @@
 	return len;
 }
 
+static DRIVER_ATTR_READER(dchan_hardhdlc_show, drv,buf)
+{
+	int			len = 0;
+
+#if	defined(CONFIG_DAHDI_BRI_DCHANS)
+	len += sprintf(buf + len, "0\n");
+#elif	defined(DAHDI_SIG_HARDHDLC)
+	len += sprintf(buf + len, "1\n");
+#else
+#error Cannot build BRI without BRISTUFF or HARDHDLC supprt
+#endif
+	return len;
+}
+
+static	DRIVER_ATTR(dchan_hardhdlc,S_IRUGO,dchan_hardhdlc_show,NULL);
+
 static int bri_xpd_probe(struct device *dev)
 {
 	xpd_t	*xpd;
@@ -1794,6 +1813,9 @@
 	int	ret;
 
 	if((ret = xpd_driver_register(&bri_driver.driver)) < 0)
+		return ret;
+	ret = driver_create_file(&bri_driver.driver, &driver_attr_dchan_hardhdlc);
+	if(ret < 0)
 		return ret;
 	INFO("revision %s\n", XPP_VERSION);
 #if	defined(CONFIG_DAHDI_BRI_DCHANS)
@@ -1812,6 +1834,7 @@
 {
 	DBG(GENERAL, "\n");
 	xproto_unregister(&PROTO_TABLE(BRI));
+	driver_remove_file(&bri_driver.driver, &driver_attr_dchan_hardhdlc);
 	xpd_driver_unregister(&bri_driver.driver);
 }
 

Modified: linux/trunk/drivers/dahdi/xpp/xdefs.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/xdefs.h?view=diff&rev=6640&r1=6639&r2=6640
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xdefs.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xdefs.h Tue May 19 10:58:14 2009
@@ -135,6 +135,8 @@
 #define	DEVICE_ATTR_WRITER(name,dev,buf, count)	\
 		ssize_t name(struct device *dev, const char *buf, size_t count)
 #endif
+#define	DRIVER_ATTR_READER(name,drv,buf)	\
+		ssize_t name(struct device_driver *drv, char * buf)
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
 #define dev_name(dev)		(dev)->bus_id




More information about the svn-commits mailing list