Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370105
b: refs/heads/master
c: 210b834
h: refs/heads/master
i:
  370103: a62227d
v: v3
  • Loading branch information
David Howells authored and Al Viro committed Apr 29, 2013
1 parent 6c5c89e commit a062479
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e781c3d794282d9fa3ba377fdef221fc948974ec
refs/heads/master: 210b834a964c775387098bbc9e3836d3cd0e9b14
34 changes: 20 additions & 14 deletions trunk/arch/h8300/kernel/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <linux/stddef.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
Expand Down Expand Up @@ -138,29 +139,34 @@ static char *port_status(int portno)
return result;
}

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,outlen;
static const char port_name[]="123456789ABCDEFGH";
outlen = 0;
int c;

for (c = 0; c < MAX_PORT; c++) {
if (ddrs[c] == NULL)
continue ;
len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c));
buf += len;
outlen += len;
continue;
seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
}
return outlen;
return 0;
}

static __init int register_proc(void)
static int gpio_proc_open(struct inode *inode, struct file *file)
{
struct proc_dir_entry *proc_gpio;
return single_open(file, gpio_proc_show, PDE_DATA(inode));
}

proc_gpio = create_proc_read_entry("gpio", S_IRUGO, NULL,
gpio_proc_read, NULL);
return proc_gpio != NULL;
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)
{
return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
}

__initcall(register_proc);
Expand Down

0 comments on commit a062479

Please sign in to comment.