diff options
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r-- | drivers/rtc/rtc-proc.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 1bd624fc685c..195be6587b30 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -16,18 +16,21 @@ | |||
16 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | 18 | ||
19 | #include "rtc-core.h" | ||
20 | |||
21 | |||
19 | static struct class_device *rtc_dev = NULL; | 22 | static struct class_device *rtc_dev = NULL; |
20 | static DEFINE_MUTEX(rtc_lock); | 23 | static DEFINE_MUTEX(rtc_lock); |
21 | 24 | ||
22 | static int rtc_proc_show(struct seq_file *seq, void *offset) | 25 | static int rtc_proc_show(struct seq_file *seq, void *offset) |
23 | { | 26 | { |
24 | int err; | 27 | int err; |
25 | struct class_device *class_dev = seq->private; | 28 | struct rtc_device *rtc = seq->private; |
26 | const struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops; | 29 | const struct rtc_class_ops *ops = rtc->ops; |
27 | struct rtc_wkalrm alrm; | 30 | struct rtc_wkalrm alrm; |
28 | struct rtc_time tm; | 31 | struct rtc_time tm; |
29 | 32 | ||
30 | err = rtc_read_time(class_dev, &tm); | 33 | err = rtc_read_time(rtc, &tm); |
31 | if (err == 0) { | 34 | if (err == 0) { |
32 | seq_printf(seq, | 35 | seq_printf(seq, |
33 | "rtc_time\t: %02d:%02d:%02d\n" | 36 | "rtc_time\t: %02d:%02d:%02d\n" |
@@ -36,7 +39,7 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
36 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); | 39 | tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday); |
37 | } | 40 | } |
38 | 41 | ||
39 | err = rtc_read_alarm(class_dev, &alrm); | 42 | err = rtc_read_alarm(rtc, &alrm); |
40 | if (err == 0) { | 43 | if (err == 0) { |
41 | seq_printf(seq, "alrm_time\t: "); | 44 | seq_printf(seq, "alrm_time\t: "); |
42 | if ((unsigned int)alrm.time.tm_hour <= 24) | 45 | if ((unsigned int)alrm.time.tm_hour <= 24) |
@@ -74,19 +77,19 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
74 | seq_printf(seq, "24hr\t\t: yes\n"); | 77 | seq_printf(seq, "24hr\t\t: yes\n"); |
75 | 78 | ||
76 | if (ops->proc) | 79 | if (ops->proc) |
77 | ops->proc(class_dev->dev, seq); | 80 | ops->proc(rtc->class_dev.dev, seq); |
78 | 81 | ||
79 | return 0; | 82 | return 0; |
80 | } | 83 | } |
81 | 84 | ||
82 | static int rtc_proc_open(struct inode *inode, struct file *file) | 85 | static int rtc_proc_open(struct inode *inode, struct file *file) |
83 | { | 86 | { |
84 | struct class_device *class_dev = PDE(inode)->data; | 87 | struct rtc_device *rtc = PDE(inode)->data; |
85 | 88 | ||
86 | if (!try_module_get(THIS_MODULE)) | 89 | if (!try_module_get(THIS_MODULE)) |
87 | return -ENODEV; | 90 | return -ENODEV; |
88 | 91 | ||
89 | return single_open(file, rtc_proc_show, class_dev); | 92 | return single_open(file, rtc_proc_show, rtc); |
90 | } | 93 | } |
91 | 94 | ||
92 | static int rtc_proc_release(struct inode *inode, struct file *file) | 95 | static int rtc_proc_release(struct inode *inode, struct file *file) |
@@ -118,7 +121,7 @@ static int rtc_proc_add_device(struct class_device *class_dev, | |||
118 | 121 | ||
119 | ent->proc_fops = &rtc_proc_fops; | 122 | ent->proc_fops = &rtc_proc_fops; |
120 | ent->owner = rtc->owner; | 123 | ent->owner = rtc->owner; |
121 | ent->data = class_dev; | 124 | ent->data = rtc; |
122 | 125 | ||
123 | dev_dbg(class_dev->dev, "rtc intf: proc\n"); | 126 | dev_dbg(class_dev->dev, "rtc intf: proc\n"); |
124 | } | 127 | } |