Commit 4bd61f76 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

proc: switch /proc/excite/unit_id to seq_file interface

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@sw.ru>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Thomas Koeller <thomas.koeller@baslerweb.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9b001212
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -28,14 +29,25 @@ ...@@ -28,14 +29,25 @@
#include <excite.h> #include <excite.h>
static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size) static int excite_unit_id_proc_show(struct seq_file *m, void *v)
{
seq_printf(m, "%06x", unit_id);
return 0;
}
static int excite_unit_id_proc_open(struct inode *inode, struct file *file)
{ {
const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id); return single_open(file, excite_unit_id_proc_show, NULL);
const int w = len - offs;
*addr = buf + offs;
return w < size ? w : size;
} }
static const struct file_operations excite_unit_id_proc_fops = {
.owner = THIS_MODULE,
.open = excite_unit_id_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int static int
excite_bootrom_read(char *page, char **start, off_t off, int count, excite_bootrom_read(char *page, char **start, off_t off, int count,
int *eof, void *data) int *eof, void *data)
...@@ -69,8 +81,8 @@ void excite_procfs_init(void) ...@@ -69,8 +81,8 @@ void excite_procfs_init(void)
if (pdir) { if (pdir) {
struct proc_dir_entry * e; struct proc_dir_entry * e;
e = create_proc_info_entry("unit_id", S_IRUGO, pdir, e = proc_create("unit_id", S_IRUGO, pdir,
excite_get_unit_id); &excite_unit_id_proc_fops);
if (e) e->size = 6; if (e) e->size = 6;
e = create_proc_read_entry("bootrom", S_IRUGO, pdir, e = create_proc_read_entry("bootrom", S_IRUGO, pdir,
......
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