diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-05-14 19:48:46 +0300 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-05-25 08:24:12 -0400 |
commit | 6362ec272c0375c0377164532e24bf9defdb8c79 (patch) | |
tree | 5cc141961fa100a8a8e39dbfee41b28e5484f66d /arch/blackfin | |
parent | d763c58a886068f1ec43751893b5aec35fc072e3 (diff) | |
download | kernel_samsung_aries-6362ec272c0375c0377164532e24bf9defdb8c79.zip kernel_samsung_aries-6362ec272c0375c0377164532e24bf9defdb8c79.tar.gz kernel_samsung_aries-6362ec272c0375c0377164532e24bf9defdb8c79.tar.bz2 |
Blackfin: switch /proc/gpio to seq_file
->read_proc interface is going away, switch to seq_file.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index f9306bb..bcf8cf6 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c @@ -10,6 +10,7 @@ #include <linux/module.h> #include <linux/err.h> #include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <asm/blackfin.h> #include <asm/gpio.h> #include <asm/portmux.h> @@ -1204,35 +1205,43 @@ void bfin_reset_boot_spi_cs(unsigned short pin) } #if defined(CONFIG_PROC_FS) -static int gpio_proc_read(char *buf, char **start, off_t offset, - int len, int *unused_i, void *unused_v) +static int gpio_proc_show(struct seq_file *m, void *v) { - int c, irq, gpio, outlen = 0; + int c, irq, gpio; for (c = 0; c < MAX_RESOURCES; c++) { irq = is_reserved(gpio_irq, c, 1); gpio = is_reserved(gpio, c, 1); if (!check_gpio(c) && (gpio || irq)) - len = sprintf(buf, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, + seq_printf(m, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, get_label(c), (gpio && irq) ? " *" : "", get_gpio_dir(c) ? "OUTPUT" : "INPUT"); else if (is_reserved(peri, c, 1)) - len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); + seq_printf(m, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); else continue; - 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, NULL); +} + +static const struct file_operations gpio_proc_ops = { + .open = gpio_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static __init int gpio_register_proc(void) { struct proc_dir_entry *proc_gpio; - proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); - if (proc_gpio) - proc_gpio->read_proc = gpio_proc_read; + proc_gpio = proc_create("gpio", S_IRUGO, NULL, &gpio_proc_ops); return proc_gpio != NULL; } __initcall(gpio_register_proc); |