aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2008-04-29 04:01:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:19 -0400
commit4bd61f76a5353df272d5c7232bf0928f6e4a9531 (patch)
tree48a6229f30c9630be91d7ed0a6f9adf0990b7108
parent9b0012126ae191c90c88df4b535b0f2ade70ecb6 (diff)
proc: switch /proc/excite/unit_id to seq_file interface
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Thomas Koeller <thomas.koeller@baslerweb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/mips/basler/excite/excite_procfs.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/arch/mips/basler/excite/excite_procfs.c b/arch/mips/basler/excite/excite_procfs.c
index 6c08b386fdad..08923e6825b5 100644
--- a/arch/mips/basler/excite/excite_procfs.c
+++ b/arch/mips/basler/excite/excite_procfs.c
@@ -18,8 +18,9 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21#include <linux/module.h>
22#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
23#include <linux/seq_file.h>
23#include <linux/stat.h> 24#include <linux/stat.h>
24#include <asm/page.h> 25#include <asm/page.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -28,14 +29,25 @@
28 29
29#include <excite.h> 30#include <excite.h>
30 31
31static int excite_get_unit_id(char *buf, char **addr, off_t offs, int size) 32static int excite_unit_id_proc_show(struct seq_file *m, void *v)
32{ 33{
33 const int len = snprintf(buf, PAGE_SIZE, "%06x", unit_id); 34 seq_printf(m, "%06x", unit_id);
34 const int w = len - offs; 35 return 0;
35 *addr = buf + offs;
36 return w < size ? w : size;
37} 36}
38 37
38static int excite_unit_id_proc_open(struct inode *inode, struct file *file)
39{
40 return single_open(file, excite_unit_id_proc_show, NULL);
41}
42
43static const struct file_operations excite_unit_id_proc_fops = {
44 .owner = THIS_MODULE,
45 .open = excite_unit_id_proc_open,
46 .read = seq_read,
47 .llseek = seq_lseek,
48 .release = single_release,
49};
50
39static int 51static int
40excite_bootrom_read(char *page, char **start, off_t off, int count, 52excite_bootrom_read(char *page, char **start, off_t off, int count,
41 int *eof, void *data) 53 int *eof, void *data)
@@ -69,8 +81,8 @@ void excite_procfs_init(void)
69 if (pdir) { 81 if (pdir) {
70 struct proc_dir_entry * e; 82 struct proc_dir_entry * e;
71 83
72 e = create_proc_info_entry("unit_id", S_IRUGO, pdir, 84 e = proc_create("unit_id", S_IRUGO, pdir,
73 excite_get_unit_id); 85 &excite_unit_id_proc_fops);
74 if (e) e->size = 6; 86 if (e) e->size = 6;
75 87
76 e = create_proc_read_entry("bootrom", S_IRUGO, pdir, 88 e = create_proc_read_entry("bootrom", S_IRUGO, pdir,