aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-proc.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 03:33:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:18 -0400
commit7d9f99eccc8f94ace31030a2a7ff73cf5f8c12a0 (patch)
tree4a4690e4050db31d7ea14c629d5710fd74cb16ae /drivers/rtc/rtc-proc.c
parent446ecbd925dc580c9972049c926c17aa8d967fe4 (diff)
rtc: simplified /proc/driver/rtc handling
This simplifies the RTC procfs support by removing the class_interface that hooks it into the rtc core. If it's configured, then sysfs support is now part of the RTC core, and is never a separate module. It also removes the class_interface hook, now that its last remaining user is gone. (That API is usable only with a "struct class_device".) It's another step towards being able to remove "struct class_device". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-By: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r--drivers/rtc/rtc-proc.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index 195be6587b3..3d7f4547c7d 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -19,9 +19,6 @@
19#include "rtc-core.h" 19#include "rtc-core.h"
20 20
21 21
22static struct class_device *rtc_dev = NULL;
23static DEFINE_MUTEX(rtc_lock);
24
25static int rtc_proc_show(struct seq_file *seq, void *offset) 22static int rtc_proc_show(struct seq_file *seq, void *offset)
26{ 23{
27 int err; 24 int err;
@@ -106,62 +103,22 @@ static const struct file_operations rtc_proc_fops = {
106 .release = rtc_proc_release, 103 .release = rtc_proc_release,
107}; 104};
108 105
109static int rtc_proc_add_device(struct class_device *class_dev, 106void rtc_proc_add_device(struct rtc_device *rtc)
110 struct class_interface *class_intf)
111{ 107{
112 mutex_lock(&rtc_lock); 108 if (rtc->id == 0) {
113 if (rtc_dev == NULL) {
114 struct proc_dir_entry *ent; 109 struct proc_dir_entry *ent;
115 110
116 rtc_dev = class_dev;
117
118 ent = create_proc_entry("driver/rtc", 0, NULL); 111 ent = create_proc_entry("driver/rtc", 0, NULL);
119 if (ent) { 112 if (ent) {
120 struct rtc_device *rtc = to_rtc_device(class_dev);
121
122 ent->proc_fops = &rtc_proc_fops; 113 ent->proc_fops = &rtc_proc_fops;
123 ent->owner = rtc->owner; 114 ent->owner = rtc->owner;
124 ent->data = rtc; 115 ent->data = rtc;
125
126 dev_dbg(class_dev->dev, "rtc intf: proc\n");
127 } 116 }
128 else
129 rtc_dev = NULL;
130 } 117 }
131 mutex_unlock(&rtc_lock);
132
133 return 0;
134} 118}
135 119
136static void rtc_proc_remove_device(struct class_device *class_dev, 120void rtc_proc_del_device(struct rtc_device *rtc)
137 struct class_interface *class_intf)
138{ 121{
139 mutex_lock(&rtc_lock); 122 if (rtc->id == 0)
140 if (rtc_dev == class_dev) {
141 remove_proc_entry("driver/rtc", NULL); 123 remove_proc_entry("driver/rtc", NULL);
142 rtc_dev = NULL;
143 }
144 mutex_unlock(&rtc_lock);
145}
146
147static struct class_interface rtc_proc_interface = {
148 .add = &rtc_proc_add_device,
149 .remove = &rtc_proc_remove_device,
150};
151
152static int __init rtc_proc_init(void)
153{
154 return rtc_interface_register(&rtc_proc_interface);
155} 124}
156
157static void __exit rtc_proc_exit(void)
158{
159 class_interface_unregister(&rtc_proc_interface);
160}
161
162subsys_initcall(rtc_proc_init);
163module_exit(rtc_proc_exit);
164
165MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
166MODULE_DESCRIPTION("RTC class proc interface");
167MODULE_LICENSE("GPL");