Patchwork [1/4] RTC: Include information about UIE and PIE in RTC driver proc.

login
register
mail settings
Submitter Marcelo Roberto Jimenez
Date Feb. 7, 2011, 9:16 p.m.
Message ID <1297113368-27174-2-git-send-email-mroberto@cpti.cetuc.puc-rio.br>
Download mbox | patch
Permalink /patch/82152/
State New
Headers show

Comments

Marcelo Roberto Jimenez - Feb. 7, 2011, 9:16 p.m.
Generic RTC code is always able to provide the necessary information
about update and periodic interrupts. This patch add such information to
the proc interface.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
---
 drivers/rtc/rtc-proc.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
John Stultz - Feb. 10, 2011, 11:06 p.m.
On Mon, 2011-02-07 at 19:16 -0200, Marcelo Roberto Jimenez wrote:
> Generic RTC code is always able to provide the necessary information
> about update and periodic interrupts. This patch add such information to
> the proc interface.

This seems to be mostly formatting changes. Are you sure we wont' break
applications expecting the existing format?

thanks
-john
Marcelo Roberto Jimenez - Feb. 11, 2011, 12:34 p.m.
Hi John,

On Thu, Feb 10, 2011 at 21:06, John Stultz <john.stultz@linaro.org> wrote:
>
> This seems to be mostly formatting changes. Are you sure we wont' break
> applications expecting the existing format?

No, I can't be 100% sure, that will depend upon how the application
parses the proc output. The formatting changes are all white space, so
I could remove them. If the value is read using scanf, white spaces
are skipped and the "\t" that were added to make the output pleasant
to the view are not a problem. That part can be reworked if you think
the breakage is serious, it is not really important.

The important thing in the patch are the information additions to the
proc interface: update IRQ enabled, periodic IRQ enabled, periodic IRQ
frequency and max user IRQ frequency. What do you think about these?

> thanks
> -john

Regards,
Marcelo.

Patch

diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index c086fc3..b4ecec0 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -30,15 +30,15 @@  static int rtc_proc_show(struct seq_file *seq, void *offset)
 	err = rtc_read_time(rtc, &tm);
 	if (err == 0) {
 		seq_printf(seq,
-			"rtc_time\t: %02d:%02d:%02d\n"
-			"rtc_date\t: %04d-%02d-%02d\n",
+			"rtc_time\t\t: %02d:%02d:%02d\n"
+			"rtc_date\t\t: %04d-%02d-%02d\n",
 			tm.tm_hour, tm.tm_min, tm.tm_sec,
 			tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
 	}
 
 	err = rtc_read_alarm(rtc, &alrm);
 	if (err == 0) {
-		seq_printf(seq, "alrm_time\t: ");
+		seq_printf(seq, "alrm_time\t\t: ");
 		if ((unsigned int)alrm.time.tm_hour <= 24)
 			seq_printf(seq, "%02d:", alrm.time.tm_hour);
 		else
@@ -52,7 +52,7 @@  static int rtc_proc_show(struct seq_file *seq, void *offset)
 		else
 			seq_printf(seq, "**\n");
 
-		seq_printf(seq, "alrm_date\t: ");
+		seq_printf(seq, "alrm_date\t\t: ");
 		if ((unsigned int)alrm.time.tm_year <= 200)
 			seq_printf(seq, "%04d-", alrm.time.tm_year + 1900);
 		else
@@ -65,13 +65,21 @@  static int rtc_proc_show(struct seq_file *seq, void *offset)
 			seq_printf(seq, "%02d\n", alrm.time.tm_mday);
 		else
 			seq_printf(seq, "**\n");
-		seq_printf(seq, "alarm_IRQ\t: %s\n",
+		seq_printf(seq, "alarm IRQ enabled\t: %s\n",
 				alrm.enabled ? "yes" : "no");
-		seq_printf(seq, "alrm_pending\t: %s\n",
+		seq_printf(seq, "alarm pending\t\t: %s\n",
 				alrm.pending ? "yes" : "no");
+		seq_printf(seq, "update IRQ enabled\t: %s\n",
+			(rtc->uie_rtctimer.enabled) ? "yes" : "no");
+		seq_printf(seq, "periodic IRQ enabled\t: %s\n",
+			(rtc->pie_enabled) ? "yes" : "no");
+		seq_printf(seq, "periodic IRQ frequency\t: %d\n",
+			rtc->irq_freq);
+		seq_printf(seq, "max user IRQ frequency\t: %d\n",
+			rtc->max_user_freq);
 	}
 
-	seq_printf(seq, "24hr\t\t: yes\n");
+	seq_printf(seq, "24hr\t\t\t: yes\n");
 
 	if (ops->proc)
 		ops->proc(rtc->dev.parent, seq);