h8300: 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: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
e781c3d794
Коммит
210b834a96
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
@ -138,29 +139,34 @@ static char *port_status(int portno)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gpio_proc_read(char *buf, char **start, off_t offset,
|
static int gpio_proc_show(struct seq_file *m, void *v)
|
||||||
int len, int *unused_i, void *unused_v)
|
|
||||||
{
|
{
|
||||||
int c,outlen;
|
|
||||||
static const char port_name[]="123456789ABCDEFGH";
|
static const char port_name[]="123456789ABCDEFGH";
|
||||||
outlen = 0;
|
int c;
|
||||||
|
|
||||||
for (c = 0; c < MAX_PORT; c++) {
|
for (c = 0; c < MAX_PORT; c++) {
|
||||||
if (ddrs[c] == NULL)
|
if (ddrs[c] == NULL)
|
||||||
continue ;
|
continue;
|
||||||
len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c));
|
seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
|
||||||
buf += len;
|
|
||||||
outlen += len;
|
|
||||||
}
|
}
|
||||||
return outlen;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gpio_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, gpio_proc_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations gpio_proc_fops = {
|
||||||
|
.open = gpio_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static __init int register_proc(void)
|
static __init int register_proc(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *proc_gpio;
|
return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
|
||||||
|
|
||||||
proc_gpio = create_proc_read_entry("gpio", S_IRUGO, NULL,
|
|
||||||
gpio_proc_read, NULL);
|
|
||||||
return proc_gpio != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__initcall(register_proc);
|
__initcall(register_proc);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче