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

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: default avatarDavid 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 11db656a
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/mutex.h> #include <linux/mutex.h>
...@@ -74,9 +75,6 @@ static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); ...@@ -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_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_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, static void hp_sdc_rtc_isr (int irq, void *dev_id,
uint8_t status, uint8_t data) uint8_t status, uint8_t data)
{ {
...@@ -427,22 +425,19 @@ static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on) ...@@ -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); 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 YN(bit) ("no")
#define NY(bit) ("yes") #define NY(bit) ("yes")
char *p;
struct rtc_time tm; struct rtc_time tm;
struct timeval tv; struct timeval tv;
memset(&tm, 0, sizeof(struct rtc_time)); memset(&tm, 0, sizeof(struct rtc_time));
p = buf;
if (hp_sdc_rtc_read_bbrtc(&tm)) { 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 { } else {
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: %04lu\n", "rtc_epoch\t: %04lu\n",
...@@ -452,41 +447,41 @@ static int hp_sdc_rtc_proc_output (char *buf) ...@@ -452,41 +447,41 @@ static int hp_sdc_rtc_proc_output (char *buf)
} }
if (hp_sdc_rtc_read_rt(&tv)) { 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 { } 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); tv.tv_sec, (int)tv.tv_usec/1000);
} }
if (hp_sdc_rtc_read_fhs(&tv)) { if (hp_sdc_rtc_read_fhs(&tv)) {
p += sprintf(p, "handshake\t: READ FAILED!\n"); seq_puts(m, "handshake\t: READ FAILED!\n");
} else { } 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); tv.tv_sec, (int)tv.tv_usec/1000);
} }
if (hp_sdc_rtc_read_mt(&tv)) { 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 { } 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); tv.tv_sec, (int)tv.tv_usec/1000);
} }
if (hp_sdc_rtc_read_dt(&tv)) { 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 { } 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); tv.tv_sec, (int)tv.tv_usec/1000);
} }
if (hp_sdc_rtc_read_ct(&tv)) { if (hp_sdc_rtc_read_ct(&tv)) {
p += sprintf(p, "periodic\t: READ FAILED!\n"); seq_puts(m, "periodic\t: READ FAILED!\n");
} else { } 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); tv.tv_sec, (int)tv.tv_usec/1000);
} }
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"
...@@ -506,23 +501,23 @@ static int hp_sdc_rtc_proc_output (char *buf) ...@@ -506,23 +501,23 @@ static int hp_sdc_rtc_proc_output (char *buf)
1UL, 1UL,
1 ? "okay" : "dead"); 1 ? "okay" : "dead");
return p - buf; return 0;
#undef YN #undef YN
#undef NY #undef NY
} }
static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off, static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file)
int count, int *eof, void *data)
{ {
int len = hp_sdc_rtc_proc_output (page); return single_open(file, hp_sdc_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 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, static int hp_sdc_rtc_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -715,8 +710,7 @@ static int __init hp_sdc_rtc_init(void) ...@@ -715,8 +710,7 @@ static int __init hp_sdc_rtc_init(void)
if (misc_register(&hp_sdc_rtc_dev) != 0) if (misc_register(&hp_sdc_rtc_dev) != 0)
printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n");
create_proc_read_entry ("driver/rtc", 0, NULL, proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops);
hp_sdc_rtc_read_proc, NULL);
printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
"(RTC v " RTC_VERSION ")\n"); "(RTC v " RTC_VERSION ")\n");
......
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