提交 a6d935a5 编写于 作者: D David Howells 提交者: 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: NDavid Howells <dhowells@redhat.com>
cc: Arnd Bergmann <arnd@arndb.de>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 c18bd9a1
......@@ -52,6 +52,7 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
......@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file)
* 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;
unsigned int flags;
struct rtc_pll_info pll;
p = buf;
flags = get_rtc_time(&tm);
p += sprintf(p,
seq_printf(m,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_epoch\t: %04u\n",
......@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf)
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)
p += sprintf(p, "%02d:", tm.tm_hour);
seq_printf(m, "%02d:", tm.tm_hour);
else
p += sprintf(p, "**:");
seq_puts(m, "**:");
if (tm.tm_min <= 59)
p += sprintf(p, "%02d:", tm.tm_min);
seq_printf(m, "%02d:", tm.tm_min);
else
p += sprintf(p, "**:");
seq_puts(m, "**:");
if (tm.tm_sec <= 59)
p += sprintf(p, "%02d\n", tm.tm_sec);
seq_printf(m, "%02d\n", tm.tm_sec);
else
p += sprintf(p, "**\n");
seq_puts(m, "**\n");
p += sprintf(p,
seq_printf(m,
"DST_enable\t: %s\n"
"BCD\t\t: %s\n"
"24hr\t\t: %s\n"
......@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf)
0L /* freq */,
(flags & RTC_BATT_BAD) ? "bad" : "okay");
if (!get_rtc_pll(&pll))
p += sprintf(p,
seq_printf(m,
"PLL 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)
pll.pll_posmult,
pll.pll_negmult,
pll.pll_clock);
return p - buf;
return 0;
}
static int gen_rtc_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
static int gen_rtc_proc_open(struct inode *inode, struct file *file)
{
int len = gen_rtc_proc_output (page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return len;
return single_open(file, gen_rtc_proc_show, NULL);
}
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)
{
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)
return -ENOMEM;
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册