[dahdi-commits] sruffell: linux/trunk r7983 - in /linux/trunk/drivers/dahdi: voicebus/ wctdm2...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Feb 3 15:38:08 CST 2010


Author: sruffell
Date: Wed Feb  3 15:37:57 2010
New Revision: 7983

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7983
Log:
wctdm24xxp, voicebus: Move sysfs handling from voicebus to wctdm24xxp.

The drv_data attached to the pci_dev is no longer the 'struct voicebus' pointer,
but is instead the 'struct wctdm' (or 'struct t1'), so the clients need to
manage the sysfs files themselves.

Modified:
    linux/trunk/drivers/dahdi/voicebus/voicebus.c
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=7983&r1=7982&r2=7983
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Wed Feb  3 15:37:57 2010
@@ -1056,24 +1056,6 @@
 }
 EXPORT_SYMBOL(voicebus_stop);
 
-#ifdef CONFIG_VOICEBUS_SYSFS
-static ssize_t
-voicebus_current_latency_show(struct device *dev,
-			      struct device_attribute *attr, char *buf)
-{
-	unsigned long flags;
-	struct voicebus *vb = dev_get_drvdata(dev);
-	unsigned int current_latency;
-	spin_lock_irqsave(&vb->lock, flags);
-	current_latency = vb->min_tx_buffer_count;
-	spin_unlock_irqrestore(&vb->lock, flags);
-	return sprintf(buf, "%d\n", current_latency);
-}
-
-DEVICE_ATTR(voicebus_current_latency, 0444,
-	    voicebus_current_latency_show, NULL);
-#endif
-
 /*!
  * \brief Prepare the interface for module unload.
  *
@@ -1086,10 +1068,6 @@
 void
 voicebus_release(struct voicebus *vb)
 {
-#ifdef CONFIG_VOICEBUS_SYSFS
-	device_remove_file(&vb->pdev->dev, &dev_attr_voicebus_current_latency);
-#endif
-
 	/* quiesce the hardware */
 	voicebus_stop(vb);
 #if VOICEBUS_DEFERRED == WORKQUEUE
@@ -1580,16 +1558,6 @@
 	vb->timer.data = (unsigned long)vb;
 #endif
 
-#ifdef CONFIG_VOICEBUS_SYSFS
-	dev_dbg(&vb->pdev->dev, "Creating sysfs attributes.\n");
-	retval = device_create_file(&vb->pdev->dev,
-				    &dev_attr_voicebus_current_latency);
-	if (retval) {
-		dev_dbg(&vb->pdev->dev,
-			"Failed to create device attributes.\n");
-		goto cleanup;
-	}
-#endif
 	/* ----------------------------------------------------------------
 	   Configure the hardware / kernel module interfaces.
 	   ---------------------------------------------------------------- */

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7983&r1=7982&r2=7983
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Wed Feb  3 15:37:57 2010
@@ -3710,6 +3710,25 @@
 	kfree(wc);
 }
 
+#ifdef CONFIG_VOICEBUS_SYSFS
+static ssize_t
+voicebus_current_latency_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	unsigned long flags;
+	struct wctdm *wc = dev_get_drvdata(dev);
+	unsigned int current_latency;
+	spin_lock_irqsave(&wc->vb.lock, flags);
+	current_latency = wc->vb.min_tx_buffer_count;
+	spin_unlock_irqrestore(&wc->vb.lock, flags);
+	return sprintf(buf, "%d\n", current_latency);
+}
+
+DEVICE_ATTR(voicebus_current_latency, 0400,
+	    voicebus_current_latency_show, NULL);
+#endif
+
+
 static const struct voicebus_operations voicebus_operations = {
 	.handle_receive = handle_receive,
 	.handle_transmit = handle_transmit,
@@ -3753,6 +3772,15 @@
 		return ret;
 	}
 
+#ifdef CONFIG_VOICEBUS_SYSFS
+	dev_dbg(&wc->vb.pdev->dev, "Creating sysfs attributes.\n");
+	ret = device_create_file(&wc->vb.pdev->dev,
+				 &dev_attr_voicebus_current_latency);
+	if (ret) {
+		dev_info(&wc->vb.pdev->dev,
+			"Failed to create device attributes.\n");
+	}
+#endif
 	if (VOICEBUS_DEFAULT_LATENCY != latency) {
 		voicebus_set_minlatency(&wc->vb, latency);
 	}
@@ -3842,6 +3870,11 @@
 	struct wctdm *wc = pci_get_drvdata(pdev);
 	struct vpmadt032 *vpm = wc->vpmadt032;
 
+#ifdef CONFIG_VOICEBUS_SYSFS
+	device_remove_file(&wc->vb.pdev->dev,
+			   &dev_attr_voicebus_current_latency);
+#endif
+
 	if (wc) {
 		if (vpm) {
 			clear_bit(VPM150M_DTMFDETECT, &vpm->control);
@@ -3929,6 +3962,7 @@
 {
 	pci_unregister_driver(&wctdm_driver);
 }
+
 
 module_param(debug, int, 0600);
 module_param(fxovoltage, int, 0600);




More information about the dahdi-commits mailing list