Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933204Ab2JDNtG (ORCPT ); Thu, 4 Oct 2012 09:49:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51523 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933097Ab2JDNtE (ORCPT ); Thu, 4 Oct 2012 09:49:04 -0400 From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , John Stultz , Thomas Gleixner Subject: [PATCH] ntp, add debugfs entries for time_status and time_state Date: Thu, 4 Oct 2012 09:48:41 -0400 Message-Id: <1349358521-4386-1-git-send-email-prarit@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1908 Lines: 73 Add debugfs entries for ntp time_status and time_state. These are useful for debugging ntp issues. Signed-off-by: Prarit Bhargava Cc: John Stultz Cc: Thomas Gleixner --- kernel/time/ntp.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 24174b4..e1ba393 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "tick-internal.h" @@ -965,3 +966,42 @@ void __init ntp_init(void) { ntp_clear(); } + +static int time_status_get(void *data, u64 *val) +{ + *val = time_status; + return 0; +} +DEFINE_SIMPLE_ATTRIBUTE(time_status_fops, time_status_get, NULL, "0x%0llx\n"); + +static int time_state_get(void *data, u64 *val) +{ + *val = time_state; + return 0; +} +DEFINE_SIMPLE_ATTRIBUTE(time_state_fops, time_state_get, NULL, "0x%llx\n"); + +static int __init ntp_debugfs_init(void) +{ + struct dentry *ntp_dentry, *time_status_dentry, *time_state_dentry; + + ntp_dentry = debugfs_create_dir("ntp", NULL); + if (!ntp_dentry) + return -ENOMEM; + + time_status_dentry = debugfs_create_file("time_status", 0444, + ntp_dentry, NULL, + &time_status_fops); + if (!time_status_dentry) + return -ENOMEM; + + time_state_dentry = debugfs_create_file("time_state", 0444, + ntp_dentry, NULL, + &time_state_fops); + if (!time_state_dentry) + return -ENOMEM; + + return 0; +} +/* debugfs init is core_initcall */ +postcore_initcall(ntp_debugfs_init); -- 1.7.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/