[LinuxPPS] [PATCH 05/11] pps: Make sysfs assert & clear times work even if software ignores them.

George Spelvin linux at horizon.com
Fri Feb 6 14:31:36 CET 2009


There's no reason to have the sysfs files conditional on the current capture mask.

---
 drivers/pps/sysfs.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/pps/sysfs.c b/drivers/pps/sysfs.c
index d4fe11e..8e47d4d 100644
--- a/drivers/pps/sysfs.c
+++ b/drivers/pps/sysfs.c
@@ -33,15 +33,11 @@ static ssize_t pps_show_assert(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
-	u32 seq;
+	u32 const seq = pps->assert_sequence;
 
-	if (!(pps->info.mode & PPS_CAPTUREASSERT))
-		return 0;
-
-	seq = pps->assert_sequence;
 	rmb();
 	return sprintf(buf, "%lld.%09d#%d\n",
-			(long long) pps->assert_tu[seq % 4].sec,
+			(long long)pps->assert_tu[seq % 4].sec,
 			pps->assert_tu[seq % 4].nsec, (unsigned)seq);
 }
 
@@ -49,15 +45,11 @@ static ssize_t pps_show_clear(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
 	struct pps_device *pps = dev_get_drvdata(dev);
-	u32 seq;
-
-	if (!(pps->info.mode & PPS_CAPTURECLEAR))
-		return 0;
+	u32 const seq = pps->clear_sequence;
 
-	seq = pps->clear_sequence;
 	rmb();
 	return sprintf(buf, "%lld.%09d#%d\n",
-			(long long) pps->clear_tu[seq % 4].sec,
+			(long long)pps->clear_tu[seq % 4].sec,
 			pps->clear_tu[seq % 4].nsec, (unsigned)seq);
 }
 
-- 
1.6.0.6




More information about the LinuxPPS mailing list