[zaptel-commits] sruffell: branch sruffell/voicebus-devel r3915 - in /team/sruffell/voicebus-d...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Feb 29 10:56:47 CST 2008


Author: sruffell
Date: Fri Feb 29 10:56:46 2008
New Revision: 3915

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3915
Log:
Committing some changes that are still in progress to a separate
voicebus-devel branch so as not to interfere with anyone who might decide to
beta test the voicebus branch.

Added:
    team/sruffell/voicebus-devel/
      - copied from r3891, team/sruffell/voicebus/
    team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c   (with props)
Modified:
    team/sruffell/voicebus-devel/kernel/wctdm24xxp/Kbuild
    team/sruffell/voicebus-devel/kernel/wctdm24xxp/base.c
    team/sruffell/voicebus-devel/kernel/wctdm24xxp/wctdm24xxp.h

Modified: team/sruffell/voicebus-devel/kernel/wctdm24xxp/Kbuild
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus-devel/kernel/wctdm24xxp/Kbuild?view=diff&rev=3915&r1=3891&r2=3915
==============================================================================
--- team/sruffell/voicebus-devel/kernel/wctdm24xxp/Kbuild (original)
+++ team/sruffell/voicebus-devel/kernel/wctdm24xxp/Kbuild Fri Feb 29 10:56:46 2008
@@ -6,7 +6,7 @@
   EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
 endif
 
-wctdm24xxp-objs := base.o GpakCust.o GpakApi.o ../voicebus.o
+wctdm24xxp-objs := base.o GpakCust.o GpakApi.o ../voicebus.o sysfs.o
 
 ifneq ($(HOTPLUG_FIRMWARE),yes)
 wctdm24xxp-objs += ../firmware/zaptel-fw-vpmadt032.o

Modified: team/sruffell/voicebus-devel/kernel/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus-devel/kernel/wctdm24xxp/base.c?view=diff&rev=3915&r1=3891&r2=3915
==============================================================================
--- team/sruffell/voicebus-devel/kernel/wctdm24xxp/base.c (original)
+++ team/sruffell/voicebus-devel/kernel/wctdm24xxp/base.c Fri Feb 29 10:56:46 2008
@@ -3865,6 +3865,15 @@
 	/* Keep track of which device we are */
 	pci_set_drvdata(pdev, wc);
 
+	if ((ret = wctdm24xxp_add_sysfs_attributes(wc))) {
+		dev_printk(KERN_ERR, &pdev->dev, 
+			"Failed to add sysfs attributes.\n");
+		voicebus_release(wc->vb);
+		wc->vb = NULL;
+		kfree(wc);
+		return ret;
+	}
+
 	/* Start the hardware processing. */
 	if (voicebus_start(wc->vb)) {
 		BUG_ON(1);
@@ -3887,7 +3896,7 @@
 	
 	/* Final initialization */
 	wctdm_post_initialize(wc);
-	
+
 	/* We should be ready for zaptel to come in now. */
 	if (zt_register(&wc->span, 0)) {
 		printk("Unable to register span with zaptel\n");
@@ -3933,6 +3942,7 @@
 #endif
 
 	if (wc) {
+		wctdm24xxp_remove_sysfs_attributes(wc);
 
 #ifdef VPM150M_SUPPORT
 		if (vpm150m) {

Added: team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c?view=auto&rev=3915
==============================================================================
--- team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c (added)
+++ team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c Fri Feb 29 10:56:46 2008
@@ -1,0 +1,65 @@
+/*
+ * sysfs interface for wctdm24xxp driver.
+ *
+ * Written by Shaun Ruffell <sruffell at digium.com>
+ * 
+ * Copyright (C) 2008 Digium, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
+ *
+ *
+ */
+
+#include <linux/pci.h>
+#include <linux/device.h>
+#include "wctdm24xxp.h"
+#include "voicebus.h"
+
+static ssize_t
+show_latency(struct device *d, struct device_attribute *attr, char *buf)
+{
+	struct wctdm *wc = dev_get_drvdata(d);
+	return snprintf(buf, PAGE_SIZE, "%d\n",
+		voicebus_current_latency(wc->vb));
+}
+
+#if 0
+static ssize_t
+store_latency(struct device *d, struct device_attribute *attr,
+	const char *buf, size_t size)
+{
+}
+#endif
+
+DEVICE_ATTR(latency, 0444, show_latency, NULL);
+
+int 
+wctdm24xxp_add_sysfs_attributes(struct wctdm *wc)
+{
+	int ret;
+	struct pci_dev *pdev = voicebus_get_pci_dev(wc->vb);
+	ret = device_create_file(&pdev->dev, &dev_attr_latency);
+	return ret;
+}
+
+void
+wctdm24xxp_remove_sysfs_attributes(struct wctdm *wc)
+{
+	struct pci_dev *pdev = voicebus_get_pci_dev(wc->vb);
+	device_remove_file(&pdev->dev, &dev_attr_latency);
+}
+

Propchange: team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/sruffell/voicebus-devel/kernel/wctdm24xxp/sysfs.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/sruffell/voicebus-devel/kernel/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus-devel/kernel/wctdm24xxp/wctdm24xxp.h?view=diff&rev=3915&r1=3891&r2=3915
==============================================================================
--- team/sruffell/voicebus-devel/kernel/wctdm24xxp/wctdm24xxp.h (original)
+++ team/sruffell/voicebus-devel/kernel/wctdm24xxp/wctdm24xxp.h Fri Feb 29 10:56:46 2008
@@ -272,4 +272,7 @@
 extern spinlock_t ifacelock;
 extern struct wctdm *ifaces[WC_MAX_IFACES];
 
-#endif
+extern int wctdm24xxp_add_sysfs_attributes(struct wctdm *wc);
+extern void wctdm24xxp_remove_sysfs_attributes(struct wctdm *wc);
+
+#endif




More information about the zaptel-commits mailing list