Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330103
b: refs/heads/master
c: 92589c9
h: refs/heads/master
i:
  330101: 9679a1e
  330099: 49a5635
  330095: 5283469
v: v3
  • Loading branch information
Kim, Milo authored and Linus Torvalds committed Oct 5, 2012
1 parent c89e648 commit 955c7a2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5fa44f86910ca9ee477cbd944c18f9349cdca30d
refs/heads/master: 92589c986b3360ce15d239fd5113a856412a0b3f
5 changes: 3 additions & 2 deletions trunk/Documentation/rtc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ three different userspace interfaces:
* /sys/class/rtc/rtcN ... sysfs attributes support readonly
access to some RTC attributes.

* /proc/driver/rtc ... the first RTC (rtc0) may expose itself
using a procfs interface. More information is (currently) shown
* /proc/driver/rtc ... the system clock RTC may expose itself
using a procfs interface. If there is no RTC for the system clock,
rtc0 is used by default. More information is (currently) shown
here than through sysfs.

The RTC Class framework supports a wide variety of RTCs, ranging from those
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ config RTC_INTF_SYSFS
If unsure, say Y.

config RTC_INTF_PROC
boolean "/proc/driver/rtc (procfs for rtc0)"
boolean "/proc/driver/rtc (procfs for rtcN)"
depends on PROC_FS
default RTC_CLASS
help
Say yes here if you want to use your first RTC through the proc
interface, /proc/driver/rtc. Other RTCs will not be available
through that API.
Say yes here if you want to use your system clock RTC through
the proc interface, /proc/driver/rtc.
Other RTCs will not be available through that API.
If there is no RTC for the system clock, then the first RTC(rtc0)
is used by default.

If unsure, say Y.

Expand Down
24 changes: 22 additions & 2 deletions trunk/drivers/rtc/rtc-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@

#include "rtc-core.h"

#define NAME_SIZE 10

#if defined(CONFIG_RTC_HCTOSYS_DEVICE)
static bool is_rtc_hctosys(struct rtc_device *rtc)
{
int size;
char name[NAME_SIZE];

size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id);
if (size > NAME_SIZE)
return false;

return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE);
}
#else
static bool is_rtc_hctosys(struct rtc_device *rtc)
{
return (rtc->id == 0);
}
#endif

static int rtc_proc_show(struct seq_file *seq, void *offset)
{
Expand Down Expand Up @@ -117,12 +137,12 @@ static const struct file_operations rtc_proc_fops = {

void rtc_proc_add_device(struct rtc_device *rtc)
{
if (rtc->id == 0)
if (is_rtc_hctosys(rtc))
proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc);
}

void rtc_proc_del_device(struct rtc_device *rtc)
{
if (rtc->id == 0)
if (is_rtc_hctosys(rtc))
remove_proc_entry("driver/rtc", NULL);
}

0 comments on commit 955c7a2

Please sign in to comment.