diff options
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r-- | drivers/rtc/rtc-proc.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index 31e7e23cc5be..a9dd9218fae2 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -107,40 +107,11 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int rtc_proc_open(struct inode *inode, struct file *file) | ||
111 | { | ||
112 | int ret; | ||
113 | struct rtc_device *rtc = PDE_DATA(inode); | ||
114 | |||
115 | if (!try_module_get(rtc->owner)) | ||
116 | return -ENODEV; | ||
117 | |||
118 | ret = single_open(file, rtc_proc_show, rtc); | ||
119 | if (ret) | ||
120 | module_put(rtc->owner); | ||
121 | return ret; | ||
122 | } | ||
123 | |||
124 | static int rtc_proc_release(struct inode *inode, struct file *file) | ||
125 | { | ||
126 | int res = single_release(inode, file); | ||
127 | struct rtc_device *rtc = PDE_DATA(inode); | ||
128 | |||
129 | module_put(rtc->owner); | ||
130 | return res; | ||
131 | } | ||
132 | |||
133 | static const struct file_operations rtc_proc_fops = { | ||
134 | .open = rtc_proc_open, | ||
135 | .read = seq_read, | ||
136 | .llseek = seq_lseek, | ||
137 | .release = rtc_proc_release, | ||
138 | }; | ||
139 | |||
140 | void rtc_proc_add_device(struct rtc_device *rtc) | 110 | void rtc_proc_add_device(struct rtc_device *rtc) |
141 | { | 111 | { |
142 | if (is_rtc_hctosys(rtc)) | 112 | if (is_rtc_hctosys(rtc)) |
143 | proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc); | 113 | proc_create_single_data("driver/rtc", 0, NULL, rtc_proc_show, |
114 | rtc); | ||
144 | } | 115 | } |
145 | 116 | ||
146 | void rtc_proc_del_device(struct rtc_device *rtc) | 117 | void rtc_proc_del_device(struct rtc_device *rtc) |