[svn-commits] rmeyerriecks: linux/trunk r9188 - /linux/trunk/drivers/dahdi/wcb4xxp/base.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Aug 24 13:44:03 CDT 2010
Author: rmeyerriecks
Date: Tue Aug 24 13:44:00 2010
New Revision: 9188
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9188
Log:
wcb4xxp: Added card level timing information in sysfs
For kernels >= 2.6.18, each individual card has it's local
timing hung off the pci device in the sysfs tree. dahdi-626
Modified:
linux/trunk/drivers/dahdi/wcb4xxp/base.c
Modified: linux/trunk/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=9188&r1=9187&r2=9188
==============================================================================
--- linux/trunk/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcb4xxp/base.c Tue Aug 24 13:44:00 2010
@@ -1134,6 +1134,7 @@
b = (port & V_SYNC_SEL_MASK) | V_MAN_SYNC;
b4xxp_setreg8(b4, R_ST_SYNC, b);
+ b4->syncspan = port;
}
/*
@@ -1160,6 +1161,41 @@
else
return src;
}
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18))
+static ssize_t b4_timing_master_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct b4xxp *b4 = dev_get_drvdata(dev);
+ return sprintf(buf, "%d\n", b4->syncspan);
+}
+
+static DEVICE_ATTR(timing_master, 0400, b4_timing_master_show, NULL);
+
+static void create_sysfs_files(struct b4xxp *b4)
+{
+ int ret;
+ ret = device_create_file(b4->dev,
+ &dev_attr_timing_master);
+ if (ret) {
+ dev_info(b4->dev,
+ "Failed to create device attributes.\n");
+ }
+}
+
+static void remove_sysfs_files(struct b4xxp *b4)
+{
+ device_remove_file(b4->dev,
+ &dev_attr_timing_master);
+}
+
+#else
+
+static inline void create_sysfs_files(struct b4xxp *b4) { return; }
+static inline void remove_sysfs_files(struct b4xxp *b4) { return; }
+
+#endif /* LINUX_KERNEL > 2.6.18 */
/*
* allocates memory and pretty-prints a given S/T state engine state to it.
@@ -1861,6 +1897,8 @@
flush_pci();
udelay(100); /* wait a bit for clock to settle */
+
+ create_sysfs_files(b4);
}
/*
@@ -2887,6 +2925,7 @@
}
b4xxp_init_stage1(b4);
+ remove_sysfs_files(b4);
free_irq(pdev->irq, b4);
pci_set_drvdata(pdev, NULL);
pci_iounmap(pdev, b4->ioaddr);
More information about the svn-commits
mailing list