diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2011-05-14 12:48:46 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-05-25 08:24:12 -0400 |
commit | 6362ec272c0375c0377164532e24bf9defdb8c79 (patch) | |
tree | 5cc141961fa100a8a8e39dbfee41b28e5484f66d /arch/blackfin/kernel/bfin_gpio.c | |
parent | d763c58a886068f1ec43751893b5aec35fc072e3 (diff) |
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/kernel/bfin_gpio.c')
-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 f9306bb5aede..bcf8cf6fe412 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/err.h> | 11 | #include <linux/err.h> |
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | #include <linux/seq_file.h> | ||
13 | #include <asm/blackfin.h> | 14 | #include <asm/blackfin.h> |
14 | #include <asm/gpio.h> | 15 | #include <asm/gpio.h> |
15 | #include <asm/portmux.h> | 16 | #include <asm/portmux.h> |
@@ -1204,35 +1205,43 @@ void bfin_reset_boot_spi_cs(unsigned short pin) | |||
1204 | } | 1205 | } |
1205 | 1206 | ||
1206 | #if defined(CONFIG_PROC_FS) | 1207 | #if defined(CONFIG_PROC_FS) |
1207 | static int gpio_proc_read(char *buf, char **start, off_t offset, | 1208 | static int gpio_proc_show(struct seq_file *m, void *v) |
1208 | int len, int *unused_i, void *unused_v) | ||
1209 | { | 1209 | { |
1210 | int c, irq, gpio, outlen = 0; | 1210 | int c, irq, gpio; |
1211 | 1211 | ||
1212 | for (c = 0; c < MAX_RESOURCES; c++) { | 1212 | for (c = 0; c < MAX_RESOURCES; c++) { |
1213 | irq = is_reserved(gpio_irq, c, 1); | 1213 | irq = is_reserved(gpio_irq, c, 1); |
1214 | gpio = is_reserved(gpio, c, 1); | 1214 | gpio = is_reserved(gpio, c, 1); |
1215 | if (!check_gpio(c) && (gpio || irq)) | 1215 | if (!check_gpio(c) && (gpio || irq)) |
1216 | len = sprintf(buf, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, | 1216 | seq_printf(m, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, |
1217 | get_label(c), (gpio && irq) ? " *" : "", | 1217 | get_label(c), (gpio && irq) ? " *" : "", |
1218 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); | 1218 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); |
1219 | else if (is_reserved(peri, c, 1)) | 1219 | else if (is_reserved(peri, c, 1)) |
1220 | len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); | 1220 | seq_printf(m, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); |
1221 | else | 1221 | else |
1222 | continue; | 1222 | continue; |
1223 | buf += len; | ||
1224 | outlen += len; | ||
1225 | } | 1223 | } |
1226 | return outlen; | 1224 | |
1225 | return 0; | ||
1227 | } | 1226 | } |
1228 | 1227 | ||
1228 | static int gpio_proc_open(struct inode *inode, struct file *file) | ||
1229 | { | ||
1230 | return single_open(file, gpio_proc_show, NULL); | ||
1231 | } | ||
1232 | |||
1233 | static const struct file_operations gpio_proc_ops = { | ||
1234 | .open = gpio_proc_open, | ||
1235 | .read = seq_read, | ||
1236 | .llseek = seq_lseek, | ||
1237 | .release = single_release, | ||
1238 | }; | ||
1239 | |||
1229 | static __init int gpio_register_proc(void) | 1240 | static __init int gpio_register_proc(void) |
1230 | { | 1241 | { |
1231 | struct proc_dir_entry *proc_gpio; | 1242 | struct proc_dir_entry *proc_gpio; |
1232 | 1243 | ||
1233 | proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); | 1244 | proc_gpio = proc_create("gpio", S_IRUGO, NULL, &gpio_proc_ops); |
1234 | if (proc_gpio) | ||
1235 | proc_gpio->read_proc = gpio_proc_read; | ||
1236 | return proc_gpio != NULL; | 1245 | return proc_gpio != NULL; |
1237 | } | 1246 | } |
1238 | __initcall(gpio_register_proc); | 1247 | __initcall(gpio_register_proc); |