aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-03-28 04:56:40 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-28 12:16:05 -0500
commitec1b9466cb4f6ae6d950bd67055d9410d1056d2a (patch)
treeb0f9fcfebd3fe82e26316f6df5d62d3655251ba3 /arch
parent3c30a75256a5863705fb7658cb0b2e3bb09a13df (diff)
[PATCH] ia64: const f_ops fix
Tweak the proc setup code so things work OK with const proc_dir_entry.proc_fops. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index c686d9c12f7b..5100261310f7 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -93,19 +93,22 @@ static int coherence_id_open(struct inode *inode, struct file *file)
93static struct proc_dir_entry 93static struct proc_dir_entry
94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, 94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
95 int (*openfunc)(struct inode *, struct file *), 95 int (*openfunc)(struct inode *, struct file *),
96 int (*releasefunc)(struct inode *, struct file *)) 96 int (*releasefunc)(struct inode *, struct file *),
97 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *))
97{ 98{
98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); 99 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
99 100
100 if (e) { 101 if (e) {
101 e->proc_fops = (struct file_operations *)kmalloc( 102 struct file_operations *f;
102 sizeof(struct file_operations), GFP_KERNEL); 103
103 if (e->proc_fops) { 104 f = kzalloc(sizeof(*f), GFP_KERNEL);
104 memset(e->proc_fops, 0, sizeof(struct file_operations)); 105 if (f) {
105 e->proc_fops->open = openfunc; 106 f->open = openfunc;
106 e->proc_fops->read = seq_read; 107 f->read = seq_read;
107 e->proc_fops->llseek = seq_lseek; 108 f->llseek = seq_lseek;
108 e->proc_fops->release = releasefunc; 109 f->release = releasefunc;
110 f->write = write;
111 e->proc_fops = f;
109 } 112 }
110 } 113 }
111 114
@@ -119,31 +122,29 @@ extern int sn_topology_release(struct inode *, struct file *);
119void register_sn_procfs(void) 122void register_sn_procfs(void)
120{ 123{
121 static struct proc_dir_entry *sgi_proc_dir = NULL; 124 static struct proc_dir_entry *sgi_proc_dir = NULL;
122 struct proc_dir_entry *e;
123 125
124 BUG_ON(sgi_proc_dir != NULL); 126 BUG_ON(sgi_proc_dir != NULL);
125 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 127 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
126 return; 128 return;
127 129
128 sn_procfs_create_entry("partition_id", sgi_proc_dir, 130 sn_procfs_create_entry("partition_id", sgi_proc_dir,
129 partition_id_open, single_release); 131 partition_id_open, single_release, NULL);
130 132
131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir, 133 sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
132 system_serial_number_open, single_release); 134 system_serial_number_open, single_release, NULL);
133 135
134 sn_procfs_create_entry("licenseID", sgi_proc_dir, 136 sn_procfs_create_entry("licenseID", sgi_proc_dir,
135 licenseID_open, single_release); 137 licenseID_open, single_release, NULL);
136 138
137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 139 sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir,
138 sn_force_interrupt_open, single_release); 140 sn_force_interrupt_open, single_release,
139 if (e) 141 sn_force_interrupt_write_proc);
140 e->proc_fops->write = sn_force_interrupt_write_proc;
141 142
142 sn_procfs_create_entry("coherence_id", sgi_proc_dir, 143 sn_procfs_create_entry("coherence_id", sgi_proc_dir,
143 coherence_id_open, single_release); 144 coherence_id_open, single_release, NULL);
144 145
145 sn_procfs_create_entry("sn_topology", sgi_proc_dir, 146 sn_procfs_create_entry("sn_topology", sgi_proc_dir,
146 sn_topology_open, sn_topology_release); 147 sn_topology_open, sn_topology_release, NULL);
147} 148}
148 149
149#endif /* CONFIG_PROC_FS */ 150#endif /* CONFIG_PROC_FS */