[zaptel-commits] sruffell: branch sruffell/voicebus r3876 - /team/sruffell/voicebus/voicebus.c

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Mon Feb 25 14:58:52 CST 2008


Author: sruffell
Date: Mon Feb 25 14:58:51 2008
New Revision: 3876

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3876
Log:
Removing the mostly commented out code for adding a sysfs attribute to the PCI
device in the voicebus library.  These attributes are more appropriately
managed in the various client libraries.


Modified:
    team/sruffell/voicebus/voicebus.c

Modified: team/sruffell/voicebus/voicebus.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/voicebus/voicebus.c?view=diff&rev=3876&r1=3875&r2=3876
==============================================================================
--- team/sruffell/voicebus/voicebus.c (original)
+++ team/sruffell/voicebus/voicebus.c Mon Feb 25 14:58:51 2008
@@ -108,7 +108,6 @@
 #define 	CSR9_MDI		0x00080000
 
 /* Forward declarations */
-static void voicebus_remove_device_attributes(struct voicebus* vb);
 static inline int vb_submit_rxb(struct voicebus *vb, void* vbb);
 static inline void vb_deferred(struct voicebus *vb);
 static int vb_is_stopped(struct voicebus *vb);
@@ -142,7 +141,7 @@
 	unsigned int	padding;
 };
 
-#define __DECLARE_VB_ATTR(_name) struct device_attribute dev_attr_##_name;
+
 /*!  * \brief Represents a VoiceBus interface on a Digium telephony card.
  */
 struct voicebus {
@@ -197,9 +196,6 @@
 	u32 sdi;
 	/*! Number of tx buffers to queue up before enabling interrupts. */
 	unsigned int 	min_tx_buffer_count;
-	/*! sysfs attribute to allow user to read / set the current number of
-	 * tx buffers that are pending. */
-	__DECLARE_VB_ATTR(tx_buffers_pending);
 };
 
 /*
@@ -315,7 +311,6 @@
 	 *
 	 */
 	dl->padding = (vb->cache_line_size*sizeof(u32)) - sizeof(*d);
-	printk("HERE: %s:%d padding=%d\n", __FILE__, __LINE__, dl->padding);
 	
 	dl->desc = pci_alloc_consistent(vb->pdev, 
 		(sizeof(*d) + dl->padding) * DRING_SIZE, &dl->desc_dma);
@@ -1043,9 +1038,6 @@
 {
 	assert(!in_interrupt());
 
-	/* Make sure user space can't sneak in while we're stopping. */
-	voicebus_remove_device_attributes(vb);
-	
 	/* quiesce the hardware */
 	voicebus_stop(vb);
 #if VOICEBUS_DEFERRED == WORKQUEUE
@@ -1310,54 +1302,6 @@
 }
 #endif /* #if VOICEBUS_DEFERRED == WORKQUEUE */
 
-#if 0
-#define vb_from_attr(_name, _attr) container_of(_attr, struct voicebus, dev_attr_##_name)
-
-static ssize_t
-show_tx_buffers_pending(struct device *d, struct device_attribute *attr, char* buf)
-{
-	struct voicebus *vb = vb_from_attr(tx_buffers_pending, attr);
-	return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&vb->txd.count));
-}
-
-static ssize_t 
-store_tx_buffers_pending(struct device *d, struct device_attribute *attr, const char *buf, size_t size)
-{
-	// struct voicebus *vb = vb_from_attr(tx_buffers_pending, attr);
-	return size;
-}
-
-#define __PREPARE_VB_ATTR(_vb, _name, _mode) do { 				\
-	(_vb)->dev_attr_##_name.attr.name = __stringify(_name);			\
-	(_vb)->dev_attr_##_name.attr.mode = _mode;				\
-	(_vb)->dev_attr_##_name.attr.owner = THIS_MODULE;			\
-	(_vb)->dev_attr_##_name.show = show_##_name;				\
-	(_vb)->dev_attr_##_name.store = store_##_name;				\
-	} while(0)
-#endif
-
-#define __CREATE_VB_FILE(_vb, _name) device_create_file(&(_vb)->pdev->dev, &(_vb)->dev_attr_##_name)
-static int
-voicebus_add_device_attributes(struct voicebus *vb)
-{
-#if 0
-	__PREPARE_VB_ATTR(vb, tx_buffers_pending, 0644);
-	return __CREATE_VB_FILE(vb, tx_buffers_pending);
-#else
-	return 0;
-#endif
-}
-#define __REMOVE_VB_FILE(_vb, _name) device_remove_file(&(_vb)->pdev->dev, &(_vb)->dev_attr_##_name)
-static void
-voicebus_remove_device_attributes(struct voicebus *vb)
-{
-#if 0
-	__REMOVE_VB_FILE(vb, tx_buffers_pending);
-#else
-	return;
-#endif
-}
-
 /*!
  * \brief Initalize the voicebus interface. 
  *
@@ -1394,6 +1338,9 @@
 		goto cleanup;
 	}
 	memset(vb,0,sizeof(*vb));
+	/* \todo make sure there is a note that the caller needs to make sure
+	 * board_name stays in memory until voicebus_release is called.
+	 */
 	vb->board_name = board_name;
 	spin_lock_init(&vb->lock);
 	init_completion(&vb->stopped_completion);
@@ -1444,8 +1391,6 @@
 	}
 	
 
-	voicebus_add_device_attributes(vb);
-
 	/* ---------------------------------------------------------------- 
 	   Configure the hardware / kernel module interfaces. 
 	   ---------------------------------------------------------------- */




More information about the zaptel-commits mailing list