Commit a6d935a5 authored by David Howells's avatar David Howells Committed by Al Viro

genrtc: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Arnd Bergmann <arnd@arndb.de>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c18bd9a1
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
...@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file) ...@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file)
* Info exported via "/proc/driver/rtc". * Info exported via "/proc/driver/rtc".
*/ */
static int gen_rtc_proc_output(char *buf) static int gen_rtc_proc_show(struct seq_file *m, void *v)
{ {
char *p;
struct rtc_time tm; struct rtc_time tm;
unsigned int flags; unsigned int flags;
struct rtc_pll_info pll; struct rtc_pll_info pll;
p = buf;
flags = get_rtc_time(&tm); flags = get_rtc_time(&tm);
p += sprintf(p, seq_printf(m,
"rtc_time\t: %02d:%02d:%02d\n" "rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n" "rtc_date\t: %04d-%02d-%02d\n"
"rtc_epoch\t: %04u\n", "rtc_epoch\t: %04u\n",
...@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf) ...@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf)
tm.tm_hour = tm.tm_min = tm.tm_sec = 0; tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
p += sprintf(p, "alarm\t\t: "); seq_puts(m, "alarm\t\t: ");
if (tm.tm_hour <= 24) if (tm.tm_hour <= 24)
p += sprintf(p, "%02d:", tm.tm_hour); seq_printf(m, "%02d:", tm.tm_hour);
else else
p += sprintf(p, "**:"); seq_puts(m, "**:");
if (tm.tm_min <= 59) if (tm.tm_min <= 59)
p += sprintf(p, "%02d:", tm.tm_min); seq_printf(m, "%02d:", tm.tm_min);
else else
p += sprintf(p, "**:"); seq_puts(m, "**:");
if (tm.tm_sec <= 59) if (tm.tm_sec <= 59)
p += sprintf(p, "%02d\n", tm.tm_sec); seq_printf(m, "%02d\n", tm.tm_sec);
else else
p += sprintf(p, "**\n"); seq_puts(m, "**\n");
p += sprintf(p, seq_printf(m,
"DST_enable\t: %s\n" "DST_enable\t: %s\n"
"BCD\t\t: %s\n" "BCD\t\t: %s\n"
"24hr\t\t: %s\n" "24hr\t\t: %s\n"
...@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf) ...@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf)
0L /* freq */, 0L /* freq */,
(flags & RTC_BATT_BAD) ? "bad" : "okay"); (flags & RTC_BATT_BAD) ? "bad" : "okay");
if (!get_rtc_pll(&pll)) if (!get_rtc_pll(&pll))
p += sprintf(p, seq_printf(m,
"PLL adjustment\t: %d\n" "PLL adjustment\t: %d\n"
"PLL max +ve adjustment\t: %d\n" "PLL max +ve adjustment\t: %d\n"
"PLL max -ve adjustment\t: %d\n" "PLL max -ve adjustment\t: %d\n"
...@@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf) ...@@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf)
pll.pll_posmult, pll.pll_posmult,
pll.pll_negmult, pll.pll_negmult,
pll.pll_clock); pll.pll_clock);
return p - buf; return 0;
} }
static int gen_rtc_read_proc(char *page, char **start, off_t off, static int gen_rtc_proc_open(struct inode *inode, struct file *file)
int count, int *eof, void *data)
{ {
int len = gen_rtc_proc_output (page); return single_open(file, gen_rtc_proc_show, NULL);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return len;
} }
static const struct file_operations gen_rtc_proc_fops = {
.open = gen_rtc_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init gen_rtc_proc_init(void) static int __init gen_rtc_proc_init(void)
{ {
struct proc_dir_entry *r; struct proc_dir_entry *r;
r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL); r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops);
if (!r) if (!r)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment