summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-10 15:52:18 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:41:54 -0400
commitc18bd9a1ff477bd010d7607a8e575da24de0b08b (patch)
tree5077d5a37fa4d9b43007ab45b5c94276c8d578b2 /drivers/input
parent11db656ad462c9aa7aff7e3817214578cfc307b3 (diff)
hp_sdc_rtc: 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: David Howells <dhowells@redhat.com> cc: Brian S. Julin <bri@calyx.com> cc: Helge Deller <deller@gmx.de> cc: linux-m68k@lists.linux-m68k.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/hp_sdc_rtc.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index 2e3334b8f82d..770479df8657 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -41,6 +41,7 @@
#include <linux/time.h>
#include <linux/miscdevice.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include <linux/poll.h>
#include <linux/rtc.h>
#include <linux/mutex.h>
@@ -74,9 +75,6 @@ static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait);
static int hp_sdc_rtc_open(struct inode *inode, struct file *file);
static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on);
-static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-
static void hp_sdc_rtc_isr (int irq, void *dev_id,
uint8_t status, uint8_t data)
{
@@ -427,22 +425,19 @@ static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on)
return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue);
}
-static int hp_sdc_rtc_proc_output (char *buf)
+static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v)
{
#define YN(bit) ("no")
#define NY(bit) ("yes")
- char *p;
struct rtc_time tm;
struct timeval tv;
memset(&tm, 0, sizeof(struct rtc_time));
- p = buf;
-
if (hp_sdc_rtc_read_bbrtc(&tm)) {
- p += sprintf(p, "BBRTC\t\t: READ FAILED!\n");
+ seq_puts(m, "BBRTC\t\t: READ FAILED!\n");
} else {
- p += sprintf(p,
+ seq_printf(m,
"rtc_time\t: %02d:%02d:%02d\n"
"rtc_date\t: %04d-%02d-%02d\n"
"rtc_epoch\t: %04lu\n",
@@ -452,41 +447,41 @@ static int hp_sdc_rtc_proc_output (char *buf)
}
if (hp_sdc_rtc_read_rt(&tv)) {
- p += sprintf(p, "i8042 rtc\t: READ FAILED!\n");
+ seq_puts(m, "i8042 rtc\t: READ FAILED!\n");
} else {
- p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n",
+ seq_printf(m, "i8042 rtc\t: %ld.%02d seconds\n",
tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_fhs(&tv)) {
- p += sprintf(p, "handshake\t: READ FAILED!\n");
+ seq_puts(m, "handshake\t: READ FAILED!\n");
} else {
- p += sprintf(p, "handshake\t: %ld.%02d seconds\n",
+ seq_printf(m, "handshake\t: %ld.%02d seconds\n",
tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_mt(&tv)) {
- p += sprintf(p, "alarm\t\t: READ FAILED!\n");
+ seq_puts(m, "alarm\t\t: READ FAILED!\n");
} else {
- p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n",
+ seq_printf(m, "alarm\t\t: %ld.%02d seconds\n",
tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_dt(&tv)) {
- p += sprintf(p, "delay\t\t: READ FAILED!\n");
+ seq_puts(m, "delay\t\t: READ FAILED!\n");
} else {
- p += sprintf(p, "delay\t\t: %ld.%02d seconds\n",
+ seq_printf(m, "delay\t\t: %ld.%02d seconds\n",
tv.tv_sec, (int)tv.tv_usec/1000);
}
if (hp_sdc_rtc_read_ct(&tv)) {
- p += sprintf(p, "periodic\t: READ FAILED!\n");
+ seq_puts(m, "periodic\t: READ FAILED!\n");
} else {
- p += sprintf(p, "periodic\t: %ld.%02d seconds\n",
+ seq_printf(m, "periodic\t: %ld.%02d seconds\n",
tv.tv_sec, (int)tv.tv_usec/1000);
}
- p += sprintf(p,
+ seq_printf(m,
"DST_enable\t: %s\n"
"BCD\t\t: %s\n"
"24hr\t\t: %s\n"
@@ -506,23 +501,23 @@ static int hp_sdc_rtc_proc_output (char *buf)
1UL,
1 ? "okay" : "dead");
- return p - buf;
+ return 0;
#undef YN
#undef NY
}
-static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file)
{
- int len = hp_sdc_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, hp_sdc_rtc_proc_show, NULL);
}
+static const struct file_operations hp_sdc_rtc_proc_fops = {
+ .open = hp_sdc_rtc_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static int hp_sdc_rtc_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
@@ -715,8 +710,7 @@ static int __init hp_sdc_rtc_init(void)
if (misc_register(&hp_sdc_rtc_dev) != 0)
printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n");
- create_proc_read_entry ("driver/rtc", 0, NULL,
- hp_sdc_rtc_read_proc, NULL);
+ proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops);
printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
"(RTC v " RTC_VERSION ")\n");