summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-02-03 21:37:57 +0000
committerShaun Ruffell <sruffell@digium.com>2010-02-03 21:37:57 +0000
commitc9bcc7d735432abe624785c286dec0ae6e92e31b (patch)
treee0ef76fd42ed115511f81970cf47d9a62856cb47
parentea3be9d2f30f991e60a3b5999861f3f7f4dbfb0d (diff)
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. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7983 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/voicebus/voicebus.c32
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c34
2 files changed, 34 insertions, 32 deletions
diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c
index 46c6ab0..edd4039 100644
--- a/drivers/dahdi/voicebus/voicebus.c
+++ b/drivers/dahdi/voicebus/voicebus.c
@@ -1056,24 +1056,6 @@ voicebus_stop(struct voicebus *vb)
}
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 @@ DEVICE_ATTR(voicebus_current_latency, 0444,
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 @@ voicebus_init(struct voicebus *vb, const char *board_name)
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.
---------------------------------------------------------------- */
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 2fc07b4..512cdd5 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -3710,6 +3710,25 @@ static void free_wc(struct wctdm *wc)
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 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic
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 @@ static void __devexit wctdm_remove_one(struct pci_dev *pdev)
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);
@@ -3930,6 +3963,7 @@ static void __exit wctdm_cleanup(void)
pci_unregister_driver(&wctdm_driver);
}
+
module_param(debug, int, 0600);
module_param(fxovoltage, int, 0600);
module_param(loopcurrent, int, 0600);