summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-proc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-04 13:00:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-04 13:00:01 -0400
commitcf626b0da78df6669c6b5f51ddd9a70a0702e579 (patch)
tree45d29a4cb7574aed7f140814ed22088ded21c291 /drivers/rtc/rtc-proc.c
parent9c50eafc32ddbd166c8a2bbaecd4ad201c452b14 (diff)
parent5ef03dbd91855544cd4c7c1910c3ef5226ee87e8 (diff)
Merge branch 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull procfs updates from Al Viro: "Christoph's proc_create_... cleanups series" * 'hch.procfs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (44 commits) xfs, proc: hide unused xfs procfs helpers isdn/gigaset: add back gigaset_procinfo assignment proc: update SIZEOF_PDE_INLINE_NAME for the new pde fields tty: replace ->proc_fops with ->proc_show ide: replace ->proc_fops with ->proc_show ide: remove ide_driver_proc_write isdn: replace ->proc_fops with ->proc_show atm: switch to proc_create_seq_private atm: simplify procfs code bluetooth: switch to proc_create_seq_data netfilter/x_tables: switch to proc_create_seq_private netfilter/xt_hashlimit: switch to proc_create_{seq,single}_data neigh: switch to proc_create_seq_data hostap: switch to proc_create_{seq,single}_data bonding: switch to proc_create_seq_data rtc/proc: switch to proc_create_single_data drbd: switch to proc_create_single resource: switch to proc_create_seq_data staging/rtl8192u: simplify procfs code jfs: simplify procfs code ...
Diffstat (limited to 'drivers/rtc/rtc-proc.c')
-rw-r--r--drivers/rtc/rtc-proc.c33
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
110static 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
124static 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
133static 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
140void rtc_proc_add_device(struct rtc_device *rtc) 110void 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
146void rtc_proc_del_device(struct rtc_device *rtc) 117void rtc_proc_del_device(struct rtc_device *rtc)