diff options
385 files changed, 7395 insertions, 14539 deletions
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index e64559f0a82d..ffe996a54fad 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c | |||
@@ -51,13 +51,11 @@ MODULE_LICENSE("GPL"); | |||
51 | typedef struct _srm_env { | 51 | typedef struct _srm_env { |
52 | char *name; | 52 | char *name; |
53 | unsigned long id; | 53 | unsigned long id; |
54 | struct proc_dir_entry *proc_entry; | ||
55 | } srm_env_t; | 54 | } srm_env_t; |
56 | 55 | ||
57 | static struct proc_dir_entry *base_dir; | 56 | static struct proc_dir_entry *base_dir; |
58 | static struct proc_dir_entry *named_dir; | 57 | static struct proc_dir_entry *named_dir; |
59 | static struct proc_dir_entry *numbered_dir; | 58 | static struct proc_dir_entry *numbered_dir; |
60 | static char number[256][4]; | ||
61 | 59 | ||
62 | static srm_env_t srm_named_entries[] = { | 60 | static srm_env_t srm_named_entries[] = { |
63 | { "auto_action", ENV_AUTO_ACTION }, | 61 | { "auto_action", ENV_AUTO_ACTION }, |
@@ -77,21 +75,18 @@ static srm_env_t srm_named_entries[] = { | |||
77 | { "tty_dev", ENV_TTY_DEV }, | 75 | { "tty_dev", ENV_TTY_DEV }, |
78 | { NULL, 0 }, | 76 | { NULL, 0 }, |
79 | }; | 77 | }; |
80 | static srm_env_t srm_numbered_entries[256]; | ||
81 | |||
82 | 78 | ||
83 | static int srm_env_proc_show(struct seq_file *m, void *v) | 79 | static int srm_env_proc_show(struct seq_file *m, void *v) |
84 | { | 80 | { |
85 | unsigned long ret; | 81 | unsigned long ret; |
86 | srm_env_t *entry; | 82 | unsigned long id = (unsigned long)m->private; |
87 | char *page; | 83 | char *page; |
88 | 84 | ||
89 | entry = m->private; | ||
90 | page = (char *)__get_free_page(GFP_USER); | 85 | page = (char *)__get_free_page(GFP_USER); |
91 | if (!page) | 86 | if (!page) |
92 | return -ENOMEM; | 87 | return -ENOMEM; |
93 | 88 | ||
94 | ret = callback_getenv(entry->id, page, PAGE_SIZE); | 89 | ret = callback_getenv(id, page, PAGE_SIZE); |
95 | 90 | ||
96 | if ((ret >> 61) == 0) { | 91 | if ((ret >> 61) == 0) { |
97 | seq_write(m, page, ret); | 92 | seq_write(m, page, ret); |
@@ -104,14 +99,14 @@ static int srm_env_proc_show(struct seq_file *m, void *v) | |||
104 | 99 | ||
105 | static int srm_env_proc_open(struct inode *inode, struct file *file) | 100 | static int srm_env_proc_open(struct inode *inode, struct file *file) |
106 | { | 101 | { |
107 | return single_open(file, srm_env_proc_show, PDE(inode)->data); | 102 | return single_open(file, srm_env_proc_show, PDE_DATA(inode)); |
108 | } | 103 | } |
109 | 104 | ||
110 | static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, | 105 | static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, |
111 | size_t count, loff_t *pos) | 106 | size_t count, loff_t *pos) |
112 | { | 107 | { |
113 | int res; | 108 | int res; |
114 | srm_env_t *entry = PDE(file_inode(file))->data; | 109 | unsigned long id = (unsigned long)PDE_DATA(file_inode(file)); |
115 | char *buf = (char *) __get_free_page(GFP_USER); | 110 | char *buf = (char *) __get_free_page(GFP_USER); |
116 | unsigned long ret1, ret2; | 111 | unsigned long ret1, ret2; |
117 | 112 | ||
@@ -127,7 +122,7 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, | |||
127 | goto out; | 122 | goto out; |
128 | buf[count] = '\0'; | 123 | buf[count] = '\0'; |
129 | 124 | ||
130 | ret1 = callback_setenv(entry->id, buf, count); | 125 | ret1 = callback_setenv(id, buf, count); |
131 | if ((ret1 >> 61) == 0) { | 126 | if ((ret1 >> 61) == 0) { |
132 | do | 127 | do |
133 | ret2 = callback_save_env(); | 128 | ret2 = callback_save_env(); |
@@ -149,52 +144,6 @@ static const struct file_operations srm_env_proc_fops = { | |||
149 | .write = srm_env_proc_write, | 144 | .write = srm_env_proc_write, |
150 | }; | 145 | }; |
151 | 146 | ||
152 | static void | ||
153 | srm_env_cleanup(void) | ||
154 | { | ||
155 | srm_env_t *entry; | ||
156 | unsigned long var_num; | ||
157 | |||
158 | if (base_dir) { | ||
159 | /* | ||
160 | * Remove named entries | ||
161 | */ | ||
162 | if (named_dir) { | ||
163 | entry = srm_named_entries; | ||
164 | while (entry->name != NULL && entry->id != 0) { | ||
165 | if (entry->proc_entry) { | ||
166 | remove_proc_entry(entry->name, | ||
167 | named_dir); | ||
168 | entry->proc_entry = NULL; | ||
169 | } | ||
170 | entry++; | ||
171 | } | ||
172 | remove_proc_entry(NAMED_DIR, base_dir); | ||
173 | } | ||
174 | |||
175 | /* | ||
176 | * Remove numbered entries | ||
177 | */ | ||
178 | if (numbered_dir) { | ||
179 | for (var_num = 0; var_num <= 255; var_num++) { | ||
180 | entry = &srm_numbered_entries[var_num]; | ||
181 | |||
182 | if (entry->proc_entry) { | ||
183 | remove_proc_entry(entry->name, | ||
184 | numbered_dir); | ||
185 | entry->proc_entry = NULL; | ||
186 | entry->name = NULL; | ||
187 | } | ||
188 | } | ||
189 | remove_proc_entry(NUMBERED_DIR, base_dir); | ||
190 | } | ||
191 | |||
192 | remove_proc_entry(BASE_DIR, NULL); | ||
193 | } | ||
194 | |||
195 | return; | ||
196 | } | ||
197 | |||
198 | static int __init | 147 | static int __init |
199 | srm_env_init(void) | 148 | srm_env_init(void) |
200 | { | 149 | { |
@@ -213,19 +162,13 @@ srm_env_init(void) | |||
213 | } | 162 | } |
214 | 163 | ||
215 | /* | 164 | /* |
216 | * Init numbers | ||
217 | */ | ||
218 | for (var_num = 0; var_num <= 255; var_num++) | ||
219 | sprintf(number[var_num], "%ld", var_num); | ||
220 | |||
221 | /* | ||
222 | * Create base directory | 165 | * Create base directory |
223 | */ | 166 | */ |
224 | base_dir = proc_mkdir(BASE_DIR, NULL); | 167 | base_dir = proc_mkdir(BASE_DIR, NULL); |
225 | if (!base_dir) { | 168 | if (!base_dir) { |
226 | printk(KERN_ERR "Couldn't create base dir /proc/%s\n", | 169 | printk(KERN_ERR "Couldn't create base dir /proc/%s\n", |
227 | BASE_DIR); | 170 | BASE_DIR); |
228 | goto cleanup; | 171 | return -ENOMEM; |
229 | } | 172 | } |
230 | 173 | ||
231 | /* | 174 | /* |
@@ -254,9 +197,8 @@ srm_env_init(void) | |||
254 | */ | 197 | */ |
255 | entry = srm_named_entries; | 198 | entry = srm_named_entries; |
256 | while (entry->name && entry->id) { | 199 | while (entry->name && entry->id) { |
257 | entry->proc_entry = proc_create_data(entry->name, 0644, named_dir, | 200 | if (!proc_create_data(entry->name, 0644, named_dir, |
258 | &srm_env_proc_fops, entry); | 201 | &srm_env_proc_fops, (void *)entry->id)) |
259 | if (!entry->proc_entry) | ||
260 | goto cleanup; | 202 | goto cleanup; |
261 | entry++; | 203 | entry++; |
262 | } | 204 | } |
@@ -265,15 +207,11 @@ srm_env_init(void) | |||
265 | * Create all numbered nodes | 207 | * Create all numbered nodes |
266 | */ | 208 | */ |
267 | for (var_num = 0; var_num <= 255; var_num++) { | 209 | for (var_num = 0; var_num <= 255; var_num++) { |
268 | entry = &srm_numbered_entries[var_num]; | 210 | char name[4]; |
269 | entry->name = number[var_num]; | 211 | sprintf(name, "%ld", var_num); |
270 | 212 | if (!proc_create_data(name, 0644, numbered_dir, | |
271 | entry->proc_entry = proc_create_data(entry->name, 0644, numbered_dir, | 213 | &srm_env_proc_fops, (void *)var_num)) |
272 | &srm_env_proc_fops, entry); | ||
273 | if (!entry->proc_entry) | ||
274 | goto cleanup; | 214 | goto cleanup; |
275 | |||
276 | entry->id = var_num; | ||
277 | } | 215 | } |
278 | 216 | ||
279 | printk(KERN_INFO "%s: version %s loaded successfully\n", NAME, | 217 | printk(KERN_INFO "%s: version %s loaded successfully\n", NAME, |
@@ -282,18 +220,15 @@ srm_env_init(void) | |||
282 | return 0; | 220 | return 0; |
283 | 221 | ||
284 | cleanup: | 222 | cleanup: |
285 | srm_env_cleanup(); | 223 | remove_proc_subtree(BASE_DIR, NULL); |
286 | |||
287 | return -ENOMEM; | 224 | return -ENOMEM; |
288 | } | 225 | } |
289 | 226 | ||
290 | static void __exit | 227 | static void __exit |
291 | srm_env_exit(void) | 228 | srm_env_exit(void) |
292 | { | 229 | { |
293 | srm_env_cleanup(); | 230 | remove_proc_subtree(BASE_DIR, NULL); |
294 | printk(KERN_INFO "%s: unloaded successfully\n", NAME); | 231 | printk(KERN_INFO "%s: unloaded successfully\n", NAME); |
295 | |||
296 | return; | ||
297 | } | 232 | } |
298 | 233 | ||
299 | module_init(srm_env_init); | 234 | module_init(srm_env_init); |
diff --git a/arch/arm/kernel/atags_proc.c b/arch/arm/kernel/atags_proc.c index 42a1a1415fa6..c7ff8073416f 100644 --- a/arch/arm/kernel/atags_proc.c +++ b/arch/arm/kernel/atags_proc.c | |||
@@ -9,24 +9,18 @@ struct buffer { | |||
9 | char data[]; | 9 | char data[]; |
10 | }; | 10 | }; |
11 | 11 | ||
12 | static int | 12 | static ssize_t atags_read(struct file *file, char __user *buf, |
13 | read_buffer(char* page, char** start, off_t off, int count, | 13 | size_t count, loff_t *ppos) |
14 | int* eof, void* data) | ||
15 | { | 14 | { |
16 | struct buffer *buffer = (struct buffer *)data; | 15 | struct buffer *b = PDE_DATA(file_inode(file)); |
17 | 16 | return simple_read_from_buffer(buf, count, ppos, b->data, b->size); | |
18 | if (off >= buffer->size) { | ||
19 | *eof = 1; | ||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | count = min((int) (buffer->size - off), count); | ||
24 | |||
25 | memcpy(page, &buffer->data[off], count); | ||
26 | |||
27 | return count; | ||
28 | } | 17 | } |
29 | 18 | ||
19 | static const struct file_operations atags_fops = { | ||
20 | .read = atags_read, | ||
21 | .llseek = default_llseek, | ||
22 | }; | ||
23 | |||
30 | #define BOOT_PARAMS_SIZE 1536 | 24 | #define BOOT_PARAMS_SIZE 1536 |
31 | static char __initdata atags_copy[BOOT_PARAMS_SIZE]; | 25 | static char __initdata atags_copy[BOOT_PARAMS_SIZE]; |
32 | 26 | ||
@@ -66,9 +60,7 @@ static int __init init_atags_procfs(void) | |||
66 | b->size = size; | 60 | b->size = size; |
67 | memcpy(b->data, atags_copy, size); | 61 | memcpy(b->data, atags_copy, size); |
68 | 62 | ||
69 | tags_entry = create_proc_read_entry("atags", 0400, | 63 | tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b); |
70 | NULL, read_buffer, b); | ||
71 | |||
72 | if (!tags_entry) | 64 | if (!tags_entry) |
73 | goto nomem; | 65 | goto nomem; |
74 | 66 | ||
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index ab1017bd1667..087fc321e9e5 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/proc_fs.h> | 23 | #include <linux/proc_fs.h> |
24 | #include <linux/seq_file.h> | ||
24 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
25 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
26 | #include <linux/perf_event.h> | 27 | #include <linux/perf_event.h> |
@@ -79,27 +80,27 @@ static unsigned long abtcounter; | |||
79 | static pid_t previous_pid; | 80 | static pid_t previous_pid; |
80 | 81 | ||
81 | #ifdef CONFIG_PROC_FS | 82 | #ifdef CONFIG_PROC_FS |
82 | static int proc_read_status(char *page, char **start, off_t off, int count, | 83 | static int proc_status_show(struct seq_file *m, void *v) |
83 | int *eof, void *data) | ||
84 | { | 84 | { |
85 | char *p = page; | 85 | seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter); |
86 | int len; | 86 | seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter); |
87 | 87 | seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter); | |
88 | p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter); | ||
89 | p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter); | ||
90 | p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter); | ||
91 | if (previous_pid != 0) | 88 | if (previous_pid != 0) |
92 | p += sprintf(p, "Last process:\t\t%d\n", previous_pid); | 89 | seq_printf(m, "Last process:\t\t%d\n", previous_pid); |
93 | 90 | return 0; | |
94 | len = (p - page) - off; | 91 | } |
95 | if (len < 0) | ||
96 | len = 0; | ||
97 | |||
98 | *eof = (len <= count) ? 1 : 0; | ||
99 | *start = page + off; | ||
100 | 92 | ||
101 | return len; | 93 | static int proc_status_open(struct inode *inode, struct file *file) |
94 | { | ||
95 | return single_open(file, proc_status_show, PDE_DATA(inode)); | ||
102 | } | 96 | } |
97 | |||
98 | static const struct file_operations proc_status_fops = { | ||
99 | .open = proc_status_open, | ||
100 | .read = seq_read, | ||
101 | .llseek = seq_lseek, | ||
102 | .release = seq_release, | ||
103 | }; | ||
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | /* | 106 | /* |
@@ -266,14 +267,8 @@ static struct undef_hook swp_hook = { | |||
266 | static int __init swp_emulation_init(void) | 267 | static int __init swp_emulation_init(void) |
267 | { | 268 | { |
268 | #ifdef CONFIG_PROC_FS | 269 | #ifdef CONFIG_PROC_FS |
269 | struct proc_dir_entry *res; | 270 | if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops)) |
270 | |||
271 | res = create_proc_entry("cpu/swp_emulation", S_IRUGO, NULL); | ||
272 | |||
273 | if (!res) | ||
274 | return -ENOMEM; | 271 | return -ENOMEM; |
275 | |||
276 | res->read_proc = proc_read_status; | ||
277 | #endif /* CONFIG_PROC_FS */ | 272 | #endif /* CONFIG_PROC_FS */ |
278 | 273 | ||
279 | printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n"); | 274 | printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n"); |
diff --git a/arch/arm/mach-msm/last_radio_log.c b/arch/arm/mach-msm/last_radio_log.c index 1e243f46a969..7777767ee89a 100644 --- a/arch/arm/mach-msm/last_radio_log.c +++ b/arch/arm/mach-msm/last_radio_log.c | |||
@@ -31,20 +31,8 @@ extern void *smem_item(unsigned id, unsigned *size); | |||
31 | static ssize_t last_radio_log_read(struct file *file, char __user *buf, | 31 | static ssize_t last_radio_log_read(struct file *file, char __user *buf, |
32 | size_t len, loff_t *offset) | 32 | size_t len, loff_t *offset) |
33 | { | 33 | { |
34 | loff_t pos = *offset; | 34 | return simple_read_from_buffer(buf, len, offset, |
35 | ssize_t count; | 35 | radio_log_base, radio_log_size); |
36 | |||
37 | if (pos >= radio_log_size) | ||
38 | return 0; | ||
39 | |||
40 | count = min(len, (size_t)(radio_log_size - pos)); | ||
41 | if (copy_to_user(buf, radio_log_base + pos, count)) { | ||
42 | pr_err("%s: copy to user failed\n", __func__); | ||
43 | return -EFAULT; | ||
44 | } | ||
45 | |||
46 | *offset += count; | ||
47 | return count; | ||
48 | } | 36 | } |
49 | 37 | ||
50 | static struct file_operations last_radio_log_fops = { | 38 | static struct file_operations last_radio_log_fops = { |
@@ -67,7 +55,8 @@ void msm_init_last_radio_log(struct module *owner) | |||
67 | return; | 55 | return; |
68 | } | 56 | } |
69 | 57 | ||
70 | entry = create_proc_entry("last_radio_log", S_IFREG | S_IRUGO, NULL); | 58 | entry = proc_create("last_radio_log", S_IRUGO, NULL, |
59 | &last_radio_log_fops); | ||
71 | if (!entry) { | 60 | if (!entry) { |
72 | pr_err("%s: could not create proc entry for radio log\n", | 61 | pr_err("%s: could not create proc entry for radio log\n", |
73 | __func__); | 62 | __func__); |
@@ -77,7 +66,6 @@ void msm_init_last_radio_log(struct module *owner) | |||
77 | pr_err("%s: last radio log is %d bytes long\n", __func__, | 66 | pr_err("%s: last radio log is %d bytes long\n", __func__, |
78 | radio_log_size); | 67 | radio_log_size); |
79 | last_radio_log_fops.owner = owner; | 68 | last_radio_log_fops.owner = owner; |
80 | entry->proc_fops = &last_radio_log_fops; | ||
81 | entry->size = radio_log_size; | 69 | entry->size = radio_log_size; |
82 | } | 70 | } |
83 | EXPORT_SYMBOL(msm_init_last_radio_log); | 71 | EXPORT_SYMBOL(msm_init_last_radio_log); |
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index db37f49da5ac..dd712f109738 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c | |||
@@ -37,7 +37,8 @@ | |||
37 | 37 | ||
38 | #include <linux/suspend.h> | 38 | #include <linux/suspend.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/debugfs.h> |
41 | #include <linux/seq_file.h> | ||
41 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
42 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
@@ -423,23 +424,12 @@ void omap1_pm_suspend(void) | |||
423 | omap_rev()); | 424 | omap_rev()); |
424 | } | 425 | } |
425 | 426 | ||
426 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 427 | #ifdef CONFIG_DEBUG_FS |
427 | static int g_read_completed; | ||
428 | |||
429 | /* | 428 | /* |
430 | * Read system PM registers for debugging | 429 | * Read system PM registers for debugging |
431 | */ | 430 | */ |
432 | static int omap_pm_read_proc( | 431 | static int omap_pm_debug_show(struct seq_file *m, void *v) |
433 | char *page_buffer, | ||
434 | char **my_first_byte, | ||
435 | off_t virtual_start, | ||
436 | int length, | ||
437 | int *eof, | ||
438 | void *data) | ||
439 | { | 432 | { |
440 | int my_buffer_offset = 0; | ||
441 | char * const my_base = page_buffer; | ||
442 | |||
443 | ARM_SAVE(ARM_CKCTL); | 433 | ARM_SAVE(ARM_CKCTL); |
444 | ARM_SAVE(ARM_IDLECT1); | 434 | ARM_SAVE(ARM_IDLECT1); |
445 | ARM_SAVE(ARM_IDLECT2); | 435 | ARM_SAVE(ARM_IDLECT2); |
@@ -480,10 +470,7 @@ static int omap_pm_read_proc( | |||
480 | MPUI1610_SAVE(EMIFS_CONFIG); | 470 | MPUI1610_SAVE(EMIFS_CONFIG); |
481 | } | 471 | } |
482 | 472 | ||
483 | if (virtual_start == 0) { | 473 | seq_printf(m, |
484 | g_read_completed = 0; | ||
485 | |||
486 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | ||
487 | "ARM_CKCTL_REG: 0x%-8x \n" | 474 | "ARM_CKCTL_REG: 0x%-8x \n" |
488 | "ARM_IDLECT1_REG: 0x%-8x \n" | 475 | "ARM_IDLECT1_REG: 0x%-8x \n" |
489 | "ARM_IDLECT2_REG: 0x%-8x \n" | 476 | "ARM_IDLECT2_REG: 0x%-8x \n" |
@@ -513,8 +500,8 @@ static int omap_pm_read_proc( | |||
513 | ULPD_SHOW(ULPD_STATUS_REQ), | 500 | ULPD_SHOW(ULPD_STATUS_REQ), |
514 | ULPD_SHOW(ULPD_POWER_CTRL)); | 501 | ULPD_SHOW(ULPD_POWER_CTRL)); |
515 | 502 | ||
516 | if (cpu_is_omap7xx()) { | 503 | if (cpu_is_omap7xx()) { |
517 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 504 | seq_printf(m, |
518 | "MPUI7XX_CTRL_REG 0x%-8x \n" | 505 | "MPUI7XX_CTRL_REG 0x%-8x \n" |
519 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" | 506 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" |
520 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 507 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -527,8 +514,8 @@ static int omap_pm_read_proc( | |||
527 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), | 514 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), |
528 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), | 515 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), |
529 | MPUI7XX_SHOW(EMIFS_CONFIG)); | 516 | MPUI7XX_SHOW(EMIFS_CONFIG)); |
530 | } else if (cpu_is_omap15xx()) { | 517 | } else if (cpu_is_omap15xx()) { |
531 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 518 | seq_printf(m, |
532 | "MPUI1510_CTRL_REG 0x%-8x \n" | 519 | "MPUI1510_CTRL_REG 0x%-8x \n" |
533 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" | 520 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" |
534 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 521 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -541,8 +528,8 @@ static int omap_pm_read_proc( | |||
541 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), | 528 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), |
542 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), | 529 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), |
543 | MPUI1510_SHOW(EMIFS_CONFIG)); | 530 | MPUI1510_SHOW(EMIFS_CONFIG)); |
544 | } else if (cpu_is_omap16xx()) { | 531 | } else if (cpu_is_omap16xx()) { |
545 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 532 | seq_printf(m, |
546 | "MPUI1610_CTRL_REG 0x%-8x \n" | 533 | "MPUI1610_CTRL_REG 0x%-8x \n" |
547 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" | 534 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" |
548 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 535 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -555,28 +542,37 @@ static int omap_pm_read_proc( | |||
555 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), | 542 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), |
556 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), | 543 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), |
557 | MPUI1610_SHOW(EMIFS_CONFIG)); | 544 | MPUI1610_SHOW(EMIFS_CONFIG)); |
558 | } | ||
559 | |||
560 | g_read_completed++; | ||
561 | } else if (g_read_completed >= 1) { | ||
562 | *eof = 1; | ||
563 | return 0; | ||
564 | } | 545 | } |
565 | g_read_completed++; | ||
566 | 546 | ||
567 | *my_first_byte = page_buffer; | 547 | return 0; |
568 | return my_buffer_offset; | 548 | } |
549 | |||
550 | static int omap_pm_debug_open(struct inode *inode, struct file *file) | ||
551 | { | ||
552 | return single_open(file, omap_pm_debug_show, | ||
553 | &inode->i_private); | ||
569 | } | 554 | } |
570 | 555 | ||
571 | static void omap_pm_init_proc(void) | 556 | static const struct file_operations omap_pm_debug_fops = { |
557 | .open = omap_pm_debug_open, | ||
558 | .read = seq_read, | ||
559 | .llseek = seq_lseek, | ||
560 | .release = seq_release, | ||
561 | }; | ||
562 | |||
563 | static void omap_pm_init_debugfs(void) | ||
572 | { | 564 | { |
573 | /* XXX Appears to leak memory */ | 565 | struct dentry *d; |
574 | create_proc_read_entry("driver/omap_pm", | 566 | |
575 | S_IWUSR | S_IRUGO, NULL, | 567 | d = debugfs_create_dir("pm_debug", NULL); |
576 | omap_pm_read_proc, NULL); | 568 | if (!d) |
569 | return; | ||
570 | |||
571 | (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, | ||
572 | d, NULL, &omap_pm_debug_fops); | ||
577 | } | 573 | } |
578 | 574 | ||
579 | #endif /* DEBUG && CONFIG_PROC_FS */ | 575 | #endif /* CONFIG_DEBUG_FS */ |
580 | 576 | ||
581 | /* | 577 | /* |
582 | * omap_pm_prepare - Do preliminary suspend work. | 578 | * omap_pm_prepare - Do preliminary suspend work. |
@@ -701,8 +697,8 @@ static int __init omap_pm_init(void) | |||
701 | 697 | ||
702 | suspend_set_ops(&omap_pm_ops); | 698 | suspend_set_ops(&omap_pm_ops); |
703 | 699 | ||
704 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 700 | #ifdef CONFIG_DEBUG_FS |
705 | omap_pm_init_proc(); | 701 | omap_pm_init_debugfs(); |
706 | #endif | 702 | #endif |
707 | 703 | ||
708 | #ifdef CONFIG_OMAP_32K_TIMER | 704 | #ifdef CONFIG_OMAP_32K_TIMER |
diff --git a/arch/blackfin/kernel/cplbinfo.c b/arch/blackfin/kernel/cplbinfo.c index e1d0b24c6070..404045dcc5e4 100644 --- a/arch/blackfin/kernel/cplbinfo.c +++ b/arch/blackfin/kernel/cplbinfo.c | |||
@@ -116,14 +116,12 @@ static const struct seq_operations cplbinfo_sops = { | |||
116 | 116 | ||
117 | static int cplbinfo_open(struct inode *inode, struct file *file) | 117 | static int cplbinfo_open(struct inode *inode, struct file *file) |
118 | { | 118 | { |
119 | struct proc_dir_entry *pde = PDE(file_inode(file)); | ||
120 | char cplb_type; | 119 | char cplb_type; |
121 | unsigned int cpu; | 120 | unsigned int cpu = (unsigned long)PDE_DATA(file_inode(file)); |
122 | int ret; | 121 | int ret; |
123 | struct seq_file *m; | 122 | struct seq_file *m; |
124 | struct cplbinfo_data *cdata; | 123 | struct cplbinfo_data *cdata; |
125 | 124 | ||
126 | cpu = (unsigned int)pde->data; | ||
127 | cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I'; | 125 | cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I'; |
128 | cpu &= ~CPLBINFO_DCPLB_FLAG; | 126 | cpu &= ~CPLBINFO_DCPLB_FLAG; |
129 | 127 | ||
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index 082f1890bacb..ce6f512968a4 100644 --- a/arch/cris/arch-v10/kernel/fasttimer.c +++ b/arch/cris/arch-v10/kernel/fasttimer.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <arch/svinto.h> | 25 | #include <arch/svinto.h> |
26 | #include <asm/fasttimer.h> | 26 | #include <asm/fasttimer.h> |
27 | #include <linux/proc_fs.h> | 27 | #include <linux/proc_fs.h> |
28 | #include <linux/seq_file.h> | ||
28 | 29 | ||
29 | 30 | ||
30 | #define DEBUG_LOG_INCLUDED | 31 | #define DEBUG_LOG_INCLUDED |
@@ -489,197 +490,162 @@ void schedule_usleep(unsigned long us) | |||
489 | } | 490 | } |
490 | 491 | ||
491 | #ifdef CONFIG_PROC_FS | 492 | #ifdef CONFIG_PROC_FS |
492 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | ||
493 | ,int *eof, void *data_unused); | ||
494 | static struct proc_dir_entry *fasttimer_proc_entry; | ||
495 | #endif /* CONFIG_PROC_FS */ | ||
496 | |||
497 | #ifdef CONFIG_PROC_FS | ||
498 | |||
499 | /* This value is very much based on testing */ | 493 | /* This value is very much based on testing */ |
500 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) | 494 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) |
501 | 495 | ||
502 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | 496 | static int proc_fasttimer_show(struct seq_file *m, void *v) |
503 | ,int *eof, void *data_unused) | ||
504 | { | 497 | { |
505 | unsigned long flags; | 498 | unsigned long flags; |
506 | int i = 0; | 499 | int i = 0; |
507 | int num_to_show; | 500 | int num_to_show; |
508 | struct fasttime_t tv; | 501 | struct fasttime_t tv; |
509 | struct fast_timer *t, *nextt; | 502 | struct fast_timer *t, *nextt; |
510 | static char *bigbuf = NULL; | 503 | |
511 | static unsigned long used; | 504 | do_gettimeofday_fast(&tv); |
512 | 505 | ||
513 | if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) | 506 | seq_printf(m, "Fast timers added: %i\n", fast_timers_added); |
514 | { | 507 | seq_printf(m, "Fast timers started: %i\n", fast_timers_started); |
515 | used = 0; | 508 | seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints); |
516 | if (buf) | 509 | seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired); |
517 | buf[0] = '\0'; | 510 | seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted); |
518 | return 0; | 511 | seq_printf(m, "Fast timer running: %s\n", |
519 | } | 512 | fast_timer_running ? "yes" : "no"); |
520 | 513 | seq_printf(m, "Current time: %lu.%06lu\n", | |
521 | if (!offset || !used) | 514 | (unsigned long)tv.tv_jiff, |
522 | { | 515 | (unsigned long)tv.tv_usec); |
523 | do_gettimeofday_fast(&tv); | ||
524 | |||
525 | used = 0; | ||
526 | used += sprintf(bigbuf + used, "Fast timers added: %i\n", | ||
527 | fast_timers_added); | ||
528 | used += sprintf(bigbuf + used, "Fast timers started: %i\n", | ||
529 | fast_timers_started); | ||
530 | used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", | ||
531 | fast_timer_ints); | ||
532 | used += sprintf(bigbuf + used, "Fast timers expired: %i\n", | ||
533 | fast_timers_expired); | ||
534 | used += sprintf(bigbuf + used, "Fast timers deleted: %i\n", | ||
535 | fast_timers_deleted); | ||
536 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", | ||
537 | fast_timer_running ? "yes" : "no"); | ||
538 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", | ||
539 | (unsigned long)tv.tv_jiff, | ||
540 | (unsigned long)tv.tv_usec); | ||
541 | #ifdef FAST_TIMER_SANITY_CHECKS | 516 | #ifdef FAST_TIMER_SANITY_CHECKS |
542 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", | 517 | seq_printf(m, "Sanity failed: %i\n", sanity_failed); |
543 | sanity_failed); | ||
544 | #endif | 518 | #endif |
545 | used += sprintf(bigbuf + used, "\n"); | 519 | seq_putc(m, '\n'); |
546 | 520 | ||
547 | #ifdef DEBUG_LOG_INCLUDED | 521 | #ifdef DEBUG_LOG_INCLUDED |
548 | { | 522 | { |
549 | int end_i = debug_log_cnt; | 523 | int end_i = debug_log_cnt; |
550 | i = 0; | 524 | i = 0; |
551 | 525 | ||
552 | if (debug_log_cnt_wrapped) | 526 | if (debug_log_cnt_wrapped) |
553 | { | 527 | i = debug_log_cnt; |
554 | i = debug_log_cnt; | 528 | |
555 | } | 529 | while (i != end_i || debug_log_cnt_wrapped) { |
556 | 530 | if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0) | |
557 | while ((i != end_i || (debug_log_cnt_wrapped && !used)) && | 531 | return 0; |
558 | used+100 < BIG_BUF_SIZE) | 532 | i = (i+1) % DEBUG_LOG_MAX; |
559 | { | 533 | } |
560 | used += sprintf(bigbuf + used, debug_log_string[i], | 534 | } |
561 | debug_log_value[i]); | 535 | seq_putc(m, '\n'); |
562 | i = (i+1) % DEBUG_LOG_MAX; | ||
563 | } | ||
564 | } | ||
565 | used += sprintf(bigbuf + used, "\n"); | ||
566 | #endif | 536 | #endif |
567 | 537 | ||
568 | num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: | 538 | num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: |
569 | NUM_TIMER_STATS); | 539 | NUM_TIMER_STATS); |
570 | used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); | 540 | seq_printf(m, "Timers started: %i\n", fast_timers_started); |
571 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) | 541 | for (i = 0; i < num_to_show; i++) { |
572 | { | 542 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; |
573 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; | ||
574 | 543 | ||
575 | #if 1 //ndef FAST_TIMER_LOG | 544 | #if 1 //ndef FAST_TIMER_LOG |
576 | used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i" | 545 | seq_printf(m, "div: %i freq: %i delay: %i" |
577 | "\n", | 546 | "\n", |
578 | timer_div_settings[cur], | 547 | timer_div_settings[cur], |
579 | timer_freq_settings[cur], | 548 | timer_freq_settings[cur], |
580 | timer_delay_settings[cur] | 549 | timer_delay_settings[cur]); |
581 | ); | ||
582 | #endif | 550 | #endif |
583 | #ifdef FAST_TIMER_LOG | 551 | #ifdef FAST_TIMER_LOG |
584 | t = &timer_started_log[cur]; | 552 | t = &timer_started_log[cur]; |
585 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 553 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
586 | "d: %6li us data: 0x%08lX" | 554 | "d: %6li us data: 0x%08lX" |
587 | "\n", | 555 | "\n", |
588 | t->name, | 556 | t->name, |
589 | (unsigned long)t->tv_set.tv_jiff, | 557 | (unsigned long)t->tv_set.tv_jiff, |
590 | (unsigned long)t->tv_set.tv_usec, | 558 | (unsigned long)t->tv_set.tv_usec, |
591 | (unsigned long)t->tv_expires.tv_jiff, | 559 | (unsigned long)t->tv_expires.tv_jiff, |
592 | (unsigned long)t->tv_expires.tv_usec, | 560 | (unsigned long)t->tv_expires.tv_usec, |
593 | t->delay_us, | 561 | t->delay_us, |
594 | t->data | 562 | t->data) < 0) |
595 | ); | 563 | return 0; |
596 | #endif | 564 | #endif |
597 | } | 565 | } |
598 | used += sprintf(bigbuf + used, "\n"); | 566 | seq_putc(m, '\n'); |
599 | 567 | ||
600 | #ifdef FAST_TIMER_LOG | 568 | #ifdef FAST_TIMER_LOG |
601 | num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: | 569 | num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: |
602 | NUM_TIMER_STATS); | 570 | NUM_TIMER_STATS); |
603 | used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); | 571 | seq_printf(m, "Timers added: %i\n", fast_timers_added); |
604 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 572 | for (i = 0; i < num_to_show; i++) { |
605 | { | 573 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; |
606 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; | 574 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
607 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 575 | "d: %6li us data: 0x%08lX" |
608 | "d: %6li us data: 0x%08lX" | 576 | "\n", |
609 | "\n", | 577 | t->name, |
610 | t->name, | 578 | (unsigned long)t->tv_set.tv_jiff, |
611 | (unsigned long)t->tv_set.tv_jiff, | 579 | (unsigned long)t->tv_set.tv_usec, |
612 | (unsigned long)t->tv_set.tv_usec, | 580 | (unsigned long)t->tv_expires.tv_jiff, |
613 | (unsigned long)t->tv_expires.tv_jiff, | 581 | (unsigned long)t->tv_expires.tv_usec, |
614 | (unsigned long)t->tv_expires.tv_usec, | 582 | t->delay_us, |
615 | t->delay_us, | 583 | t->data) < 0) |
616 | t->data | 584 | return 0; |
617 | ); | 585 | } |
618 | } | 586 | seq_putc(m, '\n'); |
619 | used += sprintf(bigbuf + used, "\n"); | 587 | |
620 | 588 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | |
621 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | 589 | NUM_TIMER_STATS); |
622 | NUM_TIMER_STATS); | 590 | seq_printf(m, "Timers expired: %i\n", fast_timers_expired); |
623 | used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); | 591 | for (i = 0; i < num_to_show; i++) { |
624 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 592 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; |
625 | { | 593 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
626 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; | 594 | "d: %6li us data: 0x%08lX" |
627 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 595 | "\n", |
628 | "d: %6li us data: 0x%08lX" | 596 | t->name, |
629 | "\n", | 597 | (unsigned long)t->tv_set.tv_jiff, |
630 | t->name, | 598 | (unsigned long)t->tv_set.tv_usec, |
631 | (unsigned long)t->tv_set.tv_jiff, | 599 | (unsigned long)t->tv_expires.tv_jiff, |
632 | (unsigned long)t->tv_set.tv_usec, | 600 | (unsigned long)t->tv_expires.tv_usec, |
633 | (unsigned long)t->tv_expires.tv_jiff, | 601 | t->delay_us, |
634 | (unsigned long)t->tv_expires.tv_usec, | 602 | t->data) < 0) |
635 | t->delay_us, | 603 | return 0; |
636 | t->data | 604 | } |
637 | ); | 605 | seq_putc(m, '\n'); |
638 | } | ||
639 | used += sprintf(bigbuf + used, "\n"); | ||
640 | #endif | 606 | #endif |
641 | 607 | ||
642 | used += sprintf(bigbuf + used, "Active timers:\n"); | 608 | seq_puts(m, "Active timers:\n"); |
643 | local_irq_save(flags); | 609 | local_irq_save(flags); |
644 | t = fast_timer_list; | 610 | t = fast_timer_list; |
645 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) | 611 | while (t) { |
646 | { | 612 | nextt = t->next; |
647 | nextt = t->next; | 613 | local_irq_restore(flags); |
648 | local_irq_restore(flags); | 614 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
649 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 615 | "d: %6li us data: 0x%08lX" |
650 | "d: %6li us data: 0x%08lX" | ||
651 | /* " func: 0x%08lX" */ | 616 | /* " func: 0x%08lX" */ |
652 | "\n", | 617 | "\n", |
653 | t->name, | 618 | t->name, |
654 | (unsigned long)t->tv_set.tv_jiff, | 619 | (unsigned long)t->tv_set.tv_jiff, |
655 | (unsigned long)t->tv_set.tv_usec, | 620 | (unsigned long)t->tv_set.tv_usec, |
656 | (unsigned long)t->tv_expires.tv_jiff, | 621 | (unsigned long)t->tv_expires.tv_jiff, |
657 | (unsigned long)t->tv_expires.tv_usec, | 622 | (unsigned long)t->tv_expires.tv_usec, |
658 | t->delay_us, | 623 | t->delay_us, |
659 | t->data | 624 | t->data |
660 | /* , t->function */ | 625 | /* , t->function */ |
661 | ); | 626 | ) < 0) |
662 | local_irq_save(flags); | 627 | return 0; |
663 | if (t->next != nextt) | 628 | local_irq_save(flags); |
664 | { | 629 | if (t->next != nextt) |
665 | printk(KERN_WARNING "timer removed!\n"); | 630 | printk(KERN_WARNING "timer removed!\n"); |
666 | } | 631 | t = nextt; |
667 | t = nextt; | 632 | } |
668 | } | 633 | local_irq_restore(flags); |
669 | local_irq_restore(flags); | ||
670 | } | ||
671 | |||
672 | if (used - offset < len) | ||
673 | { | ||
674 | len = used - offset; | ||
675 | } | ||
676 | 634 | ||
677 | memcpy(buf, bigbuf + offset, len); | 635 | return 0; |
678 | *start = buf; | 636 | } |
679 | *eof = 1; | ||
680 | 637 | ||
681 | return len; | 638 | static int proc_fasttimer_open(struct inode *inode, struct file *file) |
639 | { | ||
640 | return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE); | ||
682 | } | 641 | } |
642 | |||
643 | static const struct file_operations proc_fasttimer_fops = { | ||
644 | .open = proc_fasttimer_open, | ||
645 | .read = seq_read, | ||
646 | .llseek = seq_lseek, | ||
647 | .release = seq_release, | ||
648 | }; | ||
683 | #endif /* PROC_FS */ | 649 | #endif /* PROC_FS */ |
684 | 650 | ||
685 | #ifdef FAST_TIMER_TEST | 651 | #ifdef FAST_TIMER_TEST |
@@ -857,8 +823,7 @@ int fast_timer_init(void) | |||
857 | } | 823 | } |
858 | #endif | 824 | #endif |
859 | #ifdef CONFIG_PROC_FS | 825 | #ifdef CONFIG_PROC_FS |
860 | if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) | 826 | proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops); |
861 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; | ||
862 | #endif /* PROC_FS */ | 827 | #endif /* PROC_FS */ |
863 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, | 828 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, |
864 | "fast timer int", NULL)) | 829 | "fast timer int", NULL)) |
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c index ab1551ee43c5..e43dd70acd96 100644 --- a/arch/cris/arch-v32/kernel/fasttimer.c +++ b/arch/cris/arch-v32/kernel/fasttimer.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <hwregs/timer_defs.h> | 23 | #include <hwregs/timer_defs.h> |
24 | #include <asm/fasttimer.h> | 24 | #include <asm/fasttimer.h> |
25 | #include <linux/proc_fs.h> | 25 | #include <linux/proc_fs.h> |
26 | #include <linux/seq_file.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * timer0 is running at 100MHz and generating jiffies timer ticks | 29 | * timer0 is running at 100MHz and generating jiffies timer ticks |
@@ -463,195 +464,161 @@ void schedule_usleep(unsigned long us) | |||
463 | } | 464 | } |
464 | 465 | ||
465 | #ifdef CONFIG_PROC_FS | 466 | #ifdef CONFIG_PROC_FS |
466 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | ||
467 | ,int *eof, void *data_unused); | ||
468 | static struct proc_dir_entry *fasttimer_proc_entry; | ||
469 | #endif /* CONFIG_PROC_FS */ | ||
470 | |||
471 | #ifdef CONFIG_PROC_FS | ||
472 | |||
473 | /* This value is very much based on testing */ | 467 | /* This value is very much based on testing */ |
474 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) | 468 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) |
475 | 469 | ||
476 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | 470 | static int proc_fasttimer_show(struct seq_file *m, void *v) |
477 | ,int *eof, void *data_unused) | ||
478 | { | 471 | { |
479 | unsigned long flags; | 472 | unsigned long flags; |
480 | int i = 0; | 473 | int i = 0; |
481 | int num_to_show; | 474 | int num_to_show; |
482 | struct fasttime_t tv; | 475 | struct fasttime_t tv; |
483 | struct fast_timer *t, *nextt; | 476 | struct fast_timer *t, *nextt; |
484 | static char *bigbuf = NULL; | 477 | |
485 | static unsigned long used; | 478 | do_gettimeofday_fast(&tv); |
486 | 479 | ||
487 | if (!bigbuf) { | 480 | seq_printf(m, "Fast timers added: %i\n", fast_timers_added); |
488 | bigbuf = vmalloc(BIG_BUF_SIZE); | 481 | seq_printf(m, "Fast timers started: %i\n", fast_timers_started); |
489 | if (!bigbuf) { | 482 | seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints); |
490 | used = 0; | 483 | seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired); |
491 | if (buf) | 484 | seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted); |
492 | buf[0] = '\0'; | 485 | seq_printf(m, "Fast timer running: %s\n", |
493 | return 0; | 486 | fast_timer_running ? "yes" : "no"); |
494 | } | 487 | seq_printf(m, "Current time: %lu.%06lu\n", |
495 | } | 488 | (unsigned long)tv.tv_jiff, |
496 | 489 | (unsigned long)tv.tv_usec); | |
497 | if (!offset || !used) { | ||
498 | do_gettimeofday_fast(&tv); | ||
499 | |||
500 | used = 0; | ||
501 | used += sprintf(bigbuf + used, "Fast timers added: %i\n", | ||
502 | fast_timers_added); | ||
503 | used += sprintf(bigbuf + used, "Fast timers started: %i\n", | ||
504 | fast_timers_started); | ||
505 | used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", | ||
506 | fast_timer_ints); | ||
507 | used += sprintf(bigbuf + used, "Fast timers expired: %i\n", | ||
508 | fast_timers_expired); | ||
509 | used += sprintf(bigbuf + used, "Fast timers deleted: %i\n", | ||
510 | fast_timers_deleted); | ||
511 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", | ||
512 | fast_timer_running ? "yes" : "no"); | ||
513 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", | ||
514 | (unsigned long)tv.tv_jiff, | ||
515 | (unsigned long)tv.tv_usec); | ||
516 | #ifdef FAST_TIMER_SANITY_CHECKS | 490 | #ifdef FAST_TIMER_SANITY_CHECKS |
517 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", | 491 | seq_printf(m, "Sanity failed: %i\n", sanity_failed); |
518 | sanity_failed); | ||
519 | #endif | 492 | #endif |
520 | used += sprintf(bigbuf + used, "\n"); | 493 | seq_putc(m, '\n'); |
521 | 494 | ||
522 | #ifdef DEBUG_LOG_INCLUDED | 495 | #ifdef DEBUG_LOG_INCLUDED |
523 | { | 496 | { |
524 | int end_i = debug_log_cnt; | 497 | int end_i = debug_log_cnt; |
525 | i = 0; | 498 | i = 0; |
526 | 499 | ||
527 | if (debug_log_cnt_wrapped) | 500 | if (debug_log_cnt_wrapped) |
528 | i = debug_log_cnt; | 501 | i = debug_log_cnt; |
529 | 502 | ||
530 | while ((i != end_i || (debug_log_cnt_wrapped && !used)) && | 503 | while ((i != end_i || debug_log_cnt_wrapped)) { |
531 | used+100 < BIG_BUF_SIZE) | 504 | if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0) |
532 | { | 505 | return 0; |
533 | used += sprintf(bigbuf + used, debug_log_string[i], | 506 | i = (i+1) % DEBUG_LOG_MAX; |
534 | debug_log_value[i]); | 507 | } |
535 | i = (i+1) % DEBUG_LOG_MAX; | 508 | } |
536 | } | 509 | seq_putc(m, '\n'); |
537 | } | ||
538 | used += sprintf(bigbuf + used, "\n"); | ||
539 | #endif | 510 | #endif |
540 | 511 | ||
541 | num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: | 512 | num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: |
542 | NUM_TIMER_STATS); | 513 | NUM_TIMER_STATS); |
543 | used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); | 514 | seq_printf(m, "Timers started: %i\n", fast_timers_started); |
544 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) | 515 | for (i = 0; i < num_to_show; i++) { |
545 | { | 516 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; |
546 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; | ||
547 | 517 | ||
548 | #if 1 //ndef FAST_TIMER_LOG | 518 | #if 1 //ndef FAST_TIMER_LOG |
549 | used += sprintf(bigbuf + used, "div: %i delay: %i" | 519 | seq_printf(m, "div: %i delay: %i" |
550 | "\n", | 520 | "\n", |
551 | timer_div_settings[cur], | 521 | timer_div_settings[cur], |
552 | timer_delay_settings[cur] | 522 | timer_delay_settings[cur]); |
553 | ); | ||
554 | #endif | 523 | #endif |
555 | #ifdef FAST_TIMER_LOG | 524 | #ifdef FAST_TIMER_LOG |
556 | t = &timer_started_log[cur]; | 525 | t = &timer_started_log[cur]; |
557 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 526 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
558 | "d: %6li us data: 0x%08lX" | 527 | "d: %6li us data: 0x%08lX" |
559 | "\n", | 528 | "\n", |
560 | t->name, | 529 | t->name, |
561 | (unsigned long)t->tv_set.tv_jiff, | 530 | (unsigned long)t->tv_set.tv_jiff, |
562 | (unsigned long)t->tv_set.tv_usec, | 531 | (unsigned long)t->tv_set.tv_usec, |
563 | (unsigned long)t->tv_expires.tv_jiff, | 532 | (unsigned long)t->tv_expires.tv_jiff, |
564 | (unsigned long)t->tv_expires.tv_usec, | 533 | (unsigned long)t->tv_expires.tv_usec, |
565 | t->delay_us, | 534 | t->delay_us, |
566 | t->data | 535 | t->data) < 0) |
567 | ); | 536 | return 0; |
568 | #endif | 537 | #endif |
569 | } | 538 | } |
570 | used += sprintf(bigbuf + used, "\n"); | 539 | seq_putc(m, '\n'); |
571 | 540 | ||
572 | #ifdef FAST_TIMER_LOG | 541 | #ifdef FAST_TIMER_LOG |
573 | num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: | 542 | num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: |
574 | NUM_TIMER_STATS); | 543 | NUM_TIMER_STATS); |
575 | used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); | 544 | seq_printf(m, "Timers added: %i\n", fast_timers_added); |
576 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 545 | for (i = 0; i < num_to_show; i++) { |
577 | { | 546 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; |
578 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; | 547 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
579 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 548 | "d: %6li us data: 0x%08lX" |
580 | "d: %6li us data: 0x%08lX" | 549 | "\n", |
581 | "\n", | 550 | t->name, |
582 | t->name, | 551 | (unsigned long)t->tv_set.tv_jiff, |
583 | (unsigned long)t->tv_set.tv_jiff, | 552 | (unsigned long)t->tv_set.tv_usec, |
584 | (unsigned long)t->tv_set.tv_usec, | 553 | (unsigned long)t->tv_expires.tv_jiff, |
585 | (unsigned long)t->tv_expires.tv_jiff, | 554 | (unsigned long)t->tv_expires.tv_usec, |
586 | (unsigned long)t->tv_expires.tv_usec, | 555 | t->delay_us, |
587 | t->delay_us, | 556 | t->data) < 0) |
588 | t->data | 557 | return 0; |
589 | ); | 558 | } |
590 | } | 559 | seq_putc(m, '\n'); |
591 | used += sprintf(bigbuf + used, "\n"); | 560 | |
592 | 561 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | |
593 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | 562 | NUM_TIMER_STATS); |
594 | NUM_TIMER_STATS); | 563 | seq_printf(m, "Timers expired: %i\n", fast_timers_expired); |
595 | used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); | 564 | for (i = 0; i < num_to_show; i++){ |
596 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 565 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; |
597 | { | 566 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
598 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; | 567 | "d: %6li us data: 0x%08lX" |
599 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 568 | "\n", |
600 | "d: %6li us data: 0x%08lX" | 569 | t->name, |
601 | "\n", | 570 | (unsigned long)t->tv_set.tv_jiff, |
602 | t->name, | 571 | (unsigned long)t->tv_set.tv_usec, |
603 | (unsigned long)t->tv_set.tv_jiff, | 572 | (unsigned long)t->tv_expires.tv_jiff, |
604 | (unsigned long)t->tv_set.tv_usec, | 573 | (unsigned long)t->tv_expires.tv_usec, |
605 | (unsigned long)t->tv_expires.tv_jiff, | 574 | t->delay_us, |
606 | (unsigned long)t->tv_expires.tv_usec, | 575 | t->data) < 0) |
607 | t->delay_us, | 576 | return 0; |
608 | t->data | 577 | } |
609 | ); | 578 | seq_putc(m, '\n'); |
610 | } | ||
611 | used += sprintf(bigbuf + used, "\n"); | ||
612 | #endif | 579 | #endif |
613 | 580 | ||
614 | used += sprintf(bigbuf + used, "Active timers:\n"); | 581 | seq_puts(m, "Active timers:\n"); |
615 | local_irq_save(flags); | 582 | local_irq_save(flags); |
616 | t = fast_timer_list; | 583 | t = fast_timer_list; |
617 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) | 584 | while (t != NULL){ |
618 | { | 585 | nextt = t->next; |
619 | nextt = t->next; | 586 | local_irq_restore(flags); |
620 | local_irq_restore(flags); | 587 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
621 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 588 | "d: %6li us data: 0x%08lX" |
622 | "d: %6li us data: 0x%08lX" | ||
623 | /* " func: 0x%08lX" */ | 589 | /* " func: 0x%08lX" */ |
624 | "\n", | 590 | "\n", |
625 | t->name, | 591 | t->name, |
626 | (unsigned long)t->tv_set.tv_jiff, | 592 | (unsigned long)t->tv_set.tv_jiff, |
627 | (unsigned long)t->tv_set.tv_usec, | 593 | (unsigned long)t->tv_set.tv_usec, |
628 | (unsigned long)t->tv_expires.tv_jiff, | 594 | (unsigned long)t->tv_expires.tv_jiff, |
629 | (unsigned long)t->tv_expires.tv_usec, | 595 | (unsigned long)t->tv_expires.tv_usec, |
630 | t->delay_us, | 596 | t->delay_us, |
631 | t->data | 597 | t->data |
632 | /* , t->function */ | 598 | /* , t->function */ |
633 | ); | 599 | ) < 0) |
634 | local_irq_save(flags); | 600 | return 0; |
635 | if (t->next != nextt) | 601 | local_irq_save(flags); |
636 | { | 602 | if (t->next != nextt) |
637 | printk("timer removed!\n"); | 603 | printk("timer removed!\n"); |
638 | } | 604 | t = nextt; |
639 | t = nextt; | 605 | } |
640 | } | 606 | local_irq_restore(flags); |
641 | local_irq_restore(flags); | 607 | return 0; |
642 | } | 608 | } |
643 | 609 | ||
644 | if (used - offset < len) | 610 | static int proc_fasttimer_open(struct inode *inode, struct file *file) |
645 | { | 611 | { |
646 | len = used - offset; | 612 | return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE); |
647 | } | 613 | } |
648 | 614 | ||
649 | memcpy(buf, bigbuf + offset, len); | 615 | static const struct file_operations proc_fasttimer_fops = { |
650 | *start = buf; | 616 | .open = proc_fasttimer_open, |
651 | *eof = 1; | 617 | .read = seq_read, |
618 | .llseek = seq_lseek, | ||
619 | .release = seq_release, | ||
620 | }; | ||
652 | 621 | ||
653 | return len; | ||
654 | } | ||
655 | #endif /* PROC_FS */ | 622 | #endif /* PROC_FS */ |
656 | 623 | ||
657 | #ifdef FAST_TIMER_TEST | 624 | #ifdef FAST_TIMER_TEST |
@@ -816,9 +783,7 @@ int fast_timer_init(void) | |||
816 | printk("fast_timer_init()\n"); | 783 | printk("fast_timer_init()\n"); |
817 | 784 | ||
818 | #ifdef CONFIG_PROC_FS | 785 | #ifdef CONFIG_PROC_FS |
819 | fasttimer_proc_entry = create_proc_entry("fasttimer", 0, 0); | 786 | proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops); |
820 | if (fasttimer_proc_entry) | ||
821 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; | ||
822 | #endif /* PROC_FS */ | 787 | #endif /* PROC_FS */ |
823 | if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, | 788 | if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, |
824 | IRQF_SHARED | IRQF_DISABLED, | 789 | IRQF_SHARED | IRQF_DISABLED, |
diff --git a/arch/h8300/kernel/gpio.c b/arch/h8300/kernel/gpio.c index 6a25dd5530e7..b02c752cd326 100644 --- a/arch/h8300/kernel/gpio.c +++ b/arch/h8300/kernel/gpio.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/stddef.h> | 12 | #include <linux/stddef.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/seq_file.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/string.h> | 16 | #include <linux/string.h> |
16 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
@@ -138,30 +139,34 @@ static char *port_status(int portno) | |||
138 | return result; | 139 | return result; |
139 | } | 140 | } |
140 | 141 | ||
141 | static int gpio_proc_read(char *buf, char **start, off_t offset, | 142 | static int gpio_proc_show(struct seq_file *m, void *v) |
142 | int len, int *unused_i, void *unused_v) | ||
143 | { | 143 | { |
144 | int c,outlen; | ||
145 | static const char port_name[]="123456789ABCDEFGH"; | 144 | static const char port_name[]="123456789ABCDEFGH"; |
146 | outlen = 0; | 145 | int c; |
146 | |||
147 | for (c = 0; c < MAX_PORT; c++) { | 147 | for (c = 0; c < MAX_PORT; c++) { |
148 | if (ddrs[c] == NULL) | 148 | if (ddrs[c] == NULL) |
149 | continue ; | 149 | continue; |
150 | len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c)); | 150 | seq_printf(m, "P%c: %s\n", port_name[c], port_status(c)); |
151 | buf += len; | ||
152 | outlen += len; | ||
153 | } | 151 | } |
154 | return outlen; | 152 | return 0; |
155 | } | 153 | } |
156 | 154 | ||
157 | static __init int register_proc(void) | 155 | static int gpio_proc_open(struct inode *inode, struct file *file) |
158 | { | 156 | { |
159 | struct proc_dir_entry *proc_gpio; | 157 | return single_open(file, gpio_proc_show, PDE_DATA(inode)); |
158 | } | ||
160 | 159 | ||
161 | proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); | 160 | static const struct file_operations gpio_proc_fops = { |
162 | if (proc_gpio) | 161 | .open = gpio_proc_open, |
163 | proc_gpio->read_proc = gpio_proc_read; | 162 | .read = seq_read, |
164 | return proc_gpio != NULL; | 163 | .llseek = seq_lseek, |
164 | .release = seq_release, | ||
165 | }; | ||
166 | |||
167 | static __init int register_proc(void) | ||
168 | { | ||
169 | return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL; | ||
165 | } | 170 | } |
166 | 171 | ||
167 | __initcall(register_proc); | 172 | __initcall(register_proc); |
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c index 79521d5499f9..b17129e3b7c8 100644 --- a/arch/ia64/kernel/palinfo.c +++ b/arch/ia64/kernel/palinfo.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
25 | #include <linux/seq_file.h> | ||
25 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
26 | #include <linux/module.h> | 27 | #include <linux/module.h> |
27 | #include <linux/efi.h> | 28 | #include <linux/efi.h> |
@@ -41,7 +42,7 @@ MODULE_LICENSE("GPL"); | |||
41 | 42 | ||
42 | #define PALINFO_VERSION "0.5" | 43 | #define PALINFO_VERSION "0.5" |
43 | 44 | ||
44 | typedef int (*palinfo_func_t)(char*); | 45 | typedef int (*palinfo_func_t)(struct seq_file *); |
45 | 46 | ||
46 | typedef struct { | 47 | typedef struct { |
47 | const char *name; /* name of the proc entry */ | 48 | const char *name; /* name of the proc entry */ |
@@ -54,7 +55,7 @@ typedef struct { | |||
54 | * A bunch of string array to get pretty printing | 55 | * A bunch of string array to get pretty printing |
55 | */ | 56 | */ |
56 | 57 | ||
57 | static char *cache_types[] = { | 58 | static const char *cache_types[] = { |
58 | "", /* not used */ | 59 | "", /* not used */ |
59 | "Instruction", | 60 | "Instruction", |
60 | "Data", | 61 | "Data", |
@@ -122,19 +123,16 @@ static const char *mem_attrib[]={ | |||
122 | * - a pointer to the end of the buffer | 123 | * - a pointer to the end of the buffer |
123 | * | 124 | * |
124 | */ | 125 | */ |
125 | static char * | 126 | static void bitvector_process(struct seq_file *m, u64 vector) |
126 | bitvector_process(char *p, u64 vector) | ||
127 | { | 127 | { |
128 | int i,j; | 128 | int i,j; |
129 | const char *units[]={ "", "K", "M", "G", "T" }; | 129 | static const char *units[]={ "", "K", "M", "G", "T" }; |
130 | 130 | ||
131 | for (i=0, j=0; i < 64; i++ , j=i/10) { | 131 | for (i=0, j=0; i < 64; i++ , j=i/10) { |
132 | if (vector & 0x1) { | 132 | if (vector & 0x1) |
133 | p += sprintf(p, "%d%s ", 1 << (i-j*10), units[j]); | 133 | seq_printf(m, "%d%s ", 1 << (i-j*10), units[j]); |
134 | } | ||
135 | vector >>= 1; | 134 | vector >>= 1; |
136 | } | 135 | } |
137 | return p; | ||
138 | } | 136 | } |
139 | 137 | ||
140 | /* | 138 | /* |
@@ -149,8 +147,7 @@ bitvector_process(char *p, u64 vector) | |||
149 | * - a pointer to the end of the buffer | 147 | * - a pointer to the end of the buffer |
150 | * | 148 | * |
151 | */ | 149 | */ |
152 | static char * | 150 | static void bitregister_process(struct seq_file *m, u64 *reg_info, int max) |
153 | bitregister_process(char *p, u64 *reg_info, int max) | ||
154 | { | 151 | { |
155 | int i, begin, skip = 0; | 152 | int i, begin, skip = 0; |
156 | u64 value = reg_info[0]; | 153 | u64 value = reg_info[0]; |
@@ -163,9 +160,9 @@ bitregister_process(char *p, u64 *reg_info, int max) | |||
163 | 160 | ||
164 | if ((value & 0x1) == 0 && skip == 0) { | 161 | if ((value & 0x1) == 0 && skip == 0) { |
165 | if (begin <= i - 2) | 162 | if (begin <= i - 2) |
166 | p += sprintf(p, "%d-%d ", begin, i-1); | 163 | seq_printf(m, "%d-%d ", begin, i-1); |
167 | else | 164 | else |
168 | p += sprintf(p, "%d ", i-1); | 165 | seq_printf(m, "%d ", i-1); |
169 | skip = 1; | 166 | skip = 1; |
170 | begin = -1; | 167 | begin = -1; |
171 | } else if ((value & 0x1) && skip == 1) { | 168 | } else if ((value & 0x1) && skip == 1) { |
@@ -176,19 +173,15 @@ bitregister_process(char *p, u64 *reg_info, int max) | |||
176 | } | 173 | } |
177 | if (begin > -1) { | 174 | if (begin > -1) { |
178 | if (begin < 127) | 175 | if (begin < 127) |
179 | p += sprintf(p, "%d-127", begin); | 176 | seq_printf(m, "%d-127", begin); |
180 | else | 177 | else |
181 | p += sprintf(p, "127"); | 178 | seq_puts(m, "127"); |
182 | } | 179 | } |
183 | |||
184 | return p; | ||
185 | } | 180 | } |
186 | 181 | ||
187 | static int | 182 | static int power_info(struct seq_file *m) |
188 | power_info(char *page) | ||
189 | { | 183 | { |
190 | s64 status; | 184 | s64 status; |
191 | char *p = page; | ||
192 | u64 halt_info_buffer[8]; | 185 | u64 halt_info_buffer[8]; |
193 | pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer; | 186 | pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer; |
194 | int i; | 187 | int i; |
@@ -198,26 +191,25 @@ power_info(char *page) | |||
198 | 191 | ||
199 | for (i=0; i < 8 ; i++ ) { | 192 | for (i=0; i < 8 ; i++ ) { |
200 | if (halt_info[i].pal_power_mgmt_info_s.im == 1) { | 193 | if (halt_info[i].pal_power_mgmt_info_s.im == 1) { |
201 | p += sprintf(p, "Power level %d:\n" | 194 | seq_printf(m, |
202 | "\tentry_latency : %d cycles\n" | 195 | "Power level %d:\n" |
203 | "\texit_latency : %d cycles\n" | 196 | "\tentry_latency : %d cycles\n" |
204 | "\tpower consumption : %d mW\n" | 197 | "\texit_latency : %d cycles\n" |
205 | "\tCache+TLB coherency : %s\n", i, | 198 | "\tpower consumption : %d mW\n" |
206 | halt_info[i].pal_power_mgmt_info_s.entry_latency, | 199 | "\tCache+TLB coherency : %s\n", i, |
207 | halt_info[i].pal_power_mgmt_info_s.exit_latency, | 200 | halt_info[i].pal_power_mgmt_info_s.entry_latency, |
208 | halt_info[i].pal_power_mgmt_info_s.power_consumption, | 201 | halt_info[i].pal_power_mgmt_info_s.exit_latency, |
209 | halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No"); | 202 | halt_info[i].pal_power_mgmt_info_s.power_consumption, |
203 | halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No"); | ||
210 | } else { | 204 | } else { |
211 | p += sprintf(p,"Power level %d: not implemented\n",i); | 205 | seq_printf(m,"Power level %d: not implemented\n", i); |
212 | } | 206 | } |
213 | } | 207 | } |
214 | return p - page; | 208 | return 0; |
215 | } | 209 | } |
216 | 210 | ||
217 | static int | 211 | static int cache_info(struct seq_file *m) |
218 | cache_info(char *page) | ||
219 | { | 212 | { |
220 | char *p = page; | ||
221 | unsigned long i, levels, unique_caches; | 213 | unsigned long i, levels, unique_caches; |
222 | pal_cache_config_info_t cci; | 214 | pal_cache_config_info_t cci; |
223 | int j, k; | 215 | int j, k; |
@@ -228,73 +220,74 @@ cache_info(char *page) | |||
228 | return 0; | 220 | return 0; |
229 | } | 221 | } |
230 | 222 | ||
231 | p += sprintf(p, "Cache levels : %ld\nUnique caches : %ld\n\n", levels, unique_caches); | 223 | seq_printf(m, "Cache levels : %ld\nUnique caches : %ld\n\n", |
224 | levels, unique_caches); | ||
232 | 225 | ||
233 | for (i=0; i < levels; i++) { | 226 | for (i=0; i < levels; i++) { |
234 | |||
235 | for (j=2; j >0 ; j--) { | 227 | for (j=2; j >0 ; j--) { |
236 | |||
237 | /* even without unification some level may not be present */ | 228 | /* even without unification some level may not be present */ |
238 | if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0) { | 229 | if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0) |
239 | continue; | 230 | continue; |
240 | } | 231 | |
241 | p += sprintf(p, | 232 | seq_printf(m, |
242 | "%s Cache level %lu:\n" | 233 | "%s Cache level %lu:\n" |
243 | "\tSize : %u bytes\n" | 234 | "\tSize : %u bytes\n" |
244 | "\tAttributes : ", | 235 | "\tAttributes : ", |
245 | cache_types[j+cci.pcci_unified], i+1, | 236 | cache_types[j+cci.pcci_unified], i+1, |
246 | cci.pcci_cache_size); | 237 | cci.pcci_cache_size); |
247 | 238 | ||
248 | if (cci.pcci_unified) p += sprintf(p, "Unified "); | 239 | if (cci.pcci_unified) |
249 | 240 | seq_puts(m, "Unified "); | |
250 | p += sprintf(p, "%s\n", cache_mattrib[cci.pcci_cache_attr]); | 241 | |
251 | 242 | seq_printf(m, "%s\n", cache_mattrib[cci.pcci_cache_attr]); | |
252 | p += sprintf(p, | 243 | |
253 | "\tAssociativity : %d\n" | 244 | seq_printf(m, |
254 | "\tLine size : %d bytes\n" | 245 | "\tAssociativity : %d\n" |
255 | "\tStride : %d bytes\n", | 246 | "\tLine size : %d bytes\n" |
256 | cci.pcci_assoc, 1<<cci.pcci_line_size, 1<<cci.pcci_stride); | 247 | "\tStride : %d bytes\n", |
248 | cci.pcci_assoc, | ||
249 | 1<<cci.pcci_line_size, | ||
250 | 1<<cci.pcci_stride); | ||
257 | if (j == 1) | 251 | if (j == 1) |
258 | p += sprintf(p, "\tStore latency : N/A\n"); | 252 | seq_puts(m, "\tStore latency : N/A\n"); |
259 | else | 253 | else |
260 | p += sprintf(p, "\tStore latency : %d cycle(s)\n", | 254 | seq_printf(m, "\tStore latency : %d cycle(s)\n", |
261 | cci.pcci_st_latency); | 255 | cci.pcci_st_latency); |
262 | 256 | ||
263 | p += sprintf(p, | 257 | seq_printf(m, |
264 | "\tLoad latency : %d cycle(s)\n" | 258 | "\tLoad latency : %d cycle(s)\n" |
265 | "\tStore hints : ", cci.pcci_ld_latency); | 259 | "\tStore hints : ", cci.pcci_ld_latency); |
266 | 260 | ||
267 | for(k=0; k < 8; k++ ) { | 261 | for(k=0; k < 8; k++ ) { |
268 | if ( cci.pcci_st_hints & 0x1) | 262 | if ( cci.pcci_st_hints & 0x1) |
269 | p += sprintf(p, "[%s]", cache_st_hints[k]); | 263 | seq_printf(m, "[%s]", cache_st_hints[k]); |
270 | cci.pcci_st_hints >>=1; | 264 | cci.pcci_st_hints >>=1; |
271 | } | 265 | } |
272 | p += sprintf(p, "\n\tLoad hints : "); | 266 | seq_puts(m, "\n\tLoad hints : "); |
273 | 267 | ||
274 | for(k=0; k < 8; k++ ) { | 268 | for(k=0; k < 8; k++ ) { |
275 | if (cci.pcci_ld_hints & 0x1) | 269 | if (cci.pcci_ld_hints & 0x1) |
276 | p += sprintf(p, "[%s]", cache_ld_hints[k]); | 270 | seq_printf(m, "[%s]", cache_ld_hints[k]); |
277 | cci.pcci_ld_hints >>=1; | 271 | cci.pcci_ld_hints >>=1; |
278 | } | 272 | } |
279 | p += sprintf(p, | 273 | seq_printf(m, |
280 | "\n\tAlias boundary : %d byte(s)\n" | 274 | "\n\tAlias boundary : %d byte(s)\n" |
281 | "\tTag LSB : %d\n" | 275 | "\tTag LSB : %d\n" |
282 | "\tTag MSB : %d\n", | 276 | "\tTag MSB : %d\n", |
283 | 1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb, | 277 | 1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb, |
284 | cci.pcci_tag_msb); | 278 | cci.pcci_tag_msb); |
285 | 279 | ||
286 | /* when unified, data(j=2) is enough */ | 280 | /* when unified, data(j=2) is enough */ |
287 | if (cci.pcci_unified) break; | 281 | if (cci.pcci_unified) |
282 | break; | ||
288 | } | 283 | } |
289 | } | 284 | } |
290 | return p - page; | 285 | return 0; |
291 | } | 286 | } |
292 | 287 | ||
293 | 288 | ||
294 | static int | 289 | static int vm_info(struct seq_file *m) |
295 | vm_info(char *page) | ||
296 | { | 290 | { |
297 | char *p = page; | ||
298 | u64 tr_pages =0, vw_pages=0, tc_pages; | 291 | u64 tr_pages =0, vw_pages=0, tc_pages; |
299 | u64 attrib; | 292 | u64 attrib; |
300 | pal_vm_info_1_u_t vm_info_1; | 293 | pal_vm_info_1_u_t vm_info_1; |
@@ -309,7 +302,7 @@ vm_info(char *page) | |||
309 | printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status); | 302 | printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status); |
310 | } else { | 303 | } else { |
311 | 304 | ||
312 | p += sprintf(p, | 305 | seq_printf(m, |
313 | "Physical Address Space : %d bits\n" | 306 | "Physical Address Space : %d bits\n" |
314 | "Virtual Address Space : %d bits\n" | 307 | "Virtual Address Space : %d bits\n" |
315 | "Protection Key Registers(PKR) : %d\n" | 308 | "Protection Key Registers(PKR) : %d\n" |
@@ -324,49 +317,49 @@ vm_info(char *page) | |||
324 | vm_info_1.pal_vm_info_1_s.hash_tag_id, | 317 | vm_info_1.pal_vm_info_1_s.hash_tag_id, |
325 | vm_info_2.pal_vm_info_2_s.rid_size); | 318 | vm_info_2.pal_vm_info_2_s.rid_size); |
326 | if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES) | 319 | if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES) |
327 | p += sprintf(p, "unlimited\n"); | 320 | seq_puts(m, "unlimited\n"); |
328 | else | 321 | else |
329 | p += sprintf(p, "%d\n", | 322 | seq_printf(m, "%d\n", |
330 | vm_info_2.pal_vm_info_2_s.max_purges ? | 323 | vm_info_2.pal_vm_info_2_s.max_purges ? |
331 | vm_info_2.pal_vm_info_2_s.max_purges : 1); | 324 | vm_info_2.pal_vm_info_2_s.max_purges : 1); |
332 | } | 325 | } |
333 | 326 | ||
334 | if (ia64_pal_mem_attrib(&attrib) == 0) { | 327 | if (ia64_pal_mem_attrib(&attrib) == 0) { |
335 | p += sprintf(p, "Supported memory attributes : "); | 328 | seq_puts(m, "Supported memory attributes : "); |
336 | sep = ""; | 329 | sep = ""; |
337 | for (i = 0; i < 8; i++) { | 330 | for (i = 0; i < 8; i++) { |
338 | if (attrib & (1 << i)) { | 331 | if (attrib & (1 << i)) { |
339 | p += sprintf(p, "%s%s", sep, mem_attrib[i]); | 332 | seq_printf(m, "%s%s", sep, mem_attrib[i]); |
340 | sep = ", "; | 333 | sep = ", "; |
341 | } | 334 | } |
342 | } | 335 | } |
343 | p += sprintf(p, "\n"); | 336 | seq_putc(m, '\n'); |
344 | } | 337 | } |
345 | 338 | ||
346 | if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) { | 339 | if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) { |
347 | printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status); | 340 | printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status); |
348 | } else { | 341 | } else { |
349 | 342 | ||
350 | p += sprintf(p, | 343 | seq_printf(m, |
351 | "\nTLB walker : %simplemented\n" | 344 | "\nTLB walker : %simplemented\n" |
352 | "Number of DTR : %d\n" | 345 | "Number of DTR : %d\n" |
353 | "Number of ITR : %d\n" | 346 | "Number of ITR : %d\n" |
354 | "TLB insertable page sizes : ", | 347 | "TLB insertable page sizes : ", |
355 | vm_info_1.pal_vm_info_1_s.vw ? "" : "not ", | 348 | vm_info_1.pal_vm_info_1_s.vw ? "" : "not ", |
356 | vm_info_1.pal_vm_info_1_s.max_dtr_entry+1, | 349 | vm_info_1.pal_vm_info_1_s.max_dtr_entry+1, |
357 | vm_info_1.pal_vm_info_1_s.max_itr_entry+1); | 350 | vm_info_1.pal_vm_info_1_s.max_itr_entry+1); |
358 | |||
359 | 351 | ||
360 | p = bitvector_process(p, tr_pages); | 352 | bitvector_process(m, tr_pages); |
361 | 353 | ||
362 | p += sprintf(p, "\nTLB purgeable page sizes : "); | 354 | seq_puts(m, "\nTLB purgeable page sizes : "); |
363 | 355 | ||
364 | p = bitvector_process(p, vw_pages); | 356 | bitvector_process(m, vw_pages); |
365 | } | 357 | } |
366 | if ((status=ia64_get_ptce(&ptce)) != 0) { | 358 | |
359 | if ((status = ia64_get_ptce(&ptce)) != 0) { | ||
367 | printk(KERN_ERR "ia64_get_ptce=%ld\n", status); | 360 | printk(KERN_ERR "ia64_get_ptce=%ld\n", status); |
368 | } else { | 361 | } else { |
369 | p += sprintf(p, | 362 | seq_printf(m, |
370 | "\nPurge base address : 0x%016lx\n" | 363 | "\nPurge base address : 0x%016lx\n" |
371 | "Purge outer loop count : %d\n" | 364 | "Purge outer loop count : %d\n" |
372 | "Purge inner loop count : %d\n" | 365 | "Purge inner loop count : %d\n" |
@@ -375,7 +368,7 @@ vm_info(char *page) | |||
375 | ptce.base, ptce.count[0], ptce.count[1], | 368 | ptce.base, ptce.count[0], ptce.count[1], |
376 | ptce.stride[0], ptce.stride[1]); | 369 | ptce.stride[0], ptce.stride[1]); |
377 | 370 | ||
378 | p += sprintf(p, | 371 | seq_printf(m, |
379 | "TC Levels : %d\n" | 372 | "TC Levels : %d\n" |
380 | "Unique TC(s) : %d\n", | 373 | "Unique TC(s) : %d\n", |
381 | vm_info_1.pal_vm_info_1_s.num_tc_levels, | 374 | vm_info_1.pal_vm_info_1_s.num_tc_levels, |
@@ -385,13 +378,11 @@ vm_info(char *page) | |||
385 | for (j=2; j>0 ; j--) { | 378 | for (j=2; j>0 ; j--) { |
386 | tc_pages = 0; /* just in case */ | 379 | tc_pages = 0; /* just in case */ |
387 | 380 | ||
388 | |||
389 | /* even without unification, some levels may not be present */ | 381 | /* even without unification, some levels may not be present */ |
390 | if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) { | 382 | if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) |
391 | continue; | 383 | continue; |
392 | } | ||
393 | 384 | ||
394 | p += sprintf(p, | 385 | seq_printf(m, |
395 | "\n%s Translation Cache Level %d:\n" | 386 | "\n%s Translation Cache Level %d:\n" |
396 | "\tHash sets : %d\n" | 387 | "\tHash sets : %d\n" |
397 | "\tAssociativity : %d\n" | 388 | "\tAssociativity : %d\n" |
@@ -403,15 +394,15 @@ vm_info(char *page) | |||
403 | tc_info.tc_num_entries); | 394 | tc_info.tc_num_entries); |
404 | 395 | ||
405 | if (tc_info.tc_pf) | 396 | if (tc_info.tc_pf) |
406 | p += sprintf(p, "PreferredPageSizeOptimized "); | 397 | seq_puts(m, "PreferredPageSizeOptimized "); |
407 | if (tc_info.tc_unified) | 398 | if (tc_info.tc_unified) |
408 | p += sprintf(p, "Unified "); | 399 | seq_puts(m, "Unified "); |
409 | if (tc_info.tc_reduce_tr) | 400 | if (tc_info.tc_reduce_tr) |
410 | p += sprintf(p, "TCReduction"); | 401 | seq_puts(m, "TCReduction"); |
411 | 402 | ||
412 | p += sprintf(p, "\n\tSupported page sizes: "); | 403 | seq_puts(m, "\n\tSupported page sizes: "); |
413 | 404 | ||
414 | p = bitvector_process(p, tc_pages); | 405 | bitvector_process(m, tc_pages); |
415 | 406 | ||
416 | /* when unified date (j=2) is enough */ | 407 | /* when unified date (j=2) is enough */ |
417 | if (tc_info.tc_unified) | 408 | if (tc_info.tc_unified) |
@@ -419,16 +410,14 @@ vm_info(char *page) | |||
419 | } | 410 | } |
420 | } | 411 | } |
421 | } | 412 | } |
422 | p += sprintf(p, "\n"); | ||
423 | 413 | ||
424 | return p - page; | 414 | seq_putc(m, '\n'); |
415 | return 0; | ||
425 | } | 416 | } |
426 | 417 | ||
427 | 418 | ||
428 | static int | 419 | static int register_info(struct seq_file *m) |
429 | register_info(char *page) | ||
430 | { | 420 | { |
431 | char *p = page; | ||
432 | u64 reg_info[2]; | 421 | u64 reg_info[2]; |
433 | u64 info; | 422 | u64 info; |
434 | unsigned long phys_stacked; | 423 | unsigned long phys_stacked; |
@@ -442,35 +431,31 @@ register_info(char *page) | |||
442 | }; | 431 | }; |
443 | 432 | ||
444 | for(info=0; info < 4; info++) { | 433 | for(info=0; info < 4; info++) { |
445 | 434 | if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0) | |
446 | if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0) return 0; | 435 | return 0; |
447 | 436 | seq_printf(m, "%-32s : ", info_type[info]); | |
448 | p += sprintf(p, "%-32s : ", info_type[info]); | 437 | bitregister_process(m, reg_info, 128); |
449 | 438 | seq_putc(m, '\n'); | |
450 | p = bitregister_process(p, reg_info, 128); | ||
451 | |||
452 | p += sprintf(p, "\n"); | ||
453 | } | 439 | } |
454 | 440 | ||
455 | if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) { | 441 | if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) |
442 | seq_printf(m, | ||
443 | "RSE stacked physical registers : %ld\n" | ||
444 | "RSE load/store hints : %ld (%s)\n", | ||
445 | phys_stacked, hints.ph_data, | ||
446 | hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)"); | ||
456 | 447 | ||
457 | p += sprintf(p, | ||
458 | "RSE stacked physical registers : %ld\n" | ||
459 | "RSE load/store hints : %ld (%s)\n", | ||
460 | phys_stacked, hints.ph_data, | ||
461 | hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)"); | ||
462 | } | ||
463 | if (ia64_pal_debug_info(&iregs, &dregs)) | 448 | if (ia64_pal_debug_info(&iregs, &dregs)) |
464 | return 0; | 449 | return 0; |
465 | 450 | ||
466 | p += sprintf(p, | 451 | seq_printf(m, |
467 | "Instruction debug register pairs : %ld\n" | 452 | "Instruction debug register pairs : %ld\n" |
468 | "Data debug register pairs : %ld\n", iregs, dregs); | 453 | "Data debug register pairs : %ld\n", iregs, dregs); |
469 | 454 | ||
470 | return p - page; | 455 | return 0; |
471 | } | 456 | } |
472 | 457 | ||
473 | static char *proc_features_0[]={ /* Feature set 0 */ | 458 | static const char *const proc_features_0[]={ /* Feature set 0 */ |
474 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, | 459 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
475 | NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, | 460 | NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, |
476 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, | 461 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
@@ -502,7 +487,7 @@ static char *proc_features_0[]={ /* Feature set 0 */ | |||
502 | "Enable BERR promotion" | 487 | "Enable BERR promotion" |
503 | }; | 488 | }; |
504 | 489 | ||
505 | static char *proc_features_16[]={ /* Feature set 16 */ | 490 | static const char *const proc_features_16[]={ /* Feature set 16 */ |
506 | "Disable ETM", | 491 | "Disable ETM", |
507 | "Enable ETM", | 492 | "Enable ETM", |
508 | "Enable MCA on half-way timer", | 493 | "Enable MCA on half-way timer", |
@@ -522,7 +507,7 @@ static char *proc_features_16[]={ /* Feature set 16 */ | |||
522 | NULL, NULL, NULL, NULL, NULL | 507 | NULL, NULL, NULL, NULL, NULL |
523 | }; | 508 | }; |
524 | 509 | ||
525 | static char **proc_features[]={ | 510 | static const char *const *const proc_features[]={ |
526 | proc_features_0, | 511 | proc_features_0, |
527 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 512 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
528 | NULL, NULL, NULL, NULL, | 513 | NULL, NULL, NULL, NULL, |
@@ -530,11 +515,10 @@ static char **proc_features[]={ | |||
530 | NULL, NULL, NULL, NULL, | 515 | NULL, NULL, NULL, NULL, |
531 | }; | 516 | }; |
532 | 517 | ||
533 | static char * feature_set_info(char *page, u64 avail, u64 status, u64 control, | 518 | static void feature_set_info(struct seq_file *m, u64 avail, u64 status, u64 control, |
534 | unsigned long set) | 519 | unsigned long set) |
535 | { | 520 | { |
536 | char *p = page; | 521 | const char *const *vf, *const *v; |
537 | char **vf, **v; | ||
538 | int i; | 522 | int i; |
539 | 523 | ||
540 | vf = v = proc_features[set]; | 524 | vf = v = proc_features[set]; |
@@ -547,13 +531,13 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control, | |||
547 | if (vf) | 531 | if (vf) |
548 | v = vf + i; | 532 | v = vf + i; |
549 | if ( v && *v ) { | 533 | if ( v && *v ) { |
550 | p += sprintf(p, "%-40s : %s %s\n", *v, | 534 | seq_printf(m, "%-40s : %s %s\n", *v, |
551 | avail & 0x1 ? (status & 0x1 ? | 535 | avail & 0x1 ? (status & 0x1 ? |
552 | "On " : "Off"): "", | 536 | "On " : "Off"): "", |
553 | avail & 0x1 ? (control & 0x1 ? | 537 | avail & 0x1 ? (control & 0x1 ? |
554 | "Ctrl" : "NoCtrl"): ""); | 538 | "Ctrl" : "NoCtrl"): ""); |
555 | } else { | 539 | } else { |
556 | p += sprintf(p, "Feature set %2ld bit %2d\t\t\t" | 540 | seq_printf(m, "Feature set %2ld bit %2d\t\t\t" |
557 | " : %s %s\n", | 541 | " : %s %s\n", |
558 | set, i, | 542 | set, i, |
559 | avail & 0x1 ? (status & 0x1 ? | 543 | avail & 0x1 ? (status & 0x1 ? |
@@ -562,36 +546,32 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control, | |||
562 | "Ctrl" : "NoCtrl"): ""); | 546 | "Ctrl" : "NoCtrl"): ""); |
563 | } | 547 | } |
564 | } | 548 | } |
565 | return p; | ||
566 | } | 549 | } |
567 | 550 | ||
568 | static int | 551 | static int processor_info(struct seq_file *m) |
569 | processor_info(char *page) | ||
570 | { | 552 | { |
571 | char *p = page; | ||
572 | u64 avail=1, status=1, control=1, feature_set=0; | 553 | u64 avail=1, status=1, control=1, feature_set=0; |
573 | s64 ret; | 554 | s64 ret; |
574 | 555 | ||
575 | do { | 556 | do { |
576 | ret = ia64_pal_proc_get_features(&avail, &status, &control, | 557 | ret = ia64_pal_proc_get_features(&avail, &status, &control, |
577 | feature_set); | 558 | feature_set); |
578 | if (ret < 0) { | 559 | if (ret < 0) |
579 | return p - page; | 560 | return 0; |
580 | } | 561 | |
581 | if (ret == 1) { | 562 | if (ret == 1) { |
582 | feature_set++; | 563 | feature_set++; |
583 | continue; | 564 | continue; |
584 | } | 565 | } |
585 | 566 | ||
586 | p = feature_set_info(p, avail, status, control, feature_set); | 567 | feature_set_info(m, avail, status, control, feature_set); |
587 | |||
588 | feature_set++; | 568 | feature_set++; |
589 | } while(1); | 569 | } while(1); |
590 | 570 | ||
591 | return p - page; | 571 | return 0; |
592 | } | 572 | } |
593 | 573 | ||
594 | static const char *bus_features[]={ | 574 | static const char *const bus_features[]={ |
595 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, | 575 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
596 | NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, | 576 | NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL, |
597 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, | 577 | NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
@@ -617,125 +597,118 @@ static const char *bus_features[]={ | |||
617 | }; | 597 | }; |
618 | 598 | ||
619 | 599 | ||
620 | static int | 600 | static int bus_info(struct seq_file *m) |
621 | bus_info(char *page) | ||
622 | { | 601 | { |
623 | char *p = page; | 602 | const char *const *v = bus_features; |
624 | const char **v = bus_features; | ||
625 | pal_bus_features_u_t av, st, ct; | 603 | pal_bus_features_u_t av, st, ct; |
626 | u64 avail, status, control; | 604 | u64 avail, status, control; |
627 | int i; | 605 | int i; |
628 | s64 ret; | 606 | s64 ret; |
629 | 607 | ||
630 | if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) return 0; | 608 | if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) |
609 | return 0; | ||
631 | 610 | ||
632 | avail = av.pal_bus_features_val; | 611 | avail = av.pal_bus_features_val; |
633 | status = st.pal_bus_features_val; | 612 | status = st.pal_bus_features_val; |
634 | control = ct.pal_bus_features_val; | 613 | control = ct.pal_bus_features_val; |
635 | 614 | ||
636 | for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) { | 615 | for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) { |
637 | if ( ! *v ) continue; | 616 | if ( ! *v ) |
638 | p += sprintf(p, "%-48s : %s%s %s\n", *v, | 617 | continue; |
639 | avail & 0x1 ? "" : "NotImpl", | 618 | seq_printf(m, "%-48s : %s%s %s\n", *v, |
640 | avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "", | 619 | avail & 0x1 ? "" : "NotImpl", |
641 | avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): ""); | 620 | avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "", |
621 | avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): ""); | ||
642 | } | 622 | } |
643 | return p - page; | 623 | return 0; |
644 | } | 624 | } |
645 | 625 | ||
646 | static int | 626 | static int version_info(struct seq_file *m) |
647 | version_info(char *page) | ||
648 | { | 627 | { |
649 | pal_version_u_t min_ver, cur_ver; | 628 | pal_version_u_t min_ver, cur_ver; |
650 | char *p = page; | ||
651 | 629 | ||
652 | if (ia64_pal_version(&min_ver, &cur_ver) != 0) | 630 | if (ia64_pal_version(&min_ver, &cur_ver) != 0) |
653 | return 0; | 631 | return 0; |
654 | 632 | ||
655 | p += sprintf(p, | 633 | seq_printf(m, |
656 | "PAL_vendor : 0x%02x (min=0x%02x)\n" | 634 | "PAL_vendor : 0x%02x (min=0x%02x)\n" |
657 | "PAL_A : %02x.%02x (min=%02x.%02x)\n" | 635 | "PAL_A : %02x.%02x (min=%02x.%02x)\n" |
658 | "PAL_B : %02x.%02x (min=%02x.%02x)\n", | 636 | "PAL_B : %02x.%02x (min=%02x.%02x)\n", |
659 | cur_ver.pal_version_s.pv_pal_vendor, | 637 | cur_ver.pal_version_s.pv_pal_vendor, |
660 | min_ver.pal_version_s.pv_pal_vendor, | 638 | min_ver.pal_version_s.pv_pal_vendor, |
661 | cur_ver.pal_version_s.pv_pal_a_model, | 639 | cur_ver.pal_version_s.pv_pal_a_model, |
662 | cur_ver.pal_version_s.pv_pal_a_rev, | 640 | cur_ver.pal_version_s.pv_pal_a_rev, |
663 | min_ver.pal_version_s.pv_pal_a_model, | 641 | min_ver.pal_version_s.pv_pal_a_model, |
664 | min_ver.pal_version_s.pv_pal_a_rev, | 642 | min_ver.pal_version_s.pv_pal_a_rev, |
665 | cur_ver.pal_version_s.pv_pal_b_model, | 643 | cur_ver.pal_version_s.pv_pal_b_model, |
666 | cur_ver.pal_version_s.pv_pal_b_rev, | 644 | cur_ver.pal_version_s.pv_pal_b_rev, |
667 | min_ver.pal_version_s.pv_pal_b_model, | 645 | min_ver.pal_version_s.pv_pal_b_model, |
668 | min_ver.pal_version_s.pv_pal_b_rev); | 646 | min_ver.pal_version_s.pv_pal_b_rev); |
669 | return p - page; | 647 | return 0; |
670 | } | 648 | } |
671 | 649 | ||
672 | static int | 650 | static int perfmon_info(struct seq_file *m) |
673 | perfmon_info(char *page) | ||
674 | { | 651 | { |
675 | char *p = page; | ||
676 | u64 pm_buffer[16]; | 652 | u64 pm_buffer[16]; |
677 | pal_perf_mon_info_u_t pm_info; | 653 | pal_perf_mon_info_u_t pm_info; |
678 | 654 | ||
679 | if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) return 0; | 655 | if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) |
680 | 656 | return 0; | |
681 | p += sprintf(p, | ||
682 | "PMC/PMD pairs : %d\n" | ||
683 | "Counter width : %d bits\n" | ||
684 | "Cycle event number : %d\n" | ||
685 | "Retired event number : %d\n" | ||
686 | "Implemented PMC : ", | ||
687 | pm_info.pal_perf_mon_info_s.generic, pm_info.pal_perf_mon_info_s.width, | ||
688 | pm_info.pal_perf_mon_info_s.cycles, pm_info.pal_perf_mon_info_s.retired); | ||
689 | 657 | ||
690 | p = bitregister_process(p, pm_buffer, 256); | 658 | seq_printf(m, |
691 | p += sprintf(p, "\nImplemented PMD : "); | 659 | "PMC/PMD pairs : %d\n" |
692 | p = bitregister_process(p, pm_buffer+4, 256); | 660 | "Counter width : %d bits\n" |
693 | p += sprintf(p, "\nCycles count capable : "); | 661 | "Cycle event number : %d\n" |
694 | p = bitregister_process(p, pm_buffer+8, 256); | 662 | "Retired event number : %d\n" |
695 | p += sprintf(p, "\nRetired bundles count capable : "); | 663 | "Implemented PMC : ", |
664 | pm_info.pal_perf_mon_info_s.generic, | ||
665 | pm_info.pal_perf_mon_info_s.width, | ||
666 | pm_info.pal_perf_mon_info_s.cycles, | ||
667 | pm_info.pal_perf_mon_info_s.retired); | ||
668 | |||
669 | bitregister_process(m, pm_buffer, 256); | ||
670 | seq_puts(m, "\nImplemented PMD : "); | ||
671 | bitregister_process(m, pm_buffer+4, 256); | ||
672 | seq_puts(m, "\nCycles count capable : "); | ||
673 | bitregister_process(m, pm_buffer+8, 256); | ||
674 | seq_puts(m, "\nRetired bundles count capable : "); | ||
696 | 675 | ||
697 | #ifdef CONFIG_ITANIUM | 676 | #ifdef CONFIG_ITANIUM |
698 | /* | 677 | /* |
699 | * PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES | 678 | * PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES |
700 | * which is wrong, both PMC4 and PMD5 support it. | 679 | * which is wrong, both PMC4 and PMD5 support it. |
701 | */ | 680 | */ |
702 | if (pm_buffer[12] == 0x10) pm_buffer[12]=0x30; | 681 | if (pm_buffer[12] == 0x10) |
682 | pm_buffer[12]=0x30; | ||
703 | #endif | 683 | #endif |
704 | 684 | ||
705 | p = bitregister_process(p, pm_buffer+12, 256); | 685 | bitregister_process(m, pm_buffer+12, 256); |
706 | 686 | seq_putc(m, '\n'); | |
707 | p += sprintf(p, "\n"); | 687 | return 0; |
708 | |||
709 | return p - page; | ||
710 | } | 688 | } |
711 | 689 | ||
712 | static int | 690 | static int frequency_info(struct seq_file *m) |
713 | frequency_info(char *page) | ||
714 | { | 691 | { |
715 | char *p = page; | ||
716 | struct pal_freq_ratio proc, itc, bus; | 692 | struct pal_freq_ratio proc, itc, bus; |
717 | unsigned long base; | 693 | unsigned long base; |
718 | 694 | ||
719 | if (ia64_pal_freq_base(&base) == -1) | 695 | if (ia64_pal_freq_base(&base) == -1) |
720 | p += sprintf(p, "Output clock : not implemented\n"); | 696 | seq_puts(m, "Output clock : not implemented\n"); |
721 | else | 697 | else |
722 | p += sprintf(p, "Output clock : %ld ticks/s\n", base); | 698 | seq_printf(m, "Output clock : %ld ticks/s\n", base); |
723 | 699 | ||
724 | if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0; | 700 | if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0; |
725 | 701 | ||
726 | p += sprintf(p, | 702 | seq_printf(m, |
727 | "Processor/Clock ratio : %d/%d\n" | 703 | "Processor/Clock ratio : %d/%d\n" |
728 | "Bus/Clock ratio : %d/%d\n" | 704 | "Bus/Clock ratio : %d/%d\n" |
729 | "ITC/Clock ratio : %d/%d\n", | 705 | "ITC/Clock ratio : %d/%d\n", |
730 | proc.num, proc.den, bus.num, bus.den, itc.num, itc.den); | 706 | proc.num, proc.den, bus.num, bus.den, itc.num, itc.den); |
731 | 707 | return 0; | |
732 | return p - page; | ||
733 | } | 708 | } |
734 | 709 | ||
735 | static int | 710 | static int tr_info(struct seq_file *m) |
736 | tr_info(char *page) | ||
737 | { | 711 | { |
738 | char *p = page; | ||
739 | long status; | 712 | long status; |
740 | pal_tr_valid_u_t tr_valid; | 713 | pal_tr_valid_u_t tr_valid; |
741 | u64 tr_buffer[4]; | 714 | u64 tr_buffer[4]; |
@@ -794,39 +767,40 @@ tr_info(char *page) | |||
794 | 767 | ||
795 | ifa_reg = (struct ifa_reg *)&tr_buffer[2]; | 768 | ifa_reg = (struct ifa_reg *)&tr_buffer[2]; |
796 | 769 | ||
797 | if (ifa_reg->valid == 0) continue; | 770 | if (ifa_reg->valid == 0) |
771 | continue; | ||
798 | 772 | ||
799 | gr_reg = (struct gr_reg *)tr_buffer; | 773 | gr_reg = (struct gr_reg *)tr_buffer; |
800 | itir_reg = (struct itir_reg *)&tr_buffer[1]; | 774 | itir_reg = (struct itir_reg *)&tr_buffer[1]; |
801 | rid_reg = (struct rid_reg *)&tr_buffer[3]; | 775 | rid_reg = (struct rid_reg *)&tr_buffer[3]; |
802 | 776 | ||
803 | pgm = -1 << (itir_reg->ps - 12); | 777 | pgm = -1 << (itir_reg->ps - 12); |
804 | p += sprintf(p, | 778 | seq_printf(m, |
805 | "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n" | 779 | "%cTR%lu: av=%d pv=%d dv=%d mv=%d\n" |
806 | "\tppn : 0x%lx\n" | 780 | "\tppn : 0x%lx\n" |
807 | "\tvpn : 0x%lx\n" | 781 | "\tvpn : 0x%lx\n" |
808 | "\tps : ", | 782 | "\tps : ", |
809 | "ID"[i], j, | 783 | "ID"[i], j, |
810 | tr_valid.pal_tr_valid_s.access_rights_valid, | 784 | tr_valid.pal_tr_valid_s.access_rights_valid, |
811 | tr_valid.pal_tr_valid_s.priv_level_valid, | 785 | tr_valid.pal_tr_valid_s.priv_level_valid, |
812 | tr_valid.pal_tr_valid_s.dirty_bit_valid, | 786 | tr_valid.pal_tr_valid_s.dirty_bit_valid, |
813 | tr_valid.pal_tr_valid_s.mem_attr_valid, | 787 | tr_valid.pal_tr_valid_s.mem_attr_valid, |
814 | (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12); | 788 | (gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12); |
815 | 789 | ||
816 | p = bitvector_process(p, 1<< itir_reg->ps); | 790 | bitvector_process(m, 1<< itir_reg->ps); |
817 | 791 | ||
818 | p += sprintf(p, | 792 | seq_printf(m, |
819 | "\n\tpl : %d\n" | 793 | "\n\tpl : %d\n" |
820 | "\tar : %d\n" | 794 | "\tar : %d\n" |
821 | "\trid : %x\n" | 795 | "\trid : %x\n" |
822 | "\tp : %d\n" | 796 | "\tp : %d\n" |
823 | "\tma : %d\n" | 797 | "\tma : %d\n" |
824 | "\td : %d\n", | 798 | "\td : %d\n", |
825 | gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma, | 799 | gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma, |
826 | gr_reg->d); | 800 | gr_reg->d); |
827 | } | 801 | } |
828 | } | 802 | } |
829 | return p - page; | 803 | return 0; |
830 | } | 804 | } |
831 | 805 | ||
832 | 806 | ||
@@ -834,7 +808,7 @@ tr_info(char *page) | |||
834 | /* | 808 | /* |
835 | * List {name,function} pairs for every entry in /proc/palinfo/cpu* | 809 | * List {name,function} pairs for every entry in /proc/palinfo/cpu* |
836 | */ | 810 | */ |
837 | static palinfo_entry_t palinfo_entries[]={ | 811 | static const palinfo_entry_t palinfo_entries[]={ |
838 | { "version_info", version_info, }, | 812 | { "version_info", version_info, }, |
839 | { "vm_info", vm_info, }, | 813 | { "vm_info", vm_info, }, |
840 | { "cache_info", cache_info, }, | 814 | { "cache_info", cache_info, }, |
@@ -876,7 +850,7 @@ typedef union { | |||
876 | */ | 850 | */ |
877 | typedef struct { | 851 | typedef struct { |
878 | palinfo_func_t func; /* pointer to function to call */ | 852 | palinfo_func_t func; /* pointer to function to call */ |
879 | char *page; /* buffer to store results */ | 853 | struct seq_file *m; /* buffer to store results */ |
880 | int ret; /* return value from call */ | 854 | int ret; /* return value from call */ |
881 | } palinfo_smp_data_t; | 855 | } palinfo_smp_data_t; |
882 | 856 | ||
@@ -889,7 +863,7 @@ static void | |||
889 | palinfo_smp_call(void *info) | 863 | palinfo_smp_call(void *info) |
890 | { | 864 | { |
891 | palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; | 865 | palinfo_smp_data_t *data = (palinfo_smp_data_t *)info; |
892 | data->ret = (*data->func)(data->page); | 866 | data->ret = (*data->func)(data->m); |
893 | } | 867 | } |
894 | 868 | ||
895 | /* | 869 | /* |
@@ -899,13 +873,13 @@ palinfo_smp_call(void *info) | |||
899 | * otherwise how many bytes in the "page" buffer were written | 873 | * otherwise how many bytes in the "page" buffer were written |
900 | */ | 874 | */ |
901 | static | 875 | static |
902 | int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) | 876 | int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f) |
903 | { | 877 | { |
904 | palinfo_smp_data_t ptr; | 878 | palinfo_smp_data_t ptr; |
905 | int ret; | 879 | int ret; |
906 | 880 | ||
907 | ptr.func = palinfo_entries[f->func_id].proc_read; | 881 | ptr.func = palinfo_entries[f->func_id].proc_read; |
908 | ptr.page = page; | 882 | ptr.m = m; |
909 | ptr.ret = 0; /* just in case */ | 883 | ptr.ret = 0; /* just in case */ |
910 | 884 | ||
911 | 885 | ||
@@ -919,7 +893,7 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) | |||
919 | } | 893 | } |
920 | #else /* ! CONFIG_SMP */ | 894 | #else /* ! CONFIG_SMP */ |
921 | static | 895 | static |
922 | int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) | 896 | int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f) |
923 | { | 897 | { |
924 | printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n"); | 898 | printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n"); |
925 | return 0; | 899 | return 0; |
@@ -929,34 +903,35 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page) | |||
929 | /* | 903 | /* |
930 | * Entry point routine: all calls go through this function | 904 | * Entry point routine: all calls go through this function |
931 | */ | 905 | */ |
932 | static int | 906 | static int proc_palinfo_show(struct seq_file *m, void *v) |
933 | palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data) | ||
934 | { | 907 | { |
935 | int len=0; | 908 | pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&m->private; |
936 | pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&data; | ||
937 | 909 | ||
938 | /* | 910 | /* |
939 | * in SMP mode, we may need to call another CPU to get correct | 911 | * in SMP mode, we may need to call another CPU to get correct |
940 | * information. PAL, by definition, is processor specific | 912 | * information. PAL, by definition, is processor specific |
941 | */ | 913 | */ |
942 | if (f->req_cpu == get_cpu()) | 914 | if (f->req_cpu == get_cpu()) |
943 | len = (*palinfo_entries[f->func_id].proc_read)(page); | 915 | (*palinfo_entries[f->func_id].proc_read)(m); |
944 | else | 916 | else |
945 | len = palinfo_handle_smp(f, page); | 917 | palinfo_handle_smp(m, f); |
946 | 918 | ||
947 | put_cpu(); | 919 | put_cpu(); |
920 | return 0; | ||
921 | } | ||
948 | 922 | ||
949 | if (len <= off+count) *eof = 1; | 923 | static int proc_palinfo_open(struct inode *inode, struct file *file) |
950 | 924 | { | |
951 | *start = page + off; | 925 | return single_open(file, proc_palinfo_show, PDE_DATA(inode)); |
952 | len -= off; | ||
953 | |||
954 | if (len>count) len = count; | ||
955 | if (len<0) len = 0; | ||
956 | |||
957 | return len; | ||
958 | } | 926 | } |
959 | 927 | ||
928 | static const struct file_operations proc_palinfo_fops = { | ||
929 | .open = proc_palinfo_open, | ||
930 | .read = seq_read, | ||
931 | .llseek = seq_lseek, | ||
932 | .release = seq_release, | ||
933 | }; | ||
934 | |||
960 | static void __cpuinit | 935 | static void __cpuinit |
961 | create_palinfo_proc_entries(unsigned int cpu) | 936 | create_palinfo_proc_entries(unsigned int cpu) |
962 | { | 937 | { |
@@ -974,9 +949,8 @@ create_palinfo_proc_entries(unsigned int cpu) | |||
974 | 949 | ||
975 | for (j=0; j < NR_PALINFO_ENTRIES; j++) { | 950 | for (j=0; j < NR_PALINFO_ENTRIES; j++) { |
976 | f.func_id = j; | 951 | f.func_id = j; |
977 | create_proc_read_entry( | 952 | proc_create_data(palinfo_entries[j].name, 0, cpu_dir, |
978 | palinfo_entries[j].name, 0, cpu_dir, | 953 | &proc_palinfo_fops, (void *)f.value); |
979 | palinfo_read_entry, (void *)f.value); | ||
980 | } | 954 | } |
981 | } | 955 | } |
982 | 956 | ||
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index aa527d7e91f2..5035245cb258 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/cpu.h> | 40 | #include <linux/cpu.h> |
41 | #include <linux/types.h> | 41 | #include <linux/types.h> |
42 | #include <linux/proc_fs.h> | 42 | #include <linux/proc_fs.h> |
43 | #include <linux/seq_file.h> | ||
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
44 | #include <linux/smp.h> | 45 | #include <linux/smp.h> |
45 | #include <linux/timer.h> | 46 | #include <linux/timer.h> |
@@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>"); | |||
53 | MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); | 54 | MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); |
54 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
55 | 56 | ||
56 | static int salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data); | 57 | static const struct file_operations proc_salinfo_fops; |
57 | 58 | ||
58 | typedef struct { | 59 | typedef struct { |
59 | const char *name; /* name of the proc entry */ | 60 | const char *name; /* name of the proc entry */ |
@@ -65,7 +66,7 @@ typedef struct { | |||
65 | * List {name,feature} pairs for every entry in /proc/sal/<feature> | 66 | * List {name,feature} pairs for every entry in /proc/sal/<feature> |
66 | * that this module exports | 67 | * that this module exports |
67 | */ | 68 | */ |
68 | static salinfo_entry_t salinfo_entries[]={ | 69 | static const salinfo_entry_t salinfo_entries[]={ |
69 | { "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, }, | 70 | { "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, }, |
70 | { "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, }, | 71 | { "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, }, |
71 | { "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, }, | 72 | { "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, }, |
@@ -301,9 +302,7 @@ salinfo_event_open(struct inode *inode, struct file *file) | |||
301 | static ssize_t | 302 | static ssize_t |
302 | salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 303 | salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
303 | { | 304 | { |
304 | struct inode *inode = file_inode(file); | 305 | struct salinfo_data *data = PDE_DATA(file_inode(file)); |
305 | struct proc_dir_entry *entry = PDE(inode); | ||
306 | struct salinfo_data *data = entry->data; | ||
307 | char cmd[32]; | 306 | char cmd[32]; |
308 | size_t size; | 307 | size_t size; |
309 | int i, n, cpu = -1; | 308 | int i, n, cpu = -1; |
@@ -360,8 +359,7 @@ static const struct file_operations salinfo_event_fops = { | |||
360 | static int | 359 | static int |
361 | salinfo_log_open(struct inode *inode, struct file *file) | 360 | salinfo_log_open(struct inode *inode, struct file *file) |
362 | { | 361 | { |
363 | struct proc_dir_entry *entry = PDE(inode); | 362 | struct salinfo_data *data = PDE_DATA(inode); |
364 | struct salinfo_data *data = entry->data; | ||
365 | 363 | ||
366 | if (!capable(CAP_SYS_ADMIN)) | 364 | if (!capable(CAP_SYS_ADMIN)) |
367 | return -EPERM; | 365 | return -EPERM; |
@@ -386,8 +384,7 @@ salinfo_log_open(struct inode *inode, struct file *file) | |||
386 | static int | 384 | static int |
387 | salinfo_log_release(struct inode *inode, struct file *file) | 385 | salinfo_log_release(struct inode *inode, struct file *file) |
388 | { | 386 | { |
389 | struct proc_dir_entry *entry = PDE(inode); | 387 | struct salinfo_data *data = PDE_DATA(inode); |
390 | struct salinfo_data *data = entry->data; | ||
391 | 388 | ||
392 | if (data->state == STATE_NO_DATA) { | 389 | if (data->state == STATE_NO_DATA) { |
393 | vfree(data->log_buffer); | 390 | vfree(data->log_buffer); |
@@ -463,9 +460,7 @@ retry: | |||
463 | static ssize_t | 460 | static ssize_t |
464 | salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 461 | salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
465 | { | 462 | { |
466 | struct inode *inode = file_inode(file); | 463 | struct salinfo_data *data = PDE_DATA(file_inode(file)); |
467 | struct proc_dir_entry *entry = PDE(inode); | ||
468 | struct salinfo_data *data = entry->data; | ||
469 | u8 *buf; | 464 | u8 *buf; |
470 | u64 bufsize; | 465 | u64 bufsize; |
471 | 466 | ||
@@ -524,9 +519,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu) | |||
524 | static ssize_t | 519 | static ssize_t |
525 | salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 520 | salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
526 | { | 521 | { |
527 | struct inode *inode = file_inode(file); | 522 | struct salinfo_data *data = PDE_DATA(file_inode(file)); |
528 | struct proc_dir_entry *entry = PDE(inode); | ||
529 | struct salinfo_data *data = entry->data; | ||
530 | char cmd[32]; | 523 | char cmd[32]; |
531 | size_t size; | 524 | size_t size; |
532 | u32 offset; | 525 | u32 offset; |
@@ -637,8 +630,9 @@ salinfo_init(void) | |||
637 | 630 | ||
638 | for (i=0; i < NR_SALINFO_ENTRIES; i++) { | 631 | for (i=0; i < NR_SALINFO_ENTRIES; i++) { |
639 | /* pass the feature bit in question as misc data */ | 632 | /* pass the feature bit in question as misc data */ |
640 | *sdir++ = create_proc_read_entry (salinfo_entries[i].name, 0, salinfo_dir, | 633 | *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir, |
641 | salinfo_read, (void *)salinfo_entries[i].feature); | 634 | &proc_salinfo_fops, |
635 | (void *)salinfo_entries[i].feature); | ||
642 | } | 636 | } |
643 | 637 | ||
644 | for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { | 638 | for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { |
@@ -684,22 +678,23 @@ salinfo_init(void) | |||
684 | * 'data' contains an integer that corresponds to the feature we're | 678 | * 'data' contains an integer that corresponds to the feature we're |
685 | * testing | 679 | * testing |
686 | */ | 680 | */ |
687 | static int | 681 | static int proc_salinfo_show(struct seq_file *m, void *v) |
688 | salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data) | ||
689 | { | 682 | { |
690 | int len = 0; | 683 | unsigned long data = (unsigned long)v; |
691 | 684 | seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n"); | |
692 | len = sprintf(page, (sal_platform_features & (unsigned long)data) ? "1\n" : "0\n"); | 685 | return 0; |
693 | 686 | } | |
694 | if (len <= off+count) *eof = 1; | ||
695 | |||
696 | *start = page + off; | ||
697 | len -= off; | ||
698 | |||
699 | if (len>count) len = count; | ||
700 | if (len<0) len = 0; | ||
701 | 687 | ||
702 | return len; | 688 | static int proc_salinfo_open(struct inode *inode, struct file *file) |
689 | { | ||
690 | return single_open(file, proc_salinfo_show, PDE_DATA(inode)); | ||
703 | } | 691 | } |
704 | 692 | ||
693 | static const struct file_operations proc_salinfo_fops = { | ||
694 | .open = proc_salinfo_open, | ||
695 | .read = seq_read, | ||
696 | .llseek = seq_lseek, | ||
697 | .release = seq_release, | ||
698 | }; | ||
699 | |||
705 | module_init(salinfo_init); | 700 | module_init(salinfo_init); |
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c index 20b88cb1881a..daa8d6badb16 100644 --- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c +++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/seq_file.h> | ||
14 | #include <linux/nodemask.h> | 15 | #include <linux/nodemask.h> |
15 | #include <asm/io.h> | 16 | #include <asm/io.h> |
16 | #include <asm/sn/sn_sal.h> | 17 | #include <asm/sn/sn_sal.h> |
@@ -101,18 +102,18 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry, | |||
101 | /* | 102 | /* |
102 | * These two routines display the FIT table for each node. | 103 | * These two routines display the FIT table for each node. |
103 | */ | 104 | */ |
104 | static int dump_fit_entry(char *page, unsigned long *fentry) | 105 | static void dump_fit_entry(struct seq_file *m, unsigned long *fentry) |
105 | { | 106 | { |
106 | unsigned type; | 107 | unsigned type; |
107 | 108 | ||
108 | type = FIT_TYPE(fentry[1]); | 109 | type = FIT_TYPE(fentry[1]); |
109 | return sprintf(page, "%02x %-25s %x.%02x %016lx %u\n", | 110 | seq_printf(m, "%02x %-25s %x.%02x %016lx %u\n", |
110 | type, | 111 | type, |
111 | fit_type_name(type), | 112 | fit_type_name(type), |
112 | FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]), | 113 | FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]), |
113 | fentry[0], | 114 | fentry[0], |
114 | /* mult by sixteen to get size in bytes */ | 115 | /* mult by sixteen to get size in bytes */ |
115 | (unsigned)(fentry[1] & 0xffffff) * 16); | 116 | (unsigned)(fentry[1] & 0xffffff) * 16); |
116 | } | 117 | } |
117 | 118 | ||
118 | 119 | ||
@@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry) | |||
124 | * OK except for 4kB pages (and no one is going to do that on SN | 125 | * OK except for 4kB pages (and no one is going to do that on SN |
125 | * anyway). | 126 | * anyway). |
126 | */ | 127 | */ |
127 | static int | 128 | static int proc_fit_show(struct seq_file *m, void *v) |
128 | dump_fit(char *page, unsigned long nasid) | ||
129 | { | 129 | { |
130 | unsigned long nasid = (unsigned long)m->private; | ||
130 | unsigned long fentry[2]; | 131 | unsigned long fentry[2]; |
131 | int index; | 132 | int index; |
132 | char *p; | ||
133 | 133 | ||
134 | p = page; | ||
135 | for (index=0;;index++) { | 134 | for (index=0;;index++) { |
136 | BUG_ON(index * 60 > PAGE_SIZE); | 135 | BUG_ON(index * 60 > PAGE_SIZE); |
137 | if (get_fit_entry(nasid, index, fentry, NULL, 0)) | 136 | if (get_fit_entry(nasid, index, fentry, NULL, 0)) |
138 | break; | 137 | break; |
139 | p += dump_fit_entry(p, fentry); | 138 | dump_fit_entry(m, fentry); |
140 | } | 139 | } |
140 | return 0; | ||
141 | } | ||
141 | 142 | ||
142 | return p - page; | 143 | static int proc_fit_open(struct inode *inode, struct file *file) |
144 | { | ||
145 | return single_open(file, proc_fit_show, PDE_DATA(inode)); | ||
143 | } | 146 | } |
144 | 147 | ||
145 | static int | 148 | static const struct file_operations proc_fit_fops = { |
146 | dump_version(char *page, unsigned long nasid) | 149 | .open = proc_fit_open, |
150 | .read = seq_read, | ||
151 | .llseek = seq_lseek, | ||
152 | .release = seq_release, | ||
153 | }; | ||
154 | |||
155 | static int proc_version_show(struct seq_file *m, void *v) | ||
147 | { | 156 | { |
157 | unsigned long nasid = (unsigned long)m->private; | ||
148 | unsigned long fentry[2]; | 158 | unsigned long fentry[2]; |
149 | char banner[128]; | 159 | char banner[128]; |
150 | int index; | 160 | int index; |
151 | int len; | ||
152 | 161 | ||
153 | for (index = 0; ; index++) { | 162 | for (index = 0; ; index++) { |
154 | if (get_fit_entry(nasid, index, fentry, banner, | 163 | if (get_fit_entry(nasid, index, fentry, banner, |
@@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid) | |||
158 | break; | 167 | break; |
159 | } | 168 | } |
160 | 169 | ||
161 | len = sprintf(page, "%x.%02x\n", FIT_MAJOR(fentry[1]), | 170 | seq_printf(m, "%x.%02x\n", FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1])); |
162 | FIT_MINOR(fentry[1])); | ||
163 | page += len; | ||
164 | 171 | ||
165 | if (banner[0]) | 172 | if (banner[0]) |
166 | len += snprintf(page, PAGE_SIZE-len, "%s\n", banner); | 173 | seq_printf(m, "%s\n", banner); |
167 | 174 | return 0; | |
168 | return len; | ||
169 | } | ||
170 | |||
171 | /* same as in proc_misc.c */ | ||
172 | static int | ||
173 | proc_calc_metrics(char *page, char **start, off_t off, int count, int *eof, | ||
174 | int len) | ||
175 | { | ||
176 | if (len <= off + count) | ||
177 | *eof = 1; | ||
178 | *start = page + off; | ||
179 | len -= off; | ||
180 | if (len > count) | ||
181 | len = count; | ||
182 | if (len < 0) | ||
183 | len = 0; | ||
184 | return len; | ||
185 | } | 175 | } |
186 | 176 | ||
187 | static int | 177 | static int proc_version_open(struct inode *inode, struct file *file) |
188 | read_version_entry(char *page, char **start, off_t off, int count, int *eof, | ||
189 | void *data) | ||
190 | { | 178 | { |
191 | int len; | 179 | return single_open(file, proc_version_show, PDE_DATA(inode)); |
192 | |||
193 | /* data holds the NASID of the node */ | ||
194 | len = dump_version(page, (unsigned long)data); | ||
195 | len = proc_calc_metrics(page, start, off, count, eof, len); | ||
196 | return len; | ||
197 | } | 180 | } |
198 | 181 | ||
199 | static int | 182 | static const struct file_operations proc_version_fops = { |
200 | read_fit_entry(char *page, char **start, off_t off, int count, int *eof, | 183 | .open = proc_version_open, |
201 | void *data) | 184 | .read = seq_read, |
202 | { | 185 | .llseek = seq_lseek, |
203 | int len; | 186 | .release = seq_release, |
204 | 187 | }; | |
205 | /* data holds the NASID of the node */ | ||
206 | len = dump_fit(page, (unsigned long)data); | ||
207 | len = proc_calc_metrics(page, start, off, count, eof, len); | ||
208 | |||
209 | return len; | ||
210 | } | ||
211 | 188 | ||
212 | /* module entry points */ | 189 | /* module entry points */ |
213 | int __init prominfo_init(void); | 190 | int __init prominfo_init(void); |
@@ -216,58 +193,39 @@ void __exit prominfo_exit(void); | |||
216 | module_init(prominfo_init); | 193 | module_init(prominfo_init); |
217 | module_exit(prominfo_exit); | 194 | module_exit(prominfo_exit); |
218 | 195 | ||
219 | static struct proc_dir_entry **proc_entries; | ||
220 | static struct proc_dir_entry *sgi_prominfo_entry; | ||
221 | |||
222 | #define NODE_NAME_LEN 11 | 196 | #define NODE_NAME_LEN 11 |
223 | 197 | ||
224 | int __init prominfo_init(void) | 198 | int __init prominfo_init(void) |
225 | { | 199 | { |
226 | struct proc_dir_entry **entp; | 200 | struct proc_dir_entry *sgi_prominfo_entry; |
227 | cnodeid_t cnodeid; | 201 | cnodeid_t cnodeid; |
228 | unsigned long nasid; | ||
229 | int size; | ||
230 | char name[NODE_NAME_LEN]; | ||
231 | 202 | ||
232 | if (!ia64_platform_is("sn2")) | 203 | if (!ia64_platform_is("sn2")) |
233 | return 0; | 204 | return 0; |
234 | 205 | ||
235 | size = num_online_nodes() * sizeof(struct proc_dir_entry *); | ||
236 | proc_entries = kzalloc(size, GFP_KERNEL); | ||
237 | if (!proc_entries) | ||
238 | return -ENOMEM; | ||
239 | |||
240 | sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL); | 206 | sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL); |
207 | if (!sgi_prominfo_entry) | ||
208 | return -ENOMEM; | ||
241 | 209 | ||
242 | entp = proc_entries; | ||
243 | for_each_online_node(cnodeid) { | 210 | for_each_online_node(cnodeid) { |
211 | struct proc_dir_entry *dir; | ||
212 | unsigned long nasid; | ||
213 | char name[NODE_NAME_LEN]; | ||
214 | |||
244 | sprintf(name, "node%d", cnodeid); | 215 | sprintf(name, "node%d", cnodeid); |
245 | *entp = proc_mkdir(name, sgi_prominfo_entry); | 216 | dir = proc_mkdir(name, sgi_prominfo_entry); |
217 | if (!dir) | ||
218 | continue; | ||
246 | nasid = cnodeid_to_nasid(cnodeid); | 219 | nasid = cnodeid_to_nasid(cnodeid); |
247 | create_proc_read_entry("fit", 0, *entp, read_fit_entry, | 220 | proc_create_data("fit", 0, dir, |
248 | (void *)nasid); | 221 | &proc_fit_fops, (void *)nasid); |
249 | create_proc_read_entry("version", 0, *entp, | 222 | proc_create_data("version", 0, dir, |
250 | read_version_entry, (void *)nasid); | 223 | &proc_version_fops, (void *)nasid); |
251 | entp++; | ||
252 | } | 224 | } |
253 | |||
254 | return 0; | 225 | return 0; |
255 | } | 226 | } |
256 | 227 | ||
257 | void __exit prominfo_exit(void) | 228 | void __exit prominfo_exit(void) |
258 | { | 229 | { |
259 | struct proc_dir_entry **entp; | 230 | remove_proc_subtree("sgi_prominfo", NULL); |
260 | unsigned int cnodeid; | ||
261 | char name[NODE_NAME_LEN]; | ||
262 | |||
263 | entp = proc_entries; | ||
264 | for_each_online_node(cnodeid) { | ||
265 | remove_proc_entry("fit", *entp); | ||
266 | remove_proc_entry("version", *entp); | ||
267 | sprintf(name, "node%d", cnodeid); | ||
268 | remove_proc_entry(name, sgi_prominfo_entry); | ||
269 | entp++; | ||
270 | } | ||
271 | remove_proc_entry("sgi_prominfo", NULL); | ||
272 | kfree(proc_entries); | ||
273 | } | 231 | } |
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c index aee7c8177b5d..9fb714450e95 100644 --- a/arch/mips/kernel/smtc-proc.c +++ b/arch/mips/kernel/smtc-proc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/mipsregs.h> | 16 | #include <asm/mipsregs.h> |
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
19 | #include <linux/seq_file.h> | ||
19 | 20 | ||
20 | #include <asm/smtc_proc.h> | 21 | #include <asm/smtc_proc.h> |
21 | 22 | ||
@@ -30,51 +31,39 @@ unsigned long selfipis[NR_CPUS]; | |||
30 | 31 | ||
31 | struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; | 32 | struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; |
32 | 33 | ||
33 | static struct proc_dir_entry *smtc_stats; | ||
34 | |||
35 | atomic_t smtc_fpu_recoveries; | 34 | atomic_t smtc_fpu_recoveries; |
36 | 35 | ||
37 | static int proc_read_smtc(char *page, char **start, off_t off, | 36 | static int smtc_proc_show(struct seq_file *m, void *v) |
38 | int count, int *eof, void *data) | ||
39 | { | 37 | { |
40 | int totalen = 0; | ||
41 | int len; | ||
42 | int i; | 38 | int i; |
43 | extern unsigned long ebase; | 39 | extern unsigned long ebase; |
44 | 40 | ||
45 | len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status); | 41 | seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status); |
46 | totalen += len; | 42 | seq_printf(m, "Config7: 0x%08x\n", read_c0_config7()); |
47 | page += len; | 43 | seq_printf(m, "EBASE: 0x%08lx\n", ebase); |
48 | len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7()); | 44 | seq_printf(m, "Counter Interrupts taken per CPU (TC)\n"); |
49 | totalen += len; | 45 | for (i=0; i < NR_CPUS; i++) |
50 | page += len; | 46 | seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); |
51 | len = sprintf(page, "EBASE: 0x%08lx\n", ebase); | 47 | seq_printf(m, "Self-IPIs by CPU:\n"); |
52 | totalen += len; | 48 | for(i = 0; i < NR_CPUS; i++) |
53 | page += len; | 49 | seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); |
54 | len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n"); | 50 | seq_printf(m, "%d Recoveries of \"stolen\" FPU\n", |
55 | totalen += len; | 51 | atomic_read(&smtc_fpu_recoveries)); |
56 | page += len; | 52 | return 0; |
57 | for (i=0; i < NR_CPUS; i++) { | 53 | } |
58 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints); | ||
59 | totalen += len; | ||
60 | page += len; | ||
61 | } | ||
62 | len = sprintf(page, "Self-IPIs by CPU:\n"); | ||
63 | totalen += len; | ||
64 | page += len; | ||
65 | for(i = 0; i < NR_CPUS; i++) { | ||
66 | len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis); | ||
67 | totalen += len; | ||
68 | page += len; | ||
69 | } | ||
70 | len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n", | ||
71 | atomic_read(&smtc_fpu_recoveries)); | ||
72 | totalen += len; | ||
73 | page += len; | ||
74 | 54 | ||
75 | return totalen; | 55 | static int smtc_proc_open(struct inode *inode, struct file *file) |
56 | { | ||
57 | return single_open(file, smtc_proc_show, NULL); | ||
76 | } | 58 | } |
77 | 59 | ||
60 | static const struct file_operations smtc_proc_fops = { | ||
61 | .open = smtc_proc_open, | ||
62 | .read = seq_read, | ||
63 | .llseek = seq_lseek, | ||
64 | .release = seq_release, | ||
65 | }; | ||
66 | |||
78 | void init_smtc_stats(void) | 67 | void init_smtc_stats(void) |
79 | { | 68 | { |
80 | int i; | 69 | int i; |
@@ -86,6 +75,5 @@ void init_smtc_stats(void) | |||
86 | 75 | ||
87 | atomic_set(&smtc_fpu_recoveries, 0); | 76 | atomic_set(&smtc_fpu_recoveries, 0); |
88 | 77 | ||
89 | smtc_stats = create_proc_read_entry("smtc", 0444, NULL, | 78 | proc_create("smtc", 0444, NULL, &smtc_proc_fops); |
90 | proc_read_smtc, NULL); | ||
91 | } | 79 | } |
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c index c592bc8b8c99..638c5db122c9 100644 --- a/arch/mips/lasat/picvue_proc.c +++ b/arch/mips/lasat/picvue_proc.c | |||
@@ -58,13 +58,13 @@ static int pvc_line_proc_show(struct seq_file *m, void *v) | |||
58 | 58 | ||
59 | static int pvc_line_proc_open(struct inode *inode, struct file *file) | 59 | static int pvc_line_proc_open(struct inode *inode, struct file *file) |
60 | { | 60 | { |
61 | return single_open(file, pvc_line_proc_show, PDE(inode)->data); | 61 | return single_open(file, pvc_line_proc_show, PDE_DATA(inode)); |
62 | } | 62 | } |
63 | 63 | ||
64 | static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, | 64 | static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf, |
65 | size_t count, loff_t *pos) | 65 | size_t count, loff_t *pos) |
66 | { | 66 | { |
67 | int lineno = *(int *)PDE(file_inode(file))->data; | 67 | int lineno = *(int *)PDE_DATA(file_inode(file)); |
68 | char kbuf[PVC_LINELEN]; | 68 | char kbuf[PVC_LINELEN]; |
69 | size_t len; | 69 | size_t len; |
70 | 70 | ||
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 3d0346dbccf4..9b973e0af9cb 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pfn.h> | 29 | #include <linux/pfn.h> |
30 | #include <linux/hardirq.h> | 30 | #include <linux/hardirq.h> |
31 | #include <linux/gfp.h> | 31 | #include <linux/gfp.h> |
32 | #include <linux/kcore.h> | ||
32 | 33 | ||
33 | #include <asm/asm-offsets.h> | 34 | #include <asm/asm-offsets.h> |
34 | #include <asm/bootinfo.h> | 35 | #include <asm/bootinfo.h> |
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c index d0b6f8399b07..4eaab6327369 100644 --- a/arch/mips/pci/ops-pmcmsp.c +++ b/arch/mips/pci/ops-pmcmsp.c | |||
@@ -53,56 +53,51 @@ static void pci_proc_init(void); | |||
53 | 53 | ||
54 | /***************************************************************************** | 54 | /***************************************************************************** |
55 | * | 55 | * |
56 | * FUNCTION: read_msp_pci_counts | 56 | * FUNCTION: show_msp_pci_counts |
57 | * _________________________________________________________________________ | 57 | * _________________________________________________________________________ |
58 | * | 58 | * |
59 | * DESCRIPTION: Prints the count of how many times each PCI | 59 | * DESCRIPTION: Prints the count of how many times each PCI |
60 | * interrupt has asserted. Can be invoked by the | 60 | * interrupt has asserted. Can be invoked by the |
61 | * /proc filesystem. | 61 | * /proc filesystem. |
62 | * | 62 | * |
63 | * INPUTS: page - part of STDOUT calculation | 63 | * INPUTS: m - synthetic file construction data |
64 | * off - part of STDOUT calculation | 64 | * v - iterator |
65 | * count - part of STDOUT calculation | ||
66 | * data - unused | ||
67 | * | 65 | * |
68 | * OUTPUTS: start - new start location | 66 | * RETURNS: 0 or error |
69 | * eof - end of file pointer | ||
70 | * | ||
71 | * RETURNS: len - STDOUT length | ||
72 | * | 67 | * |
73 | ****************************************************************************/ | 68 | ****************************************************************************/ |
74 | static int read_msp_pci_counts(char *page, char **start, off_t off, | 69 | static int show_msp_pci_counts(struct seq_file *m, void *v) |
75 | int count, int *eof, void *data) | ||
76 | { | 70 | { |
77 | int i; | 71 | int i; |
78 | int len = 0; | ||
79 | unsigned int intcount, total = 0; | 72 | unsigned int intcount, total = 0; |
80 | 73 | ||
81 | for (i = 0; i < 32; ++i) { | 74 | for (i = 0; i < 32; ++i) { |
82 | intcount = pci_int_count[i]; | 75 | intcount = pci_int_count[i]; |
83 | if (intcount != 0) { | 76 | if (intcount != 0) { |
84 | len += sprintf(page + len, "[%d] = %u\n", i, intcount); | 77 | seq_printf(m, "[%d] = %u\n", i, intcount); |
85 | total += intcount; | 78 | total += intcount; |
86 | } | 79 | } |
87 | } | 80 | } |
88 | 81 | ||
89 | len += sprintf(page + len, "total = %u\n", total); | 82 | seq_printf(m, "total = %u\n", total); |
90 | if (len <= off+count) | 83 | return 0; |
91 | *eof = 1; | 84 | } |
92 | |||
93 | *start = page + off; | ||
94 | len -= off; | ||
95 | if (len > count) | ||
96 | len = count; | ||
97 | if (len < 0) | ||
98 | len = 0; | ||
99 | 85 | ||
100 | return len; | 86 | static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file) |
87 | { | ||
88 | return single_open(file, show_msp_pci_counts, NULL); | ||
101 | } | 89 | } |
102 | 90 | ||
91 | static const struct file_operations msp_pci_rd_cnt_fops = { | ||
92 | .open = msp_pci_rd_cnt_open, | ||
93 | .read = seq_read, | ||
94 | .llseek = seq_lseek, | ||
95 | .release = seq_release, | ||
96 | }; | ||
97 | |||
103 | /***************************************************************************** | 98 | /***************************************************************************** |
104 | * | 99 | * |
105 | * FUNCTION: gen_pci_cfg_wr | 100 | * FUNCTION: gen_pci_cfg_wr_show |
106 | * _________________________________________________________________________ | 101 | * _________________________________________________________________________ |
107 | * | 102 | * |
108 | * DESCRIPTION: Generates a configuration write cycle for debug purposes. | 103 | * DESCRIPTION: Generates a configuration write cycle for debug purposes. |
@@ -112,37 +107,30 @@ static int read_msp_pci_counts(char *page, char **start, off_t off, | |||
112 | * PCI bus. Intent is that this function by invocable from | 107 | * PCI bus. Intent is that this function by invocable from |
113 | * the /proc filesystem. | 108 | * the /proc filesystem. |
114 | * | 109 | * |
115 | * INPUTS: page - part of STDOUT calculation | 110 | * INPUTS: m - synthetic file construction data |
116 | * off - part of STDOUT calculation | 111 | * v - iterator |
117 | * count - part of STDOUT calculation | ||
118 | * data - unused | ||
119 | * | 112 | * |
120 | * OUTPUTS: start - new start location | 113 | * RETURNS: 0 or error |
121 | * eof - end of file pointer | ||
122 | * | ||
123 | * RETURNS: len - STDOUT length | ||
124 | * | 114 | * |
125 | ****************************************************************************/ | 115 | ****************************************************************************/ |
126 | static int gen_pci_cfg_wr(char *page, char **start, off_t off, | 116 | static int gen_pci_cfg_wr_show(struct seq_file *m, void *v) |
127 | int count, int *eof, void *data) | ||
128 | { | 117 | { |
129 | unsigned char where = 0; /* Write to static Device/Vendor ID */ | 118 | unsigned char where = 0; /* Write to static Device/Vendor ID */ |
130 | unsigned char bus_num = 0; /* Bus 0 */ | 119 | unsigned char bus_num = 0; /* Bus 0 */ |
131 | unsigned char dev_fn = 0xF; /* Arbitrary device number */ | 120 | unsigned char dev_fn = 0xF; /* Arbitrary device number */ |
132 | u32 wr_data = 0xFF00AA00; /* Arbitrary data */ | 121 | u32 wr_data = 0xFF00AA00; /* Arbitrary data */ |
133 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; | 122 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; |
134 | int len = 0; | ||
135 | unsigned long value; | 123 | unsigned long value; |
136 | int intr; | 124 | int intr; |
137 | 125 | ||
138 | len += sprintf(page + len, "PMC MSP PCI: Beginning\n"); | 126 | seq_puts(m, "PMC MSP PCI: Beginning\n"); |
139 | 127 | ||
140 | if (proc_init == 0) { | 128 | if (proc_init == 0) { |
141 | pci_proc_init(); | 129 | pci_proc_init(); |
142 | proc_init = ~0; | 130 | proc_init = ~0; |
143 | } | 131 | } |
144 | 132 | ||
145 | len += sprintf(page + len, "PMC MSP PCI: Before Cfg Wr\n"); | 133 | seq_puts(m, "PMC MSP PCI: Before Cfg Wr\n"); |
146 | 134 | ||
147 | /* | 135 | /* |
148 | * Generate PCI Configuration Write Cycle | 136 | * Generate PCI Configuration Write Cycle |
@@ -168,21 +156,22 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off, | |||
168 | */ | 156 | */ |
169 | intr = preg->if_status; | 157 | intr = preg->if_status; |
170 | 158 | ||
171 | len += sprintf(page + len, "PMC MSP PCI: After Cfg Wr\n"); | 159 | seq_puts(m, "PMC MSP PCI: After Cfg Wr\n"); |
172 | 160 | return 0; | |
173 | /* Handle STDOUT calculations */ | 161 | } |
174 | if (len <= off+count) | ||
175 | *eof = 1; | ||
176 | *start = page + off; | ||
177 | len -= off; | ||
178 | if (len > count) | ||
179 | len = count; | ||
180 | if (len < 0) | ||
181 | len = 0; | ||
182 | 162 | ||
183 | return len; | 163 | static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file) |
164 | { | ||
165 | return single_open(file, gen_pci_cfg_wr_show, NULL); | ||
184 | } | 166 | } |
185 | 167 | ||
168 | static const struct file_operations gen_pci_cfg_wr_fops = { | ||
169 | .open = gen_pci_cfg_wr_open, | ||
170 | .read = seq_read, | ||
171 | .llseek = seq_lseek, | ||
172 | .release = seq_release, | ||
173 | }; | ||
174 | |||
186 | /***************************************************************************** | 175 | /***************************************************************************** |
187 | * | 176 | * |
188 | * FUNCTION: pci_proc_init | 177 | * FUNCTION: pci_proc_init |
@@ -199,10 +188,8 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off, | |||
199 | ****************************************************************************/ | 188 | ****************************************************************************/ |
200 | static void pci_proc_init(void) | 189 | static void pci_proc_init(void) |
201 | { | 190 | { |
202 | create_proc_read_entry("pmc_msp_pci_rd_cnt", 0, NULL, | 191 | proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops); |
203 | read_msp_pci_counts, NULL); | 192 | proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops); |
204 | create_proc_read_entry("pmc_msp_pci_cfg_wr", 0, NULL, | ||
205 | gen_pci_cfg_wr, NULL); | ||
206 | } | 193 | } |
207 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ | 194 | #endif /* CONFIG_PROC_FS && PCI_COUNTERS */ |
208 | 195 | ||
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c index e651105b3f0b..cb1e3cb37d70 100644 --- a/arch/mips/sibyte/sb1250/bus_watcher.c +++ b/arch/mips/sibyte/sb1250/bus_watcher.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/proc_fs.h> | 32 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | ||
33 | #include <asm/io.h> | 34 | #include <asm/io.h> |
34 | 35 | ||
35 | #include <asm/sibyte/sb1250.h> | 36 | #include <asm/sibyte/sb1250.h> |
@@ -99,63 +100,60 @@ void check_bus_watcher(void) | |||
99 | printk("Bus watcher indicates no error\n"); | 100 | printk("Bus watcher indicates no error\n"); |
100 | } | 101 | } |
101 | 102 | ||
102 | static int bw_print_buffer(char *page, struct bw_stats_struct *stats) | 103 | #ifdef CONFIG_PROC_FS |
104 | |||
105 | /* For simplicity, I want to assume a single read is required each | ||
106 | time */ | ||
107 | static int bw_proc_show(struct seq_file *m, void *v) | ||
103 | { | 108 | { |
104 | int len; | 109 | struct bw_stats_struct *stats = m->private; |
105 | 110 | ||
106 | len = sprintf(page, "SiByte Bus Watcher statistics\n"); | 111 | seq_puts(m, "SiByte Bus Watcher statistics\n"); |
107 | len += sprintf(page+len, "-----------------------------\n"); | 112 | seq_puts(m, "-----------------------------\n"); |
108 | len += sprintf(page+len, "L2-d-cor %8ld\nL2-d-bad %8ld\n", | 113 | seq_printf(m, "L2-d-cor %8ld\nL2-d-bad %8ld\n", |
109 | stats->l2_cor_d, stats->l2_bad_d); | 114 | stats->l2_cor_d, stats->l2_bad_d); |
110 | len += sprintf(page+len, "L2-t-cor %8ld\nL2-t-bad %8ld\n", | 115 | seq_printf(m, "L2-t-cor %8ld\nL2-t-bad %8ld\n", |
111 | stats->l2_cor_t, stats->l2_bad_t); | 116 | stats->l2_cor_t, stats->l2_bad_t); |
112 | len += sprintf(page+len, "MC-d-cor %8ld\nMC-d-bad %8ld\n", | 117 | seq_printf(m, "MC-d-cor %8ld\nMC-d-bad %8ld\n", |
113 | stats->mem_cor_d, stats->mem_bad_d); | 118 | stats->mem_cor_d, stats->mem_bad_d); |
114 | len += sprintf(page+len, "IO-err %8ld\n", stats->bus_error); | 119 | seq_printf(m, "IO-err %8ld\n", stats->bus_error); |
115 | len += sprintf(page+len, "\nLast recorded signature:\n"); | 120 | seq_puts(m, "\nLast recorded signature:\n"); |
116 | len += sprintf(page+len, "Request %02x from %d, answered by %d with Dcode %d\n", | 121 | seq_printf(m, "Request %02x from %d, answered by %d with Dcode %d\n", |
117 | (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f), | 122 | (unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f), |
118 | (int)(G_SCD_BERR_TID(stats->status) >> 6), | 123 | (int)(G_SCD_BERR_TID(stats->status) >> 6), |
119 | (int)G_SCD_BERR_RID(stats->status), | 124 | (int)G_SCD_BERR_RID(stats->status), |
120 | (int)G_SCD_BERR_DCODE(stats->status)); | 125 | (int)G_SCD_BERR_DCODE(stats->status)); |
121 | /* XXXKW indicate multiple errors between printings, or stats | 126 | /* XXXKW indicate multiple errors between printings, or stats |
122 | collection (or both)? */ | 127 | collection (or both)? */ |
123 | if (stats->status & M_SCD_BERR_MULTERRS) | 128 | if (stats->status & M_SCD_BERR_MULTERRS) |
124 | len += sprintf(page+len, "Multiple errors observed since last check.\n"); | 129 | seq_puts(m, "Multiple errors observed since last check.\n"); |
125 | if (stats->status_printed) { | 130 | if (stats->status_printed) { |
126 | len += sprintf(page+len, "(no change since last printing)\n"); | 131 | seq_puts(m, "(no change since last printing)\n"); |
127 | } else { | 132 | } else { |
128 | stats->status_printed = 1; | 133 | stats->status_printed = 1; |
129 | } | 134 | } |
130 | 135 | ||
131 | return len; | 136 | return 0; |
132 | } | 137 | } |
133 | 138 | ||
134 | #ifdef CONFIG_PROC_FS | 139 | static int bw_proc_open(struct inode *inode, struct file *file) |
135 | |||
136 | /* For simplicity, I want to assume a single read is required each | ||
137 | time */ | ||
138 | static int bw_read_proc(char *page, char **start, off_t off, | ||
139 | int count, int *eof, void *data) | ||
140 | { | 140 | { |
141 | int len; | 141 | return single_open(file, bw_proc_show, PDE_DATA(inode)); |
142 | |||
143 | if (off == 0) { | ||
144 | len = bw_print_buffer(page, data); | ||
145 | *start = page; | ||
146 | } else { | ||
147 | len = 0; | ||
148 | *eof = 1; | ||
149 | } | ||
150 | return len; | ||
151 | } | 142 | } |
152 | 143 | ||
144 | static const struct file_operations bw_proc_fops = { | ||
145 | .open = bw_proc_open, | ||
146 | .read = seq_read, | ||
147 | .llseek = seq_lseek, | ||
148 | .release = seq_release, | ||
149 | }; | ||
150 | |||
153 | static void create_proc_decoder(struct bw_stats_struct *stats) | 151 | static void create_proc_decoder(struct bw_stats_struct *stats) |
154 | { | 152 | { |
155 | struct proc_dir_entry *ent; | 153 | struct proc_dir_entry *ent; |
156 | 154 | ||
157 | ent = create_proc_read_entry("bus_watcher", S_IWUSR | S_IRUGO, NULL, | 155 | ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL, |
158 | bw_read_proc, stats); | 156 | &bw_proc_fops, stats); |
159 | if (!ent) { | 157 | if (!ent) { |
160 | printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); | 158 | printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n"); |
161 | return; | 159 | return; |
@@ -210,11 +208,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data) | |||
210 | stats->bus_error += G_SCD_MEM_BUSERR(cntr); | 208 | stats->bus_error += G_SCD_MEM_BUSERR(cntr); |
211 | csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS)); | 209 | csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS)); |
212 | 210 | ||
213 | #ifndef CONFIG_PROC_FS | ||
214 | bw_print_buffer(bw_buf, stats); | ||
215 | printk(bw_buf); | ||
216 | #endif | ||
217 | |||
218 | return IRQ_HANDLED; | 211 | return IRQ_HANDLED; |
219 | } | 212 | } |
220 | 213 | ||
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c index d47ba1aa8253..8fa314fbfb18 100644 --- a/arch/parisc/kernel/pdc_chassis.c +++ b/arch/parisc/kernel/pdc_chassis.c | |||
@@ -30,11 +30,13 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/module.h> | ||
33 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
34 | #include <linux/reboot.h> | 35 | #include <linux/reboot.h> |
35 | #include <linux/notifier.h> | 36 | #include <linux/notifier.h> |
36 | #include <linux/cache.h> | 37 | #include <linux/cache.h> |
37 | #include <linux/proc_fs.h> | 38 | #include <linux/proc_fs.h> |
39 | #include <linux/seq_file.h> | ||
38 | 40 | ||
39 | #include <asm/pdc_chassis.h> | 41 | #include <asm/pdc_chassis.h> |
40 | #include <asm/processor.h> | 42 | #include <asm/processor.h> |
@@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message) | |||
244 | 246 | ||
245 | #ifdef CONFIG_PDC_CHASSIS_WARN | 247 | #ifdef CONFIG_PDC_CHASSIS_WARN |
246 | #ifdef CONFIG_PROC_FS | 248 | #ifdef CONFIG_PROC_FS |
247 | static int pdc_chassis_warn_pread(char *page, char **start, off_t off, | 249 | static int pdc_chassis_warn_show(struct seq_file *m, void *v) |
248 | int count, int *eof, void *data) | ||
249 | { | 250 | { |
250 | char *out = page; | ||
251 | int len, ret; | ||
252 | unsigned long warn; | 251 | unsigned long warn; |
253 | u32 warnreg; | 252 | u32 warnreg; |
254 | 253 | ||
255 | ret = pdc_chassis_warn(&warn); | 254 | if (pdc_chassis_warn(&warn) != PDC_OK) |
256 | if (ret != PDC_OK) | ||
257 | return -EIO; | 255 | return -EIO; |
258 | 256 | ||
259 | warnreg = (warn & 0xFFFFFFFF); | 257 | warnreg = (warn & 0xFFFFFFFF); |
260 | 258 | ||
261 | if ((warnreg >> 24) & 0xFF) | 259 | if ((warnreg >> 24) & 0xFF) |
262 | out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF)); | 260 | seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", |
263 | 261 | (warnreg >> 24) & 0xFF); | |
264 | out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK"); | 262 | |
265 | out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK"); | 263 | seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK"); |
266 | out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK"); | 264 | seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK"); |
267 | 265 | seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK"); | |
268 | len = out - page - off; | 266 | return 0; |
269 | if (len < count) { | 267 | } |
270 | *eof = 1; | 268 | |
271 | if (len <= 0) return 0; | 269 | static int pdc_chassis_warn_open(struct inode *inode, struct file *file) |
272 | } else { | 270 | { |
273 | len = count; | 271 | return single_open(file, pdc_chassis_warn_show, NULL); |
274 | } | ||
275 | *start = page + off; | ||
276 | return len; | ||
277 | } | 272 | } |
278 | 273 | ||
274 | static const struct file_operations pdc_chassis_warn_fops = { | ||
275 | .open = pdc_chassis_warn_open, | ||
276 | .read = seq_read, | ||
277 | .llseek = seq_lseek, | ||
278 | .release = seq_release, | ||
279 | }; | ||
280 | |||
279 | static int __init pdc_chassis_create_procfs(void) | 281 | static int __init pdc_chassis_create_procfs(void) |
280 | { | 282 | { |
281 | unsigned long test; | 283 | unsigned long test; |
@@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void) | |||
290 | 292 | ||
291 | printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", | 293 | printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n", |
292 | PDC_CHASSIS_VER); | 294 | PDC_CHASSIS_VER); |
293 | create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread, | 295 | proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops); |
294 | NULL); | ||
295 | return 0; | 296 | return 0; |
296 | } | 297 | } |
297 | 298 | ||
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index f5725bce9ed2..801a757c3630 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -41,8 +41,6 @@ | |||
41 | 41 | ||
42 | /* #define LPARCFG_DEBUG */ | 42 | /* #define LPARCFG_DEBUG */ |
43 | 43 | ||
44 | static struct proc_dir_entry *proc_ppc64_lparcfg; | ||
45 | |||
46 | /* | 44 | /* |
47 | * Track sum of all purrs across all processors. This is used to further | 45 | * Track sum of all purrs across all processors. This is used to further |
48 | * calculate usage values by different applications | 46 | * calculate usage values by different applications |
@@ -688,27 +686,22 @@ static const struct file_operations lparcfg_fops = { | |||
688 | 686 | ||
689 | static int __init lparcfg_init(void) | 687 | static int __init lparcfg_init(void) |
690 | { | 688 | { |
691 | struct proc_dir_entry *ent; | ||
692 | umode_t mode = S_IRUSR | S_IRGRP | S_IROTH; | 689 | umode_t mode = S_IRUSR | S_IRGRP | S_IROTH; |
693 | 690 | ||
694 | /* Allow writing if we have FW_FEATURE_SPLPAR */ | 691 | /* Allow writing if we have FW_FEATURE_SPLPAR */ |
695 | if (firmware_has_feature(FW_FEATURE_SPLPAR)) | 692 | if (firmware_has_feature(FW_FEATURE_SPLPAR)) |
696 | mode |= S_IWUSR; | 693 | mode |= S_IWUSR; |
697 | 694 | ||
698 | ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops); | 695 | if (!proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops)) { |
699 | if (!ent) { | ||
700 | printk(KERN_ERR "Failed to create powerpc/lparcfg\n"); | 696 | printk(KERN_ERR "Failed to create powerpc/lparcfg\n"); |
701 | return -EIO; | 697 | return -EIO; |
702 | } | 698 | } |
703 | |||
704 | proc_ppc64_lparcfg = ent; | ||
705 | return 0; | 699 | return 0; |
706 | } | 700 | } |
707 | 701 | ||
708 | static void __exit lparcfg_cleanup(void) | 702 | static void __exit lparcfg_cleanup(void) |
709 | { | 703 | { |
710 | if (proc_ppc64_lparcfg) | 704 | remove_proc_subtree("powerpc/lparcfg", NULL); |
711 | remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent); | ||
712 | } | 705 | } |
713 | 706 | ||
714 | module_init(lparcfg_init); | 707 | module_init(lparcfg_init); |
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c index f19d0bdc3241..feb8580fdc84 100644 --- a/arch/powerpc/kernel/proc_powerpc.c +++ b/arch/powerpc/kernel/proc_powerpc.c | |||
@@ -32,8 +32,6 @@ | |||
32 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) | 32 | static loff_t page_map_seek( struct file *file, loff_t off, int whence) |
33 | { | 33 | { |
34 | loff_t new; | 34 | loff_t new; |
35 | struct proc_dir_entry *dp = PDE(file_inode(file)); | ||
36 | |||
37 | switch(whence) { | 35 | switch(whence) { |
38 | case 0: | 36 | case 0: |
39 | new = off; | 37 | new = off; |
@@ -42,12 +40,12 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence) | |||
42 | new = file->f_pos + off; | 40 | new = file->f_pos + off; |
43 | break; | 41 | break; |
44 | case 2: | 42 | case 2: |
45 | new = dp->size + off; | 43 | new = PAGE_SIZE + off; |
46 | break; | 44 | break; |
47 | default: | 45 | default: |
48 | return -EINVAL; | 46 | return -EINVAL; |
49 | } | 47 | } |
50 | if ( new < 0 || new > dp->size ) | 48 | if ( new < 0 || new > PAGE_SIZE ) |
51 | return -EINVAL; | 49 | return -EINVAL; |
52 | return (file->f_pos = new); | 50 | return (file->f_pos = new); |
53 | } | 51 | } |
@@ -55,19 +53,18 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence) | |||
55 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, | 53 | static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, |
56 | loff_t *ppos) | 54 | loff_t *ppos) |
57 | { | 55 | { |
58 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 56 | return simple_read_from_buffer(buf, nbytes, ppos, |
59 | return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size); | 57 | PDE_DATA(file_inode(file)), PAGE_SIZE); |
60 | } | 58 | } |
61 | 59 | ||
62 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) | 60 | static int page_map_mmap( struct file *file, struct vm_area_struct *vma ) |
63 | { | 61 | { |
64 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 62 | if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) |
65 | |||
66 | if ((vma->vm_end - vma->vm_start) > dp->size) | ||
67 | return -EINVAL; | 63 | return -EINVAL; |
68 | 64 | ||
69 | remap_pfn_range(vma, vma->vm_start, __pa(dp->data) >> PAGE_SHIFT, | 65 | remap_pfn_range(vma, vma->vm_start, |
70 | dp->size, vma->vm_page_prot); | 66 | __pa(PDE_DATA(file_inode(file))) >> PAGE_SHIFT, |
67 | PAGE_SIZE, vma->vm_page_prot); | ||
71 | return 0; | 68 | return 0; |
72 | } | 69 | } |
73 | 70 | ||
@@ -86,7 +83,7 @@ static int __init proc_ppc64_init(void) | |||
86 | &page_map_fops, vdso_data); | 83 | &page_map_fops, vdso_data); |
87 | if (!pde) | 84 | if (!pde) |
88 | return 1; | 85 | return 1; |
89 | pde->size = PAGE_SIZE; | 86 | proc_set_size(pde, PAGE_SIZE); |
90 | 87 | ||
91 | return 0; | 88 | return 0; |
92 | } | 89 | } |
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index c642f0132988..5b770262c673 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -102,9 +102,10 @@ static struct kmem_cache *flash_block_cache = NULL; | |||
102 | 102 | ||
103 | #define FLASH_BLOCK_LIST_VERSION (1UL) | 103 | #define FLASH_BLOCK_LIST_VERSION (1UL) |
104 | 104 | ||
105 | /* Local copy of the flash block list. | 105 | /* |
106 | * We only allow one open of the flash proc file and create this | 106 | * Local copy of the flash block list. |
107 | * list as we go. The rtas_firmware_flash_list varable will be | 107 | * |
108 | * The rtas_firmware_flash_list varable will be | ||
108 | * set once the data is fully read. | 109 | * set once the data is fully read. |
109 | * | 110 | * |
110 | * For convenience as we build the list we use virtual addrs, | 111 | * For convenience as we build the list we use virtual addrs, |
@@ -125,23 +126,23 @@ struct rtas_update_flash_t | |||
125 | struct rtas_manage_flash_t | 126 | struct rtas_manage_flash_t |
126 | { | 127 | { |
127 | int status; /* Returned status */ | 128 | int status; /* Returned status */ |
128 | unsigned int op; /* Reject or commit image */ | ||
129 | }; | 129 | }; |
130 | 130 | ||
131 | /* Status int must be first member of struct */ | 131 | /* Status int must be first member of struct */ |
132 | struct rtas_validate_flash_t | 132 | struct rtas_validate_flash_t |
133 | { | 133 | { |
134 | int status; /* Returned status */ | 134 | int status; /* Returned status */ |
135 | char buf[VALIDATE_BUF_SIZE]; /* Candidate image buffer */ | 135 | char *buf; /* Candidate image buffer */ |
136 | unsigned int buf_size; /* Size of image buf */ | 136 | unsigned int buf_size; /* Size of image buf */ |
137 | unsigned int update_results; /* Update results token */ | 137 | unsigned int update_results; /* Update results token */ |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static DEFINE_SPINLOCK(flash_file_open_lock); | 140 | static struct rtas_update_flash_t rtas_update_flash_data; |
141 | static struct proc_dir_entry *firmware_flash_pde; | 141 | static struct rtas_manage_flash_t rtas_manage_flash_data; |
142 | static struct proc_dir_entry *firmware_update_pde; | 142 | static struct rtas_validate_flash_t rtas_validate_flash_data; |
143 | static struct proc_dir_entry *validate_pde; | 143 | static DEFINE_MUTEX(rtas_update_flash_mutex); |
144 | static struct proc_dir_entry *manage_pde; | 144 | static DEFINE_MUTEX(rtas_manage_flash_mutex); |
145 | static DEFINE_MUTEX(rtas_validate_flash_mutex); | ||
145 | 146 | ||
146 | /* Do simple sanity checks on the flash image. */ | 147 | /* Do simple sanity checks on the flash image. */ |
147 | static int flash_list_valid(struct flash_block_list *flist) | 148 | static int flash_list_valid(struct flash_block_list *flist) |
@@ -191,10 +192,10 @@ static void free_flash_list(struct flash_block_list *f) | |||
191 | 192 | ||
192 | static int rtas_flash_release(struct inode *inode, struct file *file) | 193 | static int rtas_flash_release(struct inode *inode, struct file *file) |
193 | { | 194 | { |
194 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 195 | struct rtas_update_flash_t *const uf = &rtas_update_flash_data; |
195 | struct rtas_update_flash_t *uf; | 196 | |
196 | 197 | mutex_lock(&rtas_update_flash_mutex); | |
197 | uf = (struct rtas_update_flash_t *) dp->data; | 198 | |
198 | if (uf->flist) { | 199 | if (uf->flist) { |
199 | /* File was opened in write mode for a new flash attempt */ | 200 | /* File was opened in write mode for a new flash attempt */ |
200 | /* Clear saved list */ | 201 | /* Clear saved list */ |
@@ -214,13 +215,14 @@ static int rtas_flash_release(struct inode *inode, struct file *file) | |||
214 | uf->flist = NULL; | 215 | uf->flist = NULL; |
215 | } | 216 | } |
216 | 217 | ||
217 | atomic_dec(&dp->count); | 218 | mutex_unlock(&rtas_update_flash_mutex); |
218 | return 0; | 219 | return 0; |
219 | } | 220 | } |
220 | 221 | ||
221 | static void get_flash_status_msg(int status, char *buf) | 222 | static size_t get_flash_status_msg(int status, char *buf) |
222 | { | 223 | { |
223 | char *msg; | 224 | const char *msg; |
225 | size_t len; | ||
224 | 226 | ||
225 | switch (status) { | 227 | switch (status) { |
226 | case FLASH_AUTH: | 228 | case FLASH_AUTH: |
@@ -242,34 +244,51 @@ static void get_flash_status_msg(int status, char *buf) | |||
242 | msg = "ready: firmware image ready for flash on reboot\n"; | 244 | msg = "ready: firmware image ready for flash on reboot\n"; |
243 | break; | 245 | break; |
244 | default: | 246 | default: |
245 | sprintf(buf, "error: unexpected status value %d\n", status); | 247 | return sprintf(buf, "error: unexpected status value %d\n", |
246 | return; | 248 | status); |
247 | } | 249 | } |
248 | 250 | ||
249 | strcpy(buf, msg); | 251 | len = strlen(msg); |
252 | memcpy(buf, msg, len + 1); | ||
253 | return len; | ||
250 | } | 254 | } |
251 | 255 | ||
252 | /* Reading the proc file will show status (not the firmware contents) */ | 256 | /* Reading the proc file will show status (not the firmware contents) */ |
253 | static ssize_t rtas_flash_read(struct file *file, char __user *buf, | 257 | static ssize_t rtas_flash_read_msg(struct file *file, char __user *buf, |
254 | size_t count, loff_t *ppos) | 258 | size_t count, loff_t *ppos) |
255 | { | 259 | { |
256 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 260 | struct rtas_update_flash_t *const uf = &rtas_update_flash_data; |
257 | struct rtas_update_flash_t *uf; | ||
258 | char msg[RTAS_MSG_MAXLEN]; | 261 | char msg[RTAS_MSG_MAXLEN]; |
262 | size_t len; | ||
263 | int status; | ||
259 | 264 | ||
260 | uf = dp->data; | 265 | mutex_lock(&rtas_update_flash_mutex); |
266 | status = uf->status; | ||
267 | mutex_unlock(&rtas_update_flash_mutex); | ||
261 | 268 | ||
262 | if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) { | 269 | /* Read as text message */ |
263 | get_flash_status_msg(uf->status, msg); | 270 | len = get_flash_status_msg(status, msg); |
264 | } else { /* FIRMWARE_UPDATE_NAME */ | 271 | return simple_read_from_buffer(buf, count, ppos, msg, len); |
265 | sprintf(msg, "%d\n", uf->status); | 272 | } |
266 | } | 273 | |
274 | static ssize_t rtas_flash_read_num(struct file *file, char __user *buf, | ||
275 | size_t count, loff_t *ppos) | ||
276 | { | ||
277 | struct rtas_update_flash_t *const uf = &rtas_update_flash_data; | ||
278 | char msg[RTAS_MSG_MAXLEN]; | ||
279 | int status; | ||
267 | 280 | ||
281 | mutex_lock(&rtas_update_flash_mutex); | ||
282 | status = uf->status; | ||
283 | mutex_unlock(&rtas_update_flash_mutex); | ||
284 | |||
285 | /* Read as number */ | ||
286 | sprintf(msg, "%d\n", status); | ||
268 | return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg)); | 287 | return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg)); |
269 | } | 288 | } |
270 | 289 | ||
271 | /* constructor for flash_block_cache */ | 290 | /* constructor for flash_block_cache */ |
272 | void rtas_block_ctor(void *ptr) | 291 | static void rtas_block_ctor(void *ptr) |
273 | { | 292 | { |
274 | memset(ptr, 0, RTAS_BLK_SIZE); | 293 | memset(ptr, 0, RTAS_BLK_SIZE); |
275 | } | 294 | } |
@@ -282,16 +301,15 @@ void rtas_block_ctor(void *ptr) | |||
282 | static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, | 301 | static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, |
283 | size_t count, loff_t *off) | 302 | size_t count, loff_t *off) |
284 | { | 303 | { |
285 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 304 | struct rtas_update_flash_t *const uf = &rtas_update_flash_data; |
286 | struct rtas_update_flash_t *uf; | ||
287 | char *p; | 305 | char *p; |
288 | int next_free; | 306 | int next_free, rc; |
289 | struct flash_block_list *fl; | 307 | struct flash_block_list *fl; |
290 | 308 | ||
291 | uf = (struct rtas_update_flash_t *) dp->data; | 309 | mutex_lock(&rtas_update_flash_mutex); |
292 | 310 | ||
293 | if (uf->status == FLASH_AUTH || count == 0) | 311 | if (uf->status == FLASH_AUTH || count == 0) |
294 | return count; /* discard data */ | 312 | goto out; /* discard data */ |
295 | 313 | ||
296 | /* In the case that the image is not ready for flashing, the memory | 314 | /* In the case that the image is not ready for flashing, the memory |
297 | * allocated for the block list will be freed upon the release of the | 315 | * allocated for the block list will be freed upon the release of the |
@@ -300,7 +318,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, | |||
300 | if (uf->flist == NULL) { | 318 | if (uf->flist == NULL) { |
301 | uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); | 319 | uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); |
302 | if (!uf->flist) | 320 | if (!uf->flist) |
303 | return -ENOMEM; | 321 | goto nomem; |
304 | } | 322 | } |
305 | 323 | ||
306 | fl = uf->flist; | 324 | fl = uf->flist; |
@@ -311,7 +329,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, | |||
311 | /* Need to allocate another block_list */ | 329 | /* Need to allocate another block_list */ |
312 | fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); | 330 | fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); |
313 | if (!fl->next) | 331 | if (!fl->next) |
314 | return -ENOMEM; | 332 | goto nomem; |
315 | fl = fl->next; | 333 | fl = fl->next; |
316 | next_free = 0; | 334 | next_free = 0; |
317 | } | 335 | } |
@@ -320,52 +338,37 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer, | |||
320 | count = RTAS_BLK_SIZE; | 338 | count = RTAS_BLK_SIZE; |
321 | p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); | 339 | p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL); |
322 | if (!p) | 340 | if (!p) |
323 | return -ENOMEM; | 341 | goto nomem; |
324 | 342 | ||
325 | if(copy_from_user(p, buffer, count)) { | 343 | if(copy_from_user(p, buffer, count)) { |
326 | kmem_cache_free(flash_block_cache, p); | 344 | kmem_cache_free(flash_block_cache, p); |
327 | return -EFAULT; | 345 | rc = -EFAULT; |
346 | goto error; | ||
328 | } | 347 | } |
329 | fl->blocks[next_free].data = p; | 348 | fl->blocks[next_free].data = p; |
330 | fl->blocks[next_free].length = count; | 349 | fl->blocks[next_free].length = count; |
331 | fl->num_blocks++; | 350 | fl->num_blocks++; |
332 | 351 | out: | |
352 | mutex_unlock(&rtas_update_flash_mutex); | ||
333 | return count; | 353 | return count; |
334 | } | ||
335 | |||
336 | static int rtas_excl_open(struct inode *inode, struct file *file) | ||
337 | { | ||
338 | struct proc_dir_entry *dp = PDE(inode); | ||
339 | |||
340 | /* Enforce exclusive open with use count of PDE */ | ||
341 | spin_lock(&flash_file_open_lock); | ||
342 | if (atomic_read(&dp->count) > 2) { | ||
343 | spin_unlock(&flash_file_open_lock); | ||
344 | return -EBUSY; | ||
345 | } | ||
346 | |||
347 | atomic_inc(&dp->count); | ||
348 | spin_unlock(&flash_file_open_lock); | ||
349 | |||
350 | return 0; | ||
351 | } | ||
352 | |||
353 | static int rtas_excl_release(struct inode *inode, struct file *file) | ||
354 | { | ||
355 | struct proc_dir_entry *dp = PDE(inode); | ||
356 | 354 | ||
357 | atomic_dec(&dp->count); | 355 | nomem: |
358 | 356 | rc = -ENOMEM; | |
359 | return 0; | 357 | error: |
358 | mutex_unlock(&rtas_update_flash_mutex); | ||
359 | return rc; | ||
360 | } | 360 | } |
361 | 361 | ||
362 | static void manage_flash(struct rtas_manage_flash_t *args_buf) | 362 | /* |
363 | * Flash management routines. | ||
364 | */ | ||
365 | static void manage_flash(struct rtas_manage_flash_t *args_buf, unsigned int op) | ||
363 | { | 366 | { |
364 | s32 rc; | 367 | s32 rc; |
365 | 368 | ||
366 | do { | 369 | do { |
367 | rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, | 370 | rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 1, |
368 | 1, NULL, args_buf->op); | 371 | NULL, op); |
369 | } while (rtas_busy_delay(rc)); | 372 | } while (rtas_busy_delay(rc)); |
370 | 373 | ||
371 | args_buf->status = rc; | 374 | args_buf->status = rc; |
@@ -374,55 +377,62 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf) | |||
374 | static ssize_t manage_flash_read(struct file *file, char __user *buf, | 377 | static ssize_t manage_flash_read(struct file *file, char __user *buf, |
375 | size_t count, loff_t *ppos) | 378 | size_t count, loff_t *ppos) |
376 | { | 379 | { |
377 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 380 | struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data; |
378 | struct rtas_manage_flash_t *args_buf; | ||
379 | char msg[RTAS_MSG_MAXLEN]; | 381 | char msg[RTAS_MSG_MAXLEN]; |
380 | int msglen; | 382 | int msglen, status; |
381 | 383 | ||
382 | args_buf = dp->data; | 384 | mutex_lock(&rtas_manage_flash_mutex); |
383 | if (args_buf == NULL) | 385 | status = args_buf->status; |
384 | return 0; | 386 | mutex_unlock(&rtas_manage_flash_mutex); |
385 | |||
386 | msglen = sprintf(msg, "%d\n", args_buf->status); | ||
387 | 387 | ||
388 | msglen = sprintf(msg, "%d\n", status); | ||
388 | return simple_read_from_buffer(buf, count, ppos, msg, msglen); | 389 | return simple_read_from_buffer(buf, count, ppos, msg, msglen); |
389 | } | 390 | } |
390 | 391 | ||
391 | static ssize_t manage_flash_write(struct file *file, const char __user *buf, | 392 | static ssize_t manage_flash_write(struct file *file, const char __user *buf, |
392 | size_t count, loff_t *off) | 393 | size_t count, loff_t *off) |
393 | { | 394 | { |
394 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 395 | struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data; |
395 | struct rtas_manage_flash_t *args_buf; | 396 | static const char reject_str[] = "0"; |
396 | const char reject_str[] = "0"; | 397 | static const char commit_str[] = "1"; |
397 | const char commit_str[] = "1"; | ||
398 | char stkbuf[10]; | 398 | char stkbuf[10]; |
399 | int op; | 399 | int op, rc; |
400 | |||
401 | mutex_lock(&rtas_manage_flash_mutex); | ||
400 | 402 | ||
401 | args_buf = (struct rtas_manage_flash_t *) dp->data; | ||
402 | if ((args_buf->status == MANAGE_AUTH) || (count == 0)) | 403 | if ((args_buf->status == MANAGE_AUTH) || (count == 0)) |
403 | return count; | 404 | goto out; |
404 | 405 | ||
405 | op = -1; | 406 | op = -1; |
406 | if (buf) { | 407 | if (buf) { |
407 | if (count > 9) count = 9; | 408 | if (count > 9) count = 9; |
408 | if (copy_from_user (stkbuf, buf, count)) { | 409 | rc = -EFAULT; |
409 | return -EFAULT; | 410 | if (copy_from_user (stkbuf, buf, count)) |
410 | } | 411 | goto error; |
411 | if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0) | 412 | if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0) |
412 | op = RTAS_REJECT_TMP_IMG; | 413 | op = RTAS_REJECT_TMP_IMG; |
413 | else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0) | 414 | else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0) |
414 | op = RTAS_COMMIT_TMP_IMG; | 415 | op = RTAS_COMMIT_TMP_IMG; |
415 | } | 416 | } |
416 | 417 | ||
417 | if (op == -1) /* buf is empty, or contains invalid string */ | 418 | if (op == -1) { /* buf is empty, or contains invalid string */ |
418 | return -EINVAL; | 419 | rc = -EINVAL; |
419 | 420 | goto error; | |
420 | args_buf->op = op; | 421 | } |
421 | manage_flash(args_buf); | ||
422 | 422 | ||
423 | manage_flash(args_buf, op); | ||
424 | out: | ||
425 | mutex_unlock(&rtas_manage_flash_mutex); | ||
423 | return count; | 426 | return count; |
427 | |||
428 | error: | ||
429 | mutex_unlock(&rtas_manage_flash_mutex); | ||
430 | return rc; | ||
424 | } | 431 | } |
425 | 432 | ||
433 | /* | ||
434 | * Validation routines. | ||
435 | */ | ||
426 | static void validate_flash(struct rtas_validate_flash_t *args_buf) | 436 | static void validate_flash(struct rtas_validate_flash_t *args_buf) |
427 | { | 437 | { |
428 | int token = rtas_token("ibm,validate-flash-image"); | 438 | int token = rtas_token("ibm,validate-flash-image"); |
@@ -462,14 +472,14 @@ static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf, | |||
462 | static ssize_t validate_flash_read(struct file *file, char __user *buf, | 472 | static ssize_t validate_flash_read(struct file *file, char __user *buf, |
463 | size_t count, loff_t *ppos) | 473 | size_t count, loff_t *ppos) |
464 | { | 474 | { |
465 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 475 | struct rtas_validate_flash_t *const args_buf = |
466 | struct rtas_validate_flash_t *args_buf; | 476 | &rtas_validate_flash_data; |
467 | char msg[RTAS_MSG_MAXLEN]; | 477 | char msg[RTAS_MSG_MAXLEN]; |
468 | int msglen; | 478 | int msglen; |
469 | 479 | ||
470 | args_buf = dp->data; | 480 | mutex_lock(&rtas_validate_flash_mutex); |
471 | |||
472 | msglen = get_validate_flash_msg(args_buf, msg); | 481 | msglen = get_validate_flash_msg(args_buf, msg); |
482 | mutex_unlock(&rtas_validate_flash_mutex); | ||
473 | 483 | ||
474 | return simple_read_from_buffer(buf, count, ppos, msg, msglen); | 484 | return simple_read_from_buffer(buf, count, ppos, msg, msglen); |
475 | } | 485 | } |
@@ -477,24 +487,18 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf, | |||
477 | static ssize_t validate_flash_write(struct file *file, const char __user *buf, | 487 | static ssize_t validate_flash_write(struct file *file, const char __user *buf, |
478 | size_t count, loff_t *off) | 488 | size_t count, loff_t *off) |
479 | { | 489 | { |
480 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 490 | struct rtas_validate_flash_t *const args_buf = |
481 | struct rtas_validate_flash_t *args_buf; | 491 | &rtas_validate_flash_data; |
482 | int rc; | 492 | int rc; |
483 | 493 | ||
484 | args_buf = (struct rtas_validate_flash_t *) dp->data; | 494 | mutex_lock(&rtas_validate_flash_mutex); |
485 | |||
486 | if (dp->data == NULL) { | ||
487 | dp->data = kmalloc(sizeof(struct rtas_validate_flash_t), | ||
488 | GFP_KERNEL); | ||
489 | if (dp->data == NULL) | ||
490 | return -ENOMEM; | ||
491 | } | ||
492 | 495 | ||
493 | /* We are only interested in the first 4K of the | 496 | /* We are only interested in the first 4K of the |
494 | * candidate image */ | 497 | * candidate image */ |
495 | if ((*off >= VALIDATE_BUF_SIZE) || | 498 | if ((*off >= VALIDATE_BUF_SIZE) || |
496 | (args_buf->status == VALIDATE_AUTH)) { | 499 | (args_buf->status == VALIDATE_AUTH)) { |
497 | *off += count; | 500 | *off += count; |
501 | mutex_unlock(&rtas_validate_flash_mutex); | ||
498 | return count; | 502 | return count; |
499 | } | 503 | } |
500 | 504 | ||
@@ -517,31 +521,29 @@ static ssize_t validate_flash_write(struct file *file, const char __user *buf, | |||
517 | *off += count; | 521 | *off += count; |
518 | rc = count; | 522 | rc = count; |
519 | done: | 523 | done: |
520 | if (rc < 0) { | 524 | mutex_unlock(&rtas_validate_flash_mutex); |
521 | kfree(dp->data); | ||
522 | dp->data = NULL; | ||
523 | } | ||
524 | return rc; | 525 | return rc; |
525 | } | 526 | } |
526 | 527 | ||
527 | static int validate_flash_release(struct inode *inode, struct file *file) | 528 | static int validate_flash_release(struct inode *inode, struct file *file) |
528 | { | 529 | { |
529 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 530 | struct rtas_validate_flash_t *const args_buf = |
530 | struct rtas_validate_flash_t *args_buf; | 531 | &rtas_validate_flash_data; |
531 | 532 | ||
532 | args_buf = (struct rtas_validate_flash_t *) dp->data; | 533 | mutex_lock(&rtas_validate_flash_mutex); |
533 | 534 | ||
534 | if (args_buf->status == VALIDATE_READY) { | 535 | if (args_buf->status == VALIDATE_READY) { |
535 | args_buf->buf_size = VALIDATE_BUF_SIZE; | 536 | args_buf->buf_size = VALIDATE_BUF_SIZE; |
536 | validate_flash(args_buf); | 537 | validate_flash(args_buf); |
537 | } | 538 | } |
538 | 539 | ||
539 | /* The matching atomic_inc was in rtas_excl_open() */ | 540 | mutex_unlock(&rtas_validate_flash_mutex); |
540 | atomic_dec(&dp->count); | ||
541 | |||
542 | return 0; | 541 | return 0; |
543 | } | 542 | } |
544 | 543 | ||
544 | /* | ||
545 | * On-reboot flash update applicator. | ||
546 | */ | ||
545 | static void rtas_flash_firmware(int reboot_type) | 547 | static void rtas_flash_firmware(int reboot_type) |
546 | { | 548 | { |
547 | unsigned long image_size; | 549 | unsigned long image_size; |
@@ -634,75 +636,57 @@ static void rtas_flash_firmware(int reboot_type) | |||
634 | spin_unlock(&rtas_data_buf_lock); | 636 | spin_unlock(&rtas_data_buf_lock); |
635 | } | 637 | } |
636 | 638 | ||
637 | static void remove_flash_pde(struct proc_dir_entry *dp) | 639 | /* |
638 | { | 640 | * Manifest of proc files to create |
639 | if (dp) { | 641 | */ |
640 | kfree(dp->data); | 642 | struct rtas_flash_file { |
641 | remove_proc_entry(dp->name, dp->parent); | 643 | const char *filename; |
642 | } | 644 | const char *rtas_call_name; |
643 | } | ||
644 | |||
645 | static int initialize_flash_pde_data(const char *rtas_call_name, | ||
646 | size_t buf_size, | ||
647 | struct proc_dir_entry *dp) | ||
648 | { | ||
649 | int *status; | 645 | int *status; |
650 | int token; | 646 | const struct file_operations fops; |
651 | |||
652 | dp->data = kzalloc(buf_size, GFP_KERNEL); | ||
653 | if (dp->data == NULL) | ||
654 | return -ENOMEM; | ||
655 | |||
656 | /* | ||
657 | * This code assumes that the status int is the first member of the | ||
658 | * struct | ||
659 | */ | ||
660 | status = (int *) dp->data; | ||
661 | token = rtas_token(rtas_call_name); | ||
662 | if (token == RTAS_UNKNOWN_SERVICE) | ||
663 | *status = FLASH_AUTH; | ||
664 | else | ||
665 | *status = FLASH_NO_OP; | ||
666 | |||
667 | return 0; | ||
668 | } | ||
669 | |||
670 | static struct proc_dir_entry *create_flash_pde(const char *filename, | ||
671 | const struct file_operations *fops) | ||
672 | { | ||
673 | return proc_create(filename, S_IRUSR | S_IWUSR, NULL, fops); | ||
674 | } | ||
675 | |||
676 | static const struct file_operations rtas_flash_operations = { | ||
677 | .owner = THIS_MODULE, | ||
678 | .read = rtas_flash_read, | ||
679 | .write = rtas_flash_write, | ||
680 | .open = rtas_excl_open, | ||
681 | .release = rtas_flash_release, | ||
682 | .llseek = default_llseek, | ||
683 | }; | ||
684 | |||
685 | static const struct file_operations manage_flash_operations = { | ||
686 | .owner = THIS_MODULE, | ||
687 | .read = manage_flash_read, | ||
688 | .write = manage_flash_write, | ||
689 | .open = rtas_excl_open, | ||
690 | .release = rtas_excl_release, | ||
691 | .llseek = default_llseek, | ||
692 | }; | 647 | }; |
693 | 648 | ||
694 | static const struct file_operations validate_flash_operations = { | 649 | static const struct rtas_flash_file rtas_flash_files[] = { |
695 | .owner = THIS_MODULE, | 650 | { |
696 | .read = validate_flash_read, | 651 | .filename = "powerpc/rtas/" FIRMWARE_FLASH_NAME, |
697 | .write = validate_flash_write, | 652 | .rtas_call_name = "ibm,update-flash-64-and-reboot", |
698 | .open = rtas_excl_open, | 653 | .status = &rtas_update_flash_data.status, |
699 | .release = validate_flash_release, | 654 | .fops.read = rtas_flash_read_msg, |
700 | .llseek = default_llseek, | 655 | .fops.write = rtas_flash_write, |
656 | .fops.release = rtas_flash_release, | ||
657 | .fops.llseek = default_llseek, | ||
658 | }, | ||
659 | { | ||
660 | .filename = "powerpc/rtas/" FIRMWARE_UPDATE_NAME, | ||
661 | .rtas_call_name = "ibm,update-flash-64-and-reboot", | ||
662 | .status = &rtas_update_flash_data.status, | ||
663 | .fops.read = rtas_flash_read_num, | ||
664 | .fops.write = rtas_flash_write, | ||
665 | .fops.release = rtas_flash_release, | ||
666 | .fops.llseek = default_llseek, | ||
667 | }, | ||
668 | { | ||
669 | .filename = "powerpc/rtas/" VALIDATE_FLASH_NAME, | ||
670 | .rtas_call_name = "ibm,validate-flash-image", | ||
671 | .status = &rtas_validate_flash_data.status, | ||
672 | .fops.read = validate_flash_read, | ||
673 | .fops.write = validate_flash_write, | ||
674 | .fops.release = validate_flash_release, | ||
675 | .fops.llseek = default_llseek, | ||
676 | }, | ||
677 | { | ||
678 | .filename = "powerpc/rtas/" MANAGE_FLASH_NAME, | ||
679 | .rtas_call_name = "ibm,manage-flash-image", | ||
680 | .status = &rtas_manage_flash_data.status, | ||
681 | .fops.read = manage_flash_read, | ||
682 | .fops.write = manage_flash_write, | ||
683 | .fops.llseek = default_llseek, | ||
684 | } | ||
701 | }; | 685 | }; |
702 | 686 | ||
703 | static int __init rtas_flash_init(void) | 687 | static int __init rtas_flash_init(void) |
704 | { | 688 | { |
705 | int rc; | 689 | int i; |
706 | 690 | ||
707 | if (rtas_token("ibm,update-flash-64-and-reboot") == | 691 | if (rtas_token("ibm,update-flash-64-and-reboot") == |
708 | RTAS_UNKNOWN_SERVICE) { | 692 | RTAS_UNKNOWN_SERVICE) { |
@@ -710,93 +694,65 @@ static int __init rtas_flash_init(void) | |||
710 | return 1; | 694 | return 1; |
711 | } | 695 | } |
712 | 696 | ||
713 | firmware_flash_pde = create_flash_pde("powerpc/rtas/" | 697 | rtas_validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL); |
714 | FIRMWARE_FLASH_NAME, | 698 | if (!rtas_validate_flash_data.buf) |
715 | &rtas_flash_operations); | 699 | return -ENOMEM; |
716 | if (firmware_flash_pde == NULL) { | ||
717 | rc = -ENOMEM; | ||
718 | goto cleanup; | ||
719 | } | ||
720 | 700 | ||
721 | rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", | 701 | flash_block_cache = kmem_cache_create("rtas_flash_cache", |
722 | sizeof(struct rtas_update_flash_t), | 702 | RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, |
723 | firmware_flash_pde); | 703 | rtas_block_ctor); |
724 | if (rc != 0) | 704 | if (!flash_block_cache) { |
725 | goto cleanup; | 705 | printk(KERN_ERR "%s: failed to create block cache\n", |
726 | 706 | __func__); | |
727 | firmware_update_pde = create_flash_pde("powerpc/rtas/" | 707 | goto enomem_buf; |
728 | FIRMWARE_UPDATE_NAME, | ||
729 | &rtas_flash_operations); | ||
730 | if (firmware_update_pde == NULL) { | ||
731 | rc = -ENOMEM; | ||
732 | goto cleanup; | ||
733 | } | 708 | } |
734 | 709 | ||
735 | rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", | 710 | for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) { |
736 | sizeof(struct rtas_update_flash_t), | 711 | const struct rtas_flash_file *f = &rtas_flash_files[i]; |
737 | firmware_update_pde); | 712 | int token; |
738 | if (rc != 0) | ||
739 | goto cleanup; | ||
740 | |||
741 | validate_pde = create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME, | ||
742 | &validate_flash_operations); | ||
743 | if (validate_pde == NULL) { | ||
744 | rc = -ENOMEM; | ||
745 | goto cleanup; | ||
746 | } | ||
747 | 713 | ||
748 | rc = initialize_flash_pde_data("ibm,validate-flash-image", | 714 | if (!proc_create(f->filename, S_IRUSR | S_IWUSR, NULL, &f->fops)) |
749 | sizeof(struct rtas_validate_flash_t), | 715 | goto enomem; |
750 | validate_pde); | ||
751 | if (rc != 0) | ||
752 | goto cleanup; | ||
753 | |||
754 | manage_pde = create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME, | ||
755 | &manage_flash_operations); | ||
756 | if (manage_pde == NULL) { | ||
757 | rc = -ENOMEM; | ||
758 | goto cleanup; | ||
759 | } | ||
760 | 716 | ||
761 | rc = initialize_flash_pde_data("ibm,manage-flash-image", | 717 | /* |
762 | sizeof(struct rtas_manage_flash_t), | 718 | * This code assumes that the status int is the first member of the |
763 | manage_pde); | 719 | * struct |
764 | if (rc != 0) | 720 | */ |
765 | goto cleanup; | 721 | token = rtas_token(f->rtas_call_name); |
722 | if (token == RTAS_UNKNOWN_SERVICE) | ||
723 | *f->status = FLASH_AUTH; | ||
724 | else | ||
725 | *f->status = FLASH_NO_OP; | ||
726 | } | ||
766 | 727 | ||
767 | rtas_flash_term_hook = rtas_flash_firmware; | 728 | rtas_flash_term_hook = rtas_flash_firmware; |
768 | |||
769 | flash_block_cache = kmem_cache_create("rtas_flash_cache", | ||
770 | RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, | ||
771 | rtas_block_ctor); | ||
772 | if (!flash_block_cache) { | ||
773 | printk(KERN_ERR "%s: failed to create block cache\n", | ||
774 | __func__); | ||
775 | rc = -ENOMEM; | ||
776 | goto cleanup; | ||
777 | } | ||
778 | return 0; | 729 | return 0; |
779 | 730 | ||
780 | cleanup: | 731 | enomem: |
781 | remove_flash_pde(firmware_flash_pde); | 732 | while (--i >= 0) { |
782 | remove_flash_pde(firmware_update_pde); | 733 | const struct rtas_flash_file *f = &rtas_flash_files[i]; |
783 | remove_flash_pde(validate_pde); | 734 | remove_proc_entry(f->filename, NULL); |
784 | remove_flash_pde(manage_pde); | 735 | } |
785 | 736 | ||
786 | return rc; | 737 | kmem_cache_destroy(flash_block_cache); |
738 | enomem_buf: | ||
739 | kfree(rtas_validate_flash_data.buf); | ||
740 | return -ENOMEM; | ||
787 | } | 741 | } |
788 | 742 | ||
789 | static void __exit rtas_flash_cleanup(void) | 743 | static void __exit rtas_flash_cleanup(void) |
790 | { | 744 | { |
745 | int i; | ||
746 | |||
791 | rtas_flash_term_hook = NULL; | 747 | rtas_flash_term_hook = NULL; |
792 | 748 | ||
793 | if (flash_block_cache) | 749 | for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) { |
794 | kmem_cache_destroy(flash_block_cache); | 750 | const struct rtas_flash_file *f = &rtas_flash_files[i]; |
751 | remove_proc_entry(f->filename, NULL); | ||
752 | } | ||
795 | 753 | ||
796 | remove_flash_pde(firmware_flash_pde); | 754 | kmem_cache_destroy(flash_block_cache); |
797 | remove_flash_pde(firmware_update_pde); | 755 | kfree(rtas_validate_flash_data.buf); |
798 | remove_flash_pde(validate_pde); | ||
799 | remove_flash_pde(manage_pde); | ||
800 | } | 756 | } |
801 | 757 | ||
802 | module_init(rtas_flash_init); | 758 | module_init(rtas_flash_init); |
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 8cc18abd6dde..da98e26f6e45 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
@@ -1467,7 +1467,7 @@ static int kvm_htab_release(struct inode *inode, struct file *filp) | |||
1467 | return 0; | 1467 | return 0; |
1468 | } | 1468 | } |
1469 | 1469 | ||
1470 | static struct file_operations kvm_htab_fops = { | 1470 | static const struct file_operations kvm_htab_fops = { |
1471 | .read = kvm_htab_read, | 1471 | .read = kvm_htab_read, |
1472 | .write = kvm_htab_write, | 1472 | .write = kvm_htab_write, |
1473 | .llseek = default_llseek, | 1473 | .llseek = default_llseek, |
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 72ffc899c082..b2d3f3b2de72 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c | |||
@@ -92,7 +92,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp) | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static struct file_operations kvm_spapr_tce_fops = { | 95 | static const struct file_operations kvm_spapr_tce_fops = { |
96 | .mmap = kvm_spapr_tce_mmap, | 96 | .mmap = kvm_spapr_tce_mmap, |
97 | .release = kvm_spapr_tce_release, | 97 | .release = kvm_spapr_tce_release, |
98 | }; | 98 | }; |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 80dcc53a1aba..b62bd1b97c68 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -1483,7 +1483,7 @@ static int kvm_rma_release(struct inode *inode, struct file *filp) | |||
1483 | return 0; | 1483 | return 0; |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | static struct file_operations kvm_rma_fops = { | 1486 | static const struct file_operations kvm_rma_fops = { |
1487 | .mmap = kvm_rma_mmap, | 1487 | .mmap = kvm_rma_mmap, |
1488 | .release = kvm_rma_release, | 1488 | .release = kvm_rma_release, |
1489 | }; | 1489 | }; |
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 68c57d38745a..d43d2d0b90e3 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -149,7 +149,6 @@ static int __fops ## _open(struct inode *inode, struct file *file) \ | |||
149 | return spufs_attr_open(inode, file, __get, __set, __fmt); \ | 149 | return spufs_attr_open(inode, file, __get, __set, __fmt); \ |
150 | } \ | 150 | } \ |
151 | static const struct file_operations __fops = { \ | 151 | static const struct file_operations __fops = { \ |
152 | .owner = THIS_MODULE, \ | ||
153 | .open = __fops ## _open, \ | 152 | .open = __fops ## _open, \ |
154 | .release = spufs_attr_release, \ | 153 | .release = spufs_attr_release, \ |
155 | .read = spufs_attr_read, \ | 154 | .read = spufs_attr_read, \ |
@@ -2591,7 +2590,6 @@ static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait) | |||
2591 | } | 2590 | } |
2592 | 2591 | ||
2593 | static const struct file_operations spufs_switch_log_fops = { | 2592 | static const struct file_operations spufs_switch_log_fops = { |
2594 | .owner = THIS_MODULE, | ||
2595 | .open = spufs_switch_log_open, | 2593 | .open = spufs_switch_log_open, |
2596 | .read = spufs_switch_log_read, | 2594 | .read = spufs_switch_log_read, |
2597 | .poll = spufs_switch_log_poll, | 2595 | .poll = spufs_switch_log_poll, |
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index d6491bd481d0..f93cdf55628c 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c | |||
@@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void) | |||
452 | 452 | ||
453 | ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops); | 453 | ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops); |
454 | if (ent) | 454 | if (ent) |
455 | ent->size = 0; | 455 | proc_set_size(ent, 0); |
456 | 456 | ||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index 47f3cda2a68b..b502ab61aafa 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -41,13 +41,12 @@ | |||
41 | 41 | ||
42 | 42 | ||
43 | static unsigned int ibm_scan_log_dump; /* RTAS token */ | 43 | static unsigned int ibm_scan_log_dump; /* RTAS token */ |
44 | static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */ | 44 | static unsigned int *scanlog_buffer; /* The data buffer */ |
45 | 45 | ||
46 | static ssize_t scanlog_read(struct file *file, char __user *buf, | 46 | static ssize_t scanlog_read(struct file *file, char __user *buf, |
47 | size_t count, loff_t *ppos) | 47 | size_t count, loff_t *ppos) |
48 | { | 48 | { |
49 | struct proc_dir_entry *dp = PDE(file_inode(file)); | 49 | unsigned int *data = scanlog_buffer; |
50 | unsigned int *data = (unsigned int *)dp->data; | ||
51 | int status; | 50 | int status; |
52 | unsigned long len, off; | 51 | unsigned long len, off; |
53 | unsigned int wait_time; | 52 | unsigned int wait_time; |
@@ -135,8 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf, | |||
135 | 134 | ||
136 | static int scanlog_open(struct inode * inode, struct file * file) | 135 | static int scanlog_open(struct inode * inode, struct file * file) |
137 | { | 136 | { |
138 | struct proc_dir_entry *dp = PDE(inode); | 137 | unsigned int *data = scanlog_buffer; |
139 | unsigned int *data = (unsigned int *)dp->data; | ||
140 | 138 | ||
141 | if (data[0] != 0) { | 139 | if (data[0] != 0) { |
142 | /* This imperfect test stops a second copy of the | 140 | /* This imperfect test stops a second copy of the |
@@ -152,11 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file) | |||
152 | 150 | ||
153 | static int scanlog_release(struct inode * inode, struct file * file) | 151 | static int scanlog_release(struct inode * inode, struct file * file) |
154 | { | 152 | { |
155 | struct proc_dir_entry *dp = PDE(inode); | 153 | unsigned int *data = scanlog_buffer; |
156 | unsigned int *data = (unsigned int *)dp->data; | ||
157 | 154 | ||
158 | data[0] = 0; | 155 | data[0] = 0; |
159 | |||
160 | return 0; | 156 | return 0; |
161 | } | 157 | } |
162 | 158 | ||
@@ -172,7 +168,6 @@ const struct file_operations scanlog_fops = { | |||
172 | static int __init scanlog_init(void) | 168 | static int __init scanlog_init(void) |
173 | { | 169 | { |
174 | struct proc_dir_entry *ent; | 170 | struct proc_dir_entry *ent; |
175 | void *data; | ||
176 | int err = -ENOMEM; | 171 | int err = -ENOMEM; |
177 | 172 | ||
178 | ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); | 173 | ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); |
@@ -180,29 +175,24 @@ static int __init scanlog_init(void) | |||
180 | return -ENODEV; | 175 | return -ENODEV; |
181 | 176 | ||
182 | /* Ideally we could allocate a buffer < 4G */ | 177 | /* Ideally we could allocate a buffer < 4G */ |
183 | data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); | 178 | scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); |
184 | if (!data) | 179 | if (!scanlog_buffer) |
185 | goto err; | 180 | goto err; |
186 | 181 | ||
187 | ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL, | 182 | ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL, |
188 | &scanlog_fops, data); | 183 | &scanlog_fops); |
189 | if (!ent) | 184 | if (!ent) |
190 | goto err; | 185 | goto err; |
191 | |||
192 | proc_ppc64_scan_log_dump = ent; | ||
193 | |||
194 | return 0; | 186 | return 0; |
195 | err: | 187 | err: |
196 | kfree(data); | 188 | kfree(scanlog_buffer); |
197 | return err; | 189 | return err; |
198 | } | 190 | } |
199 | 191 | ||
200 | static void __exit scanlog_cleanup(void) | 192 | static void __exit scanlog_cleanup(void) |
201 | { | 193 | { |
202 | if (proc_ppc64_scan_log_dump) { | 194 | remove_proc_entry("powerpc/rtas/scan-log-dump", NULL); |
203 | kfree(proc_ppc64_scan_log_dump->data); | 195 | kfree(scanlog_buffer); |
204 | remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent); | ||
205 | } | ||
206 | } | 196 | } |
207 | 197 | ||
208 | module_init(scanlog_init); | 198 | module_init(scanlog_init); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 17644c8e10e1..2d72d9e96c15 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1323,22 +1323,6 @@ ENTRY(compat_sys_keyctl_wrapper) | |||
1323 | llgfr %r6,%r6 # u32 | 1323 | llgfr %r6,%r6 # u32 |
1324 | jg compat_sys_keyctl # branch to system call | 1324 | jg compat_sys_keyctl # branch to system call |
1325 | 1325 | ||
1326 | ENTRY(compat_sys_preadv_wrapper) | ||
1327 | llgfr %r2,%r2 # unsigned long | ||
1328 | llgtr %r3,%r3 # compat_iovec * | ||
1329 | llgfr %r4,%r4 # unsigned long | ||
1330 | llgfr %r5,%r5 # u32 | ||
1331 | llgfr %r6,%r6 # u32 | ||
1332 | jg compat_sys_preadv # branch to system call | ||
1333 | |||
1334 | ENTRY(compat_sys_pwritev_wrapper) | ||
1335 | llgfr %r2,%r2 # unsigned long | ||
1336 | llgtr %r3,%r3 # compat_iovec * | ||
1337 | llgfr %r4,%r4 # unsigned long | ||
1338 | llgfr %r5,%r5 # u32 | ||
1339 | llgfr %r6,%r6 # u32 | ||
1340 | jg compat_sys_pwritev # branch to system call | ||
1341 | |||
1342 | ENTRY(sys_perf_event_open_wrapper) | 1326 | ENTRY(sys_perf_event_open_wrapper) |
1343 | llgtr %r2,%r2 # const struct perf_event_attr * | 1327 | llgtr %r2,%r2 # const struct perf_event_attr * |
1344 | lgfr %r3,%r3 # pid_t | 1328 | lgfr %r3,%r3 # pid_t |
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c index 4f5ef62934a4..f7fb58903f6a 100644 --- a/arch/s390/kernel/irq.c +++ b/arch/s390/kernel/irq.c | |||
@@ -162,10 +162,8 @@ asmlinkage void do_softirq(void) | |||
162 | #ifdef CONFIG_PROC_FS | 162 | #ifdef CONFIG_PROC_FS |
163 | void init_irq_proc(void) | 163 | void init_irq_proc(void) |
164 | { | 164 | { |
165 | struct proc_dir_entry *root_irq_dir; | 165 | if (proc_mkdir("irq", NULL)) |
166 | 166 | create_prof_cpu_mask(); | |
167 | root_irq_dir = proc_mkdir("irq", NULL); | ||
168 | create_prof_cpu_mask(root_irq_dir); | ||
169 | } | 167 | } |
170 | #endif | 168 | #endif |
171 | 169 | ||
diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index 46480d81df00..d112fc66f993 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/crash_dump.h> | 11 | #include <linux/crash_dump.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/slab.h> | ||
13 | #include <asm/checksum.h> | 14 | #include <asm/checksum.h> |
14 | #include <asm/lowcore.h> | 15 | #include <asm/lowcore.h> |
15 | #include <asm/os_info.h> | 16 | #include <asm/os_info.h> |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index d2baabed7148..9f214e992eed 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -336,8 +336,8 @@ SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper) | |||
336 | SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */ | 336 | SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */ |
337 | SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper) | 337 | SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper) |
338 | SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper) | 338 | SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper) |
339 | SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) | 339 | SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv) |
340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) | 340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev) |
341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */ | 341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */ |
342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) | 342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) |
343 | SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) | 343 | SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) |
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c index 1592aad7dbc4..d8f988a37d16 100644 --- a/arch/score/mm/init.c +++ b/arch/score/mm/init.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <linux/mman.h> | 32 | #include <linux/mman.h> |
33 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
34 | #include <linux/proc_fs.h> | 34 | #include <linux/kcore.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/initrd.h> | 36 | #include <linux/initrd.h> |
37 | 37 | ||
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c index f46848f088e4..851e5106e580 100644 --- a/arch/sh/drivers/dma/dma-api.c +++ b/arch/sh/drivers/dma/dma-api.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_fs.h> |
16 | #include <linux/seq_file.h> | ||
16 | #include <linux/list.h> | 17 | #include <linux/list.h> |
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
18 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
@@ -308,11 +309,9 @@ int dma_extend(unsigned int chan, unsigned long op, void *param) | |||
308 | } | 309 | } |
309 | EXPORT_SYMBOL(dma_extend); | 310 | EXPORT_SYMBOL(dma_extend); |
310 | 311 | ||
311 | static int dma_read_proc(char *buf, char **start, off_t off, | 312 | static int dma_proc_show(struct seq_file *m, void *v) |
312 | int len, int *eof, void *data) | ||
313 | { | 313 | { |
314 | struct dma_info *info; | 314 | struct dma_info *info = v; |
315 | char *p = buf; | ||
316 | 315 | ||
317 | if (list_empty(®istered_dmac_list)) | 316 | if (list_empty(®istered_dmac_list)) |
318 | return 0; | 317 | return 0; |
@@ -332,14 +331,26 @@ static int dma_read_proc(char *buf, char **start, off_t off, | |||
332 | if (!(channel->flags & DMA_CONFIGURED)) | 331 | if (!(channel->flags & DMA_CONFIGURED)) |
333 | continue; | 332 | continue; |
334 | 333 | ||
335 | p += sprintf(p, "%2d: %14s %s\n", i, | 334 | seq_printf(m, "%2d: %14s %s\n", i, |
336 | info->name, channel->dev_id); | 335 | info->name, channel->dev_id); |
337 | } | 336 | } |
338 | } | 337 | } |
339 | 338 | ||
340 | return p - buf; | 339 | return 0; |
340 | } | ||
341 | |||
342 | static int dma_proc_open(struct inode *inode, struct file *file) | ||
343 | { | ||
344 | return single_open(file, dma_proc_show, NULL); | ||
341 | } | 345 | } |
342 | 346 | ||
347 | static const struct file_operations dma_proc_fops = { | ||
348 | .open = dma_proc_open, | ||
349 | .read = seq_read, | ||
350 | .llseek = seq_lseek, | ||
351 | .release = seq_release, | ||
352 | }; | ||
353 | |||
343 | int register_dmac(struct dma_info *info) | 354 | int register_dmac(struct dma_info *info) |
344 | { | 355 | { |
345 | unsigned int total_channels, i; | 356 | unsigned int total_channels, i; |
@@ -412,8 +423,7 @@ EXPORT_SYMBOL(unregister_dmac); | |||
412 | static int __init dma_api_init(void) | 423 | static int __init dma_api_init(void) |
413 | { | 424 | { |
414 | printk(KERN_NOTICE "DMA: Registering DMA API.\n"); | 425 | printk(KERN_NOTICE "DMA: Registering DMA API.\n"); |
415 | return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0) | 426 | return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM; |
416 | ? 0 : -ENOMEM; | ||
417 | } | 427 | } |
418 | subsys_initcall(dma_api_init); | 428 | subsys_initcall(dma_api_init); |
419 | 429 | ||
diff --git a/arch/sh/mm/alignment.c b/arch/sh/mm/alignment.c index aea14855e656..ec2b25302427 100644 --- a/arch/sh/mm/alignment.c +++ b/arch/sh/mm/alignment.c | |||
@@ -140,7 +140,7 @@ static int alignment_proc_open(struct inode *inode, struct file *file) | |||
140 | static ssize_t alignment_proc_write(struct file *file, | 140 | static ssize_t alignment_proc_write(struct file *file, |
141 | const char __user *buffer, size_t count, loff_t *pos) | 141 | const char __user *buffer, size_t count, loff_t *pos) |
142 | { | 142 | { |
143 | int *data = PDE(file_inode(file))->data; | 143 | int *data = PDE_DATA(file_inode(file)); |
144 | char mode; | 144 | char mode; |
145 | 145 | ||
146 | if (count > 0) { | 146 | if (count > 0) { |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 0f094db918c7..2096468de9b2 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -693,7 +693,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v) | |||
693 | 693 | ||
694 | static int sparc_io_proc_open(struct inode *inode, struct file *file) | 694 | static int sparc_io_proc_open(struct inode *inode, struct file *file) |
695 | { | 695 | { |
696 | return single_open(file, sparc_io_proc_show, PDE(inode)->data); | 696 | return single_open(file, sparc_io_proc_show, PDE_DATA(inode)); |
697 | } | 697 | } |
698 | 698 | ||
699 | static const struct file_operations sparc_io_proc_fops = { | 699 | static const struct file_operations sparc_io_proc_fops = { |
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index e490ac9327c7..f8933be3ca8b 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/kernel_stat.h> | 8 | #include <linux/kernel_stat.h> |
9 | #include <linux/slab.h> | ||
9 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
10 | 11 | ||
11 | #include <asm/timer.h> | 12 | #include <asm/timer.h> |
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c index 20273ee37deb..38ac189d9575 100644 --- a/arch/tile/kernel/hardwall.c +++ b/arch/tile/kernel/hardwall.c | |||
@@ -914,7 +914,7 @@ static int hardwall_proc_show(struct seq_file *sf, void *v) | |||
914 | static int hardwall_proc_open(struct inode *inode, | 914 | static int hardwall_proc_open(struct inode *inode, |
915 | struct file *file) | 915 | struct file *file) |
916 | { | 916 | { |
917 | return single_open(file, hardwall_proc_show, PDE(inode)->data); | 917 | return single_open(file, hardwall_proc_show, PDE_DATA(inode)); |
918 | } | 918 | } |
919 | 919 | ||
920 | static const struct file_operations hardwall_proc_fops = { | 920 | static const struct file_operations hardwall_proc_fops = { |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 4bd82ac0210f..d7d21851e60c 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -782,8 +782,7 @@ static int create_proc_mconsole(void) | |||
782 | 782 | ||
783 | ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops); | 783 | ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops); |
784 | if (ent == NULL) { | 784 | if (ent == NULL) { |
785 | printk(KERN_INFO "create_proc_mconsole : create_proc_entry " | 785 | printk(KERN_INFO "create_proc_mconsole : proc_create failed\n"); |
786 | "failed\n"); | ||
787 | return 0; | 786 | return 0; |
788 | } | 787 | } |
789 | return 0; | 788 | return 0; |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 81e94d972f1b..805078e08013 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -322,11 +322,8 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
322 | 322 | ||
323 | if (N_MAGIC(ex) == OMAGIC) { | 323 | if (N_MAGIC(ex) == OMAGIC) { |
324 | unsigned long text_addr, map_size; | 324 | unsigned long text_addr, map_size; |
325 | loff_t pos; | ||
326 | 325 | ||
327 | text_addr = N_TXTADDR(ex); | 326 | text_addr = N_TXTADDR(ex); |
328 | |||
329 | pos = 32; | ||
330 | map_size = ex.a_text+ex.a_data; | 327 | map_size = ex.a_text+ex.a_data; |
331 | 328 | ||
332 | error = vm_brk(text_addr & PAGE_MASK, map_size); | 329 | error = vm_brk(text_addr & PAGE_MASK, map_size); |
@@ -336,15 +333,12 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
336 | return error; | 333 | return error; |
337 | } | 334 | } |
338 | 335 | ||
339 | error = bprm->file->f_op->read(bprm->file, | 336 | error = read_code(bprm->file, text_addr, 32, |
340 | (char __user *)text_addr, | 337 | ex.a_text + ex.a_data); |
341 | ex.a_text+ex.a_data, &pos); | ||
342 | if ((signed long)error < 0) { | 338 | if ((signed long)error < 0) { |
343 | send_sig(SIGKILL, current, 0); | 339 | send_sig(SIGKILL, current, 0); |
344 | return error; | 340 | return error; |
345 | } | 341 | } |
346 | |||
347 | flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data); | ||
348 | } else { | 342 | } else { |
349 | #ifdef WARN_OLD | 343 | #ifdef WARN_OLD |
350 | static unsigned long error_time, error_time2; | 344 | static unsigned long error_time, error_time2; |
@@ -366,15 +360,9 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
366 | #endif | 360 | #endif |
367 | 361 | ||
368 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { | 362 | if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { |
369 | loff_t pos = fd_offset; | ||
370 | |||
371 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | 363 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
372 | bprm->file->f_op->read(bprm->file, | 364 | read_code(bprm->file, N_TXTADDR(ex), fd_offset, |
373 | (char __user *)N_TXTADDR(ex), | 365 | ex.a_text+ex.a_data); |
374 | ex.a_text+ex.a_data, &pos); | ||
375 | flush_icache_range((unsigned long) N_TXTADDR(ex), | ||
376 | (unsigned long) N_TXTADDR(ex) + | ||
377 | ex.a_text+ex.a_data); | ||
378 | goto beyond_if; | 366 | goto beyond_if; |
379 | } | 367 | } |
380 | 368 | ||
@@ -451,8 +439,6 @@ static int load_aout_library(struct file *file) | |||
451 | start_addr = ex.a_entry & 0xfffff000; | 439 | start_addr = ex.a_entry & 0xfffff000; |
452 | 440 | ||
453 | if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { | 441 | if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { |
454 | loff_t pos = N_TXTOFF(ex); | ||
455 | |||
456 | #ifdef WARN_OLD | 442 | #ifdef WARN_OLD |
457 | static unsigned long error_time; | 443 | static unsigned long error_time; |
458 | if (time_after(jiffies, error_time + 5*HZ)) { | 444 | if (time_after(jiffies, error_time + 5*HZ)) { |
@@ -465,12 +451,8 @@ static int load_aout_library(struct file *file) | |||
465 | #endif | 451 | #endif |
466 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | 452 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
467 | 453 | ||
468 | file->f_op->read(file, (char __user *)start_addr, | 454 | read_code(file, start_addr, N_TXTOFF(ex), |
469 | ex.a_text + ex.a_data, &pos); | 455 | ex.a_text + ex.a_data); |
470 | flush_icache_range((unsigned long) start_addr, | ||
471 | (unsigned long) start_addr + ex.a_text + | ||
472 | ex.a_data); | ||
473 | |||
474 | retval = 0; | 456 | retval = 0; |
475 | goto out; | 457 | goto out; |
476 | } | 458 | } |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index caad9a0ee19f..bb00c4672ad6 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/memory_hotplug.h> | 32 | #include <linux/memory_hotplug.h> |
33 | #include <linux/nmi.h> | 33 | #include <linux/nmi.h> |
34 | #include <linux/gfp.h> | 34 | #include <linux/gfp.h> |
35 | #include <linux/kcore.h> | ||
35 | 36 | ||
36 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
37 | #include <asm/bios_ebda.h> | 38 | #include <asm/bios_ebda.h> |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 6b85db0a7ccc..55856b2310d3 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/efi-bgrt.h> | 34 | #include <linux/efi-bgrt.h> |
35 | #include <linux/export.h> | 35 | #include <linux/export.h> |
36 | #include <linux/bootmem.h> | 36 | #include <linux/bootmem.h> |
37 | #include <linux/slab.h> | ||
37 | #include <linux/memblock.h> | 38 | #include <linux/memblock.h> |
38 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
39 | #include <linux/uaccess.h> | 40 | #include <linux/uaccess.h> |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 2b2003860615..39a0e7f1f0a3 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/reboot.h> | 29 | #include <linux/reboot.h> |
30 | #include <linux/slab.h> | ||
30 | 31 | ||
31 | #include <asm/setup.h> | 32 | #include <asm/setup.h> |
32 | #include <asm/page.h> | 33 | #include <asm/page.h> |
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c index f58ffc3b68a8..4a06d70ddf5e 100644 --- a/arch/xtensa/platforms/iss/simdisk.c +++ b/arch/xtensa/platforms/iss/simdisk.c | |||
@@ -214,20 +214,27 @@ static int simdisk_detach(struct simdisk *dev) | |||
214 | return err; | 214 | return err; |
215 | } | 215 | } |
216 | 216 | ||
217 | static int proc_read_simdisk(char *page, char **start, off_t off, | 217 | static ssize_t proc_read_simdisk(struct file *file, char __user *buf, |
218 | int count, int *eof, void *data) | 218 | size_t size, loff_t *ppos) |
219 | { | 219 | { |
220 | int len; | 220 | struct simdisk *dev = PDE_DATA(file_inode(file)); |
221 | struct simdisk *dev = (struct simdisk *) data; | 221 | char *s = dev->filename; |
222 | len = sprintf(page, "%s\n", dev->filename ? dev->filename : ""); | 222 | if (s) { |
223 | return len; | 223 | ssize_t n = simple_read_from_buffer(buf, size, ppos, |
224 | s, strlen(s)); | ||
225 | if (n < 0) | ||
226 | return n; | ||
227 | buf += n; | ||
228 | size -= n; | ||
229 | } | ||
230 | return simple_read_from_buffer(buf, size, ppos, "\n", 1); | ||
224 | } | 231 | } |
225 | 232 | ||
226 | static int proc_write_simdisk(struct file *file, const char *buffer, | 233 | static ssize_t proc_write_simdisk(struct file *file, const char __user *buf, |
227 | unsigned long count, void *data) | 234 | size_t size, loff_t *ppos) |
228 | { | 235 | { |
229 | char *tmp = kmalloc(count + 1, GFP_KERNEL); | 236 | char *tmp = kmalloc(count + 1, GFP_KERNEL); |
230 | struct simdisk *dev = (struct simdisk *) data; | 237 | struct simdisk *dev = PDE_DATA(file_inode(file)); |
231 | int err; | 238 | int err; |
232 | 239 | ||
233 | if (tmp == NULL) | 240 | if (tmp == NULL) |
@@ -256,6 +263,12 @@ out_free: | |||
256 | return err; | 263 | return err; |
257 | } | 264 | } |
258 | 265 | ||
266 | static const struct file_operations fops = { | ||
267 | .read = proc_read_simdisk, | ||
268 | .write = proc_write_simdisk, | ||
269 | .llseek = default_llseek, | ||
270 | }; | ||
271 | |||
259 | static int __init simdisk_setup(struct simdisk *dev, int which, | 272 | static int __init simdisk_setup(struct simdisk *dev, int which, |
260 | struct proc_dir_entry *procdir) | 273 | struct proc_dir_entry *procdir) |
261 | { | 274 | { |
@@ -289,10 +302,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which, | |||
289 | set_capacity(dev->gd, 0); | 302 | set_capacity(dev->gd, 0); |
290 | add_disk(dev->gd); | 303 | add_disk(dev->gd); |
291 | 304 | ||
292 | dev->procfile = create_proc_entry(tmp, 0644, procdir); | 305 | dev->procfile = proc_create_data(tmp, 0644, procdir, &fops, dev); |
293 | dev->procfile->data = dev; | ||
294 | dev->procfile->read_proc = proc_read_simdisk; | ||
295 | dev->procfile->write_proc = proc_write_simdisk; | ||
296 | return 0; | 306 | return 0; |
297 | 307 | ||
298 | out_alloc_disk: | 308 | out_alloc_disk: |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 6d5bf649196d..00d2efd674df 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -194,7 +194,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) | |||
194 | 194 | ||
195 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) | 195 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) |
196 | { | 196 | { |
197 | return single_open(file, acpi_ac_seq_show, PDE(inode)->data); | 197 | return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); |
198 | } | 198 | } |
199 | 199 | ||
200 | static int acpi_ac_add_fs(struct acpi_device *device) | 200 | static int acpi_ac_add_fs(struct acpi_device *device) |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 0cc384b72943..e7100459ac4a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -929,7 +929,7 @@ static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \ | |||
929 | } \ | 929 | } \ |
930 | static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \ | 930 | static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \ |
931 | { \ | 931 | { \ |
932 | return single_open(file, acpi_battery_read_##_name, PDE(inode)->data); \ | 932 | return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \ |
933 | } | 933 | } |
934 | 934 | ||
935 | DECLARE_FILE_FUNCTIONS(info); | 935 | DECLARE_FILE_FUNCTIONS(info); |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 92a659aa6396..d2e617b5b3f6 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -129,7 +129,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | |||
129 | 129 | ||
130 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | 130 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) |
131 | { | 131 | { |
132 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | 132 | return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode)); |
133 | } | 133 | } |
134 | 134 | ||
135 | static const struct file_operations acpi_button_state_fops = { | 135 | static const struct file_operations acpi_button_state_fops = { |
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index 52ce76725c20..aa1227a7e3f2 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -120,7 +120,7 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset) | |||
120 | 120 | ||
121 | static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file) | 121 | static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file) |
122 | { | 122 | { |
123 | return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data); | 123 | return single_open(file, acpi_system_alarm_seq_show, PDE_DATA(inode)); |
124 | } | 124 | } |
125 | 125 | ||
126 | static int get_date_field(char **p, u32 * value) | 126 | static int get_date_field(char **p, u32 * value) |
@@ -397,7 +397,7 @@ static int | |||
397 | acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file) | 397 | acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file) |
398 | { | 398 | { |
399 | return single_open(file, acpi_system_wakeup_device_seq_show, | 399 | return single_open(file, acpi_system_wakeup_device_seq_show, |
400 | PDE(inode)->data); | 400 | PDE_DATA(inode)); |
401 | } | 401 | } |
402 | 402 | ||
403 | static const struct file_operations acpi_system_wakeup_device_fops = { | 403 | static const struct file_operations acpi_system_wakeup_device_fops = { |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index e523245643ac..b6241eeb1132 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -521,19 +521,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir, | |||
521 | return 0; | 521 | return 0; |
522 | } | 522 | } |
523 | 523 | ||
524 | static void | ||
525 | acpi_sbs_remove_fs(struct proc_dir_entry **dir, | ||
526 | struct proc_dir_entry *parent_dir) | ||
527 | { | ||
528 | if (*dir) { | ||
529 | remove_proc_entry(ACPI_SBS_FILE_INFO, *dir); | ||
530 | remove_proc_entry(ACPI_SBS_FILE_STATE, *dir); | ||
531 | remove_proc_entry(ACPI_SBS_FILE_ALARM, *dir); | ||
532 | remove_proc_entry((*dir)->name, parent_dir); | ||
533 | *dir = NULL; | ||
534 | } | ||
535 | } | ||
536 | |||
537 | /* Smart Battery Interface */ | 524 | /* Smart Battery Interface */ |
538 | static struct proc_dir_entry *acpi_battery_dir = NULL; | 525 | static struct proc_dir_entry *acpi_battery_dir = NULL; |
539 | 526 | ||
@@ -584,7 +571,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
584 | 571 | ||
585 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) | 572 | static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) |
586 | { | 573 | { |
587 | return single_open(file, acpi_battery_read_info, PDE(inode)->data); | 574 | return single_open(file, acpi_battery_read_info, PDE_DATA(inode)); |
588 | } | 575 | } |
589 | 576 | ||
590 | static int acpi_battery_read_state(struct seq_file *seq, void *offset) | 577 | static int acpi_battery_read_state(struct seq_file *seq, void *offset) |
@@ -623,7 +610,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
623 | 610 | ||
624 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | 611 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) |
625 | { | 612 | { |
626 | return single_open(file, acpi_battery_read_state, PDE(inode)->data); | 613 | return single_open(file, acpi_battery_read_state, PDE_DATA(inode)); |
627 | } | 614 | } |
628 | 615 | ||
629 | static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | 616 | static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) |
@@ -688,7 +675,7 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer, | |||
688 | 675 | ||
689 | static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) | 676 | static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) |
690 | { | 677 | { |
691 | return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); | 678 | return single_open(file, acpi_battery_read_alarm, PDE_DATA(inode)); |
692 | } | 679 | } |
693 | 680 | ||
694 | static const struct file_operations acpi_battery_info_fops = { | 681 | static const struct file_operations acpi_battery_info_fops = { |
@@ -736,7 +723,7 @@ static int acpi_ac_read_state(struct seq_file *seq, void *offset) | |||
736 | 723 | ||
737 | static int acpi_ac_state_open_fs(struct inode *inode, struct file *file) | 724 | static int acpi_ac_state_open_fs(struct inode *inode, struct file *file) |
738 | { | 725 | { |
739 | return single_open(file, acpi_ac_read_state, PDE(inode)->data); | 726 | return single_open(file, acpi_ac_read_state, PDE_DATA(inode)); |
740 | } | 727 | } |
741 | 728 | ||
742 | static const struct file_operations acpi_ac_state_fops = { | 729 | static const struct file_operations acpi_ac_state_fops = { |
@@ -836,8 +823,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | |||
836 | power_supply_unregister(&battery->bat); | 823 | power_supply_unregister(&battery->bat); |
837 | } | 824 | } |
838 | #ifdef CONFIG_ACPI_PROCFS_POWER | 825 | #ifdef CONFIG_ACPI_PROCFS_POWER |
839 | if (battery->proc_entry) | 826 | proc_remove(battery->proc_entry); |
840 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | 827 | battery->proc_entry = NULL; |
841 | #endif | 828 | #endif |
842 | } | 829 | } |
843 | 830 | ||
@@ -873,8 +860,8 @@ static void acpi_charger_remove(struct acpi_sbs *sbs) | |||
873 | if (sbs->charger.dev) | 860 | if (sbs->charger.dev) |
874 | power_supply_unregister(&sbs->charger); | 861 | power_supply_unregister(&sbs->charger); |
875 | #ifdef CONFIG_ACPI_PROCFS_POWER | 862 | #ifdef CONFIG_ACPI_PROCFS_POWER |
876 | if (sbs->charger_entry) | 863 | proc_remove(sbs->charger_entry); |
877 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 864 | sbs->charger_entry = NULL; |
878 | #endif | 865 | #endif |
879 | } | 866 | } |
880 | 867 | ||
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 08608de87e4e..dc4f70179e7d 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -322,23 +322,11 @@ static u8 k2_stat_check_status(struct ata_port *ap) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | #ifdef CONFIG_PPC_OF | 324 | #ifdef CONFIG_PPC_OF |
325 | /* | 325 | static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost) |
326 | * k2_sata_proc_info | ||
327 | * inout : decides on the direction of the dataflow and the meaning of the | ||
328 | * variables | ||
329 | * buffer: If inout==FALSE data is being written to it else read from it | ||
330 | * *start: If inout==FALSE start of the valid data in the buffer | ||
331 | * offset: If inout==FALSE offset from the beginning of the imaginary file | ||
332 | * from which we start writing into the buffer | ||
333 | * length: If inout==FALSE max number of bytes to be written into the buffer | ||
334 | * else number of bytes in the buffer | ||
335 | */ | ||
336 | static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, | ||
337 | off_t offset, int count, int inout) | ||
338 | { | 326 | { |
339 | struct ata_port *ap; | 327 | struct ata_port *ap; |
340 | struct device_node *np; | 328 | struct device_node *np; |
341 | int len, index; | 329 | int index; |
342 | 330 | ||
343 | /* Find the ata_port */ | 331 | /* Find the ata_port */ |
344 | ap = ata_shost_to_port(shost); | 332 | ap = ata_shost_to_port(shost); |
@@ -356,15 +344,12 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, | |||
356 | const u32 *reg = of_get_property(np, "reg", NULL); | 344 | const u32 *reg = of_get_property(np, "reg", NULL); |
357 | if (!reg) | 345 | if (!reg) |
358 | continue; | 346 | continue; |
359 | if (index == *reg) | 347 | if (index == *reg) { |
348 | seq_printf(m, "devspec: %s\n", np->full_name); | ||
360 | break; | 349 | break; |
350 | } | ||
361 | } | 351 | } |
362 | if (np == NULL) | 352 | return 0; |
363 | return 0; | ||
364 | |||
365 | len = sprintf(page, "devspec: %s\n", np->full_name); | ||
366 | |||
367 | return len; | ||
368 | } | 353 | } |
369 | #endif /* CONFIG_PPC_OF */ | 354 | #endif /* CONFIG_PPC_OF */ |
370 | 355 | ||
@@ -372,7 +357,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start, | |||
372 | static struct scsi_host_template k2_sata_sht = { | 357 | static struct scsi_host_template k2_sata_sht = { |
373 | ATA_BMDMA_SHT(DRV_NAME), | 358 | ATA_BMDMA_SHT(DRV_NAME), |
374 | #ifdef CONFIG_PPC_OF | 359 | #ifdef CONFIG_PPC_OF |
375 | .proc_info = k2_sata_proc_info, | 360 | .show_info = k2_sata_show_info, |
376 | #endif | 361 | #endif |
377 | }; | 362 | }; |
378 | 363 | ||
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 5b5ee79ff236..eb3950113e42 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -6473,7 +6473,7 @@ static int dac960_initial_status_proc_show(struct seq_file *m, void *v) | |||
6473 | 6473 | ||
6474 | static int dac960_initial_status_proc_open(struct inode *inode, struct file *file) | 6474 | static int dac960_initial_status_proc_open(struct inode *inode, struct file *file) |
6475 | { | 6475 | { |
6476 | return single_open(file, dac960_initial_status_proc_show, PDE(inode)->data); | 6476 | return single_open(file, dac960_initial_status_proc_show, PDE_DATA(inode)); |
6477 | } | 6477 | } |
6478 | 6478 | ||
6479 | static const struct file_operations dac960_initial_status_proc_fops = { | 6479 | static const struct file_operations dac960_initial_status_proc_fops = { |
@@ -6519,7 +6519,7 @@ static int dac960_current_status_proc_show(struct seq_file *m, void *v) | |||
6519 | 6519 | ||
6520 | static int dac960_current_status_proc_open(struct inode *inode, struct file *file) | 6520 | static int dac960_current_status_proc_open(struct inode *inode, struct file *file) |
6521 | { | 6521 | { |
6522 | return single_open(file, dac960_current_status_proc_show, PDE(inode)->data); | 6522 | return single_open(file, dac960_current_status_proc_show, PDE_DATA(inode)); |
6523 | } | 6523 | } |
6524 | 6524 | ||
6525 | static const struct file_operations dac960_current_status_proc_fops = { | 6525 | static const struct file_operations dac960_current_status_proc_fops = { |
@@ -6540,14 +6540,14 @@ static int dac960_user_command_proc_show(struct seq_file *m, void *v) | |||
6540 | 6540 | ||
6541 | static int dac960_user_command_proc_open(struct inode *inode, struct file *file) | 6541 | static int dac960_user_command_proc_open(struct inode *inode, struct file *file) |
6542 | { | 6542 | { |
6543 | return single_open(file, dac960_user_command_proc_show, PDE(inode)->data); | 6543 | return single_open(file, dac960_user_command_proc_show, PDE_DATA(inode)); |
6544 | } | 6544 | } |
6545 | 6545 | ||
6546 | static ssize_t dac960_user_command_proc_write(struct file *file, | 6546 | static ssize_t dac960_user_command_proc_write(struct file *file, |
6547 | const char __user *Buffer, | 6547 | const char __user *Buffer, |
6548 | size_t Count, loff_t *pos) | 6548 | size_t Count, loff_t *pos) |
6549 | { | 6549 | { |
6550 | DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file_inode(file))->data; | 6550 | DAC960_Controller_T *Controller = PDE_DATA(file_inode(file)); |
6551 | unsigned char CommandBuffer[80]; | 6551 | unsigned char CommandBuffer[80]; |
6552 | int Length; | 6552 | int Length; |
6553 | if (Count > sizeof(CommandBuffer)-1) return -EINVAL; | 6553 | if (Count > sizeof(CommandBuffer)-1) return -EINVAL; |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 1c1b8e544aa2..e18c99140c0a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -493,7 +493,7 @@ static int cciss_seq_open(struct inode *inode, struct file *file) | |||
493 | struct seq_file *seq = file->private_data; | 493 | struct seq_file *seq = file->private_data; |
494 | 494 | ||
495 | if (!ret) | 495 | if (!ret) |
496 | seq->private = PDE(inode)->data; | 496 | seq->private = PDE_DATA(inode); |
497 | 497 | ||
498 | return ret; | 498 | return ret; |
499 | } | 499 | } |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index da3311129a0c..ecd845cd28d8 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -54,13 +54,11 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h); | |||
54 | static void cmd_free(ctlr_info_t *h, CommandList_struct *c); | 54 | static void cmd_free(ctlr_info_t *h, CommandList_struct *c); |
55 | static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c); | 55 | static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c); |
56 | 56 | ||
57 | static int cciss_scsi_proc_info( | 57 | static int cciss_scsi_write_info(struct Scsi_Host *sh, |
58 | struct Scsi_Host *sh, | ||
59 | char *buffer, /* data buffer */ | 58 | char *buffer, /* data buffer */ |
60 | char **start, /* where data in buffer starts */ | 59 | int length); /* length of data in buffer */ |
61 | off_t offset, /* offset from start of imaginary file */ | 60 | static int cciss_scsi_show_info(struct seq_file *m, |
62 | int length, /* length of data in buffer */ | 61 | struct Scsi_Host *sh); |
63 | int func); /* 0 == read, 1 == write */ | ||
64 | 62 | ||
65 | static int cciss_scsi_queue_command (struct Scsi_Host *h, | 63 | static int cciss_scsi_queue_command (struct Scsi_Host *h, |
66 | struct scsi_cmnd *cmd); | 64 | struct scsi_cmnd *cmd); |
@@ -82,7 +80,8 @@ static struct scsi_host_template cciss_driver_template = { | |||
82 | .module = THIS_MODULE, | 80 | .module = THIS_MODULE, |
83 | .name = "cciss", | 81 | .name = "cciss", |
84 | .proc_name = "cciss", | 82 | .proc_name = "cciss", |
85 | .proc_info = cciss_scsi_proc_info, | 83 | .write_info = cciss_scsi_write_info, |
84 | .show_info = cciss_scsi_show_info, | ||
86 | .queuecommand = cciss_scsi_queue_command, | 85 | .queuecommand = cciss_scsi_queue_command, |
87 | .this_id = 7, | 86 | .this_id = 7, |
88 | .cmd_per_lun = 1, | 87 | .cmd_per_lun = 1, |
@@ -1302,59 +1301,54 @@ cciss_scsi_user_command(ctlr_info_t *h, int hostno, char *buffer, int length) | |||
1302 | return length; | 1301 | return length; |
1303 | } | 1302 | } |
1304 | 1303 | ||
1305 | |||
1306 | static int | 1304 | static int |
1307 | cciss_scsi_proc_info(struct Scsi_Host *sh, | 1305 | cciss_scsi_write_info(struct Scsi_Host *sh, |
1308 | char *buffer, /* data buffer */ | 1306 | char *buffer, /* data buffer */ |
1309 | char **start, /* where data in buffer starts */ | 1307 | int length) /* length of data in buffer */ |
1310 | off_t offset, /* offset from start of imaginary file */ | ||
1311 | int length, /* length of data in buffer */ | ||
1312 | int func) /* 0 == read, 1 == write */ | ||
1313 | { | 1308 | { |
1309 | ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0]; | ||
1310 | if (h == NULL) /* This really shouldn't ever happen. */ | ||
1311 | return -EINVAL; | ||
1314 | 1312 | ||
1315 | int buflen, datalen; | 1313 | return cciss_scsi_user_command(h, sh->host_no, |
1316 | ctlr_info_t *h; | 1314 | buffer, length); |
1315 | } | ||
1316 | |||
1317 | static int | ||
1318 | cciss_scsi_show_info(struct seq_file *m, struct Scsi_Host *sh) | ||
1319 | { | ||
1320 | |||
1321 | ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0]; | ||
1317 | int i; | 1322 | int i; |
1318 | 1323 | ||
1319 | h = (ctlr_info_t *) sh->hostdata[0]; | ||
1320 | if (h == NULL) /* This really shouldn't ever happen. */ | 1324 | if (h == NULL) /* This really shouldn't ever happen. */ |
1321 | return -EINVAL; | 1325 | return -EINVAL; |
1322 | 1326 | ||
1323 | if (func == 0) { /* User is reading from /proc/scsi/ciss*?/?* */ | 1327 | seq_printf(m, "cciss%d: SCSI host: %d\n", |
1324 | buflen = sprintf(buffer, "cciss%d: SCSI host: %d\n", | 1328 | h->ctlr, sh->host_no); |
1325 | h->ctlr, sh->host_no); | 1329 | |
1326 | 1330 | /* this information is needed by apps to know which cciss | |
1327 | /* this information is needed by apps to know which cciss | 1331 | device corresponds to which scsi host number without |
1328 | device corresponds to which scsi host number without | 1332 | having to open a scsi target device node. The device |
1329 | having to open a scsi target device node. The device | 1333 | information is not a duplicate of /proc/scsi/scsi because |
1330 | information is not a duplicate of /proc/scsi/scsi because | 1334 | the two may be out of sync due to scsi hotplug, rather |
1331 | the two may be out of sync due to scsi hotplug, rather | 1335 | this info is for an app to be able to use to know how to |
1332 | this info is for an app to be able to use to know how to | 1336 | get them back in sync. */ |
1333 | get them back in sync. */ | 1337 | |
1334 | 1338 | for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) { | |
1335 | for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) { | 1339 | struct cciss_scsi_dev_t *sd = |
1336 | struct cciss_scsi_dev_t *sd = | 1340 | &ccissscsi[h->ctlr].dev[i]; |
1337 | &ccissscsi[h->ctlr].dev[i]; | 1341 | seq_printf(m, "c%db%dt%dl%d %02d " |
1338 | buflen += sprintf(&buffer[buflen], "c%db%dt%dl%d %02d " | 1342 | "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", |
1339 | "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", | 1343 | sh->host_no, sd->bus, sd->target, sd->lun, |
1340 | sh->host_no, sd->bus, sd->target, sd->lun, | 1344 | sd->devtype, |
1341 | sd->devtype, | 1345 | sd->scsi3addr[0], sd->scsi3addr[1], |
1342 | sd->scsi3addr[0], sd->scsi3addr[1], | 1346 | sd->scsi3addr[2], sd->scsi3addr[3], |
1343 | sd->scsi3addr[2], sd->scsi3addr[3], | 1347 | sd->scsi3addr[4], sd->scsi3addr[5], |
1344 | sd->scsi3addr[4], sd->scsi3addr[5], | 1348 | sd->scsi3addr[6], sd->scsi3addr[7]); |
1345 | sd->scsi3addr[6], sd->scsi3addr[7]); | 1349 | } |
1346 | } | 1350 | return 0; |
1347 | datalen = buflen - offset; | 1351 | } |
1348 | if (datalen < 0) { /* they're reading past EOF. */ | ||
1349 | datalen = 0; | ||
1350 | *start = buffer+buflen; | ||
1351 | } else | ||
1352 | *start = buffer + offset; | ||
1353 | return(datalen); | ||
1354 | } else /* User is writing to /proc/scsi/cciss*?/?* ... */ | ||
1355 | return cciss_scsi_user_command(h, sh->host_no, | ||
1356 | buffer, length); | ||
1357 | } | ||
1358 | 1352 | ||
1359 | /* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci | 1353 | /* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci |
1360 | dma mapping and fills in the scatter gather entries of the | 1354 | dma mapping and fills in the scatter gather entries of the |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 3f087133a25a..3b9e8ebcb96b 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -296,7 +296,7 @@ static int ida_proc_show(struct seq_file *m, void *v) | |||
296 | 296 | ||
297 | static int ida_proc_open(struct inode *inode, struct file *file) | 297 | static int ida_proc_open(struct inode *inode, struct file *file) |
298 | { | 298 | { |
299 | return single_open(file, ida_proc_show, PDE(inode)->data); | 299 | return single_open(file, ida_proc_show, PDE_DATA(inode)); |
300 | } | 300 | } |
301 | 301 | ||
302 | static const struct file_operations ida_proc_fops = { | 302 | static const struct file_operations ida_proc_fops = { |
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 56672a61eb94..928adb815b09 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
@@ -314,7 +314,7 @@ static int drbd_seq_show(struct seq_file *seq, void *v) | |||
314 | static int drbd_proc_open(struct inode *inode, struct file *file) | 314 | static int drbd_proc_open(struct inode *inode, struct file *file) |
315 | { | 315 | { |
316 | if (try_module_get(THIS_MODULE)) | 316 | if (try_module_get(THIS_MODULE)) |
317 | return single_open(file, drbd_seq_show, PDE(inode)->data); | 317 | return single_open(file, drbd_seq_show, PDE_DATA(inode)); |
318 | return -ENODEV; | 318 | return -ENODEV; |
319 | } | 319 | } |
320 | 320 | ||
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index dfe758382eaf..b2955b3f2cbc 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -230,9 +230,11 @@ static int __do_lo_send_write(struct file *file, | |||
230 | ssize_t bw; | 230 | ssize_t bw; |
231 | mm_segment_t old_fs = get_fs(); | 231 | mm_segment_t old_fs = get_fs(); |
232 | 232 | ||
233 | file_start_write(file); | ||
233 | set_fs(get_ds()); | 234 | set_fs(get_ds()); |
234 | bw = file->f_op->write(file, buf, len, &pos); | 235 | bw = file->f_op->write(file, buf, len, &pos); |
235 | set_fs(old_fs); | 236 | set_fs(old_fs); |
237 | file_end_write(file); | ||
236 | if (likely(bw == len)) | 238 | if (likely(bw == len)) |
237 | return 0; | 239 | return 0; |
238 | printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n", | 240 | printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n", |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 2e7de7a59bfc..e0588c6dd86f 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2648,7 +2648,7 @@ static int pkt_seq_show(struct seq_file *m, void *p) | |||
2648 | 2648 | ||
2649 | static int pkt_seq_open(struct inode *inode, struct file *file) | 2649 | static int pkt_seq_open(struct inode *inode, struct file *file) |
2650 | { | 2650 | { |
2651 | return single_open(file, pkt_seq_show, PDE(inode)->data); | 2651 | return single_open(file, pkt_seq_show, PDE_DATA(inode)); |
2652 | } | 2652 | } |
2653 | 2653 | ||
2654 | static const struct file_operations pkt_proc_fops = { | 2654 | static const struct file_operations pkt_proc_fops = { |
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 75e112d66006..06a2e53e5f37 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c | |||
@@ -525,7 +525,7 @@ static int ps3vram_proc_show(struct seq_file *m, void *v) | |||
525 | 525 | ||
526 | static int ps3vram_proc_open(struct inode *inode, struct file *file) | 526 | static int ps3vram_proc_open(struct inode *inode, struct file *file) |
527 | { | 527 | { |
528 | return single_open(file, ps3vram_proc_show, PDE(inode)->data); | 528 | return single_open(file, ps3vram_proc_show, PDE_DATA(inode)); |
529 | } | 529 | } |
530 | 530 | ||
531 | static const struct file_operations ps3vram_proc_fops = { | 531 | static const struct file_operations ps3vram_proc_fops = { |
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index 24ffd8cec51e..544b4ce617f8 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/miscdevice.h> | 6 | #include <linux/miscdevice.h> |
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | #include <linux/seq_file.h> | ||
9 | #include <linux/capability.h> | 10 | #include <linux/capability.h> |
10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
11 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
@@ -329,9 +330,7 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
329 | } | 330 | } |
330 | 331 | ||
331 | #ifdef THERM_USE_PROC | 332 | #ifdef THERM_USE_PROC |
332 | static int | 333 | static int ds1620_proc_therm_show(struct seq_file *m, void *v) |
333 | proc_therm_ds1620_read(char *buf, char **start, off_t offset, | ||
334 | int len, int *eof, void *unused) | ||
335 | { | 334 | { |
336 | struct therm th; | 335 | struct therm th; |
337 | int temp; | 336 | int temp; |
@@ -339,17 +338,25 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset, | |||
339 | ds1620_read_state(&th); | 338 | ds1620_read_state(&th); |
340 | temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9)); | 339 | temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9)); |
341 | 340 | ||
342 | len = sprintf(buf, "Thermostat: HI %i.%i, LOW %i.%i; " | 341 | seq_printf(m, "Thermostat: HI %i.%i, LOW %i.%i; temperature: %i.%i C, fan %s\n", |
343 | "temperature: %i.%i C, fan %s\n", | 342 | th.hi >> 1, th.hi & 1 ? 5 : 0, |
344 | th.hi >> 1, th.hi & 1 ? 5 : 0, | 343 | th.lo >> 1, th.lo & 1 ? 5 : 0, |
345 | th.lo >> 1, th.lo & 1 ? 5 : 0, | 344 | temp >> 1, temp & 1 ? 5 : 0, |
346 | temp >> 1, temp & 1 ? 5 : 0, | 345 | fan_state[netwinder_get_fan()]); |
347 | fan_state[netwinder_get_fan()]); | 346 | return 0; |
347 | } | ||
348 | 348 | ||
349 | return len; | 349 | static int ds1620_proc_therm_open(struct inode *inode, struct file *file) |
350 | { | ||
351 | return single_open(file, ds1620_proc_therm_show, NULL); | ||
350 | } | 352 | } |
351 | 353 | ||
352 | static struct proc_dir_entry *proc_therm_ds1620; | 354 | static const struct file_operations ds1620_proc_therm_fops = { |
355 | .open = ds1620_proc_therm_open, | ||
356 | .read = seq_read, | ||
357 | .llseek = seq_lseek, | ||
358 | .release = seq_release, | ||
359 | }; | ||
353 | #endif | 360 | #endif |
354 | 361 | ||
355 | static const struct file_operations ds1620_fops = { | 362 | static const struct file_operations ds1620_fops = { |
@@ -397,10 +404,7 @@ static int __init ds1620_init(void) | |||
397 | return ret; | 404 | return ret; |
398 | 405 | ||
399 | #ifdef THERM_USE_PROC | 406 | #ifdef THERM_USE_PROC |
400 | proc_therm_ds1620 = create_proc_entry("therm", 0, NULL); | 407 | if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops)) |
401 | if (proc_therm_ds1620) | ||
402 | proc_therm_ds1620->read_proc = proc_therm_ds1620_read; | ||
403 | else | ||
404 | printk(KERN_ERR "therm: unable to register /proc/therm\n"); | 408 | printk(KERN_ERR "therm: unable to register /proc/therm\n"); |
405 | #endif | 409 | #endif |
406 | 410 | ||
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index a082d00b0f11..ea54a6e3f5ad 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/rtc.h> | 35 | #include <linux/rtc.h> |
36 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
37 | #include <linux/seq_file.h> | ||
37 | #include <linux/efi.h> | 38 | #include <linux/efi.h> |
38 | #include <linux/uaccess.h> | 39 | #include <linux/uaccess.h> |
39 | 40 | ||
@@ -296,12 +297,10 @@ static struct miscdevice efi_rtc_dev= { | |||
296 | /* | 297 | /* |
297 | * We export RAW EFI information to /proc/driver/efirtc | 298 | * We export RAW EFI information to /proc/driver/efirtc |
298 | */ | 299 | */ |
299 | static int | 300 | static int efi_rtc_proc_show(struct seq_file *m, void *v) |
300 | efi_rtc_get_status(char *buf) | ||
301 | { | 301 | { |
302 | efi_time_t eft, alm; | 302 | efi_time_t eft, alm; |
303 | efi_time_cap_t cap; | 303 | efi_time_cap_t cap; |
304 | char *p = buf; | ||
305 | efi_bool_t enabled, pending; | 304 | efi_bool_t enabled, pending; |
306 | unsigned long flags; | 305 | unsigned long flags; |
307 | 306 | ||
@@ -316,64 +315,63 @@ efi_rtc_get_status(char *buf) | |||
316 | 315 | ||
317 | spin_unlock_irqrestore(&efi_rtc_lock,flags); | 316 | spin_unlock_irqrestore(&efi_rtc_lock,flags); |
318 | 317 | ||
319 | p += sprintf(p, | 318 | seq_printf(m, |
320 | "Time : %u:%u:%u.%09u\n" | 319 | "Time : %u:%u:%u.%09u\n" |
321 | "Date : %u-%u-%u\n" | 320 | "Date : %u-%u-%u\n" |
322 | "Daylight : %u\n", | 321 | "Daylight : %u\n", |
323 | eft.hour, eft.minute, eft.second, eft.nanosecond, | 322 | eft.hour, eft.minute, eft.second, eft.nanosecond, |
324 | eft.year, eft.month, eft.day, | 323 | eft.year, eft.month, eft.day, |
325 | eft.daylight); | 324 | eft.daylight); |
326 | 325 | ||
327 | if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) | 326 | if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) |
328 | p += sprintf(p, "Timezone : unspecified\n"); | 327 | seq_puts(m, "Timezone : unspecified\n"); |
329 | else | 328 | else |
330 | /* XXX fixme: convert to string? */ | 329 | /* XXX fixme: convert to string? */ |
331 | p += sprintf(p, "Timezone : %u\n", eft.timezone); | 330 | seq_printf(m, "Timezone : %u\n", eft.timezone); |
332 | 331 | ||
333 | 332 | ||
334 | p += sprintf(p, | 333 | seq_printf(m, |
335 | "Alarm Time : %u:%u:%u.%09u\n" | 334 | "Alarm Time : %u:%u:%u.%09u\n" |
336 | "Alarm Date : %u-%u-%u\n" | 335 | "Alarm Date : %u-%u-%u\n" |
337 | "Alarm Daylight : %u\n" | 336 | "Alarm Daylight : %u\n" |
338 | "Enabled : %s\n" | 337 | "Enabled : %s\n" |
339 | "Pending : %s\n", | 338 | "Pending : %s\n", |
340 | alm.hour, alm.minute, alm.second, alm.nanosecond, | 339 | alm.hour, alm.minute, alm.second, alm.nanosecond, |
341 | alm.year, alm.month, alm.day, | 340 | alm.year, alm.month, alm.day, |
342 | alm.daylight, | 341 | alm.daylight, |
343 | enabled == 1 ? "yes" : "no", | 342 | enabled == 1 ? "yes" : "no", |
344 | pending == 1 ? "yes" : "no"); | 343 | pending == 1 ? "yes" : "no"); |
345 | 344 | ||
346 | if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) | 345 | if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE) |
347 | p += sprintf(p, "Timezone : unspecified\n"); | 346 | seq_puts(m, "Timezone : unspecified\n"); |
348 | else | 347 | else |
349 | /* XXX fixme: convert to string? */ | 348 | /* XXX fixme: convert to string? */ |
350 | p += sprintf(p, "Timezone : %u\n", alm.timezone); | 349 | seq_printf(m, "Timezone : %u\n", alm.timezone); |
351 | 350 | ||
352 | /* | 351 | /* |
353 | * now prints the capabilities | 352 | * now prints the capabilities |
354 | */ | 353 | */ |
355 | p += sprintf(p, | 354 | seq_printf(m, |
356 | "Resolution : %u\n" | 355 | "Resolution : %u\n" |
357 | "Accuracy : %u\n" | 356 | "Accuracy : %u\n" |
358 | "SetstoZero : %u\n", | 357 | "SetstoZero : %u\n", |
359 | cap.resolution, cap.accuracy, cap.sets_to_zero); | 358 | cap.resolution, cap.accuracy, cap.sets_to_zero); |
360 | 359 | ||
361 | return p - buf; | 360 | return 0; |
362 | } | 361 | } |
363 | 362 | ||
364 | static int | 363 | static int efi_rtc_proc_open(struct inode *inode, struct file *file) |
365 | efi_rtc_read_proc(char *page, char **start, off_t off, | ||
366 | int count, int *eof, void *data) | ||
367 | { | 364 | { |
368 | int len = efi_rtc_get_status(page); | 365 | return single_open(file, efi_rtc_proc_show, NULL); |
369 | if (len <= off+count) *eof = 1; | ||
370 | *start = page + off; | ||
371 | len -= off; | ||
372 | if (len>count) len = count; | ||
373 | if (len<0) len = 0; | ||
374 | return len; | ||
375 | } | 366 | } |
376 | 367 | ||
368 | static const struct file_operations efi_rtc_proc_fops = { | ||
369 | .open = efi_rtc_proc_open, | ||
370 | .read = seq_read, | ||
371 | .llseek = seq_lseek, | ||
372 | .release = seq_release, | ||
373 | }; | ||
374 | |||
377 | static int __init | 375 | static int __init |
378 | efi_rtc_init(void) | 376 | efi_rtc_init(void) |
379 | { | 377 | { |
@@ -389,8 +387,7 @@ efi_rtc_init(void) | |||
389 | return ret; | 387 | return ret; |
390 | } | 388 | } |
391 | 389 | ||
392 | dir = create_proc_read_entry ("driver/efirtc", 0, NULL, | 390 | dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops); |
393 | efi_rtc_read_proc, NULL); | ||
394 | if (dir == NULL) { | 391 | if (dir == NULL) { |
395 | printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); | 392 | printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n"); |
396 | misc_deregister(&efi_rtc_dev); | 393 | misc_deregister(&efi_rtc_dev); |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index 21cb980f1157..bc9b84d56ee4 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
53 | #include <linux/poll.h> | 53 | #include <linux/poll.h> |
54 | #include <linux/proc_fs.h> | 54 | #include <linux/proc_fs.h> |
55 | #include <linux/seq_file.h> | ||
55 | #include <linux/mutex.h> | 56 | #include <linux/mutex.h> |
56 | #include <linux/workqueue.h> | 57 | #include <linux/workqueue.h> |
57 | 58 | ||
@@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file) | |||
386 | * Info exported via "/proc/driver/rtc". | 387 | * Info exported via "/proc/driver/rtc". |
387 | */ | 388 | */ |
388 | 389 | ||
389 | static int gen_rtc_proc_output(char *buf) | 390 | static int gen_rtc_proc_show(struct seq_file *m, void *v) |
390 | { | 391 | { |
391 | char *p; | ||
392 | struct rtc_time tm; | 392 | struct rtc_time tm; |
393 | unsigned int flags; | 393 | unsigned int flags; |
394 | struct rtc_pll_info pll; | 394 | struct rtc_pll_info pll; |
395 | 395 | ||
396 | p = buf; | ||
397 | |||
398 | flags = get_rtc_time(&tm); | 396 | flags = get_rtc_time(&tm); |
399 | 397 | ||
400 | p += sprintf(p, | 398 | seq_printf(m, |
401 | "rtc_time\t: %02d:%02d:%02d\n" | 399 | "rtc_time\t: %02d:%02d:%02d\n" |
402 | "rtc_date\t: %04d-%02d-%02d\n" | 400 | "rtc_date\t: %04d-%02d-%02d\n" |
403 | "rtc_epoch\t: %04u\n", | 401 | "rtc_epoch\t: %04u\n", |
@@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf) | |||
406 | 404 | ||
407 | tm.tm_hour = tm.tm_min = tm.tm_sec = 0; | 405 | tm.tm_hour = tm.tm_min = tm.tm_sec = 0; |
408 | 406 | ||
409 | p += sprintf(p, "alarm\t\t: "); | 407 | seq_puts(m, "alarm\t\t: "); |
410 | if (tm.tm_hour <= 24) | 408 | if (tm.tm_hour <= 24) |
411 | p += sprintf(p, "%02d:", tm.tm_hour); | 409 | seq_printf(m, "%02d:", tm.tm_hour); |
412 | else | 410 | else |
413 | p += sprintf(p, "**:"); | 411 | seq_puts(m, "**:"); |
414 | 412 | ||
415 | if (tm.tm_min <= 59) | 413 | if (tm.tm_min <= 59) |
416 | p += sprintf(p, "%02d:", tm.tm_min); | 414 | seq_printf(m, "%02d:", tm.tm_min); |
417 | else | 415 | else |
418 | p += sprintf(p, "**:"); | 416 | seq_puts(m, "**:"); |
419 | 417 | ||
420 | if (tm.tm_sec <= 59) | 418 | if (tm.tm_sec <= 59) |
421 | p += sprintf(p, "%02d\n", tm.tm_sec); | 419 | seq_printf(m, "%02d\n", tm.tm_sec); |
422 | else | 420 | else |
423 | p += sprintf(p, "**\n"); | 421 | seq_puts(m, "**\n"); |
424 | 422 | ||
425 | p += sprintf(p, | 423 | seq_printf(m, |
426 | "DST_enable\t: %s\n" | 424 | "DST_enable\t: %s\n" |
427 | "BCD\t\t: %s\n" | 425 | "BCD\t\t: %s\n" |
428 | "24hr\t\t: %s\n" | 426 | "24hr\t\t: %s\n" |
@@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf) | |||
442 | 0L /* freq */, | 440 | 0L /* freq */, |
443 | (flags & RTC_BATT_BAD) ? "bad" : "okay"); | 441 | (flags & RTC_BATT_BAD) ? "bad" : "okay"); |
444 | if (!get_rtc_pll(&pll)) | 442 | if (!get_rtc_pll(&pll)) |
445 | p += sprintf(p, | 443 | seq_printf(m, |
446 | "PLL adjustment\t: %d\n" | 444 | "PLL adjustment\t: %d\n" |
447 | "PLL max +ve adjustment\t: %d\n" | 445 | "PLL max +ve adjustment\t: %d\n" |
448 | "PLL max -ve adjustment\t: %d\n" | 446 | "PLL max -ve adjustment\t: %d\n" |
@@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf) | |||
455 | pll.pll_posmult, | 453 | pll.pll_posmult, |
456 | pll.pll_negmult, | 454 | pll.pll_negmult, |
457 | pll.pll_clock); | 455 | pll.pll_clock); |
458 | return p - buf; | 456 | return 0; |
459 | } | 457 | } |
460 | 458 | ||
461 | static int gen_rtc_read_proc(char *page, char **start, off_t off, | 459 | static int gen_rtc_proc_open(struct inode *inode, struct file *file) |
462 | int count, int *eof, void *data) | ||
463 | { | 460 | { |
464 | int len = gen_rtc_proc_output (page); | 461 | return single_open(file, gen_rtc_proc_show, NULL); |
465 | if (len <= off+count) *eof = 1; | ||
466 | *start = page + off; | ||
467 | len -= off; | ||
468 | if (len>count) len = count; | ||
469 | if (len<0) len = 0; | ||
470 | return len; | ||
471 | } | 462 | } |
472 | 463 | ||
464 | static const struct file_operations gen_rtc_proc_fops = { | ||
465 | .open = gen_rtc_proc_open, | ||
466 | .read = seq_read, | ||
467 | .llseek = seq_lseek, | ||
468 | .release = seq_release, | ||
469 | }; | ||
470 | |||
473 | static int __init gen_rtc_proc_init(void) | 471 | static int __init gen_rtc_proc_init(void) |
474 | { | 472 | { |
475 | struct proc_dir_entry *r; | 473 | struct proc_dir_entry *r; |
476 | 474 | ||
477 | r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL); | 475 | r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops); |
478 | if (!r) | 476 | if (!r) |
479 | return -ENOMEM; | 477 | return -ENOMEM; |
480 | return 0; | 478 | return 0; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 053201b062a4..4d439d2fcfd6 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -1917,7 +1917,7 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v) | |||
1917 | 1917 | ||
1918 | static int smi_ipmb_proc_open(struct inode *inode, struct file *file) | 1918 | static int smi_ipmb_proc_open(struct inode *inode, struct file *file) |
1919 | { | 1919 | { |
1920 | return single_open(file, smi_ipmb_proc_show, PDE(inode)->data); | 1920 | return single_open(file, smi_ipmb_proc_show, PDE_DATA(inode)); |
1921 | } | 1921 | } |
1922 | 1922 | ||
1923 | static const struct file_operations smi_ipmb_proc_ops = { | 1923 | static const struct file_operations smi_ipmb_proc_ops = { |
@@ -1938,7 +1938,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v) | |||
1938 | 1938 | ||
1939 | static int smi_version_proc_open(struct inode *inode, struct file *file) | 1939 | static int smi_version_proc_open(struct inode *inode, struct file *file) |
1940 | { | 1940 | { |
1941 | return single_open(file, smi_version_proc_show, PDE(inode)->data); | 1941 | return single_open(file, smi_version_proc_show, PDE_DATA(inode)); |
1942 | } | 1942 | } |
1943 | 1943 | ||
1944 | static const struct file_operations smi_version_proc_ops = { | 1944 | static const struct file_operations smi_version_proc_ops = { |
@@ -2013,7 +2013,7 @@ static int smi_stats_proc_show(struct seq_file *m, void *v) | |||
2013 | 2013 | ||
2014 | static int smi_stats_proc_open(struct inode *inode, struct file *file) | 2014 | static int smi_stats_proc_open(struct inode *inode, struct file *file) |
2015 | { | 2015 | { |
2016 | return single_open(file, smi_stats_proc_show, PDE(inode)->data); | 2016 | return single_open(file, smi_stats_proc_show, PDE_DATA(inode)); |
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | static const struct file_operations smi_stats_proc_ops = { | 2019 | static const struct file_operations smi_stats_proc_ops = { |
@@ -4541,7 +4541,7 @@ static void __exit cleanup_ipmi(void) | |||
4541 | del_timer_sync(&ipmi_timer); | 4541 | del_timer_sync(&ipmi_timer); |
4542 | 4542 | ||
4543 | #ifdef CONFIG_PROC_FS | 4543 | #ifdef CONFIG_PROC_FS |
4544 | remove_proc_entry(proc_ipmi_root->name, NULL); | 4544 | proc_remove(proc_ipmi_root); |
4545 | #endif /* CONFIG_PROC_FS */ | 4545 | #endif /* CONFIG_PROC_FS */ |
4546 | 4546 | ||
4547 | driver_unregister(&ipmidriver.driver); | 4547 | driver_unregister(&ipmidriver.driver); |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 0ac9b45a585e..313538abe63c 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -2839,7 +2839,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v) | |||
2839 | 2839 | ||
2840 | static int smi_type_proc_open(struct inode *inode, struct file *file) | 2840 | static int smi_type_proc_open(struct inode *inode, struct file *file) |
2841 | { | 2841 | { |
2842 | return single_open(file, smi_type_proc_show, PDE(inode)->data); | 2842 | return single_open(file, smi_type_proc_show, PDE_DATA(inode)); |
2843 | } | 2843 | } |
2844 | 2844 | ||
2845 | static const struct file_operations smi_type_proc_ops = { | 2845 | static const struct file_operations smi_type_proc_ops = { |
@@ -2882,7 +2882,7 @@ static int smi_si_stats_proc_show(struct seq_file *m, void *v) | |||
2882 | 2882 | ||
2883 | static int smi_si_stats_proc_open(struct inode *inode, struct file *file) | 2883 | static int smi_si_stats_proc_open(struct inode *inode, struct file *file) |
2884 | { | 2884 | { |
2885 | return single_open(file, smi_si_stats_proc_show, PDE(inode)->data); | 2885 | return single_open(file, smi_si_stats_proc_show, PDE_DATA(inode)); |
2886 | } | 2886 | } |
2887 | 2887 | ||
2888 | static const struct file_operations smi_si_stats_proc_ops = { | 2888 | static const struct file_operations smi_si_stats_proc_ops = { |
@@ -2910,7 +2910,7 @@ static int smi_params_proc_show(struct seq_file *m, void *v) | |||
2910 | 2910 | ||
2911 | static int smi_params_proc_open(struct inode *inode, struct file *file) | 2911 | static int smi_params_proc_open(struct inode *inode, struct file *file) |
2912 | { | 2912 | { |
2913 | return single_open(file, smi_params_proc_show, PDE(inode)->data); | 2913 | return single_open(file, smi_params_proc_show, PDE_DATA(inode)); |
2914 | } | 2914 | } |
2915 | 2915 | ||
2916 | static const struct file_operations smi_params_proc_ops = { | 2916 | static const struct file_operations smi_params_proc_ops = { |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 67615d6d038d..202d2c85ba2e 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/efi.h> | 1 | #include <linux/efi.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/pstore.h> | 3 | #include <linux/pstore.h> |
4 | #include <linux/slab.h> | ||
4 | #include <linux/ucs2_string.h> | 5 | #include <linux/ucs2_string.h> |
5 | 6 | ||
6 | #define DUMP_NAME_LEN 52 | 7 | #define DUMP_NAME_LEN 52 |
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 5e94897244cf..b623c599e572 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
@@ -67,6 +67,7 @@ | |||
67 | 67 | ||
68 | #include <linux/efi.h> | 68 | #include <linux/efi.h> |
69 | #include <linux/module.h> | 69 | #include <linux/module.h> |
70 | #include <linux/slab.h> | ||
70 | #include <linux/ucs2_string.h> | 71 | #include <linux/ucs2_string.h> |
71 | 72 | ||
72 | #define EFIVARS_VERSION "0.08" | 73 | #define EFIVARS_VERSION "0.08" |
diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c index ff5456b7df72..d7f2324b4fb1 100644 --- a/drivers/gpu/drm/drm_proc.c +++ b/drivers/gpu/drm/drm_proc.c | |||
@@ -49,7 +49,7 @@ | |||
49 | /** | 49 | /** |
50 | * Proc file list. | 50 | * Proc file list. |
51 | */ | 51 | */ |
52 | static struct drm_info_list drm_proc_list[] = { | 52 | static const struct drm_info_list drm_proc_list[] = { |
53 | {"name", drm_name_info, 0}, | 53 | {"name", drm_name_info, 0}, |
54 | {"vm", drm_vm_info, 0}, | 54 | {"vm", drm_vm_info, 0}, |
55 | {"clients", drm_clients_info, 0}, | 55 | {"clients", drm_clients_info, 0}, |
@@ -63,7 +63,7 @@ static struct drm_info_list drm_proc_list[] = { | |||
63 | 63 | ||
64 | static int drm_proc_open(struct inode *inode, struct file *file) | 64 | static int drm_proc_open(struct inode *inode, struct file *file) |
65 | { | 65 | { |
66 | struct drm_info_node* node = PDE(inode)->data; | 66 | struct drm_info_node* node = PDE_DATA(inode); |
67 | 67 | ||
68 | return single_open(file, node->info_ent->show, node); | 68 | return single_open(file, node->info_ent->show, node); |
69 | } | 69 | } |
@@ -89,13 +89,13 @@ static const struct file_operations drm_proc_fops = { | |||
89 | * Create a given set of proc files represented by an array of | 89 | * Create a given set of proc files represented by an array of |
90 | * gdm_proc_lists in the given root directory. | 90 | * gdm_proc_lists in the given root directory. |
91 | */ | 91 | */ |
92 | static int drm_proc_create_files(struct drm_info_list *files, int count, | 92 | static int drm_proc_create_files(const struct drm_info_list *files, int count, |
93 | struct proc_dir_entry *root, struct drm_minor *minor) | 93 | struct proc_dir_entry *root, struct drm_minor *minor) |
94 | { | 94 | { |
95 | struct drm_device *dev = minor->dev; | 95 | struct drm_device *dev = minor->dev; |
96 | struct proc_dir_entry *ent; | 96 | struct proc_dir_entry *ent; |
97 | struct drm_info_node *tmp; | 97 | struct drm_info_node *tmp; |
98 | int i, ret; | 98 | int i; |
99 | 99 | ||
100 | for (i = 0; i < count; i++) { | 100 | for (i = 0; i < count; i++) { |
101 | u32 features = files[i].driver_features; | 101 | u32 features = files[i].driver_features; |
@@ -105,10 +105,9 @@ static int drm_proc_create_files(struct drm_info_list *files, int count, | |||
105 | continue; | 105 | continue; |
106 | 106 | ||
107 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); | 107 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); |
108 | if (tmp == NULL) { | 108 | if (!tmp) |
109 | ret = -1; | 109 | return -1; |
110 | goto fail; | 110 | |
111 | } | ||
112 | tmp->minor = minor; | 111 | tmp->minor = minor; |
113 | tmp->info_ent = &files[i]; | 112 | tmp->info_ent = &files[i]; |
114 | list_add(&tmp->list, &minor->proc_nodes.list); | 113 | list_add(&tmp->list, &minor->proc_nodes.list); |
@@ -116,28 +115,20 @@ static int drm_proc_create_files(struct drm_info_list *files, int count, | |||
116 | ent = proc_create_data(files[i].name, S_IRUGO, root, | 115 | ent = proc_create_data(files[i].name, S_IRUGO, root, |
117 | &drm_proc_fops, tmp); | 116 | &drm_proc_fops, tmp); |
118 | if (!ent) { | 117 | if (!ent) { |
119 | DRM_ERROR("Cannot create /proc/dri/%s/%s\n", | 118 | DRM_ERROR("Cannot create /proc/dri/%u/%s\n", |
120 | root->name, files[i].name); | 119 | minor->index, files[i].name); |
121 | list_del(&tmp->list); | 120 | list_del(&tmp->list); |
122 | kfree(tmp); | 121 | kfree(tmp); |
123 | ret = -1; | 122 | return -1; |
124 | goto fail; | ||
125 | } | 123 | } |
126 | |||
127 | } | 124 | } |
128 | return 0; | 125 | return 0; |
129 | |||
130 | fail: | ||
131 | for (i = 0; i < count; i++) | ||
132 | remove_proc_entry(drm_proc_list[i].name, minor->proc_root); | ||
133 | return ret; | ||
134 | } | 126 | } |
135 | 127 | ||
136 | /** | 128 | /** |
137 | * Initialize the DRI proc filesystem for a device | 129 | * Initialize the DRI proc filesystem for a device |
138 | * | 130 | * |
139 | * \param dev DRM device | 131 | * \param dev DRM device |
140 | * \param minor device minor number | ||
141 | * \param root DRI proc dir entry. | 132 | * \param root DRI proc dir entry. |
142 | * \param dev_root resulting DRI device proc dir entry. | 133 | * \param dev_root resulting DRI device proc dir entry. |
143 | * \return root entry pointer on success, or NULL on failure. | 134 | * \return root entry pointer on success, or NULL on failure. |
@@ -146,14 +137,13 @@ fail: | |||
146 | * "/proc/dri/%minor%/", and each entry in proc_list as | 137 | * "/proc/dri/%minor%/", and each entry in proc_list as |
147 | * "/proc/dri/%minor%/%name%". | 138 | * "/proc/dri/%minor%/%name%". |
148 | */ | 139 | */ |
149 | int drm_proc_init(struct drm_minor *minor, int minor_id, | 140 | int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root) |
150 | struct proc_dir_entry *root) | ||
151 | { | 141 | { |
152 | char name[64]; | 142 | char name[12]; |
153 | int ret; | 143 | int ret; |
154 | 144 | ||
155 | INIT_LIST_HEAD(&minor->proc_nodes.list); | 145 | INIT_LIST_HEAD(&minor->proc_nodes.list); |
156 | sprintf(name, "%d", minor_id); | 146 | sprintf(name, "%u", minor->index); |
157 | minor->proc_root = proc_mkdir(name, root); | 147 | minor->proc_root = proc_mkdir(name, root); |
158 | if (!minor->proc_root) { | 148 | if (!minor->proc_root) { |
159 | DRM_ERROR("Cannot create /proc/dri/%s\n", name); | 149 | DRM_ERROR("Cannot create /proc/dri/%s\n", name); |
@@ -163,7 +153,7 @@ int drm_proc_init(struct drm_minor *minor, int minor_id, | |||
163 | ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES, | 153 | ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES, |
164 | minor->proc_root, minor); | 154 | minor->proc_root, minor); |
165 | if (ret) { | 155 | if (ret) { |
166 | remove_proc_entry(name, root); | 156 | remove_proc_subtree(name, root); |
167 | minor->proc_root = NULL; | 157 | minor->proc_root = NULL; |
168 | DRM_ERROR("Failed to create core drm proc files\n"); | 158 | DRM_ERROR("Failed to create core drm proc files\n"); |
169 | return ret; | 159 | return ret; |
@@ -172,7 +162,7 @@ int drm_proc_init(struct drm_minor *minor, int minor_id, | |||
172 | return 0; | 162 | return 0; |
173 | } | 163 | } |
174 | 164 | ||
175 | static int drm_proc_remove_files(struct drm_info_list *files, int count, | 165 | static int drm_proc_remove_files(const struct drm_info_list *files, int count, |
176 | struct drm_minor *minor) | 166 | struct drm_minor *minor) |
177 | { | 167 | { |
178 | struct list_head *pos, *q; | 168 | struct list_head *pos, *q; |
@@ -213,8 +203,7 @@ int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root) | |||
213 | drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor); | 203 | drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor); |
214 | 204 | ||
215 | sprintf(name, "%d", minor->index); | 205 | sprintf(name, "%d", minor->index); |
216 | remove_proc_entry(name, root); | 206 | remove_proc_subtree(name, root); |
217 | |||
218 | return 0; | 207 | return 0; |
219 | } | 208 | } |
220 | 209 | ||
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 7d30802a018f..16f3ec579b3b 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -352,7 +352,7 @@ int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type) | |||
352 | idr_replace(&drm_minors_idr, new_minor, minor_id); | 352 | idr_replace(&drm_minors_idr, new_minor, minor_id); |
353 | 353 | ||
354 | if (type == DRM_MINOR_LEGACY) { | 354 | if (type == DRM_MINOR_LEGACY) { |
355 | ret = drm_proc_init(new_minor, minor_id, drm_proc_root); | 355 | ret = drm_proc_init(new_minor, drm_proc_root); |
356 | if (ret) { | 356 | if (ret) { |
357 | DRM_ERROR("DRM: Failed to initialize /proc/dri.\n"); | 357 | DRM_ERROR("DRM: Failed to initialize /proc/dri.\n"); |
358 | goto err_mem; | 358 | goto err_mem; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 8126824daccb..b23113926388 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1408,7 +1408,7 @@ static int idecd_capacity_proc_show(struct seq_file *m, void *v) | |||
1408 | 1408 | ||
1409 | static int idecd_capacity_proc_open(struct inode *inode, struct file *file) | 1409 | static int idecd_capacity_proc_open(struct inode *inode, struct file *file) |
1410 | { | 1410 | { |
1411 | return single_open(file, idecd_capacity_proc_show, PDE(inode)->data); | 1411 | return single_open(file, idecd_capacity_proc_show, PDE_DATA(inode)); |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | static const struct file_operations idecd_capacity_proc_fops = { | 1414 | static const struct file_operations idecd_capacity_proc_fops = { |
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index 8b570a17bcd9..0d1fae6cba6d 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c | |||
@@ -53,7 +53,7 @@ static int idedisk_cache_proc_show(struct seq_file *m, void *v) | |||
53 | 53 | ||
54 | static int idedisk_cache_proc_open(struct inode *inode, struct file *file) | 54 | static int idedisk_cache_proc_open(struct inode *inode, struct file *file) |
55 | { | 55 | { |
56 | return single_open(file, idedisk_cache_proc_show, PDE(inode)->data); | 56 | return single_open(file, idedisk_cache_proc_show, PDE_DATA(inode)); |
57 | } | 57 | } |
58 | 58 | ||
59 | static const struct file_operations idedisk_cache_proc_fops = { | 59 | static const struct file_operations idedisk_cache_proc_fops = { |
@@ -74,7 +74,7 @@ static int idedisk_capacity_proc_show(struct seq_file *m, void *v) | |||
74 | 74 | ||
75 | static int idedisk_capacity_proc_open(struct inode *inode, struct file *file) | 75 | static int idedisk_capacity_proc_open(struct inode *inode, struct file *file) |
76 | { | 76 | { |
77 | return single_open(file, idedisk_capacity_proc_show, PDE(inode)->data); | 77 | return single_open(file, idedisk_capacity_proc_show, PDE_DATA(inode)); |
78 | } | 78 | } |
79 | 79 | ||
80 | static const struct file_operations idedisk_capacity_proc_fops = { | 80 | static const struct file_operations idedisk_capacity_proc_fops = { |
@@ -115,7 +115,7 @@ static int idedisk_sv_proc_show(struct seq_file *m, void *v) | |||
115 | 115 | ||
116 | static int idedisk_sv_proc_open(struct inode *inode, struct file *file) | 116 | static int idedisk_sv_proc_open(struct inode *inode, struct file *file) |
117 | { | 117 | { |
118 | return single_open(file, idedisk_sv_proc_show, PDE(inode)->data); | 118 | return single_open(file, idedisk_sv_proc_show, PDE_DATA(inode)); |
119 | } | 119 | } |
120 | 120 | ||
121 | static const struct file_operations idedisk_sv_proc_fops = { | 121 | static const struct file_operations idedisk_sv_proc_fops = { |
@@ -133,7 +133,7 @@ static int idedisk_st_proc_show(struct seq_file *m, void *v) | |||
133 | 133 | ||
134 | static int idedisk_st_proc_open(struct inode *inode, struct file *file) | 134 | static int idedisk_st_proc_open(struct inode *inode, struct file *file) |
135 | { | 135 | { |
136 | return single_open(file, idedisk_st_proc_show, PDE(inode)->data); | 136 | return single_open(file, idedisk_st_proc_show, PDE_DATA(inode)); |
137 | } | 137 | } |
138 | 138 | ||
139 | static const struct file_operations idedisk_st_proc_fops = { | 139 | static const struct file_operations idedisk_st_proc_fops = { |
diff --git a/drivers/ide/ide-floppy_proc.c b/drivers/ide/ide-floppy_proc.c index 1600720f3e86..e7a25ea757df 100644 --- a/drivers/ide/ide-floppy_proc.c +++ b/drivers/ide/ide-floppy_proc.c | |||
@@ -15,7 +15,7 @@ static int idefloppy_capacity_proc_show(struct seq_file *m, void *v) | |||
15 | 15 | ||
16 | static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file) | 16 | static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file) |
17 | { | 17 | { |
18 | return single_open(file, idefloppy_capacity_proc_show, PDE(inode)->data); | 18 | return single_open(file, idefloppy_capacity_proc_show, PDE_DATA(inode)); |
19 | } | 19 | } |
20 | 20 | ||
21 | static const struct file_operations idefloppy_capacity_proc_fops = { | 21 | static const struct file_operations idefloppy_capacity_proc_fops = { |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 2abcc4790f12..97c070077774 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -58,7 +58,7 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v) | |||
58 | 58 | ||
59 | static int ide_imodel_proc_open(struct inode *inode, struct file *file) | 59 | static int ide_imodel_proc_open(struct inode *inode, struct file *file) |
60 | { | 60 | { |
61 | return single_open(file, ide_imodel_proc_show, PDE(inode)->data); | 61 | return single_open(file, ide_imodel_proc_show, PDE_DATA(inode)); |
62 | } | 62 | } |
63 | 63 | ||
64 | static const struct file_operations ide_imodel_proc_fops = { | 64 | static const struct file_operations ide_imodel_proc_fops = { |
@@ -82,7 +82,7 @@ static int ide_mate_proc_show(struct seq_file *m, void *v) | |||
82 | 82 | ||
83 | static int ide_mate_proc_open(struct inode *inode, struct file *file) | 83 | static int ide_mate_proc_open(struct inode *inode, struct file *file) |
84 | { | 84 | { |
85 | return single_open(file, ide_mate_proc_show, PDE(inode)->data); | 85 | return single_open(file, ide_mate_proc_show, PDE_DATA(inode)); |
86 | } | 86 | } |
87 | 87 | ||
88 | static const struct file_operations ide_mate_proc_fops = { | 88 | static const struct file_operations ide_mate_proc_fops = { |
@@ -103,7 +103,7 @@ static int ide_channel_proc_show(struct seq_file *m, void *v) | |||
103 | 103 | ||
104 | static int ide_channel_proc_open(struct inode *inode, struct file *file) | 104 | static int ide_channel_proc_open(struct inode *inode, struct file *file) |
105 | { | 105 | { |
106 | return single_open(file, ide_channel_proc_show, PDE(inode)->data); | 106 | return single_open(file, ide_channel_proc_show, PDE_DATA(inode)); |
107 | } | 107 | } |
108 | 108 | ||
109 | static const struct file_operations ide_channel_proc_fops = { | 109 | static const struct file_operations ide_channel_proc_fops = { |
@@ -143,7 +143,7 @@ static int ide_identify_proc_show(struct seq_file *m, void *v) | |||
143 | 143 | ||
144 | static int ide_identify_proc_open(struct inode *inode, struct file *file) | 144 | static int ide_identify_proc_open(struct inode *inode, struct file *file) |
145 | { | 145 | { |
146 | return single_open(file, ide_identify_proc_show, PDE(inode)->data); | 146 | return single_open(file, ide_identify_proc_show, PDE_DATA(inode)); |
147 | } | 147 | } |
148 | 148 | ||
149 | static const struct file_operations ide_identify_proc_fops = { | 149 | static const struct file_operations ide_identify_proc_fops = { |
@@ -325,7 +325,7 @@ static int ide_settings_proc_show(struct seq_file *m, void *v) | |||
325 | 325 | ||
326 | static int ide_settings_proc_open(struct inode *inode, struct file *file) | 326 | static int ide_settings_proc_open(struct inode *inode, struct file *file) |
327 | { | 327 | { |
328 | return single_open(file, ide_settings_proc_show, PDE(inode)->data); | 328 | return single_open(file, ide_settings_proc_show, PDE_DATA(inode)); |
329 | } | 329 | } |
330 | 330 | ||
331 | #define MAX_LEN 30 | 331 | #define MAX_LEN 30 |
@@ -333,7 +333,7 @@ static int ide_settings_proc_open(struct inode *inode, struct file *file) | |||
333 | static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer, | 333 | static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer, |
334 | size_t count, loff_t *pos) | 334 | size_t count, loff_t *pos) |
335 | { | 335 | { |
336 | ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data; | 336 | ide_drive_t *drive = PDE_DATA(file_inode(file)); |
337 | char name[MAX_LEN + 1]; | 337 | char name[MAX_LEN + 1]; |
338 | int for_real = 0, mul_factor, div_factor; | 338 | int for_real = 0, mul_factor, div_factor; |
339 | unsigned long n; | 339 | unsigned long n; |
@@ -474,7 +474,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v) | |||
474 | 474 | ||
475 | static int ide_geometry_proc_open(struct inode *inode, struct file *file) | 475 | static int ide_geometry_proc_open(struct inode *inode, struct file *file) |
476 | { | 476 | { |
477 | return single_open(file, ide_geometry_proc_show, PDE(inode)->data); | 477 | return single_open(file, ide_geometry_proc_show, PDE_DATA(inode)); |
478 | } | 478 | } |
479 | 479 | ||
480 | const struct file_operations ide_geometry_proc_fops = { | 480 | const struct file_operations ide_geometry_proc_fops = { |
@@ -497,7 +497,7 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v) | |||
497 | 497 | ||
498 | static int ide_dmodel_proc_open(struct inode *inode, struct file *file) | 498 | static int ide_dmodel_proc_open(struct inode *inode, struct file *file) |
499 | { | 499 | { |
500 | return single_open(file, ide_dmodel_proc_show, PDE(inode)->data); | 500 | return single_open(file, ide_dmodel_proc_show, PDE_DATA(inode)); |
501 | } | 501 | } |
502 | 502 | ||
503 | static const struct file_operations ide_dmodel_proc_fops = { | 503 | static const struct file_operations ide_dmodel_proc_fops = { |
@@ -525,7 +525,7 @@ static int ide_driver_proc_show(struct seq_file *m, void *v) | |||
525 | 525 | ||
526 | static int ide_driver_proc_open(struct inode *inode, struct file *file) | 526 | static int ide_driver_proc_open(struct inode *inode, struct file *file) |
527 | { | 527 | { |
528 | return single_open(file, ide_driver_proc_show, PDE(inode)->data); | 528 | return single_open(file, ide_driver_proc_show, PDE_DATA(inode)); |
529 | } | 529 | } |
530 | 530 | ||
531 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | 531 | static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) |
@@ -558,7 +558,7 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) | |||
558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, | 558 | static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer, |
559 | size_t count, loff_t *pos) | 559 | size_t count, loff_t *pos) |
560 | { | 560 | { |
561 | ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data; | 561 | ide_drive_t *drive = PDE_DATA(file_inode(file)); |
562 | char name[32]; | 562 | char name[32]; |
563 | 563 | ||
564 | if (!capable(CAP_SYS_ADMIN)) | 564 | if (!capable(CAP_SYS_ADMIN)) |
@@ -601,7 +601,7 @@ static int ide_media_proc_show(struct seq_file *m, void *v) | |||
601 | 601 | ||
602 | static int ide_media_proc_open(struct inode *inode, struct file *file) | 602 | static int ide_media_proc_open(struct inode *inode, struct file *file) |
603 | { | 603 | { |
604 | return single_open(file, ide_media_proc_show, PDE(inode)->data); | 604 | return single_open(file, ide_media_proc_show, PDE_DATA(inode)); |
605 | } | 605 | } |
606 | 606 | ||
607 | static const struct file_operations ide_media_proc_fops = { | 607 | static const struct file_operations ide_media_proc_fops = { |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index ce8237d36159..89f859591bbb 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1847,7 +1847,7 @@ static int idetape_name_proc_show(struct seq_file *m, void *v) | |||
1847 | 1847 | ||
1848 | static int idetape_name_proc_open(struct inode *inode, struct file *file) | 1848 | static int idetape_name_proc_open(struct inode *inode, struct file *file) |
1849 | { | 1849 | { |
1850 | return single_open(file, idetape_name_proc_show, PDE(inode)->data); | 1850 | return single_open(file, idetape_name_proc_show, PDE_DATA(inode)); |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | static const struct file_operations idetape_name_proc_fops = { | 1853 | static const struct file_operations idetape_name_proc_fops = { |
diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c index 2e3334b8f82d..770479df8657 100644 --- a/drivers/input/misc/hp_sdc_rtc.c +++ b/drivers/input/misc/hp_sdc_rtc.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/time.h> | 41 | #include <linux/time.h> |
42 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
43 | #include <linux/proc_fs.h> | 43 | #include <linux/proc_fs.h> |
44 | #include <linux/seq_file.h> | ||
44 | #include <linux/poll.h> | 45 | #include <linux/poll.h> |
45 | #include <linux/rtc.h> | 46 | #include <linux/rtc.h> |
46 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
@@ -74,9 +75,6 @@ static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait); | |||
74 | static int hp_sdc_rtc_open(struct inode *inode, struct file *file); | 75 | static int hp_sdc_rtc_open(struct inode *inode, struct file *file); |
75 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on); | 76 | static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on); |
76 | 77 | ||
77 | static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off, | ||
78 | int count, int *eof, void *data); | ||
79 | |||
80 | static void hp_sdc_rtc_isr (int irq, void *dev_id, | 78 | static void hp_sdc_rtc_isr (int irq, void *dev_id, |
81 | uint8_t status, uint8_t data) | 79 | uint8_t status, uint8_t data) |
82 | { | 80 | { |
@@ -427,22 +425,19 @@ static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on) | |||
427 | return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue); | 425 | return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue); |
428 | } | 426 | } |
429 | 427 | ||
430 | static int hp_sdc_rtc_proc_output (char *buf) | 428 | static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v) |
431 | { | 429 | { |
432 | #define YN(bit) ("no") | 430 | #define YN(bit) ("no") |
433 | #define NY(bit) ("yes") | 431 | #define NY(bit) ("yes") |
434 | char *p; | ||
435 | struct rtc_time tm; | 432 | struct rtc_time tm; |
436 | struct timeval tv; | 433 | struct timeval tv; |
437 | 434 | ||
438 | memset(&tm, 0, sizeof(struct rtc_time)); | 435 | memset(&tm, 0, sizeof(struct rtc_time)); |
439 | 436 | ||
440 | p = buf; | ||
441 | |||
442 | if (hp_sdc_rtc_read_bbrtc(&tm)) { | 437 | if (hp_sdc_rtc_read_bbrtc(&tm)) { |
443 | p += sprintf(p, "BBRTC\t\t: READ FAILED!\n"); | 438 | seq_puts(m, "BBRTC\t\t: READ FAILED!\n"); |
444 | } else { | 439 | } else { |
445 | p += sprintf(p, | 440 | seq_printf(m, |
446 | "rtc_time\t: %02d:%02d:%02d\n" | 441 | "rtc_time\t: %02d:%02d:%02d\n" |
447 | "rtc_date\t: %04d-%02d-%02d\n" | 442 | "rtc_date\t: %04d-%02d-%02d\n" |
448 | "rtc_epoch\t: %04lu\n", | 443 | "rtc_epoch\t: %04lu\n", |
@@ -452,41 +447,41 @@ static int hp_sdc_rtc_proc_output (char *buf) | |||
452 | } | 447 | } |
453 | 448 | ||
454 | if (hp_sdc_rtc_read_rt(&tv)) { | 449 | if (hp_sdc_rtc_read_rt(&tv)) { |
455 | p += sprintf(p, "i8042 rtc\t: READ FAILED!\n"); | 450 | seq_puts(m, "i8042 rtc\t: READ FAILED!\n"); |
456 | } else { | 451 | } else { |
457 | p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n", | 452 | seq_printf(m, "i8042 rtc\t: %ld.%02d seconds\n", |
458 | tv.tv_sec, (int)tv.tv_usec/1000); | 453 | tv.tv_sec, (int)tv.tv_usec/1000); |
459 | } | 454 | } |
460 | 455 | ||
461 | if (hp_sdc_rtc_read_fhs(&tv)) { | 456 | if (hp_sdc_rtc_read_fhs(&tv)) { |
462 | p += sprintf(p, "handshake\t: READ FAILED!\n"); | 457 | seq_puts(m, "handshake\t: READ FAILED!\n"); |
463 | } else { | 458 | } else { |
464 | p += sprintf(p, "handshake\t: %ld.%02d seconds\n", | 459 | seq_printf(m, "handshake\t: %ld.%02d seconds\n", |
465 | tv.tv_sec, (int)tv.tv_usec/1000); | 460 | tv.tv_sec, (int)tv.tv_usec/1000); |
466 | } | 461 | } |
467 | 462 | ||
468 | if (hp_sdc_rtc_read_mt(&tv)) { | 463 | if (hp_sdc_rtc_read_mt(&tv)) { |
469 | p += sprintf(p, "alarm\t\t: READ FAILED!\n"); | 464 | seq_puts(m, "alarm\t\t: READ FAILED!\n"); |
470 | } else { | 465 | } else { |
471 | p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n", | 466 | seq_printf(m, "alarm\t\t: %ld.%02d seconds\n", |
472 | tv.tv_sec, (int)tv.tv_usec/1000); | 467 | tv.tv_sec, (int)tv.tv_usec/1000); |
473 | } | 468 | } |
474 | 469 | ||
475 | if (hp_sdc_rtc_read_dt(&tv)) { | 470 | if (hp_sdc_rtc_read_dt(&tv)) { |
476 | p += sprintf(p, "delay\t\t: READ FAILED!\n"); | 471 | seq_puts(m, "delay\t\t: READ FAILED!\n"); |
477 | } else { | 472 | } else { |
478 | p += sprintf(p, "delay\t\t: %ld.%02d seconds\n", | 473 | seq_printf(m, "delay\t\t: %ld.%02d seconds\n", |
479 | tv.tv_sec, (int)tv.tv_usec/1000); | 474 | tv.tv_sec, (int)tv.tv_usec/1000); |
480 | } | 475 | } |
481 | 476 | ||
482 | if (hp_sdc_rtc_read_ct(&tv)) { | 477 | if (hp_sdc_rtc_read_ct(&tv)) { |
483 | p += sprintf(p, "periodic\t: READ FAILED!\n"); | 478 | seq_puts(m, "periodic\t: READ FAILED!\n"); |
484 | } else { | 479 | } else { |
485 | p += sprintf(p, "periodic\t: %ld.%02d seconds\n", | 480 | seq_printf(m, "periodic\t: %ld.%02d seconds\n", |
486 | tv.tv_sec, (int)tv.tv_usec/1000); | 481 | tv.tv_sec, (int)tv.tv_usec/1000); |
487 | } | 482 | } |
488 | 483 | ||
489 | p += sprintf(p, | 484 | seq_printf(m, |
490 | "DST_enable\t: %s\n" | 485 | "DST_enable\t: %s\n" |
491 | "BCD\t\t: %s\n" | 486 | "BCD\t\t: %s\n" |
492 | "24hr\t\t: %s\n" | 487 | "24hr\t\t: %s\n" |
@@ -506,23 +501,23 @@ static int hp_sdc_rtc_proc_output (char *buf) | |||
506 | 1UL, | 501 | 1UL, |
507 | 1 ? "okay" : "dead"); | 502 | 1 ? "okay" : "dead"); |
508 | 503 | ||
509 | return p - buf; | 504 | return 0; |
510 | #undef YN | 505 | #undef YN |
511 | #undef NY | 506 | #undef NY |
512 | } | 507 | } |
513 | 508 | ||
514 | static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off, | 509 | static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file) |
515 | int count, int *eof, void *data) | ||
516 | { | 510 | { |
517 | int len = hp_sdc_rtc_proc_output (page); | 511 | return single_open(file, hp_sdc_rtc_proc_show, NULL); |
518 | if (len <= off+count) *eof = 1; | ||
519 | *start = page + off; | ||
520 | len -= off; | ||
521 | if (len>count) len = count; | ||
522 | if (len<0) len = 0; | ||
523 | return len; | ||
524 | } | 512 | } |
525 | 513 | ||
514 | static const struct file_operations hp_sdc_rtc_proc_fops = { | ||
515 | .open = hp_sdc_rtc_proc_open, | ||
516 | .read = seq_read, | ||
517 | .llseek = seq_lseek, | ||
518 | .release = seq_release, | ||
519 | }; | ||
520 | |||
526 | static int hp_sdc_rtc_ioctl(struct file *file, | 521 | static int hp_sdc_rtc_ioctl(struct file *file, |
527 | unsigned int cmd, unsigned long arg) | 522 | unsigned int cmd, unsigned long arg) |
528 | { | 523 | { |
@@ -715,8 +710,7 @@ static int __init hp_sdc_rtc_init(void) | |||
715 | if (misc_register(&hp_sdc_rtc_dev) != 0) | 710 | if (misc_register(&hp_sdc_rtc_dev) != 0) |
716 | printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); | 711 | printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n"); |
717 | 712 | ||
718 | create_proc_read_entry ("driver/rtc", 0, NULL, | 713 | proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops); |
719 | hp_sdc_rtc_read_proc, NULL); | ||
720 | 714 | ||
721 | printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " | 715 | printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " |
722 | "(RTC v " RTC_VERSION ")\n"); | 716 | "(RTC v " RTC_VERSION ")\n"); |
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c index 03a0a01a4054..3286903a95d2 100644 --- a/drivers/isdn/gigaset/capi.c +++ b/drivers/isdn/gigaset/capi.c | |||
@@ -2334,7 +2334,7 @@ static int gigaset_proc_show(struct seq_file *m, void *v) | |||
2334 | 2334 | ||
2335 | static int gigaset_proc_open(struct inode *inode, struct file *file) | 2335 | static int gigaset_proc_open(struct inode *inode, struct file *file) |
2336 | { | 2336 | { |
2337 | return single_open(file, gigaset_proc_show, PDE(inode)->data); | 2337 | return single_open(file, gigaset_proc_show, PDE_DATA(inode)); |
2338 | } | 2338 | } |
2339 | 2339 | ||
2340 | static const struct file_operations gigaset_proc_fops = { | 2340 | static const struct file_operations gigaset_proc_fops = { |
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index 821f7ac33b37..4d9b195547c5 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c | |||
@@ -702,7 +702,7 @@ static int b1ctl_proc_show(struct seq_file *m, void *v) | |||
702 | 702 | ||
703 | static int b1ctl_proc_open(struct inode *inode, struct file *file) | 703 | static int b1ctl_proc_open(struct inode *inode, struct file *file) |
704 | { | 704 | { |
705 | return single_open(file, b1ctl_proc_show, PDE(inode)->data); | 705 | return single_open(file, b1ctl_proc_show, PDE_DATA(inode)); |
706 | } | 706 | } |
707 | 707 | ||
708 | const struct file_operations b1ctl_proc_fops = { | 708 | const struct file_operations b1ctl_proc_fops = { |
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 0896aa86fc08..19b113faeb7b 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -944,7 +944,7 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v) | |||
944 | 944 | ||
945 | static int b1dmactl_proc_open(struct inode *inode, struct file *file) | 945 | static int b1dmactl_proc_open(struct inode *inode, struct file *file) |
946 | { | 946 | { |
947 | return single_open(file, b1dmactl_proc_show, PDE(inode)->data); | 947 | return single_open(file, b1dmactl_proc_show, PDE_DATA(inode)); |
948 | } | 948 | } |
949 | 949 | ||
950 | const struct file_operations b1dmactl_proc_fops = { | 950 | const struct file_operations b1dmactl_proc_fops = { |
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 1d7fc44e3eef..5d00d72fe482 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -1129,7 +1129,7 @@ static int c4_proc_show(struct seq_file *m, void *v) | |||
1129 | 1129 | ||
1130 | static int c4_proc_open(struct inode *inode, struct file *file) | 1130 | static int c4_proc_open(struct inode *inode, struct file *file) |
1131 | { | 1131 | { |
1132 | return single_open(file, c4_proc_show, PDE(inode)->data); | 1132 | return single_open(file, c4_proc_show, PDE_DATA(inode)); |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | static const struct file_operations c4_proc_fops = { | 1135 | static const struct file_operations c4_proc_fops = { |
diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c index 3a4165c61196..56ce98a4e248 100644 --- a/drivers/isdn/hardware/eicon/divasproc.c +++ b/drivers/isdn/hardware/eicon/divasproc.c | |||
@@ -145,7 +145,7 @@ void remove_divas_proc(void) | |||
145 | static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, | 145 | static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, |
146 | size_t count, loff_t *pos) | 146 | size_t count, loff_t *pos) |
147 | { | 147 | { |
148 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; | 148 | diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file)); |
149 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 149 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
150 | 150 | ||
151 | if ((count == 1) || (count == 2)) { | 151 | if ((count == 1) || (count == 2)) { |
@@ -172,7 +172,7 @@ static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer, | |||
172 | static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer, | 172 | static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer, |
173 | size_t count, loff_t *pos) | 173 | size_t count, loff_t *pos) |
174 | { | 174 | { |
175 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; | 175 | diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file)); |
176 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 176 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
177 | 177 | ||
178 | if ((count == 1) || (count == 2)) { | 178 | if ((count == 1) || (count == 2)) { |
@@ -210,7 +210,7 @@ static int d_l1_down_proc_show(struct seq_file *m, void *v) | |||
210 | 210 | ||
211 | static int d_l1_down_proc_open(struct inode *inode, struct file *file) | 211 | static int d_l1_down_proc_open(struct inode *inode, struct file *file) |
212 | { | 212 | { |
213 | return single_open(file, d_l1_down_proc_show, PDE(inode)->data); | 213 | return single_open(file, d_l1_down_proc_show, PDE_DATA(inode)); |
214 | } | 214 | } |
215 | 215 | ||
216 | static const struct file_operations d_l1_down_proc_fops = { | 216 | static const struct file_operations d_l1_down_proc_fops = { |
@@ -236,7 +236,7 @@ static int grp_opt_proc_show(struct seq_file *m, void *v) | |||
236 | 236 | ||
237 | static int grp_opt_proc_open(struct inode *inode, struct file *file) | 237 | static int grp_opt_proc_open(struct inode *inode, struct file *file) |
238 | { | 238 | { |
239 | return single_open(file, grp_opt_proc_show, PDE(inode)->data); | 239 | return single_open(file, grp_opt_proc_show, PDE_DATA(inode)); |
240 | } | 240 | } |
241 | 241 | ||
242 | static const struct file_operations grp_opt_proc_fops = { | 242 | static const struct file_operations grp_opt_proc_fops = { |
@@ -251,7 +251,7 @@ static const struct file_operations grp_opt_proc_fops = { | |||
251 | static ssize_t info_proc_write(struct file *file, const char __user *buffer, | 251 | static ssize_t info_proc_write(struct file *file, const char __user *buffer, |
252 | size_t count, loff_t *pos) | 252 | size_t count, loff_t *pos) |
253 | { | 253 | { |
254 | diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data; | 254 | diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file)); |
255 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; | 255 | PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1]; |
256 | char c[4]; | 256 | char c[4]; |
257 | 257 | ||
@@ -335,7 +335,7 @@ static int info_proc_show(struct seq_file *m, void *v) | |||
335 | 335 | ||
336 | static int info_proc_open(struct inode *inode, struct file *file) | 336 | static int info_proc_open(struct inode *inode, struct file *file) |
337 | { | 337 | { |
338 | return single_open(file, info_proc_show, PDE(inode)->data); | 338 | return single_open(file, info_proc_show, PDE_DATA(inode)); |
339 | } | 339 | } |
340 | 340 | ||
341 | static const struct file_operations info_proc_fops = { | 341 | static const struct file_operations info_proc_fops = { |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index 931f916c9c23..00aad10507d8 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -469,7 +469,7 @@ static int hycapi_proc_show(struct seq_file *m, void *v) | |||
469 | 469 | ||
470 | static int hycapi_proc_open(struct inode *inode, struct file *file) | 470 | static int hycapi_proc_open(struct inode *inode, struct file *file) |
471 | { | 471 | { |
472 | return single_open(file, hycapi_proc_show, PDE(inode)->data); | 472 | return single_open(file, hycapi_proc_show, PDE_DATA(inode)); |
473 | } | 473 | } |
474 | 474 | ||
475 | static const struct file_operations hycapi_proc_fops = { | 475 | static const struct file_operations hycapi_proc_fops = { |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 8023d2510fba..73079213ec94 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -229,23 +229,12 @@ static int | |||
229 | hysdn_conf_open(struct inode *ino, struct file *filep) | 229 | hysdn_conf_open(struct inode *ino, struct file *filep) |
230 | { | 230 | { |
231 | hysdn_card *card; | 231 | hysdn_card *card; |
232 | struct proc_dir_entry *pd; | ||
233 | struct conf_writedata *cnf; | 232 | struct conf_writedata *cnf; |
234 | char *cp, *tmp; | 233 | char *cp, *tmp; |
235 | 234 | ||
236 | /* now search the addressed card */ | 235 | /* now search the addressed card */ |
237 | mutex_lock(&hysdn_conf_mutex); | 236 | mutex_lock(&hysdn_conf_mutex); |
238 | card = card_root; | 237 | card = PDE_DATA(ino); |
239 | while (card) { | ||
240 | pd = card->procconf; | ||
241 | if (pd == PDE(ino)) | ||
242 | break; | ||
243 | card = card->next; /* search next entry */ | ||
244 | } | ||
245 | if (!card) { | ||
246 | mutex_unlock(&hysdn_conf_mutex); | ||
247 | return (-ENODEV); /* device is unknown/invalid */ | ||
248 | } | ||
249 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 238 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
250 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", | 239 | hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x", |
251 | filep->f_cred->fsuid, filep->f_cred->fsgid, | 240 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
@@ -317,21 +306,9 @@ hysdn_conf_close(struct inode *ino, struct file *filep) | |||
317 | hysdn_card *card; | 306 | hysdn_card *card; |
318 | struct conf_writedata *cnf; | 307 | struct conf_writedata *cnf; |
319 | int retval = 0; | 308 | int retval = 0; |
320 | struct proc_dir_entry *pd; | ||
321 | 309 | ||
322 | mutex_lock(&hysdn_conf_mutex); | 310 | mutex_lock(&hysdn_conf_mutex); |
323 | /* search the addressed card */ | 311 | card = PDE_DATA(ino); |
324 | card = card_root; | ||
325 | while (card) { | ||
326 | pd = card->procconf; | ||
327 | if (pd == PDE(ino)) | ||
328 | break; | ||
329 | card = card->next; /* search next entry */ | ||
330 | } | ||
331 | if (!card) { | ||
332 | mutex_unlock(&hysdn_conf_mutex); | ||
333 | return (-ENODEV); /* device is unknown/invalid */ | ||
334 | } | ||
335 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) | 312 | if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL)) |
336 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", | 313 | hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x", |
337 | filep->f_cred->fsuid, filep->f_cred->fsgid, | 314 | filep->f_cred->fsuid, filep->f_cred->fsgid, |
@@ -394,10 +371,11 @@ hysdn_procconf_init(void) | |||
394 | while (card) { | 371 | while (card) { |
395 | 372 | ||
396 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); | 373 | sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid); |
397 | if ((card->procconf = (void *) proc_create(conf_name, | 374 | if ((card->procconf = (void *) proc_create_data(conf_name, |
398 | S_IFREG | S_IRUGO | S_IWUSR, | 375 | S_IFREG | S_IRUGO | S_IWUSR, |
399 | hysdn_proc_entry, | 376 | hysdn_proc_entry, |
400 | &conf_fops)) != NULL) { | 377 | &conf_fops, |
378 | card)) != NULL) { | ||
401 | hysdn_proclog_init(card); /* init the log file entry */ | 379 | hysdn_proclog_init(card); /* init the log file entry */ |
402 | } | 380 | } |
403 | card = card->next; /* next entry */ | 381 | card = card->next; /* next entry */ |
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 9a3ce93665c5..b61e8d5e84ad 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -173,27 +173,14 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off) | |||
173 | { | 173 | { |
174 | struct log_data *inf; | 174 | struct log_data *inf; |
175 | int len; | 175 | int len; |
176 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 176 | hysdn_card *card = PDE_DATA(file_inode(file)); |
177 | struct procdata *pd = NULL; | ||
178 | hysdn_card *card; | ||
179 | 177 | ||
180 | if (!*((struct log_data **) file->private_data)) { | 178 | if (!*((struct log_data **) file->private_data)) { |
179 | struct procdata *pd = card->proclog; | ||
181 | if (file->f_flags & O_NONBLOCK) | 180 | if (file->f_flags & O_NONBLOCK) |
182 | return (-EAGAIN); | 181 | return (-EAGAIN); |
183 | 182 | ||
184 | /* sorry, but we need to search the card */ | 183 | interruptible_sleep_on(&(pd->rd_queue)); |
185 | card = card_root; | ||
186 | while (card) { | ||
187 | pd = card->proclog; | ||
188 | if (pd->log == pde) | ||
189 | break; | ||
190 | card = card->next; /* search next entry */ | ||
191 | } | ||
192 | if (card) | ||
193 | interruptible_sleep_on(&(pd->rd_queue)); | ||
194 | else | ||
195 | return (-EAGAIN); | ||
196 | |||
197 | } | 184 | } |
198 | if (!(inf = *((struct log_data **) file->private_data))) | 185 | if (!(inf = *((struct log_data **) file->private_data))) |
199 | return (0); | 186 | return (0); |
@@ -215,27 +202,15 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off) | |||
215 | static int | 202 | static int |
216 | hysdn_log_open(struct inode *ino, struct file *filep) | 203 | hysdn_log_open(struct inode *ino, struct file *filep) |
217 | { | 204 | { |
218 | hysdn_card *card; | 205 | hysdn_card *card = PDE_DATA(ino); |
219 | struct procdata *pd = NULL; | ||
220 | unsigned long flags; | ||
221 | 206 | ||
222 | mutex_lock(&hysdn_log_mutex); | 207 | mutex_lock(&hysdn_log_mutex); |
223 | card = card_root; | ||
224 | while (card) { | ||
225 | pd = card->proclog; | ||
226 | if (pd->log == PDE(ino)) | ||
227 | break; | ||
228 | card = card->next; /* search next entry */ | ||
229 | } | ||
230 | if (!card) { | ||
231 | mutex_unlock(&hysdn_log_mutex); | ||
232 | return (-ENODEV); /* device is unknown/invalid */ | ||
233 | } | ||
234 | filep->private_data = card; /* remember our own card */ | ||
235 | |||
236 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { | 208 | if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { |
237 | /* write only access -> write log level only */ | 209 | /* write only access -> write log level only */ |
210 | filep->private_data = card; /* remember our own card */ | ||
238 | } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { | 211 | } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { |
212 | struct procdata *pd = card->proclog; | ||
213 | unsigned long flags; | ||
239 | 214 | ||
240 | /* read access -> log/debug read */ | 215 | /* read access -> log/debug read */ |
241 | spin_lock_irqsave(&card->hysdn_lock, flags); | 216 | spin_lock_irqsave(&card->hysdn_lock, flags); |
@@ -275,21 +250,13 @@ hysdn_log_close(struct inode *ino, struct file *filep) | |||
275 | } else { | 250 | } else { |
276 | /* read access -> log/debug read, mark one further file as closed */ | 251 | /* read access -> log/debug read, mark one further file as closed */ |
277 | 252 | ||
278 | pd = NULL; | ||
279 | inf = *((struct log_data **) filep->private_data); /* get first log entry */ | 253 | inf = *((struct log_data **) filep->private_data); /* get first log entry */ |
280 | if (inf) | 254 | if (inf) |
281 | pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ | 255 | pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ |
282 | else { | 256 | else { |
283 | /* no info available -> search card */ | 257 | /* no info available -> search card */ |
284 | card = card_root; | 258 | card = PDE_DATA(file_inode(filep)); |
285 | while (card) { | 259 | pd = card->proclog; /* pointer to procfs log */ |
286 | pd = card->proclog; | ||
287 | if (pd->log == PDE(ino)) | ||
288 | break; | ||
289 | card = card->next; /* search next entry */ | ||
290 | } | ||
291 | if (card) | ||
292 | pd = card->proclog; /* pointer to procfs log */ | ||
293 | } | 260 | } |
294 | if (pd) | 261 | if (pd) |
295 | pd->if_used--; /* decrement interface usage count by one */ | 262 | pd->if_used--; /* decrement interface usage count by one */ |
@@ -319,24 +286,12 @@ static unsigned int | |||
319 | hysdn_log_poll(struct file *file, poll_table *wait) | 286 | hysdn_log_poll(struct file *file, poll_table *wait) |
320 | { | 287 | { |
321 | unsigned int mask = 0; | 288 | unsigned int mask = 0; |
322 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 289 | hysdn_card *card = PDE_DATA(file_inode(file)); |
323 | hysdn_card *card; | 290 | struct procdata *pd = card->proclog; |
324 | struct procdata *pd = NULL; | ||
325 | 291 | ||
326 | if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) | 292 | if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) |
327 | return (mask); /* no polling for write supported */ | 293 | return (mask); /* no polling for write supported */ |
328 | 294 | ||
329 | /* we need to search the card */ | ||
330 | card = card_root; | ||
331 | while (card) { | ||
332 | pd = card->proclog; | ||
333 | if (pd->log == pde) | ||
334 | break; | ||
335 | card = card->next; /* search next entry */ | ||
336 | } | ||
337 | if (!card) | ||
338 | return (mask); /* card not found */ | ||
339 | |||
340 | poll_wait(file, &(pd->rd_queue), wait); | 295 | poll_wait(file, &(pd->rd_queue), wait); |
341 | 296 | ||
342 | if (*((struct log_data **) file->private_data)) | 297 | if (*((struct log_data **) file->private_data)) |
@@ -373,9 +328,9 @@ hysdn_proclog_init(hysdn_card *card) | |||
373 | 328 | ||
374 | if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { | 329 | if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) { |
375 | sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); | 330 | sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid); |
376 | pd->log = proc_create(pd->log_name, | 331 | pd->log = proc_create_data(pd->log_name, |
377 | S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry, | 332 | S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry, |
378 | &log_fops); | 333 | &log_fops, card); |
379 | 334 | ||
380 | init_waitqueue_head(&(pd->rd_queue)); | 335 | init_waitqueue_head(&(pd->rd_queue)); |
381 | 336 | ||
diff --git a/drivers/isdn/mISDN/timerdev.c b/drivers/isdn/mISDN/timerdev.c index 1094667d8f31..9438d7ec3308 100644 --- a/drivers/isdn/mISDN/timerdev.c +++ b/drivers/isdn/mISDN/timerdev.c | |||
@@ -64,7 +64,6 @@ mISDN_open(struct inode *ino, struct file *filep) | |||
64 | dev->work = 0; | 64 | dev->work = 0; |
65 | init_waitqueue_head(&dev->wait); | 65 | init_waitqueue_head(&dev->wait); |
66 | filep->private_data = dev; | 66 | filep->private_data = dev; |
67 | __module_get(THIS_MODULE); | ||
68 | return nonseekable_open(ino, filep); | 67 | return nonseekable_open(ino, filep); |
69 | } | 68 | } |
70 | 69 | ||
@@ -72,19 +71,28 @@ static int | |||
72 | mISDN_close(struct inode *ino, struct file *filep) | 71 | mISDN_close(struct inode *ino, struct file *filep) |
73 | { | 72 | { |
74 | struct mISDNtimerdev *dev = filep->private_data; | 73 | struct mISDNtimerdev *dev = filep->private_data; |
74 | struct list_head *list = &dev->pending; | ||
75 | struct mISDNtimer *timer, *next; | 75 | struct mISDNtimer *timer, *next; |
76 | 76 | ||
77 | if (*debug & DEBUG_TIMER) | 77 | if (*debug & DEBUG_TIMER) |
78 | printk(KERN_DEBUG "%s(%p,%p)\n", __func__, ino, filep); | 78 | printk(KERN_DEBUG "%s(%p,%p)\n", __func__, ino, filep); |
79 | list_for_each_entry_safe(timer, next, &dev->pending, list) { | 79 | |
80 | del_timer(&timer->tl); | 80 | spin_lock_irq(&dev->lock); |
81 | while (!list_empty(list)) { | ||
82 | timer = list_first_entry(list, struct mISDNtimer, list); | ||
83 | spin_unlock_irq(&dev->lock); | ||
84 | del_timer_sync(&timer->tl); | ||
85 | spin_lock_irq(&dev->lock); | ||
86 | /* it might have been moved to ->expired */ | ||
87 | list_del(&timer->list); | ||
81 | kfree(timer); | 88 | kfree(timer); |
82 | } | 89 | } |
90 | spin_unlock_irq(&dev->lock); | ||
91 | |||
83 | list_for_each_entry_safe(timer, next, &dev->expired, list) { | 92 | list_for_each_entry_safe(timer, next, &dev->expired, list) { |
84 | kfree(timer); | 93 | kfree(timer); |
85 | } | 94 | } |
86 | kfree(dev); | 95 | kfree(dev); |
87 | module_put(THIS_MODULE); | ||
88 | return 0; | 96 | return 0; |
89 | } | 97 | } |
90 | 98 | ||
@@ -92,36 +100,41 @@ static ssize_t | |||
92 | mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off) | 100 | mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off) |
93 | { | 101 | { |
94 | struct mISDNtimerdev *dev = filep->private_data; | 102 | struct mISDNtimerdev *dev = filep->private_data; |
103 | struct list_head *list = &dev->expired; | ||
95 | struct mISDNtimer *timer; | 104 | struct mISDNtimer *timer; |
96 | u_long flags; | ||
97 | int ret = 0; | 105 | int ret = 0; |
98 | 106 | ||
99 | if (*debug & DEBUG_TIMER) | 107 | if (*debug & DEBUG_TIMER) |
100 | printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__, | 108 | printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__, |
101 | filep, buf, (int)count, off); | 109 | filep, buf, (int)count, off); |
102 | 110 | ||
103 | if (list_empty(&dev->expired) && (dev->work == 0)) { | 111 | if (count < sizeof(int)) |
112 | return -ENOSPC; | ||
113 | |||
114 | spin_lock_irq(&dev->lock); | ||
115 | while (list_empty(list) && (dev->work == 0)) { | ||
116 | spin_unlock_irq(&dev->lock); | ||
104 | if (filep->f_flags & O_NONBLOCK) | 117 | if (filep->f_flags & O_NONBLOCK) |
105 | return -EAGAIN; | 118 | return -EAGAIN; |
106 | wait_event_interruptible(dev->wait, (dev->work || | 119 | wait_event_interruptible(dev->wait, (dev->work || |
107 | !list_empty(&dev->expired))); | 120 | !list_empty(list))); |
108 | if (signal_pending(current)) | 121 | if (signal_pending(current)) |
109 | return -ERESTARTSYS; | 122 | return -ERESTARTSYS; |
123 | spin_lock_irq(&dev->lock); | ||
110 | } | 124 | } |
111 | if (count < sizeof(int)) | ||
112 | return -ENOSPC; | ||
113 | if (dev->work) | 125 | if (dev->work) |
114 | dev->work = 0; | 126 | dev->work = 0; |
115 | if (!list_empty(&dev->expired)) { | 127 | if (!list_empty(list)) { |
116 | spin_lock_irqsave(&dev->lock, flags); | 128 | timer = list_first_entry(list, struct mISDNtimer, list); |
117 | timer = (struct mISDNtimer *)dev->expired.next; | ||
118 | list_del(&timer->list); | 129 | list_del(&timer->list); |
119 | spin_unlock_irqrestore(&dev->lock, flags); | 130 | spin_unlock_irq(&dev->lock); |
120 | if (put_user(timer->id, (int __user *)buf)) | 131 | if (put_user(timer->id, (int __user *)buf)) |
121 | ret = -EFAULT; | 132 | ret = -EFAULT; |
122 | else | 133 | else |
123 | ret = sizeof(int); | 134 | ret = sizeof(int); |
124 | kfree(timer); | 135 | kfree(timer); |
136 | } else { | ||
137 | spin_unlock_irq(&dev->lock); | ||
125 | } | 138 | } |
126 | return ret; | 139 | return ret; |
127 | } | 140 | } |
@@ -153,7 +166,8 @@ dev_expire_timer(unsigned long data) | |||
153 | u_long flags; | 166 | u_long flags; |
154 | 167 | ||
155 | spin_lock_irqsave(&timer->dev->lock, flags); | 168 | spin_lock_irqsave(&timer->dev->lock, flags); |
156 | list_move_tail(&timer->list, &timer->dev->expired); | 169 | if (timer->id >= 0) |
170 | list_move_tail(&timer->list, &timer->dev->expired); | ||
157 | spin_unlock_irqrestore(&timer->dev->lock, flags); | 171 | spin_unlock_irqrestore(&timer->dev->lock, flags); |
158 | wake_up_interruptible(&timer->dev->wait); | 172 | wake_up_interruptible(&timer->dev->wait); |
159 | } | 173 | } |
@@ -162,7 +176,6 @@ static int | |||
162 | misdn_add_timer(struct mISDNtimerdev *dev, int timeout) | 176 | misdn_add_timer(struct mISDNtimerdev *dev, int timeout) |
163 | { | 177 | { |
164 | int id; | 178 | int id; |
165 | u_long flags; | ||
166 | struct mISDNtimer *timer; | 179 | struct mISDNtimer *timer; |
167 | 180 | ||
168 | if (!timeout) { | 181 | if (!timeout) { |
@@ -173,19 +186,16 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout) | |||
173 | timer = kzalloc(sizeof(struct mISDNtimer), GFP_KERNEL); | 186 | timer = kzalloc(sizeof(struct mISDNtimer), GFP_KERNEL); |
174 | if (!timer) | 187 | if (!timer) |
175 | return -ENOMEM; | 188 | return -ENOMEM; |
176 | spin_lock_irqsave(&dev->lock, flags); | 189 | timer->dev = dev; |
177 | timer->id = dev->next_id++; | 190 | setup_timer(&timer->tl, dev_expire_timer, (long)timer); |
191 | spin_lock_irq(&dev->lock); | ||
192 | id = timer->id = dev->next_id++; | ||
178 | if (dev->next_id < 0) | 193 | if (dev->next_id < 0) |
179 | dev->next_id = 1; | 194 | dev->next_id = 1; |
180 | list_add_tail(&timer->list, &dev->pending); | 195 | list_add_tail(&timer->list, &dev->pending); |
181 | spin_unlock_irqrestore(&dev->lock, flags); | ||
182 | timer->dev = dev; | ||
183 | timer->tl.data = (long)timer; | ||
184 | timer->tl.function = dev_expire_timer; | ||
185 | init_timer(&timer->tl); | ||
186 | timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000); | 196 | timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000); |
187 | add_timer(&timer->tl); | 197 | add_timer(&timer->tl); |
188 | id = timer->id; | 198 | spin_unlock_irq(&dev->lock); |
189 | } | 199 | } |
190 | return id; | 200 | return id; |
191 | } | 201 | } |
@@ -193,26 +203,21 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout) | |||
193 | static int | 203 | static int |
194 | misdn_del_timer(struct mISDNtimerdev *dev, int id) | 204 | misdn_del_timer(struct mISDNtimerdev *dev, int id) |
195 | { | 205 | { |
196 | u_long flags; | ||
197 | struct mISDNtimer *timer; | 206 | struct mISDNtimer *timer; |
198 | int ret = 0; | ||
199 | 207 | ||
200 | spin_lock_irqsave(&dev->lock, flags); | 208 | spin_lock_irq(&dev->lock); |
201 | list_for_each_entry(timer, &dev->pending, list) { | 209 | list_for_each_entry(timer, &dev->pending, list) { |
202 | if (timer->id == id) { | 210 | if (timer->id == id) { |
203 | list_del_init(&timer->list); | 211 | list_del_init(&timer->list); |
204 | /* RED-PEN AK: race -- timer can be still running on | 212 | timer->id = -1; |
205 | * other CPU. Needs reference count I think | 213 | spin_unlock_irq(&dev->lock); |
206 | */ | 214 | del_timer_sync(&timer->tl); |
207 | del_timer(&timer->tl); | ||
208 | ret = timer->id; | ||
209 | kfree(timer); | 215 | kfree(timer); |
210 | goto unlock; | 216 | return id; |
211 | } | 217 | } |
212 | } | 218 | } |
213 | unlock: | 219 | spin_unlock_irq(&dev->lock); |
214 | spin_unlock_irqrestore(&dev->lock, flags); | 220 | return 0; |
215 | return ret; | ||
216 | } | 221 | } |
217 | 222 | ||
218 | static long | 223 | static long |
@@ -262,6 +267,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) | |||
262 | } | 267 | } |
263 | 268 | ||
264 | static const struct file_operations mISDN_fops = { | 269 | static const struct file_operations mISDN_fops = { |
270 | .owner = THIS_MODULE, | ||
265 | .read = mISDN_read, | 271 | .read = mISDN_read, |
266 | .poll = mISDN_poll, | 272 | .poll = mISDN_poll, |
267 | .unlocked_ioctl = mISDN_ioctl, | 273 | .unlocked_ioctl = mISDN_ioctl, |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 22b8ce4191cc..c31fbab6aa82 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -869,7 +869,7 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v) | |||
869 | 869 | ||
870 | static int pmu_battery_proc_open(struct inode *inode, struct file *file) | 870 | static int pmu_battery_proc_open(struct inode *inode, struct file *file) |
871 | { | 871 | { |
872 | return single_open(file, pmu_battery_proc_show, PDE(inode)->data); | 872 | return single_open(file, pmu_battery_proc_show, PDE_DATA(inode)); |
873 | } | 873 | } |
874 | 874 | ||
875 | static const struct file_operations pmu_battery_proc_fops = { | 875 | static const struct file_operations pmu_battery_proc_fops = { |
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 57601c0704c1..1f925e856974 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c | |||
@@ -2527,11 +2527,8 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) | |||
2527 | 2527 | ||
2528 | if (dvbdev->users == -1) { | 2528 | if (dvbdev->users == -1) { |
2529 | wake_up(&fepriv->wait_queue); | 2529 | wake_up(&fepriv->wait_queue); |
2530 | if (fepriv->exit != DVB_FE_NO_EXIT) { | 2530 | if (fepriv->exit != DVB_FE_NO_EXIT) |
2531 | fops_put(file->f_op); | ||
2532 | file->f_op = NULL; | ||
2533 | wake_up(&dvbdev->wait_queue); | 2531 | wake_up(&dvbdev->wait_queue); |
2534 | } | ||
2535 | if (fe->ops.ts_bus_ctrl) | 2532 | if (fe->ops.ts_bus_ctrl) |
2536 | fe->ops.ts_bus_ctrl(fe, 0); | 2533 | fe->ops.ts_bus_ctrl(fe, 0); |
2537 | } | 2534 | } |
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c index c3cc3b52662b..f91c80c0e9ec 100644 --- a/drivers/media/dvb-core/dvb_net.c +++ b/drivers/media/dvb-core/dvb_net.c | |||
@@ -1479,11 +1479,8 @@ static int dvb_net_close(struct inode *inode, struct file *file) | |||
1479 | 1479 | ||
1480 | dvb_generic_release(inode, file); | 1480 | dvb_generic_release(inode, file); |
1481 | 1481 | ||
1482 | if(dvbdev->users == 1 && dvbnet->exit == 1) { | 1482 | if(dvbdev->users == 1 && dvbnet->exit == 1) |
1483 | fops_put(file->f_op); | ||
1484 | file->f_op = NULL; | ||
1485 | wake_up(&dvbdev->wait_queue); | 1483 | wake_up(&dvbdev->wait_queue); |
1486 | } | ||
1487 | return 0; | 1484 | return 0; |
1488 | } | 1485 | } |
1489 | 1486 | ||
diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c index b9be535e32b8..68dbc2dbc982 100644 --- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c +++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c | |||
@@ -259,79 +259,46 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev) | |||
259 | static int cx25821_get_audio_data(struct cx25821_dev *dev, | 259 | static int cx25821_get_audio_data(struct cx25821_dev *dev, |
260 | const struct sram_channel *sram_ch) | 260 | const struct sram_channel *sram_ch) |
261 | { | 261 | { |
262 | struct file *myfile; | 262 | struct file *file; |
263 | int frame_index_temp = dev->_audioframe_index; | 263 | int frame_index_temp = dev->_audioframe_index; |
264 | int i = 0; | 264 | int i = 0; |
265 | int line_size = AUDIO_LINE_SIZE; | ||
266 | int frame_size = AUDIO_DATA_BUF_SZ; | 265 | int frame_size = AUDIO_DATA_BUF_SZ; |
267 | int frame_offset = frame_size * frame_index_temp; | 266 | int frame_offset = frame_size * frame_index_temp; |
268 | ssize_t vfs_read_retval = 0; | 267 | char mybuf[AUDIO_LINE_SIZE]; |
269 | char mybuf[line_size]; | ||
270 | loff_t file_offset = dev->_audioframe_count * frame_size; | 268 | loff_t file_offset = dev->_audioframe_count * frame_size; |
271 | loff_t pos; | 269 | char *p = NULL; |
272 | mm_segment_t old_fs; | ||
273 | 270 | ||
274 | if (dev->_audiofile_status == END_OF_FILE) | 271 | if (dev->_audiofile_status == END_OF_FILE) |
275 | return 0; | 272 | return 0; |
276 | 273 | ||
277 | myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); | 274 | file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); |
275 | if (IS_ERR(file)) { | ||
276 | pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n", | ||
277 | __func__, dev->_audiofilename, -PTR_ERR(file)); | ||
278 | return PTR_ERR(file); | ||
279 | } | ||
278 | 280 | ||
279 | if (IS_ERR(myfile)) { | 281 | if (dev->_audiodata_buf_virt_addr) |
280 | const int open_errno = -PTR_ERR(myfile); | 282 | p = (char *)dev->_audiodata_buf_virt_addr + frame_offset; |
281 | pr_err("%s(): ERROR opening file(%s) with errno = %d!\n", | ||
282 | __func__, dev->_audiofilename, open_errno); | ||
283 | return PTR_ERR(myfile); | ||
284 | } else { | ||
285 | if (!(myfile->f_op)) { | ||
286 | pr_err("%s(): File has no file operations registered!\n", | ||
287 | __func__); | ||
288 | filp_close(myfile, NULL); | ||
289 | return -EIO; | ||
290 | } | ||
291 | 283 | ||
292 | if (!myfile->f_op->read) { | 284 | for (i = 0; i < dev->_audio_lines_count; i++) { |
293 | pr_err("%s(): File has no READ operations registered!\n", | 285 | int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE); |
286 | if (n < AUDIO_LINE_SIZE) { | ||
287 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | ||
294 | __func__); | 288 | __func__); |
295 | filp_close(myfile, NULL); | 289 | dev->_audiofile_status = END_OF_FILE; |
296 | return -EIO; | 290 | fput(file); |
291 | return 0; | ||
297 | } | 292 | } |
298 | 293 | dev->_audiofile_status = IN_PROGRESS; | |
299 | pos = myfile->f_pos; | 294 | if (p) { |
300 | old_fs = get_fs(); | 295 | memcpy(p, mybuf, n); |
301 | set_fs(KERNEL_DS); | 296 | p += n; |
302 | |||
303 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
304 | pos = file_offset; | ||
305 | |||
306 | vfs_read_retval = vfs_read(myfile, mybuf, line_size, | ||
307 | &pos); | ||
308 | |||
309 | if (vfs_read_retval > 0 && vfs_read_retval == line_size | ||
310 | && dev->_audiodata_buf_virt_addr != NULL) { | ||
311 | memcpy((void *)(dev->_audiodata_buf_virt_addr + | ||
312 | frame_offset / 4), mybuf, | ||
313 | vfs_read_retval); | ||
314 | } | ||
315 | |||
316 | file_offset += vfs_read_retval; | ||
317 | frame_offset += vfs_read_retval; | ||
318 | |||
319 | if (vfs_read_retval < line_size) { | ||
320 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | ||
321 | __func__); | ||
322 | break; | ||
323 | } | ||
324 | } | 297 | } |
325 | 298 | file_offset += n; | |
326 | if (i > 0) | ||
327 | dev->_audioframe_count++; | ||
328 | |||
329 | dev->_audiofile_status = (vfs_read_retval == line_size) ? | ||
330 | IN_PROGRESS : END_OF_FILE; | ||
331 | |||
332 | set_fs(old_fs); | ||
333 | filp_close(myfile, NULL); | ||
334 | } | 299 | } |
300 | dev->_audioframe_count++; | ||
301 | fput(file); | ||
335 | 302 | ||
336 | return 0; | 303 | return 0; |
337 | } | 304 | } |
@@ -354,81 +321,41 @@ static void cx25821_audioups_handler(struct work_struct *work) | |||
354 | static int cx25821_openfile_audio(struct cx25821_dev *dev, | 321 | static int cx25821_openfile_audio(struct cx25821_dev *dev, |
355 | const struct sram_channel *sram_ch) | 322 | const struct sram_channel *sram_ch) |
356 | { | 323 | { |
357 | struct file *myfile; | 324 | char *p = (void *)dev->_audiodata_buf_virt_addr; |
358 | int i = 0, j = 0; | 325 | struct file *file; |
359 | int line_size = AUDIO_LINE_SIZE; | 326 | loff_t offset; |
360 | ssize_t vfs_read_retval = 0; | 327 | int i, j; |
361 | char mybuf[line_size]; | 328 | |
362 | loff_t pos; | 329 | file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); |
363 | loff_t offset = (unsigned long)0; | 330 | if (IS_ERR(file)) { |
364 | mm_segment_t old_fs; | 331 | pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n", |
365 | 332 | __func__, dev->_audiofilename, PTR_ERR(file)); | |
366 | myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); | 333 | return PTR_ERR(file); |
367 | 334 | } | |
368 | if (IS_ERR(myfile)) { | ||
369 | const int open_errno = -PTR_ERR(myfile); | ||
370 | pr_err("%s(): ERROR opening file(%s) with errno = %d!\n", | ||
371 | __func__, dev->_audiofilename, open_errno); | ||
372 | return PTR_ERR(myfile); | ||
373 | } else { | ||
374 | if (!(myfile->f_op)) { | ||
375 | pr_err("%s(): File has no file operations registered!\n", | ||
376 | __func__); | ||
377 | filp_close(myfile, NULL); | ||
378 | return -EIO; | ||
379 | } | ||
380 | |||
381 | if (!myfile->f_op->read) { | ||
382 | pr_err("%s(): File has no READ operations registered!\n", | ||
383 | __func__); | ||
384 | filp_close(myfile, NULL); | ||
385 | return -EIO; | ||
386 | } | ||
387 | |||
388 | pos = myfile->f_pos; | ||
389 | old_fs = get_fs(); | ||
390 | set_fs(KERNEL_DS); | ||
391 | |||
392 | for (j = 0; j < NUM_AUDIO_FRAMES; j++) { | ||
393 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
394 | pos = offset; | ||
395 | |||
396 | vfs_read_retval = vfs_read(myfile, mybuf, | ||
397 | line_size, &pos); | ||
398 | |||
399 | if (vfs_read_retval > 0 && | ||
400 | vfs_read_retval == line_size && | ||
401 | dev->_audiodata_buf_virt_addr != NULL) { | ||
402 | memcpy((void *)(dev-> | ||
403 | _audiodata_buf_virt_addr | ||
404 | + offset / 4), mybuf, | ||
405 | vfs_read_retval); | ||
406 | } | ||
407 | 335 | ||
408 | offset += vfs_read_retval; | 336 | for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) { |
337 | for (i = 0; i < dev->_audio_lines_count; i++) { | ||
338 | char buf[AUDIO_LINE_SIZE]; | ||
339 | int n = kernel_read(file, offset, buf, | ||
340 | AUDIO_LINE_SIZE); | ||
409 | 341 | ||
410 | if (vfs_read_retval < line_size) { | 342 | if (n < AUDIO_LINE_SIZE) { |
411 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", | 343 | pr_info("Done: exit %s() since no more bytes to read from Audio file\n", |
412 | __func__); | 344 | __func__); |
413 | break; | 345 | dev->_audiofile_status = END_OF_FILE; |
414 | } | 346 | fput(file); |
347 | return 0; | ||
415 | } | 348 | } |
416 | 349 | ||
417 | if (i > 0) | 350 | if (p) |
418 | dev->_audioframe_count++; | 351 | memcpy(p + offset, buf, n); |
419 | 352 | ||
420 | if (vfs_read_retval < line_size) | 353 | offset += n; |
421 | break; | ||
422 | } | 354 | } |
423 | 355 | dev->_audioframe_count++; | |
424 | dev->_audiofile_status = (vfs_read_retval == line_size) ? | ||
425 | IN_PROGRESS : END_OF_FILE; | ||
426 | |||
427 | set_fs(old_fs); | ||
428 | myfile->f_pos = 0; | ||
429 | filp_close(myfile, NULL); | ||
430 | } | 356 | } |
431 | 357 | dev->_audiofile_status = IN_PROGRESS; | |
358 | fput(file); | ||
432 | return 0; | 359 | return 0; |
433 | } | 360 | } |
434 | 361 | ||
diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c index eb822862a646..0e763a784e2b 100644 --- a/drivers/media/pci/ttpci/av7110_ir.c +++ b/drivers/media/pci/ttpci/av7110_ir.c | |||
@@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110) | |||
375 | if (av_cnt == 1) { | 375 | if (av_cnt == 1) { |
376 | e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops); | 376 | e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops); |
377 | if (e) | 377 | if (e) |
378 | e->size = 4 + 256 * sizeof(u16); | 378 | proc_set_size(e, 4 + 256 * sizeof(u16)); |
379 | } | 379 | } |
380 | 380 | ||
381 | tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir); | 381 | tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir); |
diff --git a/drivers/media/pci/zoran/zoran_procfs.c b/drivers/media/pci/zoran/zoran_procfs.c index 1512b5d40533..f7ceee0cdefd 100644 --- a/drivers/media/pci/zoran/zoran_procfs.c +++ b/drivers/media/pci/zoran/zoran_procfs.c | |||
@@ -130,14 +130,14 @@ static int zoran_show(struct seq_file *p, void *v) | |||
130 | 130 | ||
131 | static int zoran_open(struct inode *inode, struct file *file) | 131 | static int zoran_open(struct inode *inode, struct file *file) |
132 | { | 132 | { |
133 | struct zoran *data = PDE(inode)->data; | 133 | struct zoran *data = PDE_DATA(inode); |
134 | return single_open(file, zoran_show, data); | 134 | return single_open(file, zoran_show, data); |
135 | } | 135 | } |
136 | 136 | ||
137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, | 137 | static ssize_t zoran_write(struct file *file, const char __user *buffer, |
138 | size_t count, loff_t *ppos) | 138 | size_t count, loff_t *ppos) |
139 | { | 139 | { |
140 | struct zoran *zr = PDE(file_inode(file))->data; | 140 | struct zoran *zr = PDE_DATA(file_inode(file)); |
141 | char *string, *sp; | 141 | char *string, *sp; |
142 | char *line, *ldelim, *varname, *svar, *tdelim; | 142 | char *line, *ldelim, *varname, *svar, *tdelim; |
143 | 143 | ||
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index ff4d93d1907f..e4561264e124 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c | |||
@@ -307,7 +307,7 @@ static void ir_lirc_close(void *data) | |||
307 | return; | 307 | return; |
308 | } | 308 | } |
309 | 309 | ||
310 | static struct file_operations lirc_fops = { | 310 | static const struct file_operations lirc_fops = { |
311 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
312 | .write = ir_lirc_transmit_ir, | 312 | .write = ir_lirc_transmit_ir, |
313 | .unlocked_ioctl = ir_lirc_ioctl, | 313 | .unlocked_ioctl = ir_lirc_ioctl, |
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 5247d94fea29..8dc057b273f2 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c | |||
@@ -152,7 +152,7 @@ static int lirc_thread(void *irctl) | |||
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | static struct file_operations lirc_dev_fops = { | 155 | static const struct file_operations lirc_dev_fops = { |
156 | .owner = THIS_MODULE, | 156 | .owner = THIS_MODULE, |
157 | .read = lirc_dev_fop_read, | 157 | .read = lirc_dev_fop_read, |
158 | .write = lirc_dev_fop_write, | 158 | .write = lirc_dev_fop_write, |
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index fb69baa06ca8..767ff4d839f4 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -6656,7 +6656,7 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v) | |||
6656 | 6656 | ||
6657 | static int mpt_summary_proc_open(struct inode *inode, struct file *file) | 6657 | static int mpt_summary_proc_open(struct inode *inode, struct file *file) |
6658 | { | 6658 | { |
6659 | return single_open(file, mpt_summary_proc_show, PDE(inode)->data); | 6659 | return single_open(file, mpt_summary_proc_show, PDE_DATA(inode)); |
6660 | } | 6660 | } |
6661 | 6661 | ||
6662 | static const struct file_operations mpt_summary_proc_fops = { | 6662 | static const struct file_operations mpt_summary_proc_fops = { |
@@ -6805,7 +6805,7 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) | |||
6805 | 6805 | ||
6806 | static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file) | 6806 | static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file) |
6807 | { | 6807 | { |
6808 | return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data); | 6808 | return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode)); |
6809 | } | 6809 | } |
6810 | 6810 | ||
6811 | static const struct file_operations mpt_iocinfo_proc_fops = { | 6811 | static const struct file_operations mpt_iocinfo_proc_fops = { |
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index b383b6961e59..dcc8385adeb3 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -597,13 +597,6 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
597 | } | 597 | } |
598 | 598 | ||
599 | static int | 599 | static int |
600 | mptctl_release(struct inode *inode, struct file *filep) | ||
601 | { | ||
602 | fasync_helper(-1, filep, 0, &async_queue); | ||
603 | return 0; | ||
604 | } | ||
605 | |||
606 | static int | ||
607 | mptctl_fasync(int fd, struct file *filep, int mode) | 600 | mptctl_fasync(int fd, struct file *filep, int mode) |
608 | { | 601 | { |
609 | MPT_ADAPTER *ioc; | 602 | MPT_ADAPTER *ioc; |
@@ -2822,7 +2815,6 @@ static const struct file_operations mptctl_fops = { | |||
2822 | .llseek = no_llseek, | 2815 | .llseek = no_llseek, |
2823 | .fasync = mptctl_fasync, | 2816 | .fasync = mptctl_fasync, |
2824 | .unlocked_ioctl = mptctl_ioctl, | 2817 | .unlocked_ioctl = mptctl_ioctl, |
2825 | .release = mptctl_release, | ||
2826 | #ifdef CONFIG_COMPAT | 2818 | #ifdef CONFIG_COMPAT |
2827 | .compat_ioctl = compat_mpctl_ioctl, | 2819 | .compat_ioctl = compat_mpctl_ioctl, |
2828 | #endif | 2820 | #endif |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index c13cd9bc590b..fd75108c355e 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -109,7 +109,7 @@ static int mptfc_host_reset(struct scsi_cmnd *SCpnt); | |||
109 | static struct scsi_host_template mptfc_driver_template = { | 109 | static struct scsi_host_template mptfc_driver_template = { |
110 | .module = THIS_MODULE, | 110 | .module = THIS_MODULE, |
111 | .proc_name = "mptfc", | 111 | .proc_name = "mptfc", |
112 | .proc_info = mptscsih_proc_info, | 112 | .show_info = mptscsih_show_info, |
113 | .name = "MPT FC Host", | 113 | .name = "MPT FC Host", |
114 | .info = mptscsih_info, | 114 | .info = mptscsih_info, |
115 | .queuecommand = mptfc_qcmd, | 115 | .queuecommand = mptfc_qcmd, |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index fa43c391c8ed..ffee6f781e30 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -1977,7 +1977,7 @@ done: | |||
1977 | static struct scsi_host_template mptsas_driver_template = { | 1977 | static struct scsi_host_template mptsas_driver_template = { |
1978 | .module = THIS_MODULE, | 1978 | .module = THIS_MODULE, |
1979 | .proc_name = "mptsas", | 1979 | .proc_name = "mptsas", |
1980 | .proc_info = mptscsih_proc_info, | 1980 | .show_info = mptscsih_show_info, |
1981 | .name = "MPT SAS Host", | 1981 | .name = "MPT SAS Host", |
1982 | .info = mptscsih_info, | 1982 | .info = mptscsih_info, |
1983 | .queuecommand = mptsas_qcmd, | 1983 | .queuecommand = mptsas_qcmd, |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 164afa71bba7..727819cc7034 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1284,101 +1284,17 @@ mptscsih_info(struct Scsi_Host *SChost) | |||
1284 | return h->info_kbuf; | 1284 | return h->info_kbuf; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | struct info_str { | 1287 | int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host) |
1288 | char *buffer; | ||
1289 | int length; | ||
1290 | int offset; | ||
1291 | int pos; | ||
1292 | }; | ||
1293 | |||
1294 | static void | ||
1295 | mptscsih_copy_mem_info(struct info_str *info, char *data, int len) | ||
1296 | { | ||
1297 | if (info->pos + len > info->length) | ||
1298 | len = info->length - info->pos; | ||
1299 | |||
1300 | if (info->pos + len < info->offset) { | ||
1301 | info->pos += len; | ||
1302 | return; | ||
1303 | } | ||
1304 | |||
1305 | if (info->pos < info->offset) { | ||
1306 | data += (info->offset - info->pos); | ||
1307 | len -= (info->offset - info->pos); | ||
1308 | } | ||
1309 | |||
1310 | if (len > 0) { | ||
1311 | memcpy(info->buffer + info->pos, data, len); | ||
1312 | info->pos += len; | ||
1313 | } | ||
1314 | } | ||
1315 | |||
1316 | static int | ||
1317 | mptscsih_copy_info(struct info_str *info, char *fmt, ...) | ||
1318 | { | ||
1319 | va_list args; | ||
1320 | char buf[81]; | ||
1321 | int len; | ||
1322 | |||
1323 | va_start(args, fmt); | ||
1324 | len = vsprintf(buf, fmt, args); | ||
1325 | va_end(args); | ||
1326 | |||
1327 | mptscsih_copy_mem_info(info, buf, len); | ||
1328 | return len; | ||
1329 | } | ||
1330 | |||
1331 | static int | ||
1332 | mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int len) | ||
1333 | { | ||
1334 | struct info_str info; | ||
1335 | |||
1336 | info.buffer = pbuf; | ||
1337 | info.length = len; | ||
1338 | info.offset = offset; | ||
1339 | info.pos = 0; | ||
1340 | |||
1341 | mptscsih_copy_info(&info, "%s: %s, ", ioc->name, ioc->prod_name); | ||
1342 | mptscsih_copy_info(&info, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word); | ||
1343 | mptscsih_copy_info(&info, "Ports=%d, ", ioc->facts.NumberOfPorts); | ||
1344 | mptscsih_copy_info(&info, "MaxQ=%d\n", ioc->req_depth); | ||
1345 | |||
1346 | return ((info.pos > info.offset) ? info.pos - info.offset : 0); | ||
1347 | } | ||
1348 | |||
1349 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
1350 | /** | ||
1351 | * mptscsih_proc_info - Return information about MPT adapter | ||
1352 | * @host: scsi host struct | ||
1353 | * @buffer: if write, user data; if read, buffer for user | ||
1354 | * @start: returns the buffer address | ||
1355 | * @offset: if write, 0; if read, the current offset into the buffer from | ||
1356 | * the previous read. | ||
1357 | * @length: if write, return length; | ||
1358 | * @func: write = 1; read = 0 | ||
1359 | * | ||
1360 | * (linux scsi_host_template.info routine) | ||
1361 | */ | ||
1362 | int | ||
1363 | mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | ||
1364 | int length, int func) | ||
1365 | { | 1288 | { |
1366 | MPT_SCSI_HOST *hd = shost_priv(host); | 1289 | MPT_SCSI_HOST *hd = shost_priv(host); |
1367 | MPT_ADAPTER *ioc = hd->ioc; | 1290 | MPT_ADAPTER *ioc = hd->ioc; |
1368 | int size = 0; | ||
1369 | 1291 | ||
1370 | if (func) { | 1292 | seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name); |
1371 | /* | 1293 | seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word); |
1372 | * write is not supported | 1294 | seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts); |
1373 | */ | 1295 | seq_printf(m, "MaxQ=%d\n", ioc->req_depth); |
1374 | } else { | ||
1375 | if (start) | ||
1376 | *start = buffer; | ||
1377 | |||
1378 | size = mptscsih_host_info(ioc, buffer, offset, length); | ||
1379 | } | ||
1380 | 1296 | ||
1381 | return size; | 1297 | return 0; |
1382 | } | 1298 | } |
1383 | 1299 | ||
1384 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1300 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -3348,7 +3264,7 @@ EXPORT_SYMBOL(mptscsih_shutdown); | |||
3348 | EXPORT_SYMBOL(mptscsih_suspend); | 3264 | EXPORT_SYMBOL(mptscsih_suspend); |
3349 | EXPORT_SYMBOL(mptscsih_resume); | 3265 | EXPORT_SYMBOL(mptscsih_resume); |
3350 | #endif | 3266 | #endif |
3351 | EXPORT_SYMBOL(mptscsih_proc_info); | 3267 | EXPORT_SYMBOL(mptscsih_show_info); |
3352 | EXPORT_SYMBOL(mptscsih_info); | 3268 | EXPORT_SYMBOL(mptscsih_info); |
3353 | EXPORT_SYMBOL(mptscsih_qcmd); | 3269 | EXPORT_SYMBOL(mptscsih_qcmd); |
3354 | EXPORT_SYMBOL(mptscsih_slave_destroy); | 3270 | EXPORT_SYMBOL(mptscsih_slave_destroy); |
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index 43e75ff39921..83f503162f7a 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h | |||
@@ -111,7 +111,7 @@ extern void mptscsih_shutdown(struct pci_dev *); | |||
111 | extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); | 111 | extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); |
112 | extern int mptscsih_resume(struct pci_dev *pdev); | 112 | extern int mptscsih_resume(struct pci_dev *pdev); |
113 | #endif | 113 | #endif |
114 | extern int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int func); | 114 | extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *); |
115 | extern const char * mptscsih_info(struct Scsi_Host *SChost); | 115 | extern const char * mptscsih_info(struct Scsi_Host *SChost); |
116 | extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)); | 116 | extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)); |
117 | extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, | 117 | extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index c3aabde2dc4f..5653e505f91f 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -831,7 +831,7 @@ static void mptspi_slave_destroy(struct scsi_device *sdev) | |||
831 | static struct scsi_host_template mptspi_driver_template = { | 831 | static struct scsi_host_template mptspi_driver_template = { |
832 | .module = THIS_MODULE, | 832 | .module = THIS_MODULE, |
833 | .proc_name = "mptspi", | 833 | .proc_name = "mptspi", |
834 | .proc_info = mptscsih_proc_info, | 834 | .show_info = mptscsih_show_info, |
835 | .name = "MPT SPI Host", | 835 | .name = "MPT SPI Host", |
836 | .info = mptscsih_info, | 836 | .info = mptscsih_info, |
837 | .queuecommand = mptspi_qcmd, | 837 | .queuecommand = mptspi_qcmd, |
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c index 8001aa6bfb48..b7d87cd227a9 100644 --- a/drivers/message/i2o/i2o_proc.c +++ b/drivers/message/i2o/i2o_proc.c | |||
@@ -1599,98 +1599,98 @@ static int i2o_seq_show_sensors(struct seq_file *seq, void *v) | |||
1599 | 1599 | ||
1600 | static int i2o_seq_open_hrt(struct inode *inode, struct file *file) | 1600 | static int i2o_seq_open_hrt(struct inode *inode, struct file *file) |
1601 | { | 1601 | { |
1602 | return single_open(file, i2o_seq_show_hrt, PDE(inode)->data); | 1602 | return single_open(file, i2o_seq_show_hrt, PDE_DATA(inode)); |
1603 | }; | 1603 | }; |
1604 | 1604 | ||
1605 | static int i2o_seq_open_lct(struct inode *inode, struct file *file) | 1605 | static int i2o_seq_open_lct(struct inode *inode, struct file *file) |
1606 | { | 1606 | { |
1607 | return single_open(file, i2o_seq_show_lct, PDE(inode)->data); | 1607 | return single_open(file, i2o_seq_show_lct, PDE_DATA(inode)); |
1608 | }; | 1608 | }; |
1609 | 1609 | ||
1610 | static int i2o_seq_open_status(struct inode *inode, struct file *file) | 1610 | static int i2o_seq_open_status(struct inode *inode, struct file *file) |
1611 | { | 1611 | { |
1612 | return single_open(file, i2o_seq_show_status, PDE(inode)->data); | 1612 | return single_open(file, i2o_seq_show_status, PDE_DATA(inode)); |
1613 | }; | 1613 | }; |
1614 | 1614 | ||
1615 | static int i2o_seq_open_hw(struct inode *inode, struct file *file) | 1615 | static int i2o_seq_open_hw(struct inode *inode, struct file *file) |
1616 | { | 1616 | { |
1617 | return single_open(file, i2o_seq_show_hw, PDE(inode)->data); | 1617 | return single_open(file, i2o_seq_show_hw, PDE_DATA(inode)); |
1618 | }; | 1618 | }; |
1619 | 1619 | ||
1620 | static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file) | 1620 | static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file) |
1621 | { | 1621 | { |
1622 | return single_open(file, i2o_seq_show_ddm_table, PDE(inode)->data); | 1622 | return single_open(file, i2o_seq_show_ddm_table, PDE_DATA(inode)); |
1623 | }; | 1623 | }; |
1624 | 1624 | ||
1625 | static int i2o_seq_open_driver_store(struct inode *inode, struct file *file) | 1625 | static int i2o_seq_open_driver_store(struct inode *inode, struct file *file) |
1626 | { | 1626 | { |
1627 | return single_open(file, i2o_seq_show_driver_store, PDE(inode)->data); | 1627 | return single_open(file, i2o_seq_show_driver_store, PDE_DATA(inode)); |
1628 | }; | 1628 | }; |
1629 | 1629 | ||
1630 | static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file) | 1630 | static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file) |
1631 | { | 1631 | { |
1632 | return single_open(file, i2o_seq_show_drivers_stored, PDE(inode)->data); | 1632 | return single_open(file, i2o_seq_show_drivers_stored, PDE_DATA(inode)); |
1633 | }; | 1633 | }; |
1634 | 1634 | ||
1635 | static int i2o_seq_open_groups(struct inode *inode, struct file *file) | 1635 | static int i2o_seq_open_groups(struct inode *inode, struct file *file) |
1636 | { | 1636 | { |
1637 | return single_open(file, i2o_seq_show_groups, PDE(inode)->data); | 1637 | return single_open(file, i2o_seq_show_groups, PDE_DATA(inode)); |
1638 | }; | 1638 | }; |
1639 | 1639 | ||
1640 | static int i2o_seq_open_phys_device(struct inode *inode, struct file *file) | 1640 | static int i2o_seq_open_phys_device(struct inode *inode, struct file *file) |
1641 | { | 1641 | { |
1642 | return single_open(file, i2o_seq_show_phys_device, PDE(inode)->data); | 1642 | return single_open(file, i2o_seq_show_phys_device, PDE_DATA(inode)); |
1643 | }; | 1643 | }; |
1644 | 1644 | ||
1645 | static int i2o_seq_open_claimed(struct inode *inode, struct file *file) | 1645 | static int i2o_seq_open_claimed(struct inode *inode, struct file *file) |
1646 | { | 1646 | { |
1647 | return single_open(file, i2o_seq_show_claimed, PDE(inode)->data); | 1647 | return single_open(file, i2o_seq_show_claimed, PDE_DATA(inode)); |
1648 | }; | 1648 | }; |
1649 | 1649 | ||
1650 | static int i2o_seq_open_users(struct inode *inode, struct file *file) | 1650 | static int i2o_seq_open_users(struct inode *inode, struct file *file) |
1651 | { | 1651 | { |
1652 | return single_open(file, i2o_seq_show_users, PDE(inode)->data); | 1652 | return single_open(file, i2o_seq_show_users, PDE_DATA(inode)); |
1653 | }; | 1653 | }; |
1654 | 1654 | ||
1655 | static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file) | 1655 | static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file) |
1656 | { | 1656 | { |
1657 | return single_open(file, i2o_seq_show_priv_msgs, PDE(inode)->data); | 1657 | return single_open(file, i2o_seq_show_priv_msgs, PDE_DATA(inode)); |
1658 | }; | 1658 | }; |
1659 | 1659 | ||
1660 | static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file) | 1660 | static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file) |
1661 | { | 1661 | { |
1662 | return single_open(file, i2o_seq_show_authorized_users, | 1662 | return single_open(file, i2o_seq_show_authorized_users, |
1663 | PDE(inode)->data); | 1663 | PDE_DATA(inode)); |
1664 | }; | 1664 | }; |
1665 | 1665 | ||
1666 | static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file) | 1666 | static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file) |
1667 | { | 1667 | { |
1668 | return single_open(file, i2o_seq_show_dev_identity, PDE(inode)->data); | 1668 | return single_open(file, i2o_seq_show_dev_identity, PDE_DATA(inode)); |
1669 | }; | 1669 | }; |
1670 | 1670 | ||
1671 | static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file) | 1671 | static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file) |
1672 | { | 1672 | { |
1673 | return single_open(file, i2o_seq_show_ddm_identity, PDE(inode)->data); | 1673 | return single_open(file, i2o_seq_show_ddm_identity, PDE_DATA(inode)); |
1674 | }; | 1674 | }; |
1675 | 1675 | ||
1676 | static int i2o_seq_open_uinfo(struct inode *inode, struct file *file) | 1676 | static int i2o_seq_open_uinfo(struct inode *inode, struct file *file) |
1677 | { | 1677 | { |
1678 | return single_open(file, i2o_seq_show_uinfo, PDE(inode)->data); | 1678 | return single_open(file, i2o_seq_show_uinfo, PDE_DATA(inode)); |
1679 | }; | 1679 | }; |
1680 | 1680 | ||
1681 | static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file) | 1681 | static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file) |
1682 | { | 1682 | { |
1683 | return single_open(file, i2o_seq_show_sgl_limits, PDE(inode)->data); | 1683 | return single_open(file, i2o_seq_show_sgl_limits, PDE_DATA(inode)); |
1684 | }; | 1684 | }; |
1685 | 1685 | ||
1686 | static int i2o_seq_open_sensors(struct inode *inode, struct file *file) | 1686 | static int i2o_seq_open_sensors(struct inode *inode, struct file *file) |
1687 | { | 1687 | { |
1688 | return single_open(file, i2o_seq_show_sensors, PDE(inode)->data); | 1688 | return single_open(file, i2o_seq_show_sensors, PDE_DATA(inode)); |
1689 | }; | 1689 | }; |
1690 | 1690 | ||
1691 | static int i2o_seq_open_dev_name(struct inode *inode, struct file *file) | 1691 | static int i2o_seq_open_dev_name(struct inode *inode, struct file *file) |
1692 | { | 1692 | { |
1693 | return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data); | 1693 | return single_open(file, i2o_seq_show_dev_name, PDE_DATA(inode)); |
1694 | }; | 1694 | }; |
1695 | 1695 | ||
1696 | static const struct file_operations i2o_seq_fops_lct = { | 1696 | static const struct file_operations i2o_seq_fops_lct = { |
@@ -1895,25 +1895,6 @@ static int i2o_proc_create_entries(struct proc_dir_entry *dir, | |||
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | /** | 1897 | /** |
1898 | * i2o_proc_subdir_remove - Remove child entries from a proc entry | ||
1899 | * @dir: proc dir entry from which the childs should be removed | ||
1900 | * | ||
1901 | * Iterate over each i2o proc entry under dir and remove it. If the child | ||
1902 | * also has entries, remove them too. | ||
1903 | */ | ||
1904 | static void i2o_proc_subdir_remove(struct proc_dir_entry *dir) | ||
1905 | { | ||
1906 | struct proc_dir_entry *pe, *tmp; | ||
1907 | pe = dir->subdir; | ||
1908 | while (pe) { | ||
1909 | tmp = pe->next; | ||
1910 | i2o_proc_subdir_remove(pe); | ||
1911 | remove_proc_entry(pe->name, dir); | ||
1912 | pe = tmp; | ||
1913 | } | ||
1914 | }; | ||
1915 | |||
1916 | /** | ||
1917 | * i2o_proc_device_add - Add an I2O device to the proc dir | 1898 | * i2o_proc_device_add - Add an I2O device to the proc dir |
1918 | * @dir: proc dir entry to which the device should be added | 1899 | * @dir: proc dir entry to which the device should be added |
1919 | * @dev: I2O device which should be added | 1900 | * @dev: I2O device which should be added |
@@ -1932,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir, | |||
1932 | 1913 | ||
1933 | osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff); | 1914 | osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff); |
1934 | 1915 | ||
1935 | devdir = proc_mkdir(buff, dir); | 1916 | devdir = proc_mkdir_data(buff, 0, dir, dev); |
1936 | if (!devdir) { | 1917 | if (!devdir) { |
1937 | osm_warn("Could not allocate procdir!\n"); | 1918 | osm_warn("Could not allocate procdir!\n"); |
1938 | return; | 1919 | return; |
1939 | } | 1920 | } |
1940 | 1921 | ||
1941 | devdir->data = dev; | ||
1942 | |||
1943 | i2o_proc_create_entries(devdir, generic_dev_entries, dev); | 1922 | i2o_proc_create_entries(devdir, generic_dev_entries, dev); |
1944 | 1923 | ||
1945 | /* Inform core that we want updates about this device's status */ | 1924 | /* Inform core that we want updates about this device's status */ |
@@ -1973,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir, | |||
1973 | 1952 | ||
1974 | osm_debug("adding IOP /proc/i2o/%s\n", c->name); | 1953 | osm_debug("adding IOP /proc/i2o/%s\n", c->name); |
1975 | 1954 | ||
1976 | iopdir = proc_mkdir(c->name, dir); | 1955 | iopdir = proc_mkdir_data(c->name, 0, dir, c); |
1977 | if (!iopdir) | 1956 | if (!iopdir) |
1978 | return -1; | 1957 | return -1; |
1979 | 1958 | ||
1980 | iopdir->data = c; | ||
1981 | |||
1982 | i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c); | 1959 | i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c); |
1983 | 1960 | ||
1984 | list_for_each_entry(dev, &c->devices, list) | 1961 | list_for_each_entry(dev, &c->devices, list) |
@@ -1988,31 +1965,6 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir, | |||
1988 | } | 1965 | } |
1989 | 1966 | ||
1990 | /** | 1967 | /** |
1991 | * i2o_proc_iop_remove - Removes an I2O controller from the i2o proc tree | ||
1992 | * @dir: parent proc dir entry | ||
1993 | * @c: I2O controller which should be removed | ||
1994 | * | ||
1995 | * Iterate over each i2o proc entry and search controller c. If it is found | ||
1996 | * remove it from the tree. | ||
1997 | */ | ||
1998 | static void i2o_proc_iop_remove(struct proc_dir_entry *dir, | ||
1999 | struct i2o_controller *c) | ||
2000 | { | ||
2001 | struct proc_dir_entry *pe, *tmp; | ||
2002 | |||
2003 | pe = dir->subdir; | ||
2004 | while (pe) { | ||
2005 | tmp = pe->next; | ||
2006 | if (pe->data == c) { | ||
2007 | i2o_proc_subdir_remove(pe); | ||
2008 | remove_proc_entry(pe->name, dir); | ||
2009 | } | ||
2010 | osm_debug("removing IOP /proc/i2o/%s\n", c->name); | ||
2011 | pe = tmp; | ||
2012 | } | ||
2013 | } | ||
2014 | |||
2015 | /** | ||
2016 | * i2o_proc_fs_create - Create the i2o proc fs. | 1968 | * i2o_proc_fs_create - Create the i2o proc fs. |
2017 | * | 1969 | * |
2018 | * Iterate over each I2O controller and create the entries for it. | 1970 | * Iterate over each I2O controller and create the entries for it. |
@@ -2042,12 +1994,7 @@ static int __init i2o_proc_fs_create(void) | |||
2042 | */ | 1994 | */ |
2043 | static int __exit i2o_proc_fs_destroy(void) | 1995 | static int __exit i2o_proc_fs_destroy(void) |
2044 | { | 1996 | { |
2045 | struct i2o_controller *c; | 1997 | remove_proc_subtree("i2o", NULL); |
2046 | |||
2047 | list_for_each_entry(c, &i2o_controllers, list) | ||
2048 | i2o_proc_iop_remove(i2o_proc_dir_root, c); | ||
2049 | |||
2050 | remove_proc_entry("i2o", NULL); | ||
2051 | 1998 | ||
2052 | return 0; | 1999 | return 0; |
2053 | }; | 2000 | }; |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c index 4a87e5c0a320..4cd4a3d2a76a 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d.c +++ b/drivers/misc/lis3lv02d/lis3lv02d.c | |||
@@ -593,7 +593,6 @@ static int lis3lv02d_misc_release(struct inode *inode, struct file *file) | |||
593 | struct lis3lv02d *lis3 = container_of(file->private_data, | 593 | struct lis3lv02d *lis3 = container_of(file->private_data, |
594 | struct lis3lv02d, miscdev); | 594 | struct lis3lv02d, miscdev); |
595 | 595 | ||
596 | fasync_helper(-1, file, 0, &lis3->async_queue); | ||
597 | clear_bit(0, &lis3->misc_opened); /* release the device */ | 596 | clear_bit(0, &lis3->misc_opened); /* release the device */ |
598 | if (lis3->pm_dev) | 597 | if (lis3->pm_dev) |
599 | pm_runtime_put(lis3->pm_dev); | 598 | pm_runtime_put(lis3->pm_dev); |
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c index 950dbe9ecb36..797d7962cc88 100644 --- a/drivers/misc/sgi-gru/gruprocfs.c +++ b/drivers/misc/sgi-gru/gruprocfs.c | |||
@@ -355,7 +355,7 @@ static void delete_proc_files(void) | |||
355 | for (p = proc_files; p->name; p++) | 355 | for (p = proc_files; p->name; p++) |
356 | if (p->entry) | 356 | if (p->entry) |
357 | remove_proc_entry(p->name, proc_gru); | 357 | remove_proc_entry(p->name, proc_gru); |
358 | remove_proc_entry("gru", proc_gru->parent); | 358 | proc_remove(proc_gru); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 61d5f56473e1..322ca65b0cc5 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/idr.h> | 36 | #include <linux/idr.h> |
37 | #include <linux/backing-dev.h> | 37 | #include <linux/backing-dev.h> |
38 | #include <linux/gfp.h> | 38 | #include <linux/gfp.h> |
39 | #include <linux/slab.h> | ||
39 | 40 | ||
40 | #include <linux/mtd/mtd.h> | 41 | #include <linux/mtd/mtd.h> |
41 | #include <linux/mtd/partitions.h> | 42 | #include <linux/mtd/partitions.h> |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 3cea38d37344..94d06f1307b8 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
@@ -218,15 +218,13 @@ static const struct seq_operations bond_info_seq_ops = { | |||
218 | static int bond_info_open(struct inode *inode, struct file *file) | 218 | static int bond_info_open(struct inode *inode, struct file *file) |
219 | { | 219 | { |
220 | struct seq_file *seq; | 220 | struct seq_file *seq; |
221 | struct proc_dir_entry *proc; | ||
222 | int res; | 221 | int res; |
223 | 222 | ||
224 | res = seq_open(file, &bond_info_seq_ops); | 223 | res = seq_open(file, &bond_info_seq_ops); |
225 | if (!res) { | 224 | if (!res) { |
226 | /* recover the pointer buried in proc_dir_entry data */ | 225 | /* recover the pointer buried in proc_dir_entry data */ |
227 | seq = file->private_data; | 226 | seq = file->private_data; |
228 | proc = PDE(inode); | 227 | seq->private = PDE_DATA(inode); |
229 | seq->private = proc->data; | ||
230 | } | 228 | } |
231 | 229 | ||
232 | return res; | 230 | return res; |
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 2f99f8881dfc..5f4758492e4c 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
@@ -383,7 +383,7 @@ static int vlsi_seq_show(struct seq_file *seq, void *v) | |||
383 | 383 | ||
384 | static int vlsi_seq_open(struct inode *inode, struct file *file) | 384 | static int vlsi_seq_open(struct inode *inode, struct file *file) |
385 | { | 385 | { |
386 | return single_open(file, vlsi_seq_show, PDE(inode)->data); | 386 | return single_open(file, vlsi_seq_show, PDE_DATA(inode)); |
387 | } | 387 | } |
388 | 388 | ||
389 | static const struct file_operations vlsi_proc_fops = { | 389 | static const struct file_operations vlsi_proc_fops = { |
@@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1678 | IRDA_WARNING("%s: failed to create proc entry\n", | 1678 | IRDA_WARNING("%s: failed to create proc entry\n", |
1679 | __func__); | 1679 | __func__); |
1680 | } else { | 1680 | } else { |
1681 | ent->size = 0; | 1681 | proc_set_size(ent, 0); |
1682 | } | 1682 | } |
1683 | idev->proc_entry = ent; | 1683 | idev->proc_entry = ent; |
1684 | } | 1684 | } |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 53295418f576..6125adb520a3 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4506,108 +4506,75 @@ static int setup_proc_entry( struct net_device *dev, | |||
4506 | apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, | 4506 | apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm, |
4507 | airo_entry); | 4507 | airo_entry); |
4508 | if (!apriv->proc_entry) | 4508 | if (!apriv->proc_entry) |
4509 | goto fail; | 4509 | return -ENOMEM; |
4510 | apriv->proc_entry->uid = proc_kuid; | 4510 | proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid); |
4511 | apriv->proc_entry->gid = proc_kgid; | ||
4512 | 4511 | ||
4513 | /* Setup the StatsDelta */ | 4512 | /* Setup the StatsDelta */ |
4514 | entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, | 4513 | entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm, |
4515 | apriv->proc_entry, &proc_statsdelta_ops, dev); | 4514 | apriv->proc_entry, &proc_statsdelta_ops, dev); |
4516 | if (!entry) | 4515 | if (!entry) |
4517 | goto fail_stats_delta; | 4516 | goto fail; |
4518 | entry->uid = proc_kuid; | 4517 | proc_set_user(entry, proc_kuid, proc_kgid); |
4519 | entry->gid = proc_kgid; | ||
4520 | 4518 | ||
4521 | /* Setup the Stats */ | 4519 | /* Setup the Stats */ |
4522 | entry = proc_create_data("Stats", S_IRUGO & proc_perm, | 4520 | entry = proc_create_data("Stats", S_IRUGO & proc_perm, |
4523 | apriv->proc_entry, &proc_stats_ops, dev); | 4521 | apriv->proc_entry, &proc_stats_ops, dev); |
4524 | if (!entry) | 4522 | if (!entry) |
4525 | goto fail_stats; | 4523 | goto fail; |
4526 | entry->uid = proc_kuid; | 4524 | proc_set_user(entry, proc_kuid, proc_kgid); |
4527 | entry->gid = proc_kgid; | ||
4528 | 4525 | ||
4529 | /* Setup the Status */ | 4526 | /* Setup the Status */ |
4530 | entry = proc_create_data("Status", S_IRUGO & proc_perm, | 4527 | entry = proc_create_data("Status", S_IRUGO & proc_perm, |
4531 | apriv->proc_entry, &proc_status_ops, dev); | 4528 | apriv->proc_entry, &proc_status_ops, dev); |
4532 | if (!entry) | 4529 | if (!entry) |
4533 | goto fail_status; | 4530 | goto fail; |
4534 | entry->uid = proc_kuid; | 4531 | proc_set_user(entry, proc_kuid, proc_kgid); |
4535 | entry->gid = proc_kgid; | ||
4536 | 4532 | ||
4537 | /* Setup the Config */ | 4533 | /* Setup the Config */ |
4538 | entry = proc_create_data("Config", proc_perm, | 4534 | entry = proc_create_data("Config", proc_perm, |
4539 | apriv->proc_entry, &proc_config_ops, dev); | 4535 | apriv->proc_entry, &proc_config_ops, dev); |
4540 | if (!entry) | 4536 | if (!entry) |
4541 | goto fail_config; | 4537 | goto fail; |
4542 | entry->uid = proc_kuid; | 4538 | proc_set_user(entry, proc_kuid, proc_kgid); |
4543 | entry->gid = proc_kgid; | ||
4544 | 4539 | ||
4545 | /* Setup the SSID */ | 4540 | /* Setup the SSID */ |
4546 | entry = proc_create_data("SSID", proc_perm, | 4541 | entry = proc_create_data("SSID", proc_perm, |
4547 | apriv->proc_entry, &proc_SSID_ops, dev); | 4542 | apriv->proc_entry, &proc_SSID_ops, dev); |
4548 | if (!entry) | 4543 | if (!entry) |
4549 | goto fail_ssid; | 4544 | goto fail; |
4550 | entry->uid = proc_kuid; | 4545 | proc_set_user(entry, proc_kuid, proc_kgid); |
4551 | entry->gid = proc_kgid; | ||
4552 | 4546 | ||
4553 | /* Setup the APList */ | 4547 | /* Setup the APList */ |
4554 | entry = proc_create_data("APList", proc_perm, | 4548 | entry = proc_create_data("APList", proc_perm, |
4555 | apriv->proc_entry, &proc_APList_ops, dev); | 4549 | apriv->proc_entry, &proc_APList_ops, dev); |
4556 | if (!entry) | 4550 | if (!entry) |
4557 | goto fail_aplist; | 4551 | goto fail; |
4558 | entry->uid = proc_kuid; | 4552 | proc_set_user(entry, proc_kuid, proc_kgid); |
4559 | entry->gid = proc_kgid; | ||
4560 | 4553 | ||
4561 | /* Setup the BSSList */ | 4554 | /* Setup the BSSList */ |
4562 | entry = proc_create_data("BSSList", proc_perm, | 4555 | entry = proc_create_data("BSSList", proc_perm, |
4563 | apriv->proc_entry, &proc_BSSList_ops, dev); | 4556 | apriv->proc_entry, &proc_BSSList_ops, dev); |
4564 | if (!entry) | 4557 | if (!entry) |
4565 | goto fail_bsslist; | 4558 | goto fail; |
4566 | entry->uid = proc_kuid; | 4559 | proc_set_user(entry, proc_kuid, proc_kgid); |
4567 | entry->gid = proc_kgid; | ||
4568 | 4560 | ||
4569 | /* Setup the WepKey */ | 4561 | /* Setup the WepKey */ |
4570 | entry = proc_create_data("WepKey", proc_perm, | 4562 | entry = proc_create_data("WepKey", proc_perm, |
4571 | apriv->proc_entry, &proc_wepkey_ops, dev); | 4563 | apriv->proc_entry, &proc_wepkey_ops, dev); |
4572 | if (!entry) | 4564 | if (!entry) |
4573 | goto fail_wepkey; | 4565 | goto fail; |
4574 | entry->uid = proc_kuid; | 4566 | proc_set_user(entry, proc_kuid, proc_kgid); |
4575 | entry->gid = proc_kgid; | ||
4576 | |||
4577 | return 0; | 4567 | return 0; |
4578 | 4568 | ||
4579 | fail_wepkey: | ||
4580 | remove_proc_entry("BSSList", apriv->proc_entry); | ||
4581 | fail_bsslist: | ||
4582 | remove_proc_entry("APList", apriv->proc_entry); | ||
4583 | fail_aplist: | ||
4584 | remove_proc_entry("SSID", apriv->proc_entry); | ||
4585 | fail_ssid: | ||
4586 | remove_proc_entry("Config", apriv->proc_entry); | ||
4587 | fail_config: | ||
4588 | remove_proc_entry("Status", apriv->proc_entry); | ||
4589 | fail_status: | ||
4590 | remove_proc_entry("Stats", apriv->proc_entry); | ||
4591 | fail_stats: | ||
4592 | remove_proc_entry("StatsDelta", apriv->proc_entry); | ||
4593 | fail_stats_delta: | ||
4594 | remove_proc_entry(apriv->proc_name, airo_entry); | ||
4595 | fail: | 4569 | fail: |
4570 | remove_proc_subtree(apriv->proc_name, airo_entry); | ||
4596 | return -ENOMEM; | 4571 | return -ENOMEM; |
4597 | } | 4572 | } |
4598 | 4573 | ||
4599 | static int takedown_proc_entry( struct net_device *dev, | 4574 | static int takedown_proc_entry( struct net_device *dev, |
4600 | struct airo_info *apriv ) { | 4575 | struct airo_info *apriv ) |
4601 | if ( !apriv->proc_entry->namelen ) return 0; | 4576 | { |
4602 | remove_proc_entry("Stats",apriv->proc_entry); | 4577 | remove_proc_subtree(apriv->proc_name, airo_entry); |
4603 | remove_proc_entry("StatsDelta",apriv->proc_entry); | ||
4604 | remove_proc_entry("Status",apriv->proc_entry); | ||
4605 | remove_proc_entry("Config",apriv->proc_entry); | ||
4606 | remove_proc_entry("SSID",apriv->proc_entry); | ||
4607 | remove_proc_entry("APList",apriv->proc_entry); | ||
4608 | remove_proc_entry("BSSList",apriv->proc_entry); | ||
4609 | remove_proc_entry("WepKey",apriv->proc_entry); | ||
4610 | remove_proc_entry(apriv->proc_name,airo_entry); | ||
4611 | return 0; | 4578 | return 0; |
4612 | } | 4579 | } |
4613 | 4580 | ||
@@ -4663,8 +4630,7 @@ static ssize_t proc_write( struct file *file, | |||
4663 | static int proc_status_open(struct inode *inode, struct file *file) | 4630 | static int proc_status_open(struct inode *inode, struct file *file) |
4664 | { | 4631 | { |
4665 | struct proc_data *data; | 4632 | struct proc_data *data; |
4666 | struct proc_dir_entry *dp = PDE(inode); | 4633 | struct net_device *dev = PDE_DATA(inode); |
4667 | struct net_device *dev = dp->data; | ||
4668 | struct airo_info *apriv = dev->ml_priv; | 4634 | struct airo_info *apriv = dev->ml_priv; |
4669 | CapabilityRid cap_rid; | 4635 | CapabilityRid cap_rid; |
4670 | StatusRid status_rid; | 4636 | StatusRid status_rid; |
@@ -4746,8 +4712,7 @@ static int proc_stats_rid_open( struct inode *inode, | |||
4746 | u16 rid ) | 4712 | u16 rid ) |
4747 | { | 4713 | { |
4748 | struct proc_data *data; | 4714 | struct proc_data *data; |
4749 | struct proc_dir_entry *dp = PDE(inode); | 4715 | struct net_device *dev = PDE_DATA(inode); |
4750 | struct net_device *dev = dp->data; | ||
4751 | struct airo_info *apriv = dev->ml_priv; | 4716 | struct airo_info *apriv = dev->ml_priv; |
4752 | StatsRid stats; | 4717 | StatsRid stats; |
4753 | int i, j; | 4718 | int i, j; |
@@ -4809,8 +4774,7 @@ static inline int sniffing_mode(struct airo_info *ai) | |||
4809 | static void proc_config_on_close(struct inode *inode, struct file *file) | 4774 | static void proc_config_on_close(struct inode *inode, struct file *file) |
4810 | { | 4775 | { |
4811 | struct proc_data *data = file->private_data; | 4776 | struct proc_data *data = file->private_data; |
4812 | struct proc_dir_entry *dp = PDE(inode); | 4777 | struct net_device *dev = PDE_DATA(inode); |
4813 | struct net_device *dev = dp->data; | ||
4814 | struct airo_info *ai = dev->ml_priv; | 4778 | struct airo_info *ai = dev->ml_priv; |
4815 | char *line; | 4779 | char *line; |
4816 | 4780 | ||
@@ -5021,8 +4985,7 @@ static const char *get_rmode(__le16 mode) | |||
5021 | static int proc_config_open(struct inode *inode, struct file *file) | 4985 | static int proc_config_open(struct inode *inode, struct file *file) |
5022 | { | 4986 | { |
5023 | struct proc_data *data; | 4987 | struct proc_data *data; |
5024 | struct proc_dir_entry *dp = PDE(inode); | 4988 | struct net_device *dev = PDE_DATA(inode); |
5025 | struct net_device *dev = dp->data; | ||
5026 | struct airo_info *ai = dev->ml_priv; | 4989 | struct airo_info *ai = dev->ml_priv; |
5027 | int i; | 4990 | int i; |
5028 | __le16 mode; | 4991 | __le16 mode; |
@@ -5112,8 +5075,7 @@ static int proc_config_open(struct inode *inode, struct file *file) | |||
5112 | static void proc_SSID_on_close(struct inode *inode, struct file *file) | 5075 | static void proc_SSID_on_close(struct inode *inode, struct file *file) |
5113 | { | 5076 | { |
5114 | struct proc_data *data = file->private_data; | 5077 | struct proc_data *data = file->private_data; |
5115 | struct proc_dir_entry *dp = PDE(inode); | 5078 | struct net_device *dev = PDE_DATA(inode); |
5116 | struct net_device *dev = dp->data; | ||
5117 | struct airo_info *ai = dev->ml_priv; | 5079 | struct airo_info *ai = dev->ml_priv; |
5118 | SsidRid SSID_rid; | 5080 | SsidRid SSID_rid; |
5119 | int i; | 5081 | int i; |
@@ -5148,8 +5110,7 @@ static void proc_SSID_on_close(struct inode *inode, struct file *file) | |||
5148 | 5110 | ||
5149 | static void proc_APList_on_close( struct inode *inode, struct file *file ) { | 5111 | static void proc_APList_on_close( struct inode *inode, struct file *file ) { |
5150 | struct proc_data *data = file->private_data; | 5112 | struct proc_data *data = file->private_data; |
5151 | struct proc_dir_entry *dp = PDE(inode); | 5113 | struct net_device *dev = PDE_DATA(inode); |
5152 | struct net_device *dev = dp->data; | ||
5153 | struct airo_info *ai = dev->ml_priv; | 5114 | struct airo_info *ai = dev->ml_priv; |
5154 | APListRid APList_rid; | 5115 | APListRid APList_rid; |
5155 | int i; | 5116 | int i; |
@@ -5283,8 +5244,7 @@ static int set_wep_tx_idx(struct airo_info *ai, u16 index, int perm, int lock) | |||
5283 | 5244 | ||
5284 | static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { | 5245 | static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { |
5285 | struct proc_data *data; | 5246 | struct proc_data *data; |
5286 | struct proc_dir_entry *dp = PDE(inode); | 5247 | struct net_device *dev = PDE_DATA(inode); |
5287 | struct net_device *dev = dp->data; | ||
5288 | struct airo_info *ai = dev->ml_priv; | 5248 | struct airo_info *ai = dev->ml_priv; |
5289 | int i, rc; | 5249 | int i, rc; |
5290 | char key[16]; | 5250 | char key[16]; |
@@ -5335,8 +5295,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) { | |||
5335 | static int proc_wepkey_open( struct inode *inode, struct file *file ) | 5295 | static int proc_wepkey_open( struct inode *inode, struct file *file ) |
5336 | { | 5296 | { |
5337 | struct proc_data *data; | 5297 | struct proc_data *data; |
5338 | struct proc_dir_entry *dp = PDE(inode); | 5298 | struct net_device *dev = PDE_DATA(inode); |
5339 | struct net_device *dev = dp->data; | ||
5340 | struct airo_info *ai = dev->ml_priv; | 5299 | struct airo_info *ai = dev->ml_priv; |
5341 | char *ptr; | 5300 | char *ptr; |
5342 | WepKeyRid wkr; | 5301 | WepKeyRid wkr; |
@@ -5384,8 +5343,7 @@ static int proc_wepkey_open( struct inode *inode, struct file *file ) | |||
5384 | static int proc_SSID_open(struct inode *inode, struct file *file) | 5343 | static int proc_SSID_open(struct inode *inode, struct file *file) |
5385 | { | 5344 | { |
5386 | struct proc_data *data; | 5345 | struct proc_data *data; |
5387 | struct proc_dir_entry *dp = PDE(inode); | 5346 | struct net_device *dev = PDE_DATA(inode); |
5388 | struct net_device *dev = dp->data; | ||
5389 | struct airo_info *ai = dev->ml_priv; | 5347 | struct airo_info *ai = dev->ml_priv; |
5390 | int i; | 5348 | int i; |
5391 | char *ptr; | 5349 | char *ptr; |
@@ -5428,8 +5386,7 @@ static int proc_SSID_open(struct inode *inode, struct file *file) | |||
5428 | 5386 | ||
5429 | static int proc_APList_open( struct inode *inode, struct file *file ) { | 5387 | static int proc_APList_open( struct inode *inode, struct file *file ) { |
5430 | struct proc_data *data; | 5388 | struct proc_data *data; |
5431 | struct proc_dir_entry *dp = PDE(inode); | 5389 | struct net_device *dev = PDE_DATA(inode); |
5432 | struct net_device *dev = dp->data; | ||
5433 | struct airo_info *ai = dev->ml_priv; | 5390 | struct airo_info *ai = dev->ml_priv; |
5434 | int i; | 5391 | int i; |
5435 | char *ptr; | 5392 | char *ptr; |
@@ -5468,8 +5425,7 @@ static int proc_APList_open( struct inode *inode, struct file *file ) { | |||
5468 | 5425 | ||
5469 | static int proc_BSSList_open( struct inode *inode, struct file *file ) { | 5426 | static int proc_BSSList_open( struct inode *inode, struct file *file ) { |
5470 | struct proc_data *data; | 5427 | struct proc_data *data; |
5471 | struct proc_dir_entry *dp = PDE(inode); | 5428 | struct net_device *dev = PDE_DATA(inode); |
5472 | struct net_device *dev = dp->data; | ||
5473 | struct airo_info *ai = dev->ml_priv; | 5429 | struct airo_info *ai = dev->ml_priv; |
5474 | char *ptr; | 5430 | char *ptr; |
5475 | BSSListRid BSSList_rid; | 5431 | BSSListRid BSSList_rid; |
@@ -5706,10 +5662,8 @@ static int __init airo_init_module( void ) | |||
5706 | 5662 | ||
5707 | airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); | 5663 | airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL); |
5708 | 5664 | ||
5709 | if (airo_entry) { | 5665 | if (airo_entry) |
5710 | airo_entry->uid = proc_kuid; | 5666 | proc_set_user(airo_entry, proc_kuid, proc_kgid); |
5711 | airo_entry->gid = proc_kgid; | ||
5712 | } | ||
5713 | 5667 | ||
5714 | for (i = 0; i < 4 && io[i] && irq[i]; i++) { | 5668 | for (i = 0; i < 4 && io[i] && irq[i]; i++) { |
5715 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " | 5669 | airo_print_info("", "Trying to configure ISA adapter at irq=%d " |
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 4be07f5e22b9..727b1f53e6ad 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -216,7 +216,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get, | |||
216 | wil_debugfs_iomem_x32_set, "0x%08llx\n"); | 216 | wil_debugfs_iomem_x32_set, "0x%08llx\n"); |
217 | 217 | ||
218 | static struct dentry *wil_debugfs_create_iomem_x32(const char *name, | 218 | static struct dentry *wil_debugfs_create_iomem_x32(const char *name, |
219 | mode_t mode, | 219 | umode_t mode, |
220 | struct dentry *parent, | 220 | struct dentry *parent, |
221 | void __iomem *value) | 221 | void __iomem *value) |
222 | { | 222 | { |
@@ -359,7 +359,7 @@ static const struct file_operations fops_ioblob = { | |||
359 | 359 | ||
360 | static | 360 | static |
361 | struct dentry *wil_debugfs_create_ioblob(const char *name, | 361 | struct dentry *wil_debugfs_create_ioblob(const char *name, |
362 | mode_t mode, | 362 | umode_t mode, |
363 | struct dentry *parent, | 363 | struct dentry *parent, |
364 | struct debugfs_blob_wrapper *blob) | 364 | struct debugfs_blob_wrapper *blob) |
365 | { | 365 | { |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 4374079dfc2a..23a3498f14d4 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <net/iw_handler.h> | 63 | #include <net/iw_handler.h> |
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/proc_fs.h> | 65 | #include <linux/proc_fs.h> |
66 | #include <linux/seq_file.h> | ||
66 | #include <linux/device.h> | 67 | #include <linux/device.h> |
67 | #include <linux/moduleparam.h> | 68 | #include <linux/moduleparam.h> |
68 | #include <linux/firmware.h> | 69 | #include <linux/firmware.h> |
@@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel) | |||
1409 | return 0; | 1410 | return 0; |
1410 | } | 1411 | } |
1411 | 1412 | ||
1412 | static int atmel_proc_output (char *buf, struct atmel_private *priv) | 1413 | static int atmel_proc_show(struct seq_file *m, void *v) |
1413 | { | 1414 | { |
1415 | struct atmel_private *priv = m->private; | ||
1414 | int i; | 1416 | int i; |
1415 | char *p = buf; | ||
1416 | char *s, *r, *c; | 1417 | char *s, *r, *c; |
1417 | 1418 | ||
1418 | p += sprintf(p, "Driver version:\t\t%d.%d\n", | 1419 | seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR); |
1419 | DRIVER_MAJOR, DRIVER_MINOR); | ||
1420 | 1420 | ||
1421 | if (priv->station_state != STATION_STATE_DOWN) { | 1421 | if (priv->station_state != STATION_STATE_DOWN) { |
1422 | p += sprintf(p, "Firmware version:\t%d.%d build %d\n" | 1422 | seq_printf(m, |
1423 | "Firmware location:\t", | 1423 | "Firmware version:\t%d.%d build %d\n" |
1424 | priv->host_info.major_version, | 1424 | "Firmware location:\t", |
1425 | priv->host_info.minor_version, | 1425 | priv->host_info.major_version, |
1426 | priv->host_info.build_version); | 1426 | priv->host_info.minor_version, |
1427 | priv->host_info.build_version); | ||
1427 | 1428 | ||
1428 | if (priv->card_type != CARD_TYPE_EEPROM) | 1429 | if (priv->card_type != CARD_TYPE_EEPROM) |
1429 | p += sprintf(p, "on card\n"); | 1430 | seq_puts(m, "on card\n"); |
1430 | else if (priv->firmware) | 1431 | else if (priv->firmware) |
1431 | p += sprintf(p, "%s loaded by host\n", | 1432 | seq_printf(m, "%s loaded by host\n", priv->firmware_id); |
1432 | priv->firmware_id); | ||
1433 | else | 1433 | else |
1434 | p += sprintf(p, "%s loaded by hotplug\n", | 1434 | seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id); |
1435 | priv->firmware_id); | ||
1436 | 1435 | ||
1437 | switch (priv->card_type) { | 1436 | switch (priv->card_type) { |
1438 | case CARD_TYPE_PARALLEL_FLASH: | 1437 | case CARD_TYPE_PARALLEL_FLASH: |
@@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1453 | if (priv->reg_domain == channel_table[i].reg_domain) | 1452 | if (priv->reg_domain == channel_table[i].reg_domain) |
1454 | r = channel_table[i].name; | 1453 | r = channel_table[i].name; |
1455 | 1454 | ||
1456 | p += sprintf(p, "MAC memory type:\t%s\n", c); | 1455 | seq_printf(m, "MAC memory type:\t%s\n", c); |
1457 | p += sprintf(p, "Regulatory domain:\t%s\n", r); | 1456 | seq_printf(m, "Regulatory domain:\t%s\n", r); |
1458 | p += sprintf(p, "Host CRC checking:\t%s\n", | 1457 | seq_printf(m, "Host CRC checking:\t%s\n", |
1459 | priv->do_rx_crc ? "On" : "Off"); | 1458 | priv->do_rx_crc ? "On" : "Off"); |
1460 | p += sprintf(p, "WPA-capable firmware:\t%s\n", | 1459 | seq_printf(m, "WPA-capable firmware:\t%s\n", |
1461 | priv->use_wpa ? "Yes" : "No"); | 1460 | priv->use_wpa ? "Yes" : "No"); |
1462 | } | 1461 | } |
1463 | 1462 | ||
1464 | switch (priv->station_state) { | 1463 | switch (priv->station_state) { |
@@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1490 | s = "<unknown>"; | 1489 | s = "<unknown>"; |
1491 | } | 1490 | } |
1492 | 1491 | ||
1493 | p += sprintf(p, "Current state:\t\t%s\n", s); | 1492 | seq_printf(m, "Current state:\t\t%s\n", s); |
1494 | return p - buf; | 1493 | return 0; |
1495 | } | 1494 | } |
1496 | 1495 | ||
1497 | static int atmel_read_proc(char *page, char **start, off_t off, | 1496 | static int atmel_proc_open(struct inode *inode, struct file *file) |
1498 | int count, int *eof, void *data) | ||
1499 | { | 1497 | { |
1500 | struct atmel_private *priv = data; | 1498 | return single_open(file, atmel_proc_show, PDE_DATA(inode)); |
1501 | int len = atmel_proc_output (page, priv); | ||
1502 | if (len <= off+count) | ||
1503 | *eof = 1; | ||
1504 | *start = page + off; | ||
1505 | len -= off; | ||
1506 | if (len > count) | ||
1507 | len = count; | ||
1508 | if (len < 0) | ||
1509 | len = 0; | ||
1510 | return len; | ||
1511 | } | 1499 | } |
1512 | 1500 | ||
1501 | static const struct file_operations atmel_proc_fops = { | ||
1502 | .open = atmel_proc_open, | ||
1503 | .read = seq_read, | ||
1504 | .llseek = seq_lseek, | ||
1505 | .release = seq_release, | ||
1506 | }; | ||
1507 | |||
1513 | static const struct net_device_ops atmel_netdev_ops = { | 1508 | static const struct net_device_ops atmel_netdev_ops = { |
1514 | .ndo_open = atmel_open, | 1509 | .ndo_open = atmel_open, |
1515 | .ndo_stop = atmel_close, | 1510 | .ndo_stop = atmel_close, |
@@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1525 | struct device *sys_dev, | 1520 | struct device *sys_dev, |
1526 | int (*card_present)(void *), void *card) | 1521 | int (*card_present)(void *), void *card) |
1527 | { | 1522 | { |
1528 | struct proc_dir_entry *ent; | ||
1529 | struct net_device *dev; | 1523 | struct net_device *dev; |
1530 | struct atmel_private *priv; | 1524 | struct atmel_private *priv; |
1531 | int rc; | 1525 | int rc; |
@@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1630 | 1624 | ||
1631 | netif_carrier_off(dev); | 1625 | netif_carrier_off(dev); |
1632 | 1626 | ||
1633 | ent = create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); |
1634 | if (!ent) | ||
1635 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); | 1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); |
1636 | 1629 | ||
1637 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", | 1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", |
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c index dd9a18f8dbca..19c45e363aa7 100644 --- a/drivers/net/wireless/hostap/hostap_ap.c +++ b/drivers/net/wireless/hostap/hostap_ap.c | |||
@@ -17,6 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_fs.h> |
20 | #include <linux/seq_file.h> | ||
20 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
21 | #include <linux/random.h> | 22 | #include <linux/random.h> |
22 | #include <linux/if_arp.h> | 23 | #include <linux/if_arp.h> |
@@ -64,28 +65,32 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
64 | 65 | ||
65 | 66 | ||
66 | #ifndef PRISM2_NO_PROCFS_DEBUG | 67 | #ifndef PRISM2_NO_PROCFS_DEBUG |
67 | static int ap_debug_proc_read(char *page, char **start, off_t off, | 68 | static int ap_debug_proc_show(struct seq_file *m, void *v) |
68 | int count, int *eof, void *data) | 69 | { |
69 | { | 70 | struct ap_data *ap = m->private; |
70 | char *p = page; | 71 | |
71 | struct ap_data *ap = (struct ap_data *) data; | 72 | seq_printf(m, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); |
72 | 73 | seq_printf(m, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); | |
73 | if (off != 0) { | 74 | seq_printf(m, "max_inactivity=%u\n", ap->max_inactivity / HZ); |
74 | *eof = 1; | 75 | seq_printf(m, "bridge_packets=%u\n", ap->bridge_packets); |
75 | return 0; | 76 | seq_printf(m, "nullfunc_ack=%u\n", ap->nullfunc_ack); |
76 | } | 77 | seq_printf(m, "autom_ap_wds=%u\n", ap->autom_ap_wds); |
77 | 78 | seq_printf(m, "auth_algs=%u\n", ap->local->auth_algs); | |
78 | p += sprintf(p, "BridgedUnicastFrames=%u\n", ap->bridged_unicast); | 79 | seq_printf(m, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); |
79 | p += sprintf(p, "BridgedMulticastFrames=%u\n", ap->bridged_multicast); | 80 | return 0; |
80 | p += sprintf(p, "max_inactivity=%u\n", ap->max_inactivity / HZ); | 81 | } |
81 | p += sprintf(p, "bridge_packets=%u\n", ap->bridge_packets); | ||
82 | p += sprintf(p, "nullfunc_ack=%u\n", ap->nullfunc_ack); | ||
83 | p += sprintf(p, "autom_ap_wds=%u\n", ap->autom_ap_wds); | ||
84 | p += sprintf(p, "auth_algs=%u\n", ap->local->auth_algs); | ||
85 | p += sprintf(p, "tx_drop_nonassoc=%u\n", ap->tx_drop_nonassoc); | ||
86 | 82 | ||
87 | return (p - page); | 83 | static int ap_debug_proc_open(struct inode *inode, struct file *file) |
84 | { | ||
85 | return single_open(file, ap_debug_proc_show, PDE_DATA(inode)); | ||
88 | } | 86 | } |
87 | |||
88 | static const struct file_operations ap_debug_proc_fops = { | ||
89 | .open = ap_debug_proc_open, | ||
90 | .read = seq_read, | ||
91 | .llseek = seq_lseek, | ||
92 | .release = seq_release, | ||
93 | }; | ||
89 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 94 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
90 | 95 | ||
91 | 96 | ||
@@ -325,50 +330,81 @@ void hostap_deauth_all_stas(struct net_device *dev, struct ap_data *ap, | |||
325 | } | 330 | } |
326 | 331 | ||
327 | 332 | ||
328 | static int ap_control_proc_read(char *page, char **start, off_t off, | 333 | static int ap_control_proc_show(struct seq_file *m, void *v) |
329 | int count, int *eof, void *data) | ||
330 | { | 334 | { |
331 | char *p = page; | 335 | struct ap_data *ap = m->private; |
332 | struct ap_data *ap = (struct ap_data *) data; | ||
333 | char *policy_txt; | 336 | char *policy_txt; |
334 | struct mac_entry *entry; | 337 | struct mac_entry *entry; |
335 | 338 | ||
336 | if (off != 0) { | 339 | if (v == SEQ_START_TOKEN) { |
337 | *eof = 1; | 340 | switch (ap->mac_restrictions.policy) { |
341 | case MAC_POLICY_OPEN: | ||
342 | policy_txt = "open"; | ||
343 | break; | ||
344 | case MAC_POLICY_ALLOW: | ||
345 | policy_txt = "allow"; | ||
346 | break; | ||
347 | case MAC_POLICY_DENY: | ||
348 | policy_txt = "deny"; | ||
349 | break; | ||
350 | default: | ||
351 | policy_txt = "unknown"; | ||
352 | break; | ||
353 | } | ||
354 | seq_printf(m, "MAC policy: %s\n", policy_txt); | ||
355 | seq_printf(m, "MAC entries: %u\n", ap->mac_restrictions.entries); | ||
356 | seq_puts(m, "MAC list:\n"); | ||
338 | return 0; | 357 | return 0; |
339 | } | 358 | } |
340 | 359 | ||
341 | switch (ap->mac_restrictions.policy) { | 360 | entry = v; |
342 | case MAC_POLICY_OPEN: | 361 | seq_printf(m, "%pM\n", entry->addr); |
343 | policy_txt = "open"; | 362 | return 0; |
344 | break; | 363 | } |
345 | case MAC_POLICY_ALLOW: | 364 | |
346 | policy_txt = "allow"; | 365 | static void *ap_control_proc_start(struct seq_file *m, loff_t *_pos) |
347 | break; | 366 | { |
348 | case MAC_POLICY_DENY: | 367 | struct ap_data *ap = m->private; |
349 | policy_txt = "deny"; | ||
350 | break; | ||
351 | default: | ||
352 | policy_txt = "unknown"; | ||
353 | break; | ||
354 | } | ||
355 | p += sprintf(p, "MAC policy: %s\n", policy_txt); | ||
356 | p += sprintf(p, "MAC entries: %u\n", ap->mac_restrictions.entries); | ||
357 | p += sprintf(p, "MAC list:\n"); | ||
358 | spin_lock_bh(&ap->mac_restrictions.lock); | 368 | spin_lock_bh(&ap->mac_restrictions.lock); |
359 | list_for_each_entry(entry, &ap->mac_restrictions.mac_list, list) { | 369 | return seq_list_start_head(&ap->mac_restrictions.mac_list, *_pos); |
360 | if (p - page > PAGE_SIZE - 80) { | 370 | } |
361 | p += sprintf(p, "All entries did not fit one page.\n"); | ||
362 | break; | ||
363 | } | ||
364 | 371 | ||
365 | p += sprintf(p, "%pM\n", entry->addr); | 372 | static void *ap_control_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
366 | } | 373 | { |
374 | struct ap_data *ap = m->private; | ||
375 | return seq_list_next(v, &ap->mac_restrictions.mac_list, _pos); | ||
376 | } | ||
377 | |||
378 | static void ap_control_proc_stop(struct seq_file *m, void *v) | ||
379 | { | ||
380 | struct ap_data *ap = m->private; | ||
367 | spin_unlock_bh(&ap->mac_restrictions.lock); | 381 | spin_unlock_bh(&ap->mac_restrictions.lock); |
382 | } | ||
368 | 383 | ||
369 | return (p - page); | 384 | static const struct seq_operations ap_control_proc_seqops = { |
385 | .start = ap_control_proc_start, | ||
386 | .next = ap_control_proc_next, | ||
387 | .stop = ap_control_proc_stop, | ||
388 | .show = ap_control_proc_show, | ||
389 | }; | ||
390 | |||
391 | static int ap_control_proc_open(struct inode *inode, struct file *file) | ||
392 | { | ||
393 | int ret = seq_open(file, &ap_control_proc_seqops); | ||
394 | if (ret == 0) { | ||
395 | struct seq_file *m = file->private_data; | ||
396 | m->private = PDE_DATA(inode); | ||
397 | } | ||
398 | return ret; | ||
370 | } | 399 | } |
371 | 400 | ||
401 | static const struct file_operations ap_control_proc_fops = { | ||
402 | .open = ap_control_proc_open, | ||
403 | .read = seq_read, | ||
404 | .llseek = seq_lseek, | ||
405 | .release = seq_release, | ||
406 | }; | ||
407 | |||
372 | 408 | ||
373 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) | 409 | int ap_control_add_mac(struct mac_restrictions *mac_restrictions, u8 *mac) |
374 | { | 410 | { |
@@ -510,61 +546,84 @@ void ap_control_kickall(struct ap_data *ap) | |||
510 | 546 | ||
511 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | 547 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT |
512 | 548 | ||
513 | #define PROC_LIMIT (PAGE_SIZE - 80) | 549 | static int prism2_ap_proc_show(struct seq_file *m, void *v) |
514 | |||
515 | static int prism2_ap_proc_read(char *page, char **start, off_t off, | ||
516 | int count, int *eof, void *data) | ||
517 | { | 550 | { |
518 | char *p = page; | 551 | struct sta_info *sta = v; |
519 | struct ap_data *ap = (struct ap_data *) data; | ||
520 | struct sta_info *sta; | ||
521 | int i; | 552 | int i; |
522 | 553 | ||
523 | if (off > PROC_LIMIT) { | 554 | if (v == SEQ_START_TOKEN) { |
524 | *eof = 1; | 555 | seq_printf(m, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); |
525 | return 0; | 556 | return 0; |
526 | } | 557 | } |
527 | 558 | ||
528 | p += sprintf(p, "# BSSID CHAN SIGNAL NOISE RATE SSID FLAGS\n"); | 559 | if (!sta->ap) |
529 | spin_lock_bh(&ap->sta_table_lock); | 560 | return 0; |
530 | list_for_each_entry(sta, &ap->sta_list, list) { | ||
531 | if (!sta->ap) | ||
532 | continue; | ||
533 | 561 | ||
534 | p += sprintf(p, "%pM %d %d %d %d '", | 562 | seq_printf(m, "%pM %d %d %d %d '", |
535 | sta->addr, | 563 | sta->addr, |
536 | sta->u.ap.channel, sta->last_rx_signal, | 564 | sta->u.ap.channel, sta->last_rx_signal, |
537 | sta->last_rx_silence, sta->last_rx_rate); | 565 | sta->last_rx_silence, sta->last_rx_rate); |
538 | for (i = 0; i < sta->u.ap.ssid_len; i++) | ||
539 | p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 && | ||
540 | sta->u.ap.ssid[i] < 127) ? | ||
541 | "%c" : "<%02x>"), | ||
542 | sta->u.ap.ssid[i]); | ||
543 | p += sprintf(p, "'"); | ||
544 | if (sta->capability & WLAN_CAPABILITY_ESS) | ||
545 | p += sprintf(p, " [ESS]"); | ||
546 | if (sta->capability & WLAN_CAPABILITY_IBSS) | ||
547 | p += sprintf(p, " [IBSS]"); | ||
548 | if (sta->capability & WLAN_CAPABILITY_PRIVACY) | ||
549 | p += sprintf(p, " [WEP]"); | ||
550 | p += sprintf(p, "\n"); | ||
551 | |||
552 | if ((p - page) > PROC_LIMIT) { | ||
553 | printk(KERN_DEBUG "hostap: ap proc did not fit\n"); | ||
554 | break; | ||
555 | } | ||
556 | } | ||
557 | spin_unlock_bh(&ap->sta_table_lock); | ||
558 | 566 | ||
559 | if ((p - page) <= off) { | 567 | for (i = 0; i < sta->u.ap.ssid_len; i++) { |
560 | *eof = 1; | 568 | if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) |
561 | return 0; | 569 | seq_putc(m, sta->u.ap.ssid[i]); |
570 | else | ||
571 | seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); | ||
562 | } | 572 | } |
563 | 573 | ||
564 | *start = page + off; | 574 | seq_putc(m, '\''); |
575 | if (sta->capability & WLAN_CAPABILITY_ESS) | ||
576 | seq_puts(m, " [ESS]"); | ||
577 | if (sta->capability & WLAN_CAPABILITY_IBSS) | ||
578 | seq_puts(m, " [IBSS]"); | ||
579 | if (sta->capability & WLAN_CAPABILITY_PRIVACY) | ||
580 | seq_puts(m, " [WEP]"); | ||
581 | seq_putc(m, '\n'); | ||
582 | return 0; | ||
583 | } | ||
584 | |||
585 | static void *prism2_ap_proc_start(struct seq_file *m, loff_t *_pos) | ||
586 | { | ||
587 | struct ap_data *ap = m->private; | ||
588 | spin_lock_bh(&ap->sta_table_lock); | ||
589 | return seq_list_start_head(&ap->sta_list, *_pos); | ||
590 | } | ||
565 | 591 | ||
566 | return (p - page - off); | 592 | static void *prism2_ap_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
593 | { | ||
594 | struct ap_data *ap = m->private; | ||
595 | return seq_list_next(v, &ap->sta_list, _pos); | ||
567 | } | 596 | } |
597 | |||
598 | static void prism2_ap_proc_stop(struct seq_file *m, void *v) | ||
599 | { | ||
600 | struct ap_data *ap = m->private; | ||
601 | spin_unlock_bh(&ap->sta_table_lock); | ||
602 | } | ||
603 | |||
604 | static const struct seq_operations prism2_ap_proc_seqops = { | ||
605 | .start = prism2_ap_proc_start, | ||
606 | .next = prism2_ap_proc_next, | ||
607 | .stop = prism2_ap_proc_stop, | ||
608 | .show = prism2_ap_proc_show, | ||
609 | }; | ||
610 | |||
611 | static int prism2_ap_proc_open(struct inode *inode, struct file *file) | ||
612 | { | ||
613 | int ret = seq_open(file, &prism2_ap_proc_seqops); | ||
614 | if (ret == 0) { | ||
615 | struct seq_file *m = file->private_data; | ||
616 | m->private = PDE_DATA(inode); | ||
617 | } | ||
618 | return ret; | ||
619 | } | ||
620 | |||
621 | static const struct file_operations prism2_ap_proc_fops = { | ||
622 | .open = prism2_ap_proc_open, | ||
623 | .read = seq_read, | ||
624 | .llseek = seq_lseek, | ||
625 | .release = seq_release, | ||
626 | }; | ||
568 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 627 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
569 | 628 | ||
570 | 629 | ||
@@ -836,15 +895,12 @@ void hostap_init_ap_proc(local_info_t *local) | |||
836 | return; | 895 | return; |
837 | 896 | ||
838 | #ifndef PRISM2_NO_PROCFS_DEBUG | 897 | #ifndef PRISM2_NO_PROCFS_DEBUG |
839 | create_proc_read_entry("ap_debug", 0, ap->proc, | 898 | proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); |
840 | ap_debug_proc_read, ap); | ||
841 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 899 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
842 | 900 | ||
843 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | 901 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT |
844 | create_proc_read_entry("ap_control", 0, ap->proc, | 902 | proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); |
845 | ap_control_proc_read, ap); | 903 | proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); |
846 | create_proc_read_entry("ap", 0, ap->proc, | ||
847 | prism2_ap_proc_read, ap); | ||
848 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 904 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
849 | 905 | ||
850 | } | 906 | } |
@@ -982,79 +1038,86 @@ static void prism2_send_mgmt(struct net_device *dev, | |||
982 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 1038 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
983 | 1039 | ||
984 | 1040 | ||
985 | static int prism2_sta_proc_read(char *page, char **start, off_t off, | 1041 | static int prism2_sta_proc_show(struct seq_file *m, void *v) |
986 | int count, int *eof, void *data) | ||
987 | { | 1042 | { |
988 | char *p = page; | 1043 | struct sta_info *sta = m->private; |
989 | struct sta_info *sta = (struct sta_info *) data; | ||
990 | int i; | 1044 | int i; |
991 | 1045 | ||
992 | /* FIX: possible race condition.. the STA data could have just expired, | 1046 | /* FIX: possible race condition.. the STA data could have just expired, |
993 | * but proc entry was still here so that the read could have started; | 1047 | * but proc entry was still here so that the read could have started; |
994 | * some locking should be done here.. */ | 1048 | * some locking should be done here.. */ |
995 | 1049 | ||
996 | if (off != 0) { | 1050 | seq_printf(m, |
997 | *eof = 1; | 1051 | "%s=%pM\nusers=%d\naid=%d\n" |
998 | return 0; | 1052 | "flags=0x%04x%s%s%s%s%s%s%s\n" |
999 | } | 1053 | "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", |
1000 | 1054 | sta->ap ? "AP" : "STA", | |
1001 | p += sprintf(p, "%s=%pM\nusers=%d\naid=%d\n" | 1055 | sta->addr, atomic_read(&sta->users), sta->aid, |
1002 | "flags=0x%04x%s%s%s%s%s%s%s\n" | 1056 | sta->flags, |
1003 | "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", | 1057 | sta->flags & WLAN_STA_AUTH ? " AUTH" : "", |
1004 | sta->ap ? "AP" : "STA", | 1058 | sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", |
1005 | sta->addr, atomic_read(&sta->users), sta->aid, | 1059 | sta->flags & WLAN_STA_PS ? " PS" : "", |
1006 | sta->flags, | 1060 | sta->flags & WLAN_STA_TIM ? " TIM" : "", |
1007 | sta->flags & WLAN_STA_AUTH ? " AUTH" : "", | 1061 | sta->flags & WLAN_STA_PERM ? " PERM" : "", |
1008 | sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", | 1062 | sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "", |
1009 | sta->flags & WLAN_STA_PS ? " PS" : "", | 1063 | sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "", |
1010 | sta->flags & WLAN_STA_TIM ? " TIM" : "", | 1064 | sta->capability, sta->listen_interval); |
1011 | sta->flags & WLAN_STA_PERM ? " PERM" : "", | ||
1012 | sta->flags & WLAN_STA_AUTHORIZED ? " AUTHORIZED" : "", | ||
1013 | sta->flags & WLAN_STA_PENDING_POLL ? " POLL" : "", | ||
1014 | sta->capability, sta->listen_interval); | ||
1015 | /* supported_rates: 500 kbit/s units with msb ignored */ | 1065 | /* supported_rates: 500 kbit/s units with msb ignored */ |
1016 | for (i = 0; i < sizeof(sta->supported_rates); i++) | 1066 | for (i = 0; i < sizeof(sta->supported_rates); i++) |
1017 | if (sta->supported_rates[i] != 0) | 1067 | if (sta->supported_rates[i] != 0) |
1018 | p += sprintf(p, "%d%sMbps ", | 1068 | seq_printf(m, "%d%sMbps ", |
1019 | (sta->supported_rates[i] & 0x7f) / 2, | 1069 | (sta->supported_rates[i] & 0x7f) / 2, |
1020 | sta->supported_rates[i] & 1 ? ".5" : ""); | 1070 | sta->supported_rates[i] & 1 ? ".5" : ""); |
1021 | p += sprintf(p, "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" | 1071 | seq_printf(m, |
1022 | "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" | 1072 | "\njiffies=%lu\nlast_auth=%lu\nlast_assoc=%lu\n" |
1023 | "tx_packets=%lu\n" | 1073 | "last_rx=%lu\nlast_tx=%lu\nrx_packets=%lu\n" |
1024 | "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" | 1074 | "tx_packets=%lu\n" |
1025 | "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" | 1075 | "rx_bytes=%lu\ntx_bytes=%lu\nbuffer_count=%d\n" |
1026 | "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" | 1076 | "last_rx: silence=%d dBm signal=%d dBm rate=%d%s Mbps\n" |
1027 | "tx[11M]=%d\n" | 1077 | "tx_rate=%d\ntx[1M]=%d\ntx[2M]=%d\ntx[5.5M]=%d\n" |
1028 | "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", | 1078 | "tx[11M]=%d\n" |
1029 | jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, | 1079 | "rx[1M]=%d\nrx[2M]=%d\nrx[5.5M]=%d\nrx[11M]=%d\n", |
1030 | sta->last_tx, | 1080 | jiffies, sta->last_auth, sta->last_assoc, sta->last_rx, |
1031 | sta->rx_packets, sta->tx_packets, sta->rx_bytes, | 1081 | sta->last_tx, |
1032 | sta->tx_bytes, skb_queue_len(&sta->tx_buf), | 1082 | sta->rx_packets, sta->tx_packets, sta->rx_bytes, |
1033 | sta->last_rx_silence, | 1083 | sta->tx_bytes, skb_queue_len(&sta->tx_buf), |
1034 | sta->last_rx_signal, sta->last_rx_rate / 10, | 1084 | sta->last_rx_silence, |
1035 | sta->last_rx_rate % 10 ? ".5" : "", | 1085 | sta->last_rx_signal, sta->last_rx_rate / 10, |
1036 | sta->tx_rate, sta->tx_count[0], sta->tx_count[1], | 1086 | sta->last_rx_rate % 10 ? ".5" : "", |
1037 | sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], | 1087 | sta->tx_rate, sta->tx_count[0], sta->tx_count[1], |
1038 | sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); | 1088 | sta->tx_count[2], sta->tx_count[3], sta->rx_count[0], |
1089 | sta->rx_count[1], sta->rx_count[2], sta->rx_count[3]); | ||
1039 | if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats) | 1090 | if (sta->crypt && sta->crypt->ops && sta->crypt->ops->print_stats) |
1040 | p = sta->crypt->ops->print_stats(p, sta->crypt->priv); | 1091 | sta->crypt->ops->print_stats(m, sta->crypt->priv); |
1041 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT | 1092 | #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT |
1042 | if (sta->ap) { | 1093 | if (sta->ap) { |
1043 | if (sta->u.ap.channel >= 0) | 1094 | if (sta->u.ap.channel >= 0) |
1044 | p += sprintf(p, "channel=%d\n", sta->u.ap.channel); | 1095 | seq_printf(m, "channel=%d\n", sta->u.ap.channel); |
1045 | p += sprintf(p, "ssid="); | 1096 | seq_puts(m, "ssid="); |
1046 | for (i = 0; i < sta->u.ap.ssid_len; i++) | 1097 | for (i = 0; i < sta->u.ap.ssid_len; i++) { |
1047 | p += sprintf(p, ((sta->u.ap.ssid[i] >= 32 && | 1098 | if (sta->u.ap.ssid[i] >= 32 && sta->u.ap.ssid[i] < 127) |
1048 | sta->u.ap.ssid[i] < 127) ? | 1099 | seq_putc(m, sta->u.ap.ssid[i]); |
1049 | "%c" : "<%02x>"), | 1100 | else |
1050 | sta->u.ap.ssid[i]); | 1101 | seq_printf(m, "<%02x>", sta->u.ap.ssid[i]); |
1051 | p += sprintf(p, "\n"); | 1102 | } |
1103 | seq_putc(m, '\n'); | ||
1052 | } | 1104 | } |
1053 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ | 1105 | #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ |
1054 | 1106 | ||
1055 | return (p - page); | 1107 | return 0; |
1108 | } | ||
1109 | |||
1110 | static int prism2_sta_proc_open(struct inode *inode, struct file *file) | ||
1111 | { | ||
1112 | return single_open(file, prism2_sta_proc_show, PDE_DATA(inode)); | ||
1056 | } | 1113 | } |
1057 | 1114 | ||
1115 | static const struct file_operations prism2_sta_proc_fops = { | ||
1116 | .open = prism2_sta_proc_open, | ||
1117 | .read = seq_read, | ||
1118 | .llseek = seq_lseek, | ||
1119 | .release = seq_release, | ||
1120 | }; | ||
1058 | 1121 | ||
1059 | static void handle_add_proc_queue(struct work_struct *work) | 1122 | static void handle_add_proc_queue(struct work_struct *work) |
1060 | { | 1123 | { |
@@ -1076,9 +1139,9 @@ static void handle_add_proc_queue(struct work_struct *work) | |||
1076 | 1139 | ||
1077 | if (sta) { | 1140 | if (sta) { |
1078 | sprintf(name, "%pM", sta->addr); | 1141 | sprintf(name, "%pM", sta->addr); |
1079 | sta->proc = create_proc_read_entry( | 1142 | sta->proc = proc_create_data( |
1080 | name, 0, ap->proc, | 1143 | name, 0, ap->proc, |
1081 | prism2_sta_proc_read, sta); | 1144 | &prism2_sta_proc_fops, sta); |
1082 | 1145 | ||
1083 | atomic_dec(&sta->users); | 1146 | atomic_dec(&sta->users); |
1084 | } | 1147 | } |
diff --git a/drivers/net/wireless/hostap/hostap_download.c b/drivers/net/wireless/hostap/hostap_download.c index e73bf739fd9b..705fe668b969 100644 --- a/drivers/net/wireless/hostap/hostap_download.c +++ b/drivers/net/wireless/hostap/hostap_download.c | |||
@@ -174,20 +174,70 @@ static int prism2_pda_ok(u8 *buf) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | static int prism2_download_aux_dump(struct net_device *dev, | 177 | #define prism2_download_aux_dump_npages 65536 |
178 | unsigned int addr, int len, u8 *buf) | ||
179 | { | ||
180 | int res; | ||
181 | 178 | ||
182 | prism2_enable_aux_port(dev, 1); | 179 | struct prism2_download_aux_dump { |
183 | res = hfa384x_from_aux(dev, addr, len, buf); | 180 | local_info_t *local; |
184 | prism2_enable_aux_port(dev, 0); | 181 | u16 page[0x80]; |
185 | if (res) | 182 | }; |
186 | return -1; | 183 | |
184 | static int prism2_download_aux_dump_proc_show(struct seq_file *m, void *v) | ||
185 | { | ||
186 | struct prism2_download_aux_dump *ctx = m->private; | ||
187 | 187 | ||
188 | hfa384x_from_aux(ctx->local->dev, (unsigned long)v - 1, 0x80, ctx->page); | ||
189 | seq_write(m, ctx->page, 0x80); | ||
188 | return 0; | 190 | return 0; |
189 | } | 191 | } |
190 | 192 | ||
193 | static void *prism2_download_aux_dump_proc_start(struct seq_file *m, loff_t *_pos) | ||
194 | { | ||
195 | struct prism2_download_aux_dump *ctx = m->private; | ||
196 | prism2_enable_aux_port(ctx->local->dev, 1); | ||
197 | if (*_pos >= prism2_download_aux_dump_npages) | ||
198 | return NULL; | ||
199 | return (void *)((unsigned long)*_pos + 1); | ||
200 | } | ||
201 | |||
202 | static void *prism2_download_aux_dump_proc_next(struct seq_file *m, void *v, loff_t *_pos) | ||
203 | { | ||
204 | ++*_pos; | ||
205 | if (*_pos >= prism2_download_aux_dump_npages) | ||
206 | return NULL; | ||
207 | return (void *)((unsigned long)*_pos + 1); | ||
208 | } | ||
209 | |||
210 | static void prism2_download_aux_dump_proc_stop(struct seq_file *m, void *v) | ||
211 | { | ||
212 | struct prism2_download_aux_dump *ctx = m->private; | ||
213 | prism2_enable_aux_port(ctx->local->dev, 0); | ||
214 | } | ||
215 | |||
216 | static const struct seq_operations prism2_download_aux_dump_proc_seqops = { | ||
217 | .start = prism2_download_aux_dump_proc_start, | ||
218 | .next = prism2_download_aux_dump_proc_next, | ||
219 | .stop = prism2_download_aux_dump_proc_stop, | ||
220 | .show = prism2_download_aux_dump_proc_show, | ||
221 | }; | ||
222 | |||
223 | static int prism2_download_aux_dump_proc_open(struct inode *inode, struct file *file) | ||
224 | { | ||
225 | int ret = seq_open_private(file, &prism2_download_aux_dump_proc_seqops, | ||
226 | sizeof(struct prism2_download_aux_dump)); | ||
227 | if (ret == 0) { | ||
228 | struct seq_file *m = file->private_data; | ||
229 | m->private = PDE_DATA(inode); | ||
230 | } | ||
231 | return ret; | ||
232 | } | ||
233 | |||
234 | static const struct file_operations prism2_download_aux_dump_proc_fops = { | ||
235 | .open = prism2_download_aux_dump_proc_open, | ||
236 | .read = seq_read, | ||
237 | .llseek = seq_lseek, | ||
238 | .release = seq_release_private, | ||
239 | }; | ||
240 | |||
191 | 241 | ||
192 | static u8 * prism2_read_pda(struct net_device *dev) | 242 | static u8 * prism2_read_pda(struct net_device *dev) |
193 | { | 243 | { |
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 8e7000fd4414..507ab99eef4e 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/netdevice.h> | 38 | #include <linux/netdevice.h> |
39 | #include <linux/etherdevice.h> | 39 | #include <linux/etherdevice.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
41 | #include <linux/seq_file.h> | ||
41 | #include <linux/if_arp.h> | 42 | #include <linux/if_arp.h> |
42 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
43 | #include <linux/random.h> | 44 | #include <linux/random.h> |
@@ -129,8 +130,7 @@ static void prism2_check_sta_fw_version(local_info_t *local); | |||
129 | 130 | ||
130 | #ifdef PRISM2_DOWNLOAD_SUPPORT | 131 | #ifdef PRISM2_DOWNLOAD_SUPPORT |
131 | /* hostap_download.c */ | 132 | /* hostap_download.c */ |
132 | static int prism2_download_aux_dump(struct net_device *dev, | 133 | static const struct file_operations prism2_download_aux_dump_proc_fops; |
133 | unsigned int addr, int len, u8 *buf); | ||
134 | static u8 * prism2_read_pda(struct net_device *dev); | 134 | static u8 * prism2_read_pda(struct net_device *dev); |
135 | static int prism2_download(local_info_t *local, | 135 | static int prism2_download(local_info_t *local, |
136 | struct prism2_download_param *param); | 136 | struct prism2_download_param *param); |
@@ -2894,19 +2894,12 @@ static void hostap_tick_timer(unsigned long data) | |||
2894 | 2894 | ||
2895 | 2895 | ||
2896 | #ifndef PRISM2_NO_PROCFS_DEBUG | 2896 | #ifndef PRISM2_NO_PROCFS_DEBUG |
2897 | static int prism2_registers_proc_read(char *page, char **start, off_t off, | 2897 | static int prism2_registers_proc_show(struct seq_file *m, void *v) |
2898 | int count, int *eof, void *data) | ||
2899 | { | 2898 | { |
2900 | char *p = page; | 2899 | local_info_t *local = m->private; |
2901 | local_info_t *local = (local_info_t *) data; | ||
2902 | |||
2903 | if (off != 0) { | ||
2904 | *eof = 1; | ||
2905 | return 0; | ||
2906 | } | ||
2907 | 2900 | ||
2908 | #define SHOW_REG(n) \ | 2901 | #define SHOW_REG(n) \ |
2909 | p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) | 2902 | seq_printf(m, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) |
2910 | 2903 | ||
2911 | SHOW_REG(CMD); | 2904 | SHOW_REG(CMD); |
2912 | SHOW_REG(PARAM0); | 2905 | SHOW_REG(PARAM0); |
@@ -2952,8 +2945,21 @@ p += sprintf(p, #n "=%04x\n", hfa384x_read_reg(local->dev, HFA384X_##n##_OFF)) | |||
2952 | SHOW_REG(PCI_M1_CTL); | 2945 | SHOW_REG(PCI_M1_CTL); |
2953 | #endif /* PRISM2_PCI */ | 2946 | #endif /* PRISM2_PCI */ |
2954 | 2947 | ||
2955 | return (p - page); | 2948 | return 0; |
2956 | } | 2949 | } |
2950 | |||
2951 | static int prism2_registers_proc_open(struct inode *inode, struct file *file) | ||
2952 | { | ||
2953 | return single_open(file, prism2_registers_proc_show, PDE_DATA(inode)); | ||
2954 | } | ||
2955 | |||
2956 | static const struct file_operations prism2_registers_proc_fops = { | ||
2957 | .open = prism2_registers_proc_open, | ||
2958 | .read = seq_read, | ||
2959 | .llseek = seq_lseek, | ||
2960 | .release = seq_release, | ||
2961 | }; | ||
2962 | |||
2957 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 2963 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
2958 | 2964 | ||
2959 | 2965 | ||
@@ -3128,7 +3134,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx, | |||
3128 | local->func->reset_port = prism2_reset_port; | 3134 | local->func->reset_port = prism2_reset_port; |
3129 | local->func->schedule_reset = prism2_schedule_reset; | 3135 | local->func->schedule_reset = prism2_schedule_reset; |
3130 | #ifdef PRISM2_DOWNLOAD_SUPPORT | 3136 | #ifdef PRISM2_DOWNLOAD_SUPPORT |
3131 | local->func->read_aux = prism2_download_aux_dump; | 3137 | local->func->read_aux_fops = &prism2_download_aux_dump_proc_fops; |
3132 | local->func->download = prism2_download; | 3138 | local->func->download = prism2_download; |
3133 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ | 3139 | #endif /* PRISM2_DOWNLOAD_SUPPORT */ |
3134 | local->func->tx = prism2_tx_80211; | 3140 | local->func->tx = prism2_tx_80211; |
@@ -3274,8 +3280,8 @@ static int hostap_hw_ready(struct net_device *dev) | |||
3274 | } | 3280 | } |
3275 | hostap_init_proc(local); | 3281 | hostap_init_proc(local); |
3276 | #ifndef PRISM2_NO_PROCFS_DEBUG | 3282 | #ifndef PRISM2_NO_PROCFS_DEBUG |
3277 | create_proc_read_entry("registers", 0, local->proc, | 3283 | proc_create_data("registers", 0, local->proc, |
3278 | prism2_registers_proc_read, local); | 3284 | &prism2_registers_proc_fops, local); |
3279 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 3285 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
3280 | hostap_init_ap_proc(local); | 3286 | hostap_init_ap_proc(local); |
3281 | return 0; | 3287 | return 0; |
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c index dc447c1b5abe..7491dab2c105 100644 --- a/drivers/net/wireless/hostap/hostap_proc.c +++ b/drivers/net/wireless/hostap/hostap_proc.c | |||
@@ -12,259 +12,297 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | #ifndef PRISM2_NO_PROCFS_DEBUG | 14 | #ifndef PRISM2_NO_PROCFS_DEBUG |
15 | static int prism2_debug_proc_read(char *page, char **start, off_t off, | 15 | static int prism2_debug_proc_show(struct seq_file *m, void *v) |
16 | int count, int *eof, void *data) | ||
17 | { | 16 | { |
18 | char *p = page; | 17 | local_info_t *local = m->private; |
19 | local_info_t *local = (local_info_t *) data; | ||
20 | int i; | 18 | int i; |
21 | 19 | ||
22 | if (off != 0) { | 20 | seq_printf(m, "next_txfid=%d next_alloc=%d\n", |
23 | *eof = 1; | 21 | local->next_txfid, local->next_alloc); |
24 | return 0; | ||
25 | } | ||
26 | |||
27 | p += sprintf(p, "next_txfid=%d next_alloc=%d\n", | ||
28 | local->next_txfid, local->next_alloc); | ||
29 | for (i = 0; i < PRISM2_TXFID_COUNT; i++) | 22 | for (i = 0; i < PRISM2_TXFID_COUNT; i++) |
30 | p += sprintf(p, "FID: tx=%04X intransmit=%04X\n", | 23 | seq_printf(m, "FID: tx=%04X intransmit=%04X\n", |
31 | local->txfid[i], local->intransmitfid[i]); | 24 | local->txfid[i], local->intransmitfid[i]); |
32 | p += sprintf(p, "FW TX rate control: %d\n", local->fw_tx_rate_control); | 25 | seq_printf(m, "FW TX rate control: %d\n", local->fw_tx_rate_control); |
33 | p += sprintf(p, "beacon_int=%d\n", local->beacon_int); | 26 | seq_printf(m, "beacon_int=%d\n", local->beacon_int); |
34 | p += sprintf(p, "dtim_period=%d\n", local->dtim_period); | 27 | seq_printf(m, "dtim_period=%d\n", local->dtim_period); |
35 | p += sprintf(p, "wds_max_connections=%d\n", | 28 | seq_printf(m, "wds_max_connections=%d\n", local->wds_max_connections); |
36 | local->wds_max_connections); | 29 | seq_printf(m, "dev_enabled=%d\n", local->dev_enabled); |
37 | p += sprintf(p, "dev_enabled=%d\n", local->dev_enabled); | 30 | seq_printf(m, "sw_tick_stuck=%d\n", local->sw_tick_stuck); |
38 | p += sprintf(p, "sw_tick_stuck=%d\n", local->sw_tick_stuck); | ||
39 | for (i = 0; i < WEP_KEYS; i++) { | 31 | for (i = 0; i < WEP_KEYS; i++) { |
40 | if (local->crypt_info.crypt[i] && | 32 | if (local->crypt_info.crypt[i] && |
41 | local->crypt_info.crypt[i]->ops) { | 33 | local->crypt_info.crypt[i]->ops) { |
42 | p += sprintf(p, "crypt[%d]=%s\n", i, | 34 | seq_printf(m, "crypt[%d]=%s\n", i, |
43 | local->crypt_info.crypt[i]->ops->name); | 35 | local->crypt_info.crypt[i]->ops->name); |
44 | } | 36 | } |
45 | } | 37 | } |
46 | p += sprintf(p, "pri_only=%d\n", local->pri_only); | 38 | seq_printf(m, "pri_only=%d\n", local->pri_only); |
47 | p += sprintf(p, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); | 39 | seq_printf(m, "pci=%d\n", local->func->hw_type == HOSTAP_HW_PCI); |
48 | p += sprintf(p, "sram_type=%d\n", local->sram_type); | 40 | seq_printf(m, "sram_type=%d\n", local->sram_type); |
49 | p += sprintf(p, "no_pri=%d\n", local->no_pri); | 41 | seq_printf(m, "no_pri=%d\n", local->no_pri); |
50 | 42 | ||
51 | return (p - page); | 43 | return 0; |
52 | } | 44 | } |
45 | |||
46 | static int prism2_debug_proc_open(struct inode *inode, struct file *file) | ||
47 | { | ||
48 | return single_open(file, prism2_debug_proc_show, PDE_DATA(inode)); | ||
49 | } | ||
50 | |||
51 | static const struct file_operations prism2_debug_proc_fops = { | ||
52 | .open = prism2_debug_proc_open, | ||
53 | .read = seq_read, | ||
54 | .llseek = seq_lseek, | ||
55 | .release = seq_release, | ||
56 | }; | ||
53 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 57 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
54 | 58 | ||
55 | 59 | ||
56 | static int prism2_stats_proc_read(char *page, char **start, off_t off, | 60 | static int prism2_stats_proc_show(struct seq_file *m, void *v) |
57 | int count, int *eof, void *data) | ||
58 | { | 61 | { |
59 | char *p = page; | 62 | local_info_t *local = m->private; |
60 | local_info_t *local = (local_info_t *) data; | ||
61 | struct comm_tallies_sums *sums = &local->comm_tallies; | 63 | struct comm_tallies_sums *sums = &local->comm_tallies; |
62 | 64 | ||
63 | if (off != 0) { | 65 | seq_printf(m, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); |
64 | *eof = 1; | 66 | seq_printf(m, "TxMulticastframes=%u\n", sums->tx_multicast_frames); |
65 | return 0; | 67 | seq_printf(m, "TxFragments=%u\n", sums->tx_fragments); |
66 | } | 68 | seq_printf(m, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); |
67 | 69 | seq_printf(m, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); | |
68 | p += sprintf(p, "TxUnicastFrames=%u\n", sums->tx_unicast_frames); | 70 | seq_printf(m, "TxDeferredTransmissions=%u\n", |
69 | p += sprintf(p, "TxMulticastframes=%u\n", sums->tx_multicast_frames); | 71 | sums->tx_deferred_transmissions); |
70 | p += sprintf(p, "TxFragments=%u\n", sums->tx_fragments); | 72 | seq_printf(m, "TxSingleRetryFrames=%u\n", sums->tx_single_retry_frames); |
71 | p += sprintf(p, "TxUnicastOctets=%u\n", sums->tx_unicast_octets); | 73 | seq_printf(m, "TxMultipleRetryFrames=%u\n", |
72 | p += sprintf(p, "TxMulticastOctets=%u\n", sums->tx_multicast_octets); | 74 | sums->tx_multiple_retry_frames); |
73 | p += sprintf(p, "TxDeferredTransmissions=%u\n", | 75 | seq_printf(m, "TxRetryLimitExceeded=%u\n", |
74 | sums->tx_deferred_transmissions); | 76 | sums->tx_retry_limit_exceeded); |
75 | p += sprintf(p, "TxSingleRetryFrames=%u\n", | 77 | seq_printf(m, "TxDiscards=%u\n", sums->tx_discards); |
76 | sums->tx_single_retry_frames); | 78 | seq_printf(m, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); |
77 | p += sprintf(p, "TxMultipleRetryFrames=%u\n", | 79 | seq_printf(m, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); |
78 | sums->tx_multiple_retry_frames); | 80 | seq_printf(m, "RxFragments=%u\n", sums->rx_fragments); |
79 | p += sprintf(p, "TxRetryLimitExceeded=%u\n", | 81 | seq_printf(m, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); |
80 | sums->tx_retry_limit_exceeded); | 82 | seq_printf(m, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); |
81 | p += sprintf(p, "TxDiscards=%u\n", sums->tx_discards); | 83 | seq_printf(m, "RxFCSErrors=%u\n", sums->rx_fcs_errors); |
82 | p += sprintf(p, "RxUnicastFrames=%u\n", sums->rx_unicast_frames); | 84 | seq_printf(m, "RxDiscardsNoBuffer=%u\n", sums->rx_discards_no_buffer); |
83 | p += sprintf(p, "RxMulticastFrames=%u\n", sums->rx_multicast_frames); | 85 | seq_printf(m, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa); |
84 | p += sprintf(p, "RxFragments=%u\n", sums->rx_fragments); | 86 | seq_printf(m, "RxDiscardsWEPUndecryptable=%u\n", |
85 | p += sprintf(p, "RxUnicastOctets=%u\n", sums->rx_unicast_octets); | 87 | sums->rx_discards_wep_undecryptable); |
86 | p += sprintf(p, "RxMulticastOctets=%u\n", sums->rx_multicast_octets); | 88 | seq_printf(m, "RxMessageInMsgFragments=%u\n", |
87 | p += sprintf(p, "RxFCSErrors=%u\n", sums->rx_fcs_errors); | 89 | sums->rx_message_in_msg_fragments); |
88 | p += sprintf(p, "RxDiscardsNoBuffer=%u\n", | 90 | seq_printf(m, "RxMessageInBadMsgFragments=%u\n", |
89 | sums->rx_discards_no_buffer); | 91 | sums->rx_message_in_bad_msg_fragments); |
90 | p += sprintf(p, "TxDiscardsWrongSA=%u\n", sums->tx_discards_wrong_sa); | ||
91 | p += sprintf(p, "RxDiscardsWEPUndecryptable=%u\n", | ||
92 | sums->rx_discards_wep_undecryptable); | ||
93 | p += sprintf(p, "RxMessageInMsgFragments=%u\n", | ||
94 | sums->rx_message_in_msg_fragments); | ||
95 | p += sprintf(p, "RxMessageInBadMsgFragments=%u\n", | ||
96 | sums->rx_message_in_bad_msg_fragments); | ||
97 | /* FIX: this may grow too long for one page(?) */ | 92 | /* FIX: this may grow too long for one page(?) */ |
98 | 93 | ||
99 | return (p - page); | 94 | return 0; |
95 | } | ||
96 | |||
97 | static int prism2_stats_proc_open(struct inode *inode, struct file *file) | ||
98 | { | ||
99 | return single_open(file, prism2_stats_proc_show, PDE_DATA(inode)); | ||
100 | } | 100 | } |
101 | 101 | ||
102 | static const struct file_operations prism2_stats_proc_fops = { | ||
103 | .open = prism2_stats_proc_open, | ||
104 | .read = seq_read, | ||
105 | .llseek = seq_lseek, | ||
106 | .release = seq_release, | ||
107 | }; | ||
102 | 108 | ||
103 | static int prism2_wds_proc_read(char *page, char **start, off_t off, | 109 | |
104 | int count, int *eof, void *data) | 110 | static int prism2_wds_proc_show(struct seq_file *m, void *v) |
105 | { | 111 | { |
106 | char *p = page; | 112 | struct list_head *ptr = v; |
107 | local_info_t *local = (local_info_t *) data; | ||
108 | struct list_head *ptr; | ||
109 | struct hostap_interface *iface; | 113 | struct hostap_interface *iface; |
110 | 114 | ||
111 | if (off > PROC_LIMIT) { | 115 | iface = list_entry(ptr, struct hostap_interface, list); |
112 | *eof = 1; | 116 | if (iface->type == HOSTAP_INTERFACE_WDS) |
113 | return 0; | 117 | seq_printf(m, "%s\t%pM\n", |
114 | } | 118 | iface->dev->name, iface->u.wds.remote_addr); |
119 | return 0; | ||
120 | } | ||
115 | 121 | ||
122 | static void *prism2_wds_proc_start(struct seq_file *m, loff_t *_pos) | ||
123 | { | ||
124 | local_info_t *local = m->private; | ||
116 | read_lock_bh(&local->iface_lock); | 125 | read_lock_bh(&local->iface_lock); |
117 | list_for_each(ptr, &local->hostap_interfaces) { | 126 | return seq_list_start(&local->hostap_interfaces, *_pos); |
118 | iface = list_entry(ptr, struct hostap_interface, list); | 127 | } |
119 | if (iface->type != HOSTAP_INTERFACE_WDS) | ||
120 | continue; | ||
121 | p += sprintf(p, "%s\t%pM\n", | ||
122 | iface->dev->name, | ||
123 | iface->u.wds.remote_addr); | ||
124 | if ((p - page) > PROC_LIMIT) { | ||
125 | printk(KERN_DEBUG "%s: wds proc did not fit\n", | ||
126 | local->dev->name); | ||
127 | break; | ||
128 | } | ||
129 | } | ||
130 | read_unlock_bh(&local->iface_lock); | ||
131 | 128 | ||
132 | if ((p - page) <= off) { | 129 | static void *prism2_wds_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
133 | *eof = 1; | 130 | { |
134 | return 0; | 131 | local_info_t *local = m->private; |
135 | } | 132 | return seq_list_next(v, &local->hostap_interfaces, _pos); |
133 | } | ||
136 | 134 | ||
137 | *start = page + off; | 135 | static void prism2_wds_proc_stop(struct seq_file *m, void *v) |
136 | { | ||
137 | local_info_t *local = m->private; | ||
138 | read_unlock_bh(&local->iface_lock); | ||
139 | } | ||
138 | 140 | ||
139 | return (p - page - off); | 141 | static const struct seq_operations prism2_wds_proc_seqops = { |
142 | .start = prism2_wds_proc_start, | ||
143 | .next = prism2_wds_proc_next, | ||
144 | .stop = prism2_wds_proc_stop, | ||
145 | .show = prism2_wds_proc_show, | ||
146 | }; | ||
147 | |||
148 | static int prism2_wds_proc_open(struct inode *inode, struct file *file) | ||
149 | { | ||
150 | int ret = seq_open(file, &prism2_wds_proc_seqops); | ||
151 | if (ret == 0) { | ||
152 | struct seq_file *m = file->private_data; | ||
153 | m->private = PDE_DATA(inode); | ||
154 | } | ||
155 | return ret; | ||
140 | } | 156 | } |
141 | 157 | ||
158 | static const struct file_operations prism2_wds_proc_fops = { | ||
159 | .open = prism2_wds_proc_open, | ||
160 | .read = seq_read, | ||
161 | .llseek = seq_lseek, | ||
162 | .release = seq_release, | ||
163 | }; | ||
142 | 164 | ||
143 | static int prism2_bss_list_proc_read(char *page, char **start, off_t off, | 165 | |
144 | int count, int *eof, void *data) | 166 | static int prism2_bss_list_proc_show(struct seq_file *m, void *v) |
145 | { | 167 | { |
146 | char *p = page; | 168 | local_info_t *local = m->private; |
147 | local_info_t *local = (local_info_t *) data; | 169 | struct list_head *ptr = v; |
148 | struct list_head *ptr; | ||
149 | struct hostap_bss_info *bss; | 170 | struct hostap_bss_info *bss; |
150 | int i; | 171 | int i; |
151 | 172 | ||
152 | if (off > PROC_LIMIT) { | 173 | if (ptr == &local->bss_list) { |
153 | *eof = 1; | 174 | seq_printf(m, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" |
175 | "SSID(hex)\tWPA IE\n"); | ||
154 | return 0; | 176 | return 0; |
155 | } | 177 | } |
156 | 178 | ||
157 | p += sprintf(p, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t" | 179 | bss = list_entry(ptr, struct hostap_bss_info, list); |
158 | "SSID(hex)\tWPA IE\n"); | 180 | seq_printf(m, "%pM\t%lu\t%u\t0x%x\t", |
181 | bss->bssid, bss->last_update, | ||
182 | bss->count, bss->capab_info); | ||
183 | |||
184 | for (i = 0; i < bss->ssid_len; i++) | ||
185 | seq_putc(m,bss->ssid[i] >= 32 && bss->ssid[i] < 127 ? | ||
186 | bss->ssid[i] : '_'); | ||
187 | |||
188 | seq_putc(m, '\t'); | ||
189 | for (i = 0; i < bss->ssid_len; i++) | ||
190 | seq_printf(m, "%02x", bss->ssid[i]); | ||
191 | seq_putc(m, '\t'); | ||
192 | for (i = 0; i < bss->wpa_ie_len; i++) | ||
193 | seq_printf(m, "%02x", bss->wpa_ie[i]); | ||
194 | seq_putc(m, '\n'); | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static void *prism2_bss_list_proc_start(struct seq_file *m, loff_t *_pos) | ||
199 | { | ||
200 | local_info_t *local = m->private; | ||
159 | spin_lock_bh(&local->lock); | 201 | spin_lock_bh(&local->lock); |
160 | list_for_each(ptr, &local->bss_list) { | 202 | return seq_list_start_head(&local->bss_list, *_pos); |
161 | bss = list_entry(ptr, struct hostap_bss_info, list); | 203 | } |
162 | p += sprintf(p, "%pM\t%lu\t%u\t0x%x\t", | ||
163 | bss->bssid, bss->last_update, | ||
164 | bss->count, bss->capab_info); | ||
165 | for (i = 0; i < bss->ssid_len; i++) { | ||
166 | p += sprintf(p, "%c", | ||
167 | bss->ssid[i] >= 32 && bss->ssid[i] < 127 ? | ||
168 | bss->ssid[i] : '_'); | ||
169 | } | ||
170 | p += sprintf(p, "\t"); | ||
171 | for (i = 0; i < bss->ssid_len; i++) { | ||
172 | p += sprintf(p, "%02x", bss->ssid[i]); | ||
173 | } | ||
174 | p += sprintf(p, "\t"); | ||
175 | for (i = 0; i < bss->wpa_ie_len; i++) { | ||
176 | p += sprintf(p, "%02x", bss->wpa_ie[i]); | ||
177 | } | ||
178 | p += sprintf(p, "\n"); | ||
179 | if ((p - page) > PROC_LIMIT) { | ||
180 | printk(KERN_DEBUG "%s: BSS proc did not fit\n", | ||
181 | local->dev->name); | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | spin_unlock_bh(&local->lock); | ||
186 | 204 | ||
187 | if ((p - page) <= off) { | 205 | static void *prism2_bss_list_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
188 | *eof = 1; | 206 | { |
189 | return 0; | 207 | local_info_t *local = m->private; |
190 | } | 208 | return seq_list_next(v, &local->bss_list, _pos); |
209 | } | ||
191 | 210 | ||
192 | *start = page + off; | 211 | static void prism2_bss_list_proc_stop(struct seq_file *m, void *v) |
212 | { | ||
213 | local_info_t *local = m->private; | ||
214 | spin_unlock_bh(&local->lock); | ||
215 | } | ||
216 | |||
217 | static const struct seq_operations prism2_bss_list_proc_seqops = { | ||
218 | .start = prism2_bss_list_proc_start, | ||
219 | .next = prism2_bss_list_proc_next, | ||
220 | .stop = prism2_bss_list_proc_stop, | ||
221 | .show = prism2_bss_list_proc_show, | ||
222 | }; | ||
193 | 223 | ||
194 | return (p - page - off); | 224 | static int prism2_bss_list_proc_open(struct inode *inode, struct file *file) |
225 | { | ||
226 | int ret = seq_open(file, &prism2_bss_list_proc_seqops); | ||
227 | if (ret == 0) { | ||
228 | struct seq_file *m = file->private_data; | ||
229 | m->private = PDE_DATA(inode); | ||
230 | } | ||
231 | return ret; | ||
195 | } | 232 | } |
196 | 233 | ||
234 | static const struct file_operations prism2_bss_list_proc_fops = { | ||
235 | .open = prism2_bss_list_proc_open, | ||
236 | .read = seq_read, | ||
237 | .llseek = seq_lseek, | ||
238 | .release = seq_release, | ||
239 | }; | ||
197 | 240 | ||
198 | static int prism2_crypt_proc_read(char *page, char **start, off_t off, | 241 | |
199 | int count, int *eof, void *data) | 242 | static int prism2_crypt_proc_show(struct seq_file *m, void *v) |
200 | { | 243 | { |
201 | char *p = page; | 244 | local_info_t *local = m->private; |
202 | local_info_t *local = (local_info_t *) data; | ||
203 | int i; | 245 | int i; |
204 | 246 | ||
205 | if (off > PROC_LIMIT) { | 247 | seq_printf(m, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx); |
206 | *eof = 1; | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | p += sprintf(p, "tx_keyidx=%d\n", local->crypt_info.tx_keyidx); | ||
211 | for (i = 0; i < WEP_KEYS; i++) { | 248 | for (i = 0; i < WEP_KEYS; i++) { |
212 | if (local->crypt_info.crypt[i] && | 249 | if (local->crypt_info.crypt[i] && |
213 | local->crypt_info.crypt[i]->ops && | 250 | local->crypt_info.crypt[i]->ops && |
214 | local->crypt_info.crypt[i]->ops->print_stats) { | 251 | local->crypt_info.crypt[i]->ops->print_stats) { |
215 | p = local->crypt_info.crypt[i]->ops->print_stats( | 252 | local->crypt_info.crypt[i]->ops->print_stats( |
216 | p, local->crypt_info.crypt[i]->priv); | 253 | m, local->crypt_info.crypt[i]->priv); |
217 | } | 254 | } |
218 | } | 255 | } |
256 | return 0; | ||
257 | } | ||
219 | 258 | ||
220 | if ((p - page) <= off) { | 259 | static int prism2_crypt_proc_open(struct inode *inode, struct file *file) |
221 | *eof = 1; | 260 | { |
222 | return 0; | 261 | return single_open(file, prism2_crypt_proc_show, PDE_DATA(inode)); |
223 | } | ||
224 | |||
225 | *start = page + off; | ||
226 | |||
227 | return (p - page - off); | ||
228 | } | 262 | } |
229 | 263 | ||
264 | static const struct file_operations prism2_crypt_proc_fops = { | ||
265 | .open = prism2_crypt_proc_open, | ||
266 | .read = seq_read, | ||
267 | .llseek = seq_lseek, | ||
268 | .release = seq_release, | ||
269 | }; | ||
230 | 270 | ||
231 | static int prism2_pda_proc_read(char *page, char **start, off_t off, | 271 | |
232 | int count, int *eof, void *data) | 272 | static ssize_t prism2_pda_proc_read(struct file *file, char __user *buf, |
273 | size_t count, loff_t *_pos) | ||
233 | { | 274 | { |
234 | local_info_t *local = (local_info_t *) data; | 275 | local_info_t *local = PDE_DATA(file_inode(file)); |
276 | size_t off; | ||
235 | 277 | ||
236 | if (local->pda == NULL || off >= PRISM2_PDA_SIZE) { | 278 | if (local->pda == NULL || *_pos >= PRISM2_PDA_SIZE) |
237 | *eof = 1; | ||
238 | return 0; | 279 | return 0; |
239 | } | ||
240 | 280 | ||
241 | if (off + count > PRISM2_PDA_SIZE) | 281 | off = *_pos; |
282 | if (count > PRISM2_PDA_SIZE - off) | ||
242 | count = PRISM2_PDA_SIZE - off; | 283 | count = PRISM2_PDA_SIZE - off; |
243 | 284 | if (copy_to_user(buf, local->pda + off, count) != 0) | |
244 | memcpy(page, local->pda + off, count); | 285 | return -EFAULT; |
286 | *_pos += count; | ||
245 | return count; | 287 | return count; |
246 | } | 288 | } |
247 | 289 | ||
290 | static const struct file_operations prism2_pda_proc_fops = { | ||
291 | .read = prism2_pda_proc_read, | ||
292 | .llseek = generic_file_llseek, | ||
293 | }; | ||
248 | 294 | ||
249 | static int prism2_aux_dump_proc_read(char *page, char **start, off_t off, | ||
250 | int count, int *eof, void *data) | ||
251 | { | ||
252 | local_info_t *local = (local_info_t *) data; | ||
253 | |||
254 | if (local->func->read_aux == NULL) { | ||
255 | *eof = 1; | ||
256 | return 0; | ||
257 | } | ||
258 | 295 | ||
259 | if (local->func->read_aux(local->dev, off, count, page)) { | 296 | static ssize_t prism2_aux_dump_proc_no_read(struct file *file, char __user *buf, |
260 | *eof = 1; | 297 | size_t bufsize, loff_t *_pos) |
261 | return 0; | 298 | { |
262 | } | 299 | return 0; |
263 | *start = page; | ||
264 | |||
265 | return count; | ||
266 | } | 300 | } |
267 | 301 | ||
302 | static const struct file_operations prism2_aux_dump_proc_fops = { | ||
303 | .read = prism2_aux_dump_proc_no_read, | ||
304 | }; | ||
305 | |||
268 | 306 | ||
269 | #ifdef PRISM2_IO_DEBUG | 307 | #ifdef PRISM2_IO_DEBUG |
270 | static int prism2_io_debug_proc_read(char *page, char **start, off_t off, | 308 | static int prism2_io_debug_proc_read(char *page, char **start, off_t off, |
@@ -306,82 +344,108 @@ static int prism2_io_debug_proc_read(char *page, char **start, off_t off, | |||
306 | 344 | ||
307 | 345 | ||
308 | #ifndef PRISM2_NO_STATION_MODES | 346 | #ifndef PRISM2_NO_STATION_MODES |
309 | static int prism2_scan_results_proc_read(char *page, char **start, off_t off, | 347 | static int prism2_scan_results_proc_show(struct seq_file *m, void *v) |
310 | int count, int *eof, void *data) | ||
311 | { | 348 | { |
312 | char *p = page; | 349 | local_info_t *local = m->private; |
313 | local_info_t *local = (local_info_t *) data; | 350 | unsigned long entry; |
314 | int entry, i, len, total = 0; | 351 | int i, len; |
315 | struct hfa384x_hostscan_result *scanres; | 352 | struct hfa384x_hostscan_result *scanres; |
316 | u8 *pos; | 353 | u8 *p; |
317 | 354 | ||
318 | p += sprintf(p, "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates " | 355 | if (v == SEQ_START_TOKEN) { |
319 | "SSID\n"); | 356 | seq_printf(m, |
357 | "CHID ANL SL BcnInt Capab Rate BSSID ATIM SupRates SSID\n"); | ||
358 | return 0; | ||
359 | } | ||
320 | 360 | ||
361 | entry = (unsigned long)v - 2; | ||
362 | scanres = &local->last_scan_results[entry]; | ||
363 | |||
364 | seq_printf(m, "%d %d %d %d 0x%02x %d %pM %d ", | ||
365 | le16_to_cpu(scanres->chid), | ||
366 | (s16) le16_to_cpu(scanres->anl), | ||
367 | (s16) le16_to_cpu(scanres->sl), | ||
368 | le16_to_cpu(scanres->beacon_interval), | ||
369 | le16_to_cpu(scanres->capability), | ||
370 | le16_to_cpu(scanres->rate), | ||
371 | scanres->bssid, | ||
372 | le16_to_cpu(scanres->atim)); | ||
373 | |||
374 | p = scanres->sup_rates; | ||
375 | for (i = 0; i < sizeof(scanres->sup_rates); i++) { | ||
376 | if (p[i] == 0) | ||
377 | break; | ||
378 | seq_printf(m, "<%02x>", p[i]); | ||
379 | } | ||
380 | seq_putc(m, ' '); | ||
381 | |||
382 | p = scanres->ssid; | ||
383 | len = le16_to_cpu(scanres->ssid_len); | ||
384 | if (len > 32) | ||
385 | len = 32; | ||
386 | for (i = 0; i < len; i++) { | ||
387 | unsigned char c = p[i]; | ||
388 | if (c >= 32 && c < 127) | ||
389 | seq_putc(m, c); | ||
390 | else | ||
391 | seq_printf(m, "<%02x>", c); | ||
392 | } | ||
393 | seq_putc(m, '\n'); | ||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | static void *prism2_scan_results_proc_start(struct seq_file *m, loff_t *_pos) | ||
398 | { | ||
399 | local_info_t *local = m->private; | ||
321 | spin_lock_bh(&local->lock); | 400 | spin_lock_bh(&local->lock); |
322 | for (entry = 0; entry < local->last_scan_results_count; entry++) { | ||
323 | scanres = &local->last_scan_results[entry]; | ||
324 | 401 | ||
325 | if (total + (p - page) <= off) { | 402 | /* We have a header (pos 0) + N results to show (pos 1...N) */ |
326 | total += p - page; | 403 | if (*_pos > local->last_scan_results_count) |
327 | p = page; | 404 | return NULL; |
328 | } | 405 | return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ |
329 | if (total + (p - page) > off + count) | 406 | } |
330 | break; | ||
331 | if ((p - page) > (PAGE_SIZE - 200)) | ||
332 | break; | ||
333 | 407 | ||
334 | p += sprintf(p, "%d %d %d %d 0x%02x %d %pM %d ", | 408 | static void *prism2_scan_results_proc_next(struct seq_file *m, void *v, loff_t *_pos) |
335 | le16_to_cpu(scanres->chid), | 409 | { |
336 | (s16) le16_to_cpu(scanres->anl), | 410 | local_info_t *local = m->private; |
337 | (s16) le16_to_cpu(scanres->sl), | 411 | |
338 | le16_to_cpu(scanres->beacon_interval), | 412 | ++*_pos; |
339 | le16_to_cpu(scanres->capability), | 413 | if (*_pos > local->last_scan_results_count) |
340 | le16_to_cpu(scanres->rate), | 414 | return NULL; |
341 | scanres->bssid, | 415 | return (void *)(unsigned long)(*_pos + 1); /* 0 would be EOF */ |
342 | le16_to_cpu(scanres->atim)); | 416 | } |
343 | 417 | ||
344 | pos = scanres->sup_rates; | 418 | static void prism2_scan_results_proc_stop(struct seq_file *m, void *v) |
345 | for (i = 0; i < sizeof(scanres->sup_rates); i++) { | 419 | { |
346 | if (pos[i] == 0) | 420 | local_info_t *local = m->private; |
347 | break; | ||
348 | p += sprintf(p, "<%02x>", pos[i]); | ||
349 | } | ||
350 | p += sprintf(p, " "); | ||
351 | |||
352 | pos = scanres->ssid; | ||
353 | len = le16_to_cpu(scanres->ssid_len); | ||
354 | if (len > 32) | ||
355 | len = 32; | ||
356 | for (i = 0; i < len; i++) { | ||
357 | unsigned char c = pos[i]; | ||
358 | if (c >= 32 && c < 127) | ||
359 | p += sprintf(p, "%c", c); | ||
360 | else | ||
361 | p += sprintf(p, "<%02x>", c); | ||
362 | } | ||
363 | p += sprintf(p, "\n"); | ||
364 | } | ||
365 | spin_unlock_bh(&local->lock); | 421 | spin_unlock_bh(&local->lock); |
422 | } | ||
366 | 423 | ||
367 | total += (p - page); | 424 | static const struct seq_operations prism2_scan_results_proc_seqops = { |
368 | if (total >= off + count) | 425 | .start = prism2_scan_results_proc_start, |
369 | *eof = 1; | 426 | .next = prism2_scan_results_proc_next, |
427 | .stop = prism2_scan_results_proc_stop, | ||
428 | .show = prism2_scan_results_proc_show, | ||
429 | }; | ||
370 | 430 | ||
371 | if (total < off) { | 431 | static int prism2_scan_results_proc_open(struct inode *inode, struct file *file) |
372 | *eof = 1; | 432 | { |
373 | return 0; | 433 | int ret = seq_open(file, &prism2_scan_results_proc_seqops); |
434 | if (ret == 0) { | ||
435 | struct seq_file *m = file->private_data; | ||
436 | m->private = PDE_DATA(inode); | ||
374 | } | 437 | } |
438 | return ret; | ||
439 | } | ||
440 | |||
441 | static const struct file_operations prism2_scan_results_proc_fops = { | ||
442 | .open = prism2_scan_results_proc_open, | ||
443 | .read = seq_read, | ||
444 | .llseek = seq_lseek, | ||
445 | .release = seq_release, | ||
446 | }; | ||
375 | 447 | ||
376 | len = total - off; | ||
377 | if (len > (p - page)) | ||
378 | len = p - page; | ||
379 | *start = p - len; | ||
380 | if (len > count) | ||
381 | len = count; | ||
382 | 448 | ||
383 | return len; | ||
384 | } | ||
385 | #endif /* PRISM2_NO_STATION_MODES */ | 449 | #endif /* PRISM2_NO_STATION_MODES */ |
386 | 450 | ||
387 | 451 | ||
@@ -403,53 +467,36 @@ void hostap_init_proc(local_info_t *local) | |||
403 | } | 467 | } |
404 | 468 | ||
405 | #ifndef PRISM2_NO_PROCFS_DEBUG | 469 | #ifndef PRISM2_NO_PROCFS_DEBUG |
406 | create_proc_read_entry("debug", 0, local->proc, | 470 | proc_create_data("debug", 0, local->proc, |
407 | prism2_debug_proc_read, local); | 471 | &prism2_debug_proc_fops, local); |
408 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | 472 | #endif /* PRISM2_NO_PROCFS_DEBUG */ |
409 | create_proc_read_entry("stats", 0, local->proc, | 473 | proc_create_data("stats", 0, local->proc, |
410 | prism2_stats_proc_read, local); | 474 | &prism2_stats_proc_fops, local); |
411 | create_proc_read_entry("wds", 0, local->proc, | 475 | proc_create_data("wds", 0, local->proc, |
412 | prism2_wds_proc_read, local); | 476 | &prism2_wds_proc_fops, local); |
413 | create_proc_read_entry("pda", 0, local->proc, | 477 | proc_create_data("pda", 0, local->proc, |
414 | prism2_pda_proc_read, local); | 478 | &prism2_pda_proc_fops, local); |
415 | create_proc_read_entry("aux_dump", 0, local->proc, | 479 | proc_create_data("aux_dump", 0, local->proc, |
416 | prism2_aux_dump_proc_read, local); | 480 | local->func->read_aux_fops ?: &prism2_aux_dump_proc_fops, |
417 | create_proc_read_entry("bss_list", 0, local->proc, | 481 | local); |
418 | prism2_bss_list_proc_read, local); | 482 | proc_create_data("bss_list", 0, local->proc, |
419 | create_proc_read_entry("crypt", 0, local->proc, | 483 | &prism2_bss_list_proc_fops, local); |
420 | prism2_crypt_proc_read, local); | 484 | proc_create_data("crypt", 0, local->proc, |
485 | &prism2_crypt_proc_fops, local); | ||
421 | #ifdef PRISM2_IO_DEBUG | 486 | #ifdef PRISM2_IO_DEBUG |
422 | create_proc_read_entry("io_debug", 0, local->proc, | 487 | proc_create_data("io_debug", 0, local->proc, |
423 | prism2_io_debug_proc_read, local); | 488 | &prism2_io_debug_proc_fops, local); |
424 | #endif /* PRISM2_IO_DEBUG */ | 489 | #endif /* PRISM2_IO_DEBUG */ |
425 | #ifndef PRISM2_NO_STATION_MODES | 490 | #ifndef PRISM2_NO_STATION_MODES |
426 | create_proc_read_entry("scan_results", 0, local->proc, | 491 | proc_create_data("scan_results", 0, local->proc, |
427 | prism2_scan_results_proc_read, local); | 492 | &prism2_scan_results_proc_fops, local); |
428 | #endif /* PRISM2_NO_STATION_MODES */ | 493 | #endif /* PRISM2_NO_STATION_MODES */ |
429 | } | 494 | } |
430 | 495 | ||
431 | 496 | ||
432 | void hostap_remove_proc(local_info_t *local) | 497 | void hostap_remove_proc(local_info_t *local) |
433 | { | 498 | { |
434 | if (local->proc != NULL) { | 499 | remove_proc_subtree(local->ddev->name, hostap_proc); |
435 | #ifndef PRISM2_NO_STATION_MODES | ||
436 | remove_proc_entry("scan_results", local->proc); | ||
437 | #endif /* PRISM2_NO_STATION_MODES */ | ||
438 | #ifdef PRISM2_IO_DEBUG | ||
439 | remove_proc_entry("io_debug", local->proc); | ||
440 | #endif /* PRISM2_IO_DEBUG */ | ||
441 | remove_proc_entry("pda", local->proc); | ||
442 | remove_proc_entry("aux_dump", local->proc); | ||
443 | remove_proc_entry("wds", local->proc); | ||
444 | remove_proc_entry("stats", local->proc); | ||
445 | remove_proc_entry("bss_list", local->proc); | ||
446 | remove_proc_entry("crypt", local->proc); | ||
447 | #ifndef PRISM2_NO_PROCFS_DEBUG | ||
448 | remove_proc_entry("debug", local->proc); | ||
449 | #endif /* PRISM2_NO_PROCFS_DEBUG */ | ||
450 | if (hostap_proc != NULL) | ||
451 | remove_proc_entry(local->proc->name, hostap_proc); | ||
452 | } | ||
453 | } | 500 | } |
454 | 501 | ||
455 | 502 | ||
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h index 7bb0b4b3f2cb..57904015380f 100644 --- a/drivers/net/wireless/hostap/hostap_wlan.h +++ b/drivers/net/wireless/hostap/hostap_wlan.h | |||
@@ -596,8 +596,7 @@ struct prism2_helper_functions { | |||
596 | struct prism2_download_param *param); | 596 | struct prism2_download_param *param); |
597 | int (*tx)(struct sk_buff *skb, struct net_device *dev); | 597 | int (*tx)(struct sk_buff *skb, struct net_device *dev); |
598 | int (*set_tim)(struct net_device *dev, int aid, int set); | 598 | int (*set_tim)(struct net_device *dev, int aid, int set); |
599 | int (*read_aux)(struct net_device *dev, unsigned addr, int len, | 599 | const struct file_operations *read_aux_fops; |
600 | u8 *buf); | ||
601 | 600 | ||
602 | int need_tx_headroom; /* number of bytes of headroom needed before | 601 | int need_tx_headroom; /* number of bytes of headroom needed before |
603 | * IEEE 802.11 header */ | 602 | * IEEE 802.11 header */ |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index ebada812b3a5..9b557a1bb7f8 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2778,7 +2778,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer, | |||
2778 | nr = nr * 10 + c; | 2778 | nr = nr * 10 + c; |
2779 | p++; | 2779 | p++; |
2780 | } while (--len); | 2780 | } while (--len); |
2781 | *(int *)PDE(file_inode(file))->data = nr; | 2781 | *(int *)PDE_DATA(file_inode(file)) = nr; |
2782 | return count; | 2782 | return count; |
2783 | } | 2783 | } |
2784 | 2784 | ||
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 44d01afafe9c..43926cd25ae8 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <asm/setup.h> | 19 | #include <asm/setup.h> |
20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
21 | #include <asm/hwtest.h> | 21 | #include <asm/hwtest.h> |
22 | #include <linux/proc_fs.h> | ||
23 | #include <asm/mac_via.h> | 22 | #include <asm/mac_via.h> |
24 | #include <asm/mac_oss.h> | 23 | #include <asm/mac_oss.h> |
25 | 24 | ||
@@ -954,56 +953,6 @@ void __init nubus_probe_slot(int slot) | |||
954 | } | 953 | } |
955 | } | 954 | } |
956 | 955 | ||
957 | #if defined(CONFIG_PROC_FS) | ||
958 | |||
959 | /* /proc/nubus stuff */ | ||
960 | |||
961 | static int sprint_nubus_board(struct nubus_board* board, char* ptr, int len) | ||
962 | { | ||
963 | if(len < 100) | ||
964 | return -1; | ||
965 | |||
966 | sprintf(ptr, "Slot %X: %s\n", | ||
967 | board->slot, board->name); | ||
968 | |||
969 | return strlen(ptr); | ||
970 | } | ||
971 | |||
972 | static int nubus_read_proc(char *page, char **start, off_t off, | ||
973 | int count, int *eof, void *data) | ||
974 | { | ||
975 | int nprinted, len, begin = 0; | ||
976 | int size = PAGE_SIZE; | ||
977 | struct nubus_board* board; | ||
978 | |||
979 | len = sprintf(page, "Nubus devices found:\n"); | ||
980 | /* Walk the list of NuBus boards */ | ||
981 | for (board = nubus_boards; board != NULL; board = board->next) | ||
982 | { | ||
983 | nprinted = sprint_nubus_board(board, page + len, size - len); | ||
984 | if (nprinted < 0) | ||
985 | break; | ||
986 | len += nprinted; | ||
987 | if (len+begin < off) { | ||
988 | begin += len; | ||
989 | len = 0; | ||
990 | } | ||
991 | if (len+begin >= off+count) | ||
992 | break; | ||
993 | } | ||
994 | if (len+begin < off) | ||
995 | *eof = 1; | ||
996 | off -= begin; | ||
997 | *start = page + off; | ||
998 | len -= off; | ||
999 | if (len>count) | ||
1000 | len = count; | ||
1001 | if (len<0) | ||
1002 | len = 0; | ||
1003 | return len; | ||
1004 | } | ||
1005 | #endif | ||
1006 | |||
1007 | void __init nubus_scan_bus(void) | 956 | void __init nubus_scan_bus(void) |
1008 | { | 957 | { |
1009 | int slot; | 958 | int slot; |
@@ -1041,11 +990,7 @@ static int __init nubus_init(void) | |||
1041 | nubus_devices = NULL; | 990 | nubus_devices = NULL; |
1042 | nubus_boards = NULL; | 991 | nubus_boards = NULL; |
1043 | nubus_scan_bus(); | 992 | nubus_scan_bus(); |
1044 | |||
1045 | #ifdef CONFIG_PROC_FS | ||
1046 | create_proc_read_entry("nubus", 0, NULL, nubus_read_proc, NULL); | ||
1047 | nubus_proc_init(); | 993 | nubus_proc_init(); |
1048 | #endif | ||
1049 | return 0; | 994 | return 0; |
1050 | } | 995 | } |
1051 | 996 | ||
diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c index 208dd12825bc..b8286ed65919 100644 --- a/drivers/nubus/proc.c +++ b/drivers/nubus/proc.c | |||
@@ -52,7 +52,6 @@ static int nubus_devices_proc_open(struct inode *inode, struct file *file) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | static const struct file_operations nubus_devices_proc_fops = { | 54 | static const struct file_operations nubus_devices_proc_fops = { |
55 | .owner = THIS_MODULE, | ||
56 | .open = nubus_devices_proc_open, | 55 | .open = nubus_devices_proc_open, |
57 | .read = seq_read, | 56 | .read = seq_read, |
58 | .llseek = seq_lseek, | 57 | .llseek = seq_lseek, |
@@ -61,6 +60,10 @@ static const struct file_operations nubus_devices_proc_fops = { | |||
61 | 60 | ||
62 | static struct proc_dir_entry *proc_bus_nubus_dir; | 61 | static struct proc_dir_entry *proc_bus_nubus_dir; |
63 | 62 | ||
63 | static const struct file_operations nubus_proc_subdir_fops = { | ||
64 | #warning Need to set some I/O handlers here | ||
65 | }; | ||
66 | |||
64 | static void nubus_proc_subdir(struct nubus_dev* dev, | 67 | static void nubus_proc_subdir(struct nubus_dev* dev, |
65 | struct proc_dir_entry* parent, | 68 | struct proc_dir_entry* parent, |
66 | struct nubus_dir* dir) | 69 | struct nubus_dir* dir) |
@@ -73,9 +76,10 @@ static void nubus_proc_subdir(struct nubus_dev* dev, | |||
73 | struct proc_dir_entry* e; | 76 | struct proc_dir_entry* e; |
74 | 77 | ||
75 | sprintf(name, "%x", ent.type); | 78 | sprintf(name, "%x", ent.type); |
76 | e = create_proc_entry(name, S_IFREG | S_IRUGO | | 79 | e = proc_create(name, S_IFREG | S_IRUGO | S_IWUSR, parent, |
77 | S_IWUSR, parent); | 80 | &nubus_proc_subdir_fops); |
78 | if (!e) return; | 81 | if (!e) |
82 | return; | ||
79 | } | 83 | } |
80 | } | 84 | } |
81 | 85 | ||
@@ -158,6 +162,73 @@ int nubus_proc_detach_device(struct nubus_dev *dev) | |||
158 | } | 162 | } |
159 | EXPORT_SYMBOL(nubus_proc_detach_device); | 163 | EXPORT_SYMBOL(nubus_proc_detach_device); |
160 | 164 | ||
165 | /* | ||
166 | * /proc/nubus stuff | ||
167 | */ | ||
168 | static int nubus_proc_show(struct seq_file *m, void *v) | ||
169 | { | ||
170 | const struct nubus_board *board = v; | ||
171 | |||
172 | /* Display header on line 1 */ | ||
173 | if (v == SEQ_START_TOKEN) | ||
174 | seq_puts(m, "Nubus devices found:\n"); | ||
175 | else | ||
176 | seq_printf(m, "Slot %X: %s\n", board->slot, board->name); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
180 | static void *nubus_proc_start(struct seq_file *m, loff_t *_pos) | ||
181 | { | ||
182 | struct nubus_board *board; | ||
183 | unsigned pos; | ||
184 | |||
185 | if (*_pos > LONG_MAX) | ||
186 | return NULL; | ||
187 | pos = *_pos; | ||
188 | if (pos == 0) | ||
189 | return SEQ_START_TOKEN; | ||
190 | for (board = nubus_boards; board; board = board->next) | ||
191 | if (--pos == 0) | ||
192 | break; | ||
193 | return board; | ||
194 | } | ||
195 | |||
196 | static void *nubus_proc_next(struct seq_file *p, void *v, loff_t *_pos) | ||
197 | { | ||
198 | /* Walk the list of NuBus boards */ | ||
199 | struct nubus_board *board = v; | ||
200 | |||
201 | ++*_pos; | ||
202 | if (v == SEQ_START_TOKEN) | ||
203 | board = nubus_boards; | ||
204 | else if (board) | ||
205 | board = board->next; | ||
206 | return board; | ||
207 | } | ||
208 | |||
209 | static void nubus_proc_stop(struct seq_file *p, void *v) | ||
210 | { | ||
211 | } | ||
212 | |||
213 | static const struct seq_operations nubus_proc_seqops = { | ||
214 | .start = nubus_proc_start, | ||
215 | .next = nubus_proc_next, | ||
216 | .stop = nubus_proc_stop, | ||
217 | .show = nubus_proc_show, | ||
218 | }; | ||
219 | |||
220 | static int nubus_proc_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | return seq_open(file, &nubus_proc_seqops); | ||
223 | } | ||
224 | |||
225 | static const struct file_operations nubus_proc_fops = { | ||
226 | .open = nubus_proc_open, | ||
227 | .read = seq_read, | ||
228 | .llseek = seq_lseek, | ||
229 | .release = seq_release, | ||
230 | }; | ||
231 | |||
161 | void __init proc_bus_nubus_add_devices(void) | 232 | void __init proc_bus_nubus_add_devices(void) |
162 | { | 233 | { |
163 | struct nubus_dev *dev; | 234 | struct nubus_dev *dev; |
@@ -168,6 +239,7 @@ void __init proc_bus_nubus_add_devices(void) | |||
168 | 239 | ||
169 | void __init nubus_proc_init(void) | 240 | void __init nubus_proc_init(void) |
170 | { | 241 | { |
242 | proc_create("nubus", 0, NULL, &nubus_proc_fops); | ||
171 | if (!MACH_IS_MAC) | 243 | if (!MACH_IS_MAC) |
172 | return; | 244 | return; |
173 | proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); | 245 | proc_bus_nubus_dir = proc_mkdir("bus/nubus", NULL); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 1733081eb873..0a2bdd106b23 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1453,16 +1453,7 @@ int of_attach_node(struct device_node *np) | |||
1453 | #ifdef CONFIG_PROC_DEVICETREE | 1453 | #ifdef CONFIG_PROC_DEVICETREE |
1454 | static void of_remove_proc_dt_entry(struct device_node *dn) | 1454 | static void of_remove_proc_dt_entry(struct device_node *dn) |
1455 | { | 1455 | { |
1456 | struct device_node *parent = dn->parent; | 1456 | proc_remove(dn->pde); |
1457 | struct property *prop = dn->properties; | ||
1458 | |||
1459 | while (prop) { | ||
1460 | remove_proc_entry(prop->name, dn->pde); | ||
1461 | prop = prop->next; | ||
1462 | } | ||
1463 | |||
1464 | if (dn->pde) | ||
1465 | remove_proc_entry(dn->pde->name, parent->pde); | ||
1466 | } | 1457 | } |
1467 | #else | 1458 | #else |
1468 | static void of_remove_proc_dt_entry(struct device_node *dn) | 1459 | static void of_remove_proc_dt_entry(struct device_node *dn) |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index d4d800c54d86..b48243131993 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -172,14 +172,14 @@ static int led_proc_show(struct seq_file *m, void *v) | |||
172 | 172 | ||
173 | static int led_proc_open(struct inode *inode, struct file *file) | 173 | static int led_proc_open(struct inode *inode, struct file *file) |
174 | { | 174 | { |
175 | return single_open(file, led_proc_show, PDE(inode)->data); | 175 | return single_open(file, led_proc_show, PDE_DATA(inode)); |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | static ssize_t led_proc_write(struct file *file, const char *buf, | 179 | static ssize_t led_proc_write(struct file *file, const char *buf, |
180 | size_t count, loff_t *pos) | 180 | size_t count, loff_t *pos) |
181 | { | 181 | { |
182 | void *data = PDE(file_inode(file))->data; | 182 | void *data = PDE_DATA(file_inode(file)); |
183 | char *cur, lbuf[32]; | 183 | char *cur, lbuf[32]; |
184 | int d; | 184 | int d; |
185 | 185 | ||
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 0b009470e6db..08126087ec31 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c | |||
@@ -46,9 +46,7 @@ proc_bus_pci_lseek(struct file *file, loff_t off, int whence) | |||
46 | static ssize_t | 46 | static ssize_t |
47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 47 | proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
48 | { | 48 | { |
49 | const struct inode *ino = file_inode(file); | 49 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
50 | const struct proc_dir_entry *dp = PDE(ino); | ||
51 | struct pci_dev *dev = dp->data; | ||
52 | unsigned int pos = *ppos; | 50 | unsigned int pos = *ppos; |
53 | unsigned int cnt, size; | 51 | unsigned int cnt, size; |
54 | 52 | ||
@@ -59,7 +57,7 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp | |||
59 | */ | 57 | */ |
60 | 58 | ||
61 | if (capable(CAP_SYS_ADMIN)) | 59 | if (capable(CAP_SYS_ADMIN)) |
62 | size = dp->size; | 60 | size = dev->cfg_size; |
63 | else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | 61 | else if (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) |
64 | size = 128; | 62 | size = 128; |
65 | else | 63 | else |
@@ -133,10 +131,9 @@ static ssize_t | |||
133 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) | 131 | proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) |
134 | { | 132 | { |
135 | struct inode *ino = file_inode(file); | 133 | struct inode *ino = file_inode(file); |
136 | const struct proc_dir_entry *dp = PDE(ino); | 134 | struct pci_dev *dev = PDE_DATA(ino); |
137 | struct pci_dev *dev = dp->data; | ||
138 | int pos = *ppos; | 135 | int pos = *ppos; |
139 | int size = dp->size; | 136 | int size = dev->cfg_size; |
140 | int cnt; | 137 | int cnt; |
141 | 138 | ||
142 | if (pos >= size) | 139 | if (pos >= size) |
@@ -200,7 +197,7 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof | |||
200 | pci_config_pm_runtime_put(dev); | 197 | pci_config_pm_runtime_put(dev); |
201 | 198 | ||
202 | *ppos = pos; | 199 | *ppos = pos; |
203 | i_size_write(ino, dp->size); | 200 | i_size_write(ino, dev->cfg_size); |
204 | return nbytes; | 201 | return nbytes; |
205 | } | 202 | } |
206 | 203 | ||
@@ -212,8 +209,7 @@ struct pci_filp_private { | |||
212 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | 209 | static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, |
213 | unsigned long arg) | 210 | unsigned long arg) |
214 | { | 211 | { |
215 | const struct proc_dir_entry *dp = PDE(file_inode(file)); | 212 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
216 | struct pci_dev *dev = dp->data; | ||
217 | #ifdef HAVE_PCI_MMAP | 213 | #ifdef HAVE_PCI_MMAP |
218 | struct pci_filp_private *fpriv = file->private_data; | 214 | struct pci_filp_private *fpriv = file->private_data; |
219 | #endif /* HAVE_PCI_MMAP */ | 215 | #endif /* HAVE_PCI_MMAP */ |
@@ -253,9 +249,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, | |||
253 | #ifdef HAVE_PCI_MMAP | 249 | #ifdef HAVE_PCI_MMAP |
254 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) | 250 | static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) |
255 | { | 251 | { |
256 | struct inode *inode = file_inode(file); | 252 | struct pci_dev *dev = PDE_DATA(file_inode(file)); |
257 | const struct proc_dir_entry *dp = PDE(inode); | ||
258 | struct pci_dev *dev = dp->data; | ||
259 | struct pci_filp_private *fpriv = file->private_data; | 253 | struct pci_filp_private *fpriv = file->private_data; |
260 | int i, ret; | 254 | int i, ret; |
261 | 255 | ||
@@ -425,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev) | |||
425 | &proc_bus_pci_operations, dev); | 419 | &proc_bus_pci_operations, dev); |
426 | if (!e) | 420 | if (!e) |
427 | return -ENOMEM; | 421 | return -ENOMEM; |
428 | e->size = dev->cfg_size; | 422 | proc_set_size(e, dev->cfg_size); |
429 | dev->procent = e; | 423 | dev->procent = e; |
430 | 424 | ||
431 | return 0; | 425 | return 0; |
@@ -433,20 +427,14 @@ int pci_proc_attach_device(struct pci_dev *dev) | |||
433 | 427 | ||
434 | int pci_proc_detach_device(struct pci_dev *dev) | 428 | int pci_proc_detach_device(struct pci_dev *dev) |
435 | { | 429 | { |
436 | struct proc_dir_entry *e; | 430 | proc_remove(dev->procent); |
437 | 431 | dev->procent = NULL; | |
438 | if ((e = dev->procent)) { | ||
439 | remove_proc_entry(e->name, dev->bus->procdir); | ||
440 | dev->procent = NULL; | ||
441 | } | ||
442 | return 0; | 432 | return 0; |
443 | } | 433 | } |
444 | 434 | ||
445 | int pci_proc_detach_bus(struct pci_bus* bus) | 435 | int pci_proc_detach_bus(struct pci_bus* bus) |
446 | { | 436 | { |
447 | struct proc_dir_entry *de = bus->procdir; | 437 | proc_remove(bus->procdir); |
448 | if (de) | ||
449 | remove_proc_entry(de->name, proc_bus_pci_dir); | ||
450 | return 0; | 438 | return 0; |
451 | } | 439 | } |
452 | 440 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index edec135b1685..54d31c0a9840 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -844,14 +844,14 @@ static int dispatch_proc_show(struct seq_file *m, void *v) | |||
844 | 844 | ||
845 | static int dispatch_proc_open(struct inode *inode, struct file *file) | 845 | static int dispatch_proc_open(struct inode *inode, struct file *file) |
846 | { | 846 | { |
847 | return single_open(file, dispatch_proc_show, PDE(inode)->data); | 847 | return single_open(file, dispatch_proc_show, PDE_DATA(inode)); |
848 | } | 848 | } |
849 | 849 | ||
850 | static ssize_t dispatch_proc_write(struct file *file, | 850 | static ssize_t dispatch_proc_write(struct file *file, |
851 | const char __user *userbuf, | 851 | const char __user *userbuf, |
852 | size_t count, loff_t *pos) | 852 | size_t count, loff_t *pos) |
853 | { | 853 | { |
854 | struct ibm_struct *ibm = PDE(file_inode(file))->data; | 854 | struct ibm_struct *ibm = PDE_DATA(file_inode(file)); |
855 | char *kernbuf; | 855 | char *kernbuf; |
856 | int ret; | 856 | int ret; |
857 | 857 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 242abac62d8b..eb3467ea6d86 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -553,7 +553,7 @@ static int lcd_proc_show(struct seq_file *m, void *v) | |||
553 | 553 | ||
554 | static int lcd_proc_open(struct inode *inode, struct file *file) | 554 | static int lcd_proc_open(struct inode *inode, struct file *file) |
555 | { | 555 | { |
556 | return single_open(file, lcd_proc_show, PDE(inode)->data); | 556 | return single_open(file, lcd_proc_show, PDE_DATA(inode)); |
557 | } | 557 | } |
558 | 558 | ||
559 | static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) | 559 | static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) |
@@ -583,7 +583,7 @@ static int set_lcd_status(struct backlight_device *bd) | |||
583 | static ssize_t lcd_proc_write(struct file *file, const char __user *buf, | 583 | static ssize_t lcd_proc_write(struct file *file, const char __user *buf, |
584 | size_t count, loff_t *pos) | 584 | size_t count, loff_t *pos) |
585 | { | 585 | { |
586 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; | 586 | struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
587 | char cmd[42]; | 587 | char cmd[42]; |
588 | size_t len; | 588 | size_t len; |
589 | int value; | 589 | int value; |
@@ -644,13 +644,13 @@ static int video_proc_show(struct seq_file *m, void *v) | |||
644 | 644 | ||
645 | static int video_proc_open(struct inode *inode, struct file *file) | 645 | static int video_proc_open(struct inode *inode, struct file *file) |
646 | { | 646 | { |
647 | return single_open(file, video_proc_show, PDE(inode)->data); | 647 | return single_open(file, video_proc_show, PDE_DATA(inode)); |
648 | } | 648 | } |
649 | 649 | ||
650 | static ssize_t video_proc_write(struct file *file, const char __user *buf, | 650 | static ssize_t video_proc_write(struct file *file, const char __user *buf, |
651 | size_t count, loff_t *pos) | 651 | size_t count, loff_t *pos) |
652 | { | 652 | { |
653 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; | 653 | struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
654 | char *cmd, *buffer; | 654 | char *cmd, *buffer; |
655 | int ret; | 655 | int ret; |
656 | int value; | 656 | int value; |
@@ -744,13 +744,13 @@ static int fan_proc_show(struct seq_file *m, void *v) | |||
744 | 744 | ||
745 | static int fan_proc_open(struct inode *inode, struct file *file) | 745 | static int fan_proc_open(struct inode *inode, struct file *file) |
746 | { | 746 | { |
747 | return single_open(file, fan_proc_show, PDE(inode)->data); | 747 | return single_open(file, fan_proc_show, PDE_DATA(inode)); |
748 | } | 748 | } |
749 | 749 | ||
750 | static ssize_t fan_proc_write(struct file *file, const char __user *buf, | 750 | static ssize_t fan_proc_write(struct file *file, const char __user *buf, |
751 | size_t count, loff_t *pos) | 751 | size_t count, loff_t *pos) |
752 | { | 752 | { |
753 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; | 753 | struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
754 | char cmd[42]; | 754 | char cmd[42]; |
755 | size_t len; | 755 | size_t len; |
756 | int value; | 756 | int value; |
@@ -816,13 +816,13 @@ static int keys_proc_show(struct seq_file *m, void *v) | |||
816 | 816 | ||
817 | static int keys_proc_open(struct inode *inode, struct file *file) | 817 | static int keys_proc_open(struct inode *inode, struct file *file) |
818 | { | 818 | { |
819 | return single_open(file, keys_proc_show, PDE(inode)->data); | 819 | return single_open(file, keys_proc_show, PDE_DATA(inode)); |
820 | } | 820 | } |
821 | 821 | ||
822 | static ssize_t keys_proc_write(struct file *file, const char __user *buf, | 822 | static ssize_t keys_proc_write(struct file *file, const char __user *buf, |
823 | size_t count, loff_t *pos) | 823 | size_t count, loff_t *pos) |
824 | { | 824 | { |
825 | struct toshiba_acpi_dev *dev = PDE(file_inode(file))->data; | 825 | struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); |
826 | char cmd[42]; | 826 | char cmd[42]; |
827 | size_t len; | 827 | size_t len; |
828 | int value; | 828 | int value; |
@@ -859,7 +859,7 @@ static int version_proc_show(struct seq_file *m, void *v) | |||
859 | 859 | ||
860 | static int version_proc_open(struct inode *inode, struct file *file) | 860 | static int version_proc_open(struct inode *inode, struct file *file) |
861 | { | 861 | { |
862 | return single_open(file, version_proc_show, PDE(inode)->data); | 862 | return single_open(file, version_proc_show, PDE_DATA(inode)); |
863 | } | 863 | } |
864 | 864 | ||
865 | static const struct file_operations version_proc_fops = { | 865 | static const struct file_operations version_proc_fops = { |
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 65f735ac6b3b..2365ef37ae24 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c | |||
@@ -55,9 +55,7 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) | |||
55 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, | 55 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf, |
56 | size_t nbytes, loff_t * ppos) | 56 | size_t nbytes, loff_t * ppos) |
57 | { | 57 | { |
58 | struct inode *ino = file_inode(file); | 58 | struct pnp_dev *dev = PDE_DATA(file_inode(file)); |
59 | struct proc_dir_entry *dp = PDE(ino); | ||
60 | struct pnp_dev *dev = dp->data; | ||
61 | int pos = *ppos; | 59 | int pos = *ppos; |
62 | int cnt, size = 256; | 60 | int cnt, size = 256; |
63 | 61 | ||
@@ -107,7 +105,7 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev) | |||
107 | &isapnp_proc_bus_file_operations, dev); | 105 | &isapnp_proc_bus_file_operations, dev); |
108 | if (!e) | 106 | if (!e) |
109 | return -ENOMEM; | 107 | return -ENOMEM; |
110 | e->size = 256; | 108 | proc_set_size(e, 256); |
111 | return 0; | 109 | return 0; |
112 | } | 110 | } |
113 | 111 | ||
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 1c03ee822e50..c212db0fc65d 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -237,13 +237,13 @@ static int pnpbios_proc_show(struct seq_file *m, void *v) | |||
237 | 237 | ||
238 | static int pnpbios_proc_open(struct inode *inode, struct file *file) | 238 | static int pnpbios_proc_open(struct inode *inode, struct file *file) |
239 | { | 239 | { |
240 | return single_open(file, pnpbios_proc_show, PDE(inode)->data); | 240 | return single_open(file, pnpbios_proc_show, PDE_DATA(inode)); |
241 | } | 241 | } |
242 | 242 | ||
243 | static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf, | 243 | static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf, |
244 | size_t count, loff_t *pos) | 244 | size_t count, loff_t *pos) |
245 | { | 245 | { |
246 | void *data = PDE(file_inode(file))->data; | 246 | void *data = PDE_DATA(file_inode(file)); |
247 | struct pnp_bios_node *node; | 247 | struct pnp_bios_node *node; |
248 | int boot = (long)data >> 8; | 248 | int boot = (long)data >> 8; |
249 | u8 nodenum = (long)data; | 249 | u8 nodenum = (long)data; |
diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c index e1b4705ae3ec..38a8bbe74810 100644 --- a/drivers/pps/clients/pps_parport.c +++ b/drivers/pps/clients/pps_parport.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/irqnr.h> | 33 | #include <linux/irqnr.h> |
34 | #include <linux/time.h> | 34 | #include <linux/time.h> |
35 | #include <linux/slab.h> | ||
35 | #include <linux/parport.h> | 36 | #include <linux/parport.h> |
36 | #include <linux/pps_kernel.h> | 37 | #include <linux/pps_kernel.h> |
37 | 38 | ||
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index e96236ac2e78..ffa69e1c9245 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c | |||
@@ -110,7 +110,7 @@ static int rtc_proc_show(struct seq_file *seq, void *offset) | |||
110 | static int rtc_proc_open(struct inode *inode, struct file *file) | 110 | static int rtc_proc_open(struct inode *inode, struct file *file) |
111 | { | 111 | { |
112 | int ret; | 112 | int ret; |
113 | struct rtc_device *rtc = PDE(inode)->data; | 113 | struct rtc_device *rtc = PDE_DATA(inode); |
114 | 114 | ||
115 | if (!try_module_get(THIS_MODULE)) | 115 | if (!try_module_get(THIS_MODULE)) |
116 | return -ENODEV; | 116 | return -ENODEV; |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index ccaae9d63d27..4221b02085ad 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -224,7 +224,7 @@ static int qperf_seq_open(struct inode *inode, struct file *filp) | |||
224 | file_inode(filp)->i_private); | 224 | file_inode(filp)->i_private); |
225 | } | 225 | } |
226 | 226 | ||
227 | static struct file_operations debugfs_perf_fops = { | 227 | static const struct file_operations debugfs_perf_fops = { |
228 | .owner = THIS_MODULE, | 228 | .owner = THIS_MODULE, |
229 | .open = qperf_seq_open, | 229 | .open = qperf_seq_open, |
230 | .read = seq_read, | 230 | .read = seq_read, |
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index d7ca247efa35..344d87599cd2 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -3201,26 +3201,30 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de | |||
3201 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. | 3201 | BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. |
3202 | */ | 3202 | */ |
3203 | 3203 | ||
3204 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *shost, char *ProcBuffer, char **StartPointer, off_t Offset, int BytesAvailable, int WriteFlag) | 3204 | static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable) |
3205 | { | 3205 | { |
3206 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; | 3206 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; |
3207 | struct BusLogic_TargetStatistics *TargetStatistics; | 3207 | struct BusLogic_TargetStatistics *TargetStatistics; |
3208 | int TargetID, Length; | ||
3209 | char *Buffer; | ||
3210 | 3208 | ||
3211 | TargetStatistics = HostAdapter->TargetStatistics; | 3209 | TargetStatistics = HostAdapter->TargetStatistics; |
3212 | if (WriteFlag) { | 3210 | HostAdapter->ExternalHostAdapterResets = 0; |
3213 | HostAdapter->ExternalHostAdapterResets = 0; | 3211 | HostAdapter->HostAdapterInternalErrors = 0; |
3214 | HostAdapter->HostAdapterInternalErrors = 0; | 3212 | memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); |
3215 | memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); | 3213 | return 0; |
3216 | return 0; | 3214 | } |
3217 | } | 3215 | |
3218 | Buffer = HostAdapter->MessageBuffer; | 3216 | static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost) |
3219 | Length = HostAdapter->MessageBufferLength; | 3217 | { |
3220 | Length += sprintf(&Buffer[Length], "\n\ | 3218 | struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; |
3219 | struct BusLogic_TargetStatistics *TargetStatistics; | ||
3220 | int TargetID; | ||
3221 | |||
3222 | TargetStatistics = HostAdapter->TargetStatistics; | ||
3223 | seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength); | ||
3224 | seq_printf(m, "\n\ | ||
3221 | Current Driver Queue Depth: %d\n\ | 3225 | Current Driver Queue Depth: %d\n\ |
3222 | Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); | 3226 | Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); |
3223 | Length += sprintf(&Buffer[Length], "\n\n\ | 3227 | seq_printf(m, "\n\n\ |
3224 | DATA TRANSFER STATISTICS\n\ | 3228 | DATA TRANSFER STATISTICS\n\ |
3225 | \n\ | 3229 | \n\ |
3226 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ | 3230 | Target Tagged Queuing Queue Depth Active Attempted Completed\n\ |
@@ -3229,66 +3233,62 @@ Target Tagged Queuing Queue Depth Active Attempted Completed\n\ | |||
3229 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3233 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3230 | if (!TargetFlags->TargetExists) | 3234 | if (!TargetFlags->TargetExists) |
3231 | continue; | 3235 | continue; |
3232 | Length += sprintf(&Buffer[Length], " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) | 3236 | seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) |
3233 | ? " Permitted" : " Disabled")) | 3237 | ? " Permitted" : " Disabled")) |
3234 | : "Not Supported")); | 3238 | : "Not Supported")); |
3235 | Length += sprintf(&Buffer[Length], | 3239 | seq_printf(m, |
3236 | " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); | 3240 | " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); |
3237 | } | 3241 | } |
3238 | Length += sprintf(&Buffer[Length], "\n\ | 3242 | seq_printf(m, "\n\ |
3239 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ | 3243 | Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ |
3240 | ====== ============= ============== =================== ===================\n"); | 3244 | ====== ============= ============== =================== ===================\n"); |
3241 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3245 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3242 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3246 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3243 | if (!TargetFlags->TargetExists) | 3247 | if (!TargetFlags->TargetExists) |
3244 | continue; | 3248 | continue; |
3245 | Length += sprintf(&Buffer[Length], " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); | 3249 | seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); |
3246 | if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) | 3250 | if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) |
3247 | Length += sprintf(&Buffer[Length], " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); | 3251 | seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); |
3248 | else | 3252 | else |
3249 | Length += sprintf(&Buffer[Length], " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); | 3253 | seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); |
3250 | if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) | 3254 | if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) |
3251 | Length += sprintf(&Buffer[Length], " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); | 3255 | seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); |
3252 | else | 3256 | else |
3253 | Length += sprintf(&Buffer[Length], " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); | 3257 | seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); |
3254 | } | 3258 | } |
3255 | Length += sprintf(&Buffer[Length], "\n\ | 3259 | seq_printf(m, "\n\ |
3256 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ | 3260 | Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ |
3257 | ====== ======= ========= ========= ========= ========= =========\n"); | 3261 | ====== ======= ========= ========= ========= ========= =========\n"); |
3258 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3262 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3259 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3263 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3260 | if (!TargetFlags->TargetExists) | 3264 | if (!TargetFlags->TargetExists) |
3261 | continue; | 3265 | continue; |
3262 | Length += | 3266 | seq_printf(m, |
3263 | sprintf(&Buffer[Length], | ||
3264 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3267 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, |
3265 | TargetStatistics[TargetID].ReadCommandSizeBuckets[0], | 3268 | TargetStatistics[TargetID].ReadCommandSizeBuckets[0], |
3266 | TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); | 3269 | TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); |
3267 | Length += | 3270 | seq_printf(m, |
3268 | sprintf(&Buffer[Length], | ||
3269 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3271 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, |
3270 | TargetStatistics[TargetID].WriteCommandSizeBuckets[0], | 3272 | TargetStatistics[TargetID].WriteCommandSizeBuckets[0], |
3271 | TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); | 3273 | TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); |
3272 | } | 3274 | } |
3273 | Length += sprintf(&Buffer[Length], "\n\ | 3275 | seq_printf(m, "\n\ |
3274 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ | 3276 | Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ |
3275 | ====== ======= ========= ========= ========= ========= =========\n"); | 3277 | ====== ======= ========= ========= ========= ========= =========\n"); |
3276 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { | 3278 | for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { |
3277 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3279 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3278 | if (!TargetFlags->TargetExists) | 3280 | if (!TargetFlags->TargetExists) |
3279 | continue; | 3281 | continue; |
3280 | Length += | 3282 | seq_printf(m, |
3281 | sprintf(&Buffer[Length], | ||
3282 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, | 3283 | " %2d Read %9u %9u %9u %9u %9u\n", TargetID, |
3283 | TargetStatistics[TargetID].ReadCommandSizeBuckets[5], | 3284 | TargetStatistics[TargetID].ReadCommandSizeBuckets[5], |
3284 | TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); | 3285 | TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); |
3285 | Length += | 3286 | seq_printf(m, |
3286 | sprintf(&Buffer[Length], | ||
3287 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, | 3287 | " %2d Write %9u %9u %9u %9u %9u\n", TargetID, |
3288 | TargetStatistics[TargetID].WriteCommandSizeBuckets[5], | 3288 | TargetStatistics[TargetID].WriteCommandSizeBuckets[5], |
3289 | TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); | 3289 | TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); |
3290 | } | 3290 | } |
3291 | Length += sprintf(&Buffer[Length], "\n\n\ | 3291 | seq_printf(m, "\n\n\ |
3292 | ERROR RECOVERY STATISTICS\n\ | 3292 | ERROR RECOVERY STATISTICS\n\ |
3293 | \n\ | 3293 | \n\ |
3294 | Command Aborts Bus Device Resets Host Adapter Resets\n\ | 3294 | Command Aborts Bus Device Resets Host Adapter Resets\n\ |
@@ -3299,20 +3299,12 @@ Target Requested Completed Requested Completed Requested Completed\n\ | |||
3299 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; | 3299 | struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; |
3300 | if (!TargetFlags->TargetExists) | 3300 | if (!TargetFlags->TargetExists) |
3301 | continue; | 3301 | continue; |
3302 | Length += sprintf(&Buffer[Length], "\ | 3302 | seq_printf(m, "\ |
3303 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); | 3303 | %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); |
3304 | } | 3304 | } |
3305 | Length += sprintf(&Buffer[Length], "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); | 3305 | seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); |
3306 | Length += sprintf(&Buffer[Length], "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); | 3306 | seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); |
3307 | if (Length >= BusLogic_MessageBufferSize) | 3307 | return 0; |
3308 | BusLogic_Error("Message Buffer length %d exceeds size %d\n", HostAdapter, Length, BusLogic_MessageBufferSize); | ||
3309 | if ((Length -= Offset) <= 0) | ||
3310 | return 0; | ||
3311 | if (Length >= BytesAvailable) | ||
3312 | Length = BytesAvailable; | ||
3313 | memcpy(ProcBuffer, HostAdapter->MessageBuffer + Offset, Length); | ||
3314 | *StartPointer = ProcBuffer; | ||
3315 | return Length; | ||
3316 | } | 3308 | } |
3317 | 3309 | ||
3318 | 3310 | ||
@@ -3566,7 +3558,8 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString) | |||
3566 | static struct scsi_host_template Bus_Logic_template = { | 3558 | static struct scsi_host_template Bus_Logic_template = { |
3567 | .module = THIS_MODULE, | 3559 | .module = THIS_MODULE, |
3568 | .proc_name = "BusLogic", | 3560 | .proc_name = "BusLogic", |
3569 | .proc_info = BusLogic_ProcDirectoryInfo, | 3561 | .write_info = BusLogic_write_info, |
3562 | .show_info = BusLogic_show_info, | ||
3570 | .name = "BusLogic", | 3563 | .name = "BusLogic", |
3571 | .info = BusLogic_DriverInfo, | 3564 | .info = BusLogic_DriverInfo, |
3572 | .queuecommand = BusLogic_QueueCommand, | 3565 | .queuecommand = BusLogic_QueueCommand, |
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h index 649fcb31f26d..6c6c13c3be1b 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h | |||
@@ -1321,7 +1321,6 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co | |||
1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); | 1321 | static const char *BusLogic_DriverInfo(struct Scsi_Host *); |
1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); | 1322 | static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); |
1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); | 1323 | static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); |
1324 | static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); | ||
1325 | static int BusLogic_SlaveConfigure(struct scsi_device *); | 1324 | static int BusLogic_SlaveConfigure(struct scsi_device *); |
1326 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); | 1325 | static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); |
1327 | static irqreturn_t BusLogic_InterruptHandler(int, void *); | 1326 | static irqreturn_t BusLogic_InterruptHandler(int, void *); |
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 450353e04dde..1e9d6ad9302b 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -695,33 +695,35 @@ static void NCR5380_print_status(struct Scsi_Host *instance) | |||
695 | * Return the number of bytes read from or written | 695 | * Return the number of bytes read from or written |
696 | */ | 696 | */ |
697 | 697 | ||
698 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, | ||
699 | char *buffer, int length) | ||
700 | { | ||
701 | #ifdef DTC_PUBLIC_RELEASE | ||
702 | dtc_wmaxi = dtc_maxi = 0; | ||
703 | #endif | ||
704 | #ifdef PAS16_PUBLIC_RELEASE | ||
705 | pas_wmaxi = pas_maxi = 0; | ||
706 | #endif | ||
707 | return (-ENOSYS); /* Currently this is a no-op */ | ||
708 | } | ||
709 | |||
698 | #undef SPRINTF | 710 | #undef SPRINTF |
699 | #define SPRINTF(args...) do { if(pos < buffer + length-80) pos += sprintf(pos, ## args); } while(0) | 711 | #define SPRINTF(args...) seq_printf(m, ## args) |
700 | static | 712 | static |
701 | char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length); | 713 | void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m); |
702 | static | 714 | static |
703 | char *lprint_command(unsigned char *cmd, char *pos, char *buffer, int len); | 715 | void lprint_command(unsigned char *cmd, struct seq_file *m); |
704 | static | 716 | static |
705 | char *lprint_opcode(int opcode, char *pos, char *buffer, int length); | 717 | void lprint_opcode(int opcode, struct seq_file *m); |
706 | 718 | ||
707 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | 719 | static int __maybe_unused NCR5380_show_info(struct seq_file *m, |
708 | char *buffer, char **start, off_t offset, int length, int inout) | 720 | struct Scsi_Host *instance) |
709 | { | 721 | { |
710 | char *pos = buffer; | ||
711 | struct NCR5380_hostdata *hostdata; | 722 | struct NCR5380_hostdata *hostdata; |
712 | Scsi_Cmnd *ptr; | 723 | Scsi_Cmnd *ptr; |
713 | 724 | ||
714 | hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 725 | hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
715 | 726 | ||
716 | if (inout) { /* Has data been written to the file ? */ | ||
717 | #ifdef DTC_PUBLIC_RELEASE | ||
718 | dtc_wmaxi = dtc_maxi = 0; | ||
719 | #endif | ||
720 | #ifdef PAS16_PUBLIC_RELEASE | ||
721 | pas_wmaxi = pas_maxi = 0; | ||
722 | #endif | ||
723 | return (-ENOSYS); /* Currently this is a no-op */ | ||
724 | } | ||
725 | SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); | 727 | SPRINTF("NCR5380 core release=%d. ", NCR5380_PUBLIC_RELEASE); |
726 | if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) | 728 | if (((struct NCR5380_hostdata *) instance->hostdata)->flags & FLAG_NCR53C400) |
727 | SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); | 729 | SPRINTF("ncr53c400 release=%d. ", NCR53C400_PUBLIC_RELEASE); |
@@ -755,46 +757,37 @@ static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | |||
755 | if (!hostdata->connected) | 757 | if (!hostdata->connected) |
756 | SPRINTF("scsi%d: no currently connected command\n", instance->host_no); | 758 | SPRINTF("scsi%d: no currently connected command\n", instance->host_no); |
757 | else | 759 | else |
758 | pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, pos, buffer, length); | 760 | lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); |
759 | SPRINTF("scsi%d: issue_queue\n", instance->host_no); | 761 | SPRINTF("scsi%d: issue_queue\n", instance->host_no); |
760 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 762 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
761 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 763 | lprint_Scsi_Cmnd(ptr, m); |
762 | 764 | ||
763 | SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); | 765 | SPRINTF("scsi%d: disconnected_queue\n", instance->host_no); |
764 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 766 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
765 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 767 | lprint_Scsi_Cmnd(ptr, m); |
766 | spin_unlock_irq(instance->host_lock); | 768 | spin_unlock_irq(instance->host_lock); |
767 | 769 | return 0; | |
768 | *start = buffer; | ||
769 | if (pos - buffer < offset) | ||
770 | return 0; | ||
771 | else if (pos - buffer - offset < length) | ||
772 | return pos - buffer - offset; | ||
773 | return length; | ||
774 | } | 770 | } |
775 | 771 | ||
776 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length) | 772 | static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m) |
777 | { | 773 | { |
778 | SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); | 774 | SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); |
779 | SPRINTF(" command = "); | 775 | SPRINTF(" command = "); |
780 | pos = lprint_command(cmd->cmnd, pos, buffer, length); | 776 | lprint_command(cmd->cmnd, m); |
781 | return (pos); | ||
782 | } | 777 | } |
783 | 778 | ||
784 | static char *lprint_command(unsigned char *command, char *pos, char *buffer, int length) | 779 | static void lprint_command(unsigned char *command, struct seq_file *m) |
785 | { | 780 | { |
786 | int i, s; | 781 | int i, s; |
787 | pos = lprint_opcode(command[0], pos, buffer, length); | 782 | lprint_opcode(command[0], m); |
788 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 783 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
789 | SPRINTF("%02x ", command[i]); | 784 | SPRINTF("%02x ", command[i]); |
790 | SPRINTF("\n"); | 785 | SPRINTF("\n"); |
791 | return (pos); | ||
792 | } | 786 | } |
793 | 787 | ||
794 | static char *lprint_opcode(int opcode, char *pos, char *buffer, int length) | 788 | static void lprint_opcode(int opcode, struct seq_file *m) |
795 | { | 789 | { |
796 | SPRINTF("%2d (0x%02x)", opcode, opcode); | 790 | SPRINTF("%2d (0x%02x)", opcode, opcode); |
797 | return (pos); | ||
798 | } | 791 | } |
799 | 792 | ||
800 | 793 | ||
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h index fd40a32b1f6f..14964d0a0e9d 100644 --- a/drivers/scsi/NCR5380.h +++ b/drivers/scsi/NCR5380.h | |||
@@ -314,8 +314,10 @@ static void NCR5380_print(struct Scsi_Host *instance); | |||
314 | static int NCR5380_abort(Scsi_Cmnd * cmd); | 314 | static int NCR5380_abort(Scsi_Cmnd * cmd); |
315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); | 315 | static int NCR5380_bus_reset(Scsi_Cmnd * cmd); |
316 | static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); | 316 | static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *); |
317 | static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, | 317 | static int __maybe_unused NCR5380_show_info(struct seq_file *, |
318 | char *buffer, char **start, off_t offset, int length, int inout); | 318 | struct Scsi_Host *); |
319 | static int __maybe_unused NCR5380_write_info(struct Scsi_Host *instance, | ||
320 | char *buffer, int length); | ||
319 | 321 | ||
320 | static void NCR5380_reselect(struct Scsi_Host *instance); | 322 | static void NCR5380_reselect(struct Scsi_Host *instance); |
321 | static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); | 323 | static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag); |
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index 3e09aa21c1ca..30fa38a0ad39 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c | |||
@@ -166,7 +166,8 @@ static int a2091_bus_reset(struct scsi_cmnd *cmd) | |||
166 | static struct scsi_host_template a2091_scsi_template = { | 166 | static struct scsi_host_template a2091_scsi_template = { |
167 | .module = THIS_MODULE, | 167 | .module = THIS_MODULE, |
168 | .name = "Commodore A2091/A590 SCSI", | 168 | .name = "Commodore A2091/A590 SCSI", |
169 | .proc_info = wd33c93_proc_info, | 169 | .show_info = wd33c93_show_info, |
170 | .write_info = wd33c93_write_info, | ||
170 | .proc_name = "A2901", | 171 | .proc_name = "A2901", |
171 | .queuecommand = wd33c93_queuecommand, | 172 | .queuecommand = wd33c93_queuecommand, |
172 | .eh_abort_handler = wd33c93_abort, | 173 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index e29fe0e708f8..c487916a9d45 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c | |||
@@ -181,7 +181,8 @@ static int a3000_bus_reset(struct scsi_cmnd *cmd) | |||
181 | static struct scsi_host_template amiga_a3000_scsi_template = { | 181 | static struct scsi_host_template amiga_a3000_scsi_template = { |
182 | .module = THIS_MODULE, | 182 | .module = THIS_MODULE, |
183 | .name = "Amiga 3000 built-in SCSI", | 183 | .name = "Amiga 3000 built-in SCSI", |
184 | .proc_info = wd33c93_proc_info, | 184 | .show_info = wd33c93_show_info, |
185 | .write_info = wd33c93_write_info, | ||
185 | .proc_name = "A3000", | 186 | .proc_name = "A3000", |
186 | .queuecommand = wd33c93_queuecommand, | 187 | .queuecommand = wd33c93_queuecommand, |
187 | .eh_abort_handler = wd33c93_abort, | 188 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index dcfaee66a8b9..c67e401954c5 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -2178,22 +2178,6 @@ do { \ | |||
2178 | 2178 | ||
2179 | #define ASC_INFO_SIZE 128 /* advansys_info() line size */ | 2179 | #define ASC_INFO_SIZE 128 /* advansys_info() line size */ |
2180 | 2180 | ||
2181 | #ifdef CONFIG_PROC_FS | ||
2182 | /* /proc/scsi/advansys/[0...] related definitions */ | ||
2183 | #define ASC_PRTBUF_SIZE 2048 | ||
2184 | #define ASC_PRTLINE_SIZE 160 | ||
2185 | |||
2186 | #define ASC_PRT_NEXT() \ | ||
2187 | if (cp) { \ | ||
2188 | totlen += len; \ | ||
2189 | leftlen -= len; \ | ||
2190 | if (leftlen == 0) { \ | ||
2191 | return totlen; \ | ||
2192 | } \ | ||
2193 | cp += len; \ | ||
2194 | } | ||
2195 | #endif /* CONFIG_PROC_FS */ | ||
2196 | |||
2197 | /* Asc Library return codes */ | 2181 | /* Asc Library return codes */ |
2198 | #define ASC_TRUE 1 | 2182 | #define ASC_TRUE 1 |
2199 | #define ASC_FALSE 0 | 2183 | #define ASC_FALSE 0 |
@@ -2384,7 +2368,6 @@ struct asc_board { | |||
2384 | } eep_config; | 2368 | } eep_config; |
2385 | ulong last_reset; /* Saved last reset time */ | 2369 | ulong last_reset; /* Saved last reset time */ |
2386 | /* /proc/scsi/advansys/[0...] */ | 2370 | /* /proc/scsi/advansys/[0...] */ |
2387 | char *prtbuf; /* /proc print buffer */ | ||
2388 | #ifdef ADVANSYS_STATS | 2371 | #ifdef ADVANSYS_STATS |
2389 | struct asc_stats asc_stats; /* Board statistics */ | 2372 | struct asc_stats asc_stats; /* Board statistics */ |
2390 | #endif /* ADVANSYS_STATS */ | 2373 | #endif /* ADVANSYS_STATS */ |
@@ -2875,64 +2858,21 @@ static const char *advansys_info(struct Scsi_Host *shost) | |||
2875 | } | 2858 | } |
2876 | 2859 | ||
2877 | #ifdef CONFIG_PROC_FS | 2860 | #ifdef CONFIG_PROC_FS |
2878 | /* | ||
2879 | * asc_prt_line() | ||
2880 | * | ||
2881 | * If 'cp' is NULL print to the console, otherwise print to a buffer. | ||
2882 | * | ||
2883 | * Return 0 if printing to the console, otherwise return the number of | ||
2884 | * bytes written to the buffer. | ||
2885 | * | ||
2886 | * Note: If any single line is greater than ASC_PRTLINE_SIZE bytes the stack | ||
2887 | * will be corrupted. 's[]' is defined to be ASC_PRTLINE_SIZE bytes. | ||
2888 | */ | ||
2889 | static int asc_prt_line(char *buf, int buflen, char *fmt, ...) | ||
2890 | { | ||
2891 | va_list args; | ||
2892 | int ret; | ||
2893 | char s[ASC_PRTLINE_SIZE]; | ||
2894 | |||
2895 | va_start(args, fmt); | ||
2896 | ret = vsprintf(s, fmt, args); | ||
2897 | BUG_ON(ret >= ASC_PRTLINE_SIZE); | ||
2898 | if (buf == NULL) { | ||
2899 | (void)printk(s); | ||
2900 | ret = 0; | ||
2901 | } else { | ||
2902 | ret = min(buflen, ret); | ||
2903 | memcpy(buf, s, ret); | ||
2904 | } | ||
2905 | va_end(args); | ||
2906 | return ret; | ||
2907 | } | ||
2908 | 2861 | ||
2909 | /* | 2862 | /* |
2910 | * asc_prt_board_devices() | 2863 | * asc_prt_board_devices() |
2911 | * | 2864 | * |
2912 | * Print driver information for devices attached to the board. | 2865 | * Print driver information for devices attached to the board. |
2913 | * | ||
2914 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
2915 | * cf. asc_prt_line(). | ||
2916 | * | ||
2917 | * Return the number of characters copied into 'cp'. No more than | ||
2918 | * 'cplen' characters will be copied to 'cp'. | ||
2919 | */ | 2866 | */ |
2920 | static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) | 2867 | static void asc_prt_board_devices(struct seq_file *m, struct Scsi_Host *shost) |
2921 | { | 2868 | { |
2922 | struct asc_board *boardp = shost_priv(shost); | 2869 | struct asc_board *boardp = shost_priv(shost); |
2923 | int leftlen; | ||
2924 | int totlen; | ||
2925 | int len; | ||
2926 | int chip_scsi_id; | 2870 | int chip_scsi_id; |
2927 | int i; | 2871 | int i; |
2928 | 2872 | ||
2929 | leftlen = cplen; | 2873 | seq_printf(m, |
2930 | totlen = len = 0; | 2874 | "\nDevice Information for AdvanSys SCSI Host %d:\n", |
2931 | 2875 | shost->host_no); | |
2932 | len = asc_prt_line(cp, leftlen, | ||
2933 | "\nDevice Information for AdvanSys SCSI Host %d:\n", | ||
2934 | shost->host_no); | ||
2935 | ASC_PRT_NEXT(); | ||
2936 | 2876 | ||
2937 | if (ASC_NARROW_BOARD(boardp)) { | 2877 | if (ASC_NARROW_BOARD(boardp)) { |
2938 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; | 2878 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
@@ -2940,60 +2880,42 @@ static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) | |||
2940 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; | 2880 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
2941 | } | 2881 | } |
2942 | 2882 | ||
2943 | len = asc_prt_line(cp, leftlen, "Target IDs Detected:"); | 2883 | seq_printf(m, "Target IDs Detected:"); |
2944 | ASC_PRT_NEXT(); | ||
2945 | for (i = 0; i <= ADV_MAX_TID; i++) { | 2884 | for (i = 0; i <= ADV_MAX_TID; i++) { |
2946 | if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) { | 2885 | if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) |
2947 | len = asc_prt_line(cp, leftlen, " %X,", i); | 2886 | seq_printf(m, " %X,", i); |
2948 | ASC_PRT_NEXT(); | ||
2949 | } | ||
2950 | } | 2887 | } |
2951 | len = asc_prt_line(cp, leftlen, " (%X=Host Adapter)\n", chip_scsi_id); | 2888 | seq_printf(m, " (%X=Host Adapter)\n", chip_scsi_id); |
2952 | ASC_PRT_NEXT(); | ||
2953 | |||
2954 | return totlen; | ||
2955 | } | 2889 | } |
2956 | 2890 | ||
2957 | /* | 2891 | /* |
2958 | * Display Wide Board BIOS Information. | 2892 | * Display Wide Board BIOS Information. |
2959 | */ | 2893 | */ |
2960 | static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) | 2894 | static void asc_prt_adv_bios(struct seq_file *m, struct Scsi_Host *shost) |
2961 | { | 2895 | { |
2962 | struct asc_board *boardp = shost_priv(shost); | 2896 | struct asc_board *boardp = shost_priv(shost); |
2963 | int leftlen; | ||
2964 | int totlen; | ||
2965 | int len; | ||
2966 | ushort major, minor, letter; | 2897 | ushort major, minor, letter; |
2967 | 2898 | ||
2968 | leftlen = cplen; | 2899 | seq_printf(m, "\nROM BIOS Version: "); |
2969 | totlen = len = 0; | ||
2970 | |||
2971 | len = asc_prt_line(cp, leftlen, "\nROM BIOS Version: "); | ||
2972 | ASC_PRT_NEXT(); | ||
2973 | 2900 | ||
2974 | /* | 2901 | /* |
2975 | * If the BIOS saved a valid signature, then fill in | 2902 | * If the BIOS saved a valid signature, then fill in |
2976 | * the BIOS code segment base address. | 2903 | * the BIOS code segment base address. |
2977 | */ | 2904 | */ |
2978 | if (boardp->bios_signature != 0x55AA) { | 2905 | if (boardp->bios_signature != 0x55AA) { |
2979 | len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n"); | 2906 | seq_printf(m, "Disabled or Pre-3.1\n"); |
2980 | ASC_PRT_NEXT(); | 2907 | seq_printf(m, |
2981 | len = asc_prt_line(cp, leftlen, | 2908 | "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); |
2982 | "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n"); | 2909 | seq_printf(m, |
2983 | ASC_PRT_NEXT(); | 2910 | "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n"); |
2984 | len = asc_prt_line(cp, leftlen, | ||
2985 | "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n"); | ||
2986 | ASC_PRT_NEXT(); | ||
2987 | } else { | 2911 | } else { |
2988 | major = (boardp->bios_version >> 12) & 0xF; | 2912 | major = (boardp->bios_version >> 12) & 0xF; |
2989 | minor = (boardp->bios_version >> 8) & 0xF; | 2913 | minor = (boardp->bios_version >> 8) & 0xF; |
2990 | letter = (boardp->bios_version & 0xFF); | 2914 | letter = (boardp->bios_version & 0xFF); |
2991 | 2915 | ||
2992 | len = asc_prt_line(cp, leftlen, "%d.%d%c\n", | 2916 | seq_printf(m, "%d.%d%c\n", |
2993 | major, minor, | 2917 | major, minor, |
2994 | letter >= 26 ? '?' : letter + 'A'); | 2918 | letter >= 26 ? '?' : letter + 'A'); |
2995 | ASC_PRT_NEXT(); | ||
2996 | |||
2997 | /* | 2919 | /* |
2998 | * Current available ROM BIOS release is 3.1I for UW | 2920 | * Current available ROM BIOS release is 3.1I for UW |
2999 | * and 3.2I for U2W. This code doesn't differentiate | 2921 | * and 3.2I for U2W. This code doesn't differentiate |
@@ -3001,16 +2923,12 @@ static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) | |||
3001 | */ | 2923 | */ |
3002 | if (major < 3 || (major <= 3 && minor < 1) || | 2924 | if (major < 3 || (major <= 3 && minor < 1) || |
3003 | (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { | 2925 | (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) { |
3004 | len = asc_prt_line(cp, leftlen, | 2926 | seq_printf(m, |
3005 | "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"); | 2927 | "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n"); |
3006 | ASC_PRT_NEXT(); | 2928 | seq_printf(m, |
3007 | len = asc_prt_line(cp, leftlen, | 2929 | "ftp://ftp.connectcom.net/pub\n"); |
3008 | "ftp://ftp.connectcom.net/pub\n"); | ||
3009 | ASC_PRT_NEXT(); | ||
3010 | } | 2930 | } |
3011 | } | 2931 | } |
3012 | |||
3013 | return totlen; | ||
3014 | } | 2932 | } |
3015 | 2933 | ||
3016 | /* | 2934 | /* |
@@ -3115,20 +3033,11 @@ static int asc_get_eeprom_string(ushort *serialnum, uchar *cp) | |||
3115 | * asc_prt_asc_board_eeprom() | 3033 | * asc_prt_asc_board_eeprom() |
3116 | * | 3034 | * |
3117 | * Print board EEPROM configuration. | 3035 | * Print board EEPROM configuration. |
3118 | * | ||
3119 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3120 | * cf. asc_prt_line(). | ||
3121 | * | ||
3122 | * Return the number of characters copied into 'cp'. No more than | ||
3123 | * 'cplen' characters will be copied to 'cp'. | ||
3124 | */ | 3036 | */ |
3125 | static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) | 3037 | static void asc_prt_asc_board_eeprom(struct seq_file *m, struct Scsi_Host *shost) |
3126 | { | 3038 | { |
3127 | struct asc_board *boardp = shost_priv(shost); | 3039 | struct asc_board *boardp = shost_priv(shost); |
3128 | ASC_DVC_VAR *asc_dvc_varp; | 3040 | ASC_DVC_VAR *asc_dvc_varp; |
3129 | int leftlen; | ||
3130 | int totlen; | ||
3131 | int len; | ||
3132 | ASCEEP_CONFIG *ep; | 3041 | ASCEEP_CONFIG *ep; |
3133 | int i; | 3042 | int i; |
3134 | #ifdef CONFIG_ISA | 3043 | #ifdef CONFIG_ISA |
@@ -3139,129 +3048,75 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3139 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; | 3048 | asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; |
3140 | ep = &boardp->eep_config.asc_eep; | 3049 | ep = &boardp->eep_config.asc_eep; |
3141 | 3050 | ||
3142 | leftlen = cplen; | 3051 | seq_printf(m, |
3143 | totlen = len = 0; | 3052 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
3144 | 3053 | shost->host_no); | |
3145 | len = asc_prt_line(cp, leftlen, | ||
3146 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", | ||
3147 | shost->host_no); | ||
3148 | ASC_PRT_NEXT(); | ||
3149 | 3054 | ||
3150 | if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) | 3055 | if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr) |
3151 | == ASC_TRUE) { | 3056 | == ASC_TRUE) |
3152 | len = | 3057 | seq_printf(m, " Serial Number: %s\n", serialstr); |
3153 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", | 3058 | else if (ep->adapter_info[5] == 0xBB) |
3154 | serialstr); | 3059 | seq_printf(m, |
3155 | ASC_PRT_NEXT(); | 3060 | " Default Settings Used for EEPROM-less Adapter.\n"); |
3156 | } else { | 3061 | else |
3157 | if (ep->adapter_info[5] == 0xBB) { | 3062 | seq_printf(m, |
3158 | len = asc_prt_line(cp, leftlen, | 3063 | " Serial Number Signature Not Present.\n"); |
3159 | " Default Settings Used for EEPROM-less Adapter.\n"); | 3064 | |
3160 | ASC_PRT_NEXT(); | 3065 | seq_printf(m, |
3161 | } else { | 3066 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3162 | len = asc_prt_line(cp, leftlen, | 3067 | ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, |
3163 | " Serial Number Signature Not Present.\n"); | 3068 | ep->max_tag_qng); |
3164 | ASC_PRT_NEXT(); | 3069 | |
3165 | } | 3070 | seq_printf(m, |
3166 | } | 3071 | " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); |
3167 | 3072 | ||
3168 | len = asc_prt_line(cp, leftlen, | 3073 | seq_printf(m, " Target ID: "); |
3169 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3074 | for (i = 0; i <= ASC_MAX_TID; i++) |
3170 | ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, | 3075 | seq_printf(m, " %d", i); |
3171 | ep->max_tag_qng); | 3076 | seq_printf(m, "\n"); |
3172 | ASC_PRT_NEXT(); | 3077 | |
3173 | 3078 | seq_printf(m, " Disconnects: "); | |
3174 | len = asc_prt_line(cp, leftlen, | 3079 | for (i = 0; i <= ASC_MAX_TID; i++) |
3175 | " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam); | 3080 | seq_printf(m, " %c", |
3176 | ASC_PRT_NEXT(); | 3081 | (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3177 | 3082 | seq_printf(m, "\n"); | |
3178 | len = asc_prt_line(cp, leftlen, " Target ID: "); | 3083 | |
3179 | ASC_PRT_NEXT(); | 3084 | seq_printf(m, " Command Queuing: "); |
3180 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3085 | for (i = 0; i <= ASC_MAX_TID; i++) |
3181 | len = asc_prt_line(cp, leftlen, " %d", i); | 3086 | seq_printf(m, " %c", |
3182 | ASC_PRT_NEXT(); | 3087 | (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3183 | } | 3088 | seq_printf(m, "\n"); |
3184 | len = asc_prt_line(cp, leftlen, "\n"); | 3089 | |
3185 | ASC_PRT_NEXT(); | 3090 | seq_printf(m, " Start Motor: "); |
3186 | 3091 | for (i = 0; i <= ASC_MAX_TID; i++) | |
3187 | len = asc_prt_line(cp, leftlen, " Disconnects: "); | 3092 | seq_printf(m, " %c", |
3188 | ASC_PRT_NEXT(); | 3093 | (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3189 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3094 | seq_printf(m, "\n"); |
3190 | len = asc_prt_line(cp, leftlen, " %c", | 3095 | |
3191 | (ep-> | 3096 | seq_printf(m, " Synchronous Transfer:"); |
3192 | disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3097 | for (i = 0; i <= ASC_MAX_TID; i++) |
3193 | 'N'); | 3098 | seq_printf(m, " %c", |
3194 | ASC_PRT_NEXT(); | 3099 | (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3195 | } | 3100 | seq_printf(m, "\n"); |
3196 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3197 | ASC_PRT_NEXT(); | ||
3198 | |||
3199 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); | ||
3200 | ASC_PRT_NEXT(); | ||
3201 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3202 | len = asc_prt_line(cp, leftlen, " %c", | ||
3203 | (ep-> | ||
3204 | use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3205 | 'N'); | ||
3206 | ASC_PRT_NEXT(); | ||
3207 | } | ||
3208 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3209 | ASC_PRT_NEXT(); | ||
3210 | |||
3211 | len = asc_prt_line(cp, leftlen, " Start Motor: "); | ||
3212 | ASC_PRT_NEXT(); | ||
3213 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3214 | len = asc_prt_line(cp, leftlen, " %c", | ||
3215 | (ep-> | ||
3216 | start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3217 | 'N'); | ||
3218 | ASC_PRT_NEXT(); | ||
3219 | } | ||
3220 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3221 | ASC_PRT_NEXT(); | ||
3222 | |||
3223 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | ||
3224 | ASC_PRT_NEXT(); | ||
3225 | for (i = 0; i <= ASC_MAX_TID; i++) { | ||
3226 | len = asc_prt_line(cp, leftlen, " %c", | ||
3227 | (ep-> | ||
3228 | init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3229 | 'N'); | ||
3230 | ASC_PRT_NEXT(); | ||
3231 | } | ||
3232 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3233 | ASC_PRT_NEXT(); | ||
3234 | 3101 | ||
3235 | #ifdef CONFIG_ISA | 3102 | #ifdef CONFIG_ISA |
3236 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { | 3103 | if (asc_dvc_varp->bus_type & ASC_IS_ISA) { |
3237 | len = asc_prt_line(cp, leftlen, | 3104 | seq_printf(m, |
3238 | " Host ISA DMA speed: %d MB/S\n", | 3105 | " Host ISA DMA speed: %d MB/S\n", |
3239 | isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]); | 3106 | isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]); |
3240 | ASC_PRT_NEXT(); | ||
3241 | } | 3107 | } |
3242 | #endif /* CONFIG_ISA */ | 3108 | #endif /* CONFIG_ISA */ |
3243 | |||
3244 | return totlen; | ||
3245 | } | 3109 | } |
3246 | 3110 | ||
3247 | /* | 3111 | /* |
3248 | * asc_prt_adv_board_eeprom() | 3112 | * asc_prt_adv_board_eeprom() |
3249 | * | 3113 | * |
3250 | * Print board EEPROM configuration. | 3114 | * Print board EEPROM configuration. |
3251 | * | ||
3252 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3253 | * cf. asc_prt_line(). | ||
3254 | * | ||
3255 | * Return the number of characters copied into 'cp'. No more than | ||
3256 | * 'cplen' characters will be copied to 'cp'. | ||
3257 | */ | 3115 | */ |
3258 | static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) | 3116 | static void asc_prt_adv_board_eeprom(struct seq_file *m, struct Scsi_Host *shost) |
3259 | { | 3117 | { |
3260 | struct asc_board *boardp = shost_priv(shost); | 3118 | struct asc_board *boardp = shost_priv(shost); |
3261 | ADV_DVC_VAR *adv_dvc_varp; | 3119 | ADV_DVC_VAR *adv_dvc_varp; |
3262 | int leftlen; | ||
3263 | int totlen; | ||
3264 | int len; | ||
3265 | int i; | 3120 | int i; |
3266 | char *termstr; | 3121 | char *termstr; |
3267 | uchar serialstr[13]; | 3122 | uchar serialstr[13]; |
@@ -3281,13 +3136,9 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3281 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; | 3136 | ep_38C1600 = &boardp->eep_config.adv_38C1600_eep; |
3282 | } | 3137 | } |
3283 | 3138 | ||
3284 | leftlen = cplen; | 3139 | seq_printf(m, |
3285 | totlen = len = 0; | 3140 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", |
3286 | 3141 | shost->host_no); | |
3287 | len = asc_prt_line(cp, leftlen, | ||
3288 | "\nEEPROM Settings for AdvanSys SCSI Host %d:\n", | ||
3289 | shost->host_no); | ||
3290 | ASC_PRT_NEXT(); | ||
3291 | 3142 | ||
3292 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3143 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3293 | wordp = &ep_3550->serial_number_word1; | 3144 | wordp = &ep_3550->serial_number_word1; |
@@ -3297,38 +3148,28 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3297 | wordp = &ep_38C1600->serial_number_word1; | 3148 | wordp = &ep_38C1600->serial_number_word1; |
3298 | } | 3149 | } |
3299 | 3150 | ||
3300 | if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) { | 3151 | if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) |
3301 | len = | 3152 | seq_printf(m, " Serial Number: %s\n", serialstr); |
3302 | asc_prt_line(cp, leftlen, " Serial Number: %s\n", | 3153 | else |
3303 | serialstr); | 3154 | seq_printf(m, " Serial Number Signature Not Present.\n"); |
3304 | ASC_PRT_NEXT(); | ||
3305 | } else { | ||
3306 | len = asc_prt_line(cp, leftlen, | ||
3307 | " Serial Number Signature Not Present.\n"); | ||
3308 | ASC_PRT_NEXT(); | ||
3309 | } | ||
3310 | 3155 | ||
3311 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3156 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) |
3312 | len = asc_prt_line(cp, leftlen, | 3157 | seq_printf(m, |
3313 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3158 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3314 | ep_3550->adapter_scsi_id, | 3159 | ep_3550->adapter_scsi_id, |
3315 | ep_3550->max_host_qng, ep_3550->max_dvc_qng); | 3160 | ep_3550->max_host_qng, ep_3550->max_dvc_qng); |
3316 | ASC_PRT_NEXT(); | 3161 | else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) |
3317 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3162 | seq_printf(m, |
3318 | len = asc_prt_line(cp, leftlen, | 3163 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3319 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3164 | ep_38C0800->adapter_scsi_id, |
3320 | ep_38C0800->adapter_scsi_id, | 3165 | ep_38C0800->max_host_qng, |
3321 | ep_38C0800->max_host_qng, | 3166 | ep_38C0800->max_dvc_qng); |
3322 | ep_38C0800->max_dvc_qng); | 3167 | else |
3323 | ASC_PRT_NEXT(); | 3168 | seq_printf(m, |
3324 | } else { | 3169 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", |
3325 | len = asc_prt_line(cp, leftlen, | 3170 | ep_38C1600->adapter_scsi_id, |
3326 | " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n", | 3171 | ep_38C1600->max_host_qng, |
3327 | ep_38C1600->adapter_scsi_id, | 3172 | ep_38C1600->max_dvc_qng); |
3328 | ep_38C1600->max_host_qng, | ||
3329 | ep_38C1600->max_dvc_qng); | ||
3330 | ASC_PRT_NEXT(); | ||
3331 | } | ||
3332 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3173 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3333 | word = ep_3550->termination; | 3174 | word = ep_3550->termination; |
3334 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3175 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { |
@@ -3352,34 +3193,26 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3352 | break; | 3193 | break; |
3353 | } | 3194 | } |
3354 | 3195 | ||
3355 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3196 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) |
3356 | len = asc_prt_line(cp, leftlen, | 3197 | seq_printf(m, |
3357 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3198 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3358 | ep_3550->termination, termstr, | 3199 | ep_3550->termination, termstr, |
3359 | ep_3550->bios_ctrl); | 3200 | ep_3550->bios_ctrl); |
3360 | ASC_PRT_NEXT(); | 3201 | else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) |
3361 | } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) { | 3202 | seq_printf(m, |
3362 | len = asc_prt_line(cp, leftlen, | 3203 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3363 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3204 | ep_38C0800->termination_lvd, termstr, |
3364 | ep_38C0800->termination_lvd, termstr, | 3205 | ep_38C0800->bios_ctrl); |
3365 | ep_38C0800->bios_ctrl); | 3206 | else |
3366 | ASC_PRT_NEXT(); | 3207 | seq_printf(m, |
3367 | } else { | 3208 | " termination: %u (%s), bios_ctrl: 0x%x\n", |
3368 | len = asc_prt_line(cp, leftlen, | 3209 | ep_38C1600->termination_lvd, termstr, |
3369 | " termination: %u (%s), bios_ctrl: 0x%x\n", | 3210 | ep_38C1600->bios_ctrl); |
3370 | ep_38C1600->termination_lvd, termstr, | ||
3371 | ep_38C1600->bios_ctrl); | ||
3372 | ASC_PRT_NEXT(); | ||
3373 | } | ||
3374 | 3211 | ||
3375 | len = asc_prt_line(cp, leftlen, " Target ID: "); | 3212 | seq_printf(m, " Target ID: "); |
3376 | ASC_PRT_NEXT(); | 3213 | for (i = 0; i <= ADV_MAX_TID; i++) |
3377 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3214 | seq_printf(m, " %X", i); |
3378 | len = asc_prt_line(cp, leftlen, " %X", i); | 3215 | seq_printf(m, "\n"); |
3379 | ASC_PRT_NEXT(); | ||
3380 | } | ||
3381 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3382 | ASC_PRT_NEXT(); | ||
3383 | 3216 | ||
3384 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3217 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3385 | word = ep_3550->disc_enable; | 3218 | word = ep_3550->disc_enable; |
@@ -3388,15 +3221,11 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3388 | } else { | 3221 | } else { |
3389 | word = ep_38C1600->disc_enable; | 3222 | word = ep_38C1600->disc_enable; |
3390 | } | 3223 | } |
3391 | len = asc_prt_line(cp, leftlen, " Disconnects: "); | 3224 | seq_printf(m, " Disconnects: "); |
3392 | ASC_PRT_NEXT(); | 3225 | for (i = 0; i <= ADV_MAX_TID; i++) |
3393 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3226 | seq_printf(m, " %c", |
3394 | len = asc_prt_line(cp, leftlen, " %c", | 3227 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3395 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3228 | seq_printf(m, "\n"); |
3396 | ASC_PRT_NEXT(); | ||
3397 | } | ||
3398 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3399 | ASC_PRT_NEXT(); | ||
3400 | 3229 | ||
3401 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3230 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3402 | word = ep_3550->tagqng_able; | 3231 | word = ep_3550->tagqng_able; |
@@ -3405,15 +3234,11 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3405 | } else { | 3234 | } else { |
3406 | word = ep_38C1600->tagqng_able; | 3235 | word = ep_38C1600->tagqng_able; |
3407 | } | 3236 | } |
3408 | len = asc_prt_line(cp, leftlen, " Command Queuing: "); | 3237 | seq_printf(m, " Command Queuing: "); |
3409 | ASC_PRT_NEXT(); | 3238 | for (i = 0; i <= ADV_MAX_TID; i++) |
3410 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3239 | seq_printf(m, " %c", |
3411 | len = asc_prt_line(cp, leftlen, " %c", | 3240 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3412 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3241 | seq_printf(m, "\n"); |
3413 | ASC_PRT_NEXT(); | ||
3414 | } | ||
3415 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3416 | ASC_PRT_NEXT(); | ||
3417 | 3242 | ||
3418 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3243 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3419 | word = ep_3550->start_motor; | 3244 | word = ep_3550->start_motor; |
@@ -3422,42 +3247,28 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3422 | } else { | 3247 | } else { |
3423 | word = ep_38C1600->start_motor; | 3248 | word = ep_38C1600->start_motor; |
3424 | } | 3249 | } |
3425 | len = asc_prt_line(cp, leftlen, " Start Motor: "); | 3250 | seq_printf(m, " Start Motor: "); |
3426 | ASC_PRT_NEXT(); | 3251 | for (i = 0; i <= ADV_MAX_TID; i++) |
3427 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3252 | seq_printf(m, " %c", |
3428 | len = asc_prt_line(cp, leftlen, " %c", | 3253 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3429 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3254 | seq_printf(m, "\n"); |
3430 | ASC_PRT_NEXT(); | ||
3431 | } | ||
3432 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3433 | ASC_PRT_NEXT(); | ||
3434 | 3255 | ||
3435 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3256 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3436 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | 3257 | seq_printf(m, " Synchronous Transfer:"); |
3437 | ASC_PRT_NEXT(); | 3258 | for (i = 0; i <= ADV_MAX_TID; i++) |
3438 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3259 | seq_printf(m, " %c", |
3439 | len = asc_prt_line(cp, leftlen, " %c", | 3260 | (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ? |
3440 | (ep_3550-> | 3261 | 'Y' : 'N'); |
3441 | sdtr_able & ADV_TID_TO_TIDMASK(i)) ? | 3262 | seq_printf(m, "\n"); |
3442 | 'Y' : 'N'); | ||
3443 | ASC_PRT_NEXT(); | ||
3444 | } | ||
3445 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3446 | ASC_PRT_NEXT(); | ||
3447 | } | 3263 | } |
3448 | 3264 | ||
3449 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3265 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
3450 | len = asc_prt_line(cp, leftlen, " Ultra Transfer: "); | 3266 | seq_printf(m, " Ultra Transfer: "); |
3451 | ASC_PRT_NEXT(); | 3267 | for (i = 0; i <= ADV_MAX_TID; i++) |
3452 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3268 | seq_printf(m, " %c", |
3453 | len = asc_prt_line(cp, leftlen, " %c", | 3269 | (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i)) |
3454 | (ep_3550-> | 3270 | ? 'Y' : 'N'); |
3455 | ultra_able & ADV_TID_TO_TIDMASK(i)) | 3271 | seq_printf(m, "\n"); |
3456 | ? 'Y' : 'N'); | ||
3457 | ASC_PRT_NEXT(); | ||
3458 | } | ||
3459 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3460 | ASC_PRT_NEXT(); | ||
3461 | } | 3272 | } |
3462 | 3273 | ||
3463 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { | 3274 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { |
@@ -3467,21 +3278,16 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3467 | } else { | 3278 | } else { |
3468 | word = ep_38C1600->wdtr_able; | 3279 | word = ep_38C1600->wdtr_able; |
3469 | } | 3280 | } |
3470 | len = asc_prt_line(cp, leftlen, " Wide Transfer: "); | 3281 | seq_printf(m, " Wide Transfer: "); |
3471 | ASC_PRT_NEXT(); | 3282 | for (i = 0; i <= ADV_MAX_TID; i++) |
3472 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3283 | seq_printf(m, " %c", |
3473 | len = asc_prt_line(cp, leftlen, " %c", | 3284 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3474 | (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); | 3285 | seq_printf(m, "\n"); |
3475 | ASC_PRT_NEXT(); | ||
3476 | } | ||
3477 | len = asc_prt_line(cp, leftlen, "\n"); | ||
3478 | ASC_PRT_NEXT(); | ||
3479 | 3286 | ||
3480 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || | 3287 | if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 || |
3481 | adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { | 3288 | adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) { |
3482 | len = asc_prt_line(cp, leftlen, | 3289 | seq_printf(m, |
3483 | " Synchronous Transfer Speed (Mhz):\n "); | 3290 | " Synchronous Transfer Speed (Mhz):\n "); |
3484 | ASC_PRT_NEXT(); | ||
3485 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3291 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3486 | char *speed_str; | 3292 | char *speed_str; |
3487 | 3293 | ||
@@ -3517,99 +3323,64 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen | |||
3517 | speed_str = "Unk"; | 3323 | speed_str = "Unk"; |
3518 | break; | 3324 | break; |
3519 | } | 3325 | } |
3520 | len = asc_prt_line(cp, leftlen, "%X:%s ", i, speed_str); | 3326 | seq_printf(m, "%X:%s ", i, speed_str); |
3521 | ASC_PRT_NEXT(); | 3327 | if (i == 7) |
3522 | if (i == 7) { | 3328 | seq_printf(m, "\n "); |
3523 | len = asc_prt_line(cp, leftlen, "\n "); | ||
3524 | ASC_PRT_NEXT(); | ||
3525 | } | ||
3526 | sdtr_speed >>= 4; | 3329 | sdtr_speed >>= 4; |
3527 | } | 3330 | } |
3528 | len = asc_prt_line(cp, leftlen, "\n"); | 3331 | seq_printf(m, "\n"); |
3529 | ASC_PRT_NEXT(); | ||
3530 | } | 3332 | } |
3531 | |||
3532 | return totlen; | ||
3533 | } | 3333 | } |
3534 | 3334 | ||
3535 | /* | 3335 | /* |
3536 | * asc_prt_driver_conf() | 3336 | * asc_prt_driver_conf() |
3537 | * | ||
3538 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3539 | * cf. asc_prt_line(). | ||
3540 | * | ||
3541 | * Return the number of characters copied into 'cp'. No more than | ||
3542 | * 'cplen' characters will be copied to 'cp'. | ||
3543 | */ | 3337 | */ |
3544 | static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen) | 3338 | static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost) |
3545 | { | 3339 | { |
3546 | struct asc_board *boardp = shost_priv(shost); | 3340 | struct asc_board *boardp = shost_priv(shost); |
3547 | int leftlen; | ||
3548 | int totlen; | ||
3549 | int len; | ||
3550 | int chip_scsi_id; | 3341 | int chip_scsi_id; |
3551 | 3342 | ||
3552 | leftlen = cplen; | 3343 | seq_printf(m, |
3553 | totlen = len = 0; | 3344 | "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n", |
3345 | shost->host_no); | ||
3554 | 3346 | ||
3555 | len = asc_prt_line(cp, leftlen, | 3347 | seq_printf(m, |
3556 | "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n", | 3348 | " host_busy %u, last_reset %lu, max_id %u, max_lun %u, max_channel %u\n", |
3557 | shost->host_no); | 3349 | shost->host_busy, shost->last_reset, shost->max_id, |
3558 | ASC_PRT_NEXT(); | 3350 | shost->max_lun, shost->max_channel); |
3559 | 3351 | ||
3560 | len = asc_prt_line(cp, leftlen, | 3352 | seq_printf(m, |
3561 | " host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n", | 3353 | " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n", |
3562 | shost->host_busy, shost->last_reset, shost->max_id, | 3354 | shost->unique_id, shost->can_queue, shost->this_id, |
3563 | shost->max_lun, shost->max_channel); | 3355 | shost->sg_tablesize, shost->cmd_per_lun); |
3564 | ASC_PRT_NEXT(); | ||
3565 | 3356 | ||
3566 | len = asc_prt_line(cp, leftlen, | 3357 | seq_printf(m, |
3567 | " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n", | 3358 | " unchecked_isa_dma %d, use_clustering %d\n", |
3568 | shost->unique_id, shost->can_queue, shost->this_id, | 3359 | shost->unchecked_isa_dma, shost->use_clustering); |
3569 | shost->sg_tablesize, shost->cmd_per_lun); | ||
3570 | ASC_PRT_NEXT(); | ||
3571 | 3360 | ||
3572 | len = asc_prt_line(cp, leftlen, | 3361 | seq_printf(m, |
3573 | " unchecked_isa_dma %d, use_clustering %d\n", | 3362 | " flags 0x%x, last_reset 0x%lx, jiffies 0x%lx, asc_n_io_port 0x%x\n", |
3574 | shost->unchecked_isa_dma, shost->use_clustering); | 3363 | boardp->flags, boardp->last_reset, jiffies, |
3575 | ASC_PRT_NEXT(); | 3364 | boardp->asc_n_io_port); |
3576 | 3365 | ||
3577 | len = asc_prt_line(cp, leftlen, | 3366 | seq_printf(m, " io_port 0x%lx\n", shost->io_port); |
3578 | " flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n", | ||
3579 | boardp->flags, boardp->last_reset, jiffies, | ||
3580 | boardp->asc_n_io_port); | ||
3581 | ASC_PRT_NEXT(); | ||
3582 | |||
3583 | len = asc_prt_line(cp, leftlen, " io_port 0x%x\n", shost->io_port); | ||
3584 | ASC_PRT_NEXT(); | ||
3585 | 3367 | ||
3586 | if (ASC_NARROW_BOARD(boardp)) { | 3368 | if (ASC_NARROW_BOARD(boardp)) { |
3587 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; | 3369 | chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id; |
3588 | } else { | 3370 | } else { |
3589 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; | 3371 | chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id; |
3590 | } | 3372 | } |
3591 | |||
3592 | return totlen; | ||
3593 | } | 3373 | } |
3594 | 3374 | ||
3595 | /* | 3375 | /* |
3596 | * asc_prt_asc_board_info() | 3376 | * asc_prt_asc_board_info() |
3597 | * | 3377 | * |
3598 | * Print dynamic board configuration information. | 3378 | * Print dynamic board configuration information. |
3599 | * | ||
3600 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3601 | * cf. asc_prt_line(). | ||
3602 | * | ||
3603 | * Return the number of characters copied into 'cp'. No more than | ||
3604 | * 'cplen' characters will be copied to 'cp'. | ||
3605 | */ | 3379 | */ |
3606 | static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | 3380 | static void asc_prt_asc_board_info(struct seq_file *m, struct Scsi_Host *shost) |
3607 | { | 3381 | { |
3608 | struct asc_board *boardp = shost_priv(shost); | 3382 | struct asc_board *boardp = shost_priv(shost); |
3609 | int chip_scsi_id; | 3383 | int chip_scsi_id; |
3610 | int leftlen; | ||
3611 | int totlen; | ||
3612 | int len; | ||
3613 | ASC_DVC_VAR *v; | 3384 | ASC_DVC_VAR *v; |
3614 | ASC_DVC_CFG *c; | 3385 | ASC_DVC_CFG *c; |
3615 | int i; | 3386 | int i; |
@@ -3619,105 +3390,79 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3619 | c = &boardp->dvc_cfg.asc_dvc_cfg; | 3390 | c = &boardp->dvc_cfg.asc_dvc_cfg; |
3620 | chip_scsi_id = c->chip_scsi_id; | 3391 | chip_scsi_id = c->chip_scsi_id; |
3621 | 3392 | ||
3622 | leftlen = cplen; | 3393 | seq_printf(m, |
3623 | totlen = len = 0; | 3394 | "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
3395 | shost->host_no); | ||
3624 | 3396 | ||
3625 | len = asc_prt_line(cp, leftlen, | 3397 | seq_printf(m, " chip_version %u, mcode_date 0x%x, " |
3626 | "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", | 3398 | "mcode_version 0x%x, err_code %u\n", |
3627 | shost->host_no); | 3399 | c->chip_version, c->mcode_date, c->mcode_version, |
3628 | ASC_PRT_NEXT(); | 3400 | v->err_code); |
3629 | |||
3630 | len = asc_prt_line(cp, leftlen, " chip_version %u, mcode_date 0x%x, " | ||
3631 | "mcode_version 0x%x, err_code %u\n", | ||
3632 | c->chip_version, c->mcode_date, c->mcode_version, | ||
3633 | v->err_code); | ||
3634 | ASC_PRT_NEXT(); | ||
3635 | 3401 | ||
3636 | /* Current number of commands waiting for the host. */ | 3402 | /* Current number of commands waiting for the host. */ |
3637 | len = asc_prt_line(cp, leftlen, | 3403 | seq_printf(m, |
3638 | " Total Command Pending: %d\n", v->cur_total_qng); | 3404 | " Total Command Pending: %d\n", v->cur_total_qng); |
3639 | ASC_PRT_NEXT(); | ||
3640 | 3405 | ||
3641 | len = asc_prt_line(cp, leftlen, " Command Queuing:"); | 3406 | seq_printf(m, " Command Queuing:"); |
3642 | ASC_PRT_NEXT(); | ||
3643 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3407 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3644 | if ((chip_scsi_id == i) || | 3408 | if ((chip_scsi_id == i) || |
3645 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3409 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3646 | continue; | 3410 | continue; |
3647 | } | 3411 | } |
3648 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3412 | seq_printf(m, " %X:%c", |
3649 | i, | 3413 | i, |
3650 | (v-> | 3414 | (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3651 | use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? | ||
3652 | 'Y' : 'N'); | ||
3653 | ASC_PRT_NEXT(); | ||
3654 | } | 3415 | } |
3655 | len = asc_prt_line(cp, leftlen, "\n"); | 3416 | seq_printf(m, "\n"); |
3656 | ASC_PRT_NEXT(); | ||
3657 | 3417 | ||
3658 | /* Current number of commands waiting for a device. */ | 3418 | /* Current number of commands waiting for a device. */ |
3659 | len = asc_prt_line(cp, leftlen, " Command Queue Pending:"); | 3419 | seq_printf(m, " Command Queue Pending:"); |
3660 | ASC_PRT_NEXT(); | ||
3661 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3420 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3662 | if ((chip_scsi_id == i) || | 3421 | if ((chip_scsi_id == i) || |
3663 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3422 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3664 | continue; | 3423 | continue; |
3665 | } | 3424 | } |
3666 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->cur_dvc_qng[i]); | 3425 | seq_printf(m, " %X:%u", i, v->cur_dvc_qng[i]); |
3667 | ASC_PRT_NEXT(); | ||
3668 | } | 3426 | } |
3669 | len = asc_prt_line(cp, leftlen, "\n"); | 3427 | seq_printf(m, "\n"); |
3670 | ASC_PRT_NEXT(); | ||
3671 | 3428 | ||
3672 | /* Current limit on number of commands that can be sent to a device. */ | 3429 | /* Current limit on number of commands that can be sent to a device. */ |
3673 | len = asc_prt_line(cp, leftlen, " Command Queue Limit:"); | 3430 | seq_printf(m, " Command Queue Limit:"); |
3674 | ASC_PRT_NEXT(); | ||
3675 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3431 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3676 | if ((chip_scsi_id == i) || | 3432 | if ((chip_scsi_id == i) || |
3677 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3433 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3678 | continue; | 3434 | continue; |
3679 | } | 3435 | } |
3680 | len = asc_prt_line(cp, leftlen, " %X:%u", i, v->max_dvc_qng[i]); | 3436 | seq_printf(m, " %X:%u", i, v->max_dvc_qng[i]); |
3681 | ASC_PRT_NEXT(); | ||
3682 | } | 3437 | } |
3683 | len = asc_prt_line(cp, leftlen, "\n"); | 3438 | seq_printf(m, "\n"); |
3684 | ASC_PRT_NEXT(); | ||
3685 | 3439 | ||
3686 | /* Indicate whether the device has returned queue full status. */ | 3440 | /* Indicate whether the device has returned queue full status. */ |
3687 | len = asc_prt_line(cp, leftlen, " Command Queue Full:"); | 3441 | seq_printf(m, " Command Queue Full:"); |
3688 | ASC_PRT_NEXT(); | ||
3689 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3442 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3690 | if ((chip_scsi_id == i) || | 3443 | if ((chip_scsi_id == i) || |
3691 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3444 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3692 | continue; | 3445 | continue; |
3693 | } | 3446 | } |
3694 | if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) { | 3447 | if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) |
3695 | len = asc_prt_line(cp, leftlen, " %X:Y-%d", | 3448 | seq_printf(m, " %X:Y-%d", |
3696 | i, boardp->queue_full_cnt[i]); | 3449 | i, boardp->queue_full_cnt[i]); |
3697 | } else { | 3450 | else |
3698 | len = asc_prt_line(cp, leftlen, " %X:N", i); | 3451 | seq_printf(m, " %X:N", i); |
3699 | } | ||
3700 | ASC_PRT_NEXT(); | ||
3701 | } | 3452 | } |
3702 | len = asc_prt_line(cp, leftlen, "\n"); | 3453 | seq_printf(m, "\n"); |
3703 | ASC_PRT_NEXT(); | ||
3704 | 3454 | ||
3705 | len = asc_prt_line(cp, leftlen, " Synchronous Transfer:"); | 3455 | seq_printf(m, " Synchronous Transfer:"); |
3706 | ASC_PRT_NEXT(); | ||
3707 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3456 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3708 | if ((chip_scsi_id == i) || | 3457 | if ((chip_scsi_id == i) || |
3709 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3458 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3710 | continue; | 3459 | continue; |
3711 | } | 3460 | } |
3712 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3461 | seq_printf(m, " %X:%c", |
3713 | i, | 3462 | i, |
3714 | (v-> | 3463 | (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3715 | sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | ||
3716 | 'N'); | ||
3717 | ASC_PRT_NEXT(); | ||
3718 | } | 3464 | } |
3719 | len = asc_prt_line(cp, leftlen, "\n"); | 3465 | seq_printf(m, "\n"); |
3720 | ASC_PRT_NEXT(); | ||
3721 | 3466 | ||
3722 | for (i = 0; i <= ASC_MAX_TID; i++) { | 3467 | for (i = 0; i <= ASC_MAX_TID; i++) { |
3723 | uchar syn_period_ix; | 3468 | uchar syn_period_ix; |
@@ -3728,69 +3473,48 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3728 | continue; | 3473 | continue; |
3729 | } | 3474 | } |
3730 | 3475 | ||
3731 | len = asc_prt_line(cp, leftlen, " %X:", i); | 3476 | seq_printf(m, " %X:", i); |
3732 | ASC_PRT_NEXT(); | ||
3733 | 3477 | ||
3734 | if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { | 3478 | if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) { |
3735 | len = asc_prt_line(cp, leftlen, " Asynchronous"); | 3479 | seq_printf(m, " Asynchronous"); |
3736 | ASC_PRT_NEXT(); | ||
3737 | } else { | 3480 | } else { |
3738 | syn_period_ix = | 3481 | syn_period_ix = |
3739 | (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - | 3482 | (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - |
3740 | 1); | 3483 | 1); |
3741 | 3484 | ||
3742 | len = asc_prt_line(cp, leftlen, | 3485 | seq_printf(m, |
3743 | " Transfer Period Factor: %d (%d.%d Mhz),", | 3486 | " Transfer Period Factor: %d (%d.%d Mhz),", |
3744 | v->sdtr_period_tbl[syn_period_ix], | 3487 | v->sdtr_period_tbl[syn_period_ix], |
3745 | 250 / | 3488 | 250 / v->sdtr_period_tbl[syn_period_ix], |
3746 | v->sdtr_period_tbl[syn_period_ix], | 3489 | ASC_TENTHS(250, |
3747 | ASC_TENTHS(250, | 3490 | v->sdtr_period_tbl[syn_period_ix])); |
3748 | v-> | ||
3749 | sdtr_period_tbl | ||
3750 | [syn_period_ix])); | ||
3751 | ASC_PRT_NEXT(); | ||
3752 | 3491 | ||
3753 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", | 3492 | seq_printf(m, " REQ/ACK Offset: %d", |
3754 | boardp-> | 3493 | boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET); |
3755 | sdtr_data[i] & ASC_SYN_MAX_OFFSET); | ||
3756 | ASC_PRT_NEXT(); | ||
3757 | } | 3494 | } |
3758 | 3495 | ||
3759 | if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3496 | if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
3760 | len = asc_prt_line(cp, leftlen, "*\n"); | 3497 | seq_printf(m, "*\n"); |
3761 | renegotiate = 1; | 3498 | renegotiate = 1; |
3762 | } else { | 3499 | } else { |
3763 | len = asc_prt_line(cp, leftlen, "\n"); | 3500 | seq_printf(m, "\n"); |
3764 | } | 3501 | } |
3765 | ASC_PRT_NEXT(); | ||
3766 | } | 3502 | } |
3767 | 3503 | ||
3768 | if (renegotiate) { | 3504 | if (renegotiate) { |
3769 | len = asc_prt_line(cp, leftlen, | 3505 | seq_printf(m, |
3770 | " * = Re-negotiation pending before next command.\n"); | 3506 | " * = Re-negotiation pending before next command.\n"); |
3771 | ASC_PRT_NEXT(); | ||
3772 | } | 3507 | } |
3773 | |||
3774 | return totlen; | ||
3775 | } | 3508 | } |
3776 | 3509 | ||
3777 | /* | 3510 | /* |
3778 | * asc_prt_adv_board_info() | 3511 | * asc_prt_adv_board_info() |
3779 | * | 3512 | * |
3780 | * Print dynamic board configuration information. | 3513 | * Print dynamic board configuration information. |
3781 | * | ||
3782 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
3783 | * cf. asc_prt_line(). | ||
3784 | * | ||
3785 | * Return the number of characters copied into 'cp'. No more than | ||
3786 | * 'cplen' characters will be copied to 'cp'. | ||
3787 | */ | 3514 | */ |
3788 | static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | 3515 | static void asc_prt_adv_board_info(struct seq_file *m, struct Scsi_Host *shost) |
3789 | { | 3516 | { |
3790 | struct asc_board *boardp = shost_priv(shost); | 3517 | struct asc_board *boardp = shost_priv(shost); |
3791 | int leftlen; | ||
3792 | int totlen; | ||
3793 | int len; | ||
3794 | int i; | 3518 | int i; |
3795 | ADV_DVC_VAR *v; | 3519 | ADV_DVC_VAR *v; |
3796 | ADV_DVC_CFG *c; | 3520 | ADV_DVC_CFG *c; |
@@ -3809,47 +3533,35 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3809 | iop_base = v->iop_base; | 3533 | iop_base = v->iop_base; |
3810 | chip_scsi_id = v->chip_scsi_id; | 3534 | chip_scsi_id = v->chip_scsi_id; |
3811 | 3535 | ||
3812 | leftlen = cplen; | 3536 | seq_printf(m, |
3813 | totlen = len = 0; | 3537 | "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", |
3814 | 3538 | shost->host_no); | |
3815 | len = asc_prt_line(cp, leftlen, | ||
3816 | "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n", | ||
3817 | shost->host_no); | ||
3818 | ASC_PRT_NEXT(); | ||
3819 | 3539 | ||
3820 | len = asc_prt_line(cp, leftlen, | 3540 | seq_printf(m, |
3821 | " iop_base 0x%lx, cable_detect: %X, err_code %u\n", | 3541 | " iop_base 0x%lx, cable_detect: %X, err_code %u\n", |
3822 | v->iop_base, | 3542 | (unsigned long)v->iop_base, |
3823 | AdvReadWordRegister(iop_base, | 3543 | AdvReadWordRegister(iop_base,IOPW_SCSI_CFG1) & CABLE_DETECT, |
3824 | IOPW_SCSI_CFG1) & CABLE_DETECT, | 3544 | v->err_code); |
3825 | v->err_code); | ||
3826 | ASC_PRT_NEXT(); | ||
3827 | 3545 | ||
3828 | len = asc_prt_line(cp, leftlen, " chip_version %u, mcode_date 0x%x, " | 3546 | seq_printf(m, " chip_version %u, mcode_date 0x%x, " |
3829 | "mcode_version 0x%x\n", c->chip_version, | 3547 | "mcode_version 0x%x\n", c->chip_version, |
3830 | c->mcode_date, c->mcode_version); | 3548 | c->mcode_date, c->mcode_version); |
3831 | ASC_PRT_NEXT(); | ||
3832 | 3549 | ||
3833 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); | 3550 | AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able); |
3834 | len = asc_prt_line(cp, leftlen, " Queuing Enabled:"); | 3551 | seq_printf(m, " Queuing Enabled:"); |
3835 | ASC_PRT_NEXT(); | ||
3836 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3552 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3837 | if ((chip_scsi_id == i) || | 3553 | if ((chip_scsi_id == i) || |
3838 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3554 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3839 | continue; | 3555 | continue; |
3840 | } | 3556 | } |
3841 | 3557 | ||
3842 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3558 | seq_printf(m, " %X:%c", |
3843 | i, | 3559 | i, |
3844 | (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3560 | (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3845 | 'N'); | ||
3846 | ASC_PRT_NEXT(); | ||
3847 | } | 3561 | } |
3848 | len = asc_prt_line(cp, leftlen, "\n"); | 3562 | seq_printf(m, "\n"); |
3849 | ASC_PRT_NEXT(); | ||
3850 | 3563 | ||
3851 | len = asc_prt_line(cp, leftlen, " Queue Limit:"); | 3564 | seq_printf(m, " Queue Limit:"); |
3852 | ASC_PRT_NEXT(); | ||
3853 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3565 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3854 | if ((chip_scsi_id == i) || | 3566 | if ((chip_scsi_id == i) || |
3855 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3567 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3859,14 +3571,11 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3859 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, | 3571 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, |
3860 | lrambyte); | 3572 | lrambyte); |
3861 | 3573 | ||
3862 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); | 3574 | seq_printf(m, " %X:%d", i, lrambyte); |
3863 | ASC_PRT_NEXT(); | ||
3864 | } | 3575 | } |
3865 | len = asc_prt_line(cp, leftlen, "\n"); | 3576 | seq_printf(m, "\n"); |
3866 | ASC_PRT_NEXT(); | ||
3867 | 3577 | ||
3868 | len = asc_prt_line(cp, leftlen, " Command Pending:"); | 3578 | seq_printf(m, " Command Pending:"); |
3869 | ASC_PRT_NEXT(); | ||
3870 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3579 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3871 | if ((chip_scsi_id == i) || | 3580 | if ((chip_scsi_id == i) || |
3872 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3581 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3876,33 +3585,26 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3876 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, | 3585 | AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, |
3877 | lrambyte); | 3586 | lrambyte); |
3878 | 3587 | ||
3879 | len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte); | 3588 | seq_printf(m, " %X:%d", i, lrambyte); |
3880 | ASC_PRT_NEXT(); | ||
3881 | } | 3589 | } |
3882 | len = asc_prt_line(cp, leftlen, "\n"); | 3590 | seq_printf(m, "\n"); |
3883 | ASC_PRT_NEXT(); | ||
3884 | 3591 | ||
3885 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); | 3592 | AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able); |
3886 | len = asc_prt_line(cp, leftlen, " Wide Enabled:"); | 3593 | seq_printf(m, " Wide Enabled:"); |
3887 | ASC_PRT_NEXT(); | ||
3888 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3594 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3889 | if ((chip_scsi_id == i) || | 3595 | if ((chip_scsi_id == i) || |
3890 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3596 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3891 | continue; | 3597 | continue; |
3892 | } | 3598 | } |
3893 | 3599 | ||
3894 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3600 | seq_printf(m, " %X:%c", |
3895 | i, | 3601 | i, |
3896 | (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3602 | (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3897 | 'N'); | ||
3898 | ASC_PRT_NEXT(); | ||
3899 | } | 3603 | } |
3900 | len = asc_prt_line(cp, leftlen, "\n"); | 3604 | seq_printf(m, "\n"); |
3901 | ASC_PRT_NEXT(); | ||
3902 | 3605 | ||
3903 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done); | 3606 | AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done); |
3904 | len = asc_prt_line(cp, leftlen, " Transfer Bit Width:"); | 3607 | seq_printf(m, " Transfer Bit Width:"); |
3905 | ASC_PRT_NEXT(); | ||
3906 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3608 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3907 | if ((chip_scsi_id == i) || | 3609 | if ((chip_scsi_id == i) || |
3908 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3610 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
@@ -3913,37 +3615,30 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3913 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), | 3615 | ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i), |
3914 | lramword); | 3616 | lramword); |
3915 | 3617 | ||
3916 | len = asc_prt_line(cp, leftlen, " %X:%d", | 3618 | seq_printf(m, " %X:%d", |
3917 | i, (lramword & 0x8000) ? 16 : 8); | 3619 | i, (lramword & 0x8000) ? 16 : 8); |
3918 | ASC_PRT_NEXT(); | ||
3919 | 3620 | ||
3920 | if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) && | 3621 | if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) && |
3921 | (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3622 | (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
3922 | len = asc_prt_line(cp, leftlen, "*"); | 3623 | seq_printf(m, "*"); |
3923 | ASC_PRT_NEXT(); | ||
3924 | renegotiate = 1; | 3624 | renegotiate = 1; |
3925 | } | 3625 | } |
3926 | } | 3626 | } |
3927 | len = asc_prt_line(cp, leftlen, "\n"); | 3627 | seq_printf(m, "\n"); |
3928 | ASC_PRT_NEXT(); | ||
3929 | 3628 | ||
3930 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); | 3629 | AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able); |
3931 | len = asc_prt_line(cp, leftlen, " Synchronous Enabled:"); | 3630 | seq_printf(m, " Synchronous Enabled:"); |
3932 | ASC_PRT_NEXT(); | ||
3933 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3631 | for (i = 0; i <= ADV_MAX_TID; i++) { |
3934 | if ((chip_scsi_id == i) || | 3632 | if ((chip_scsi_id == i) || |
3935 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { | 3633 | ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) { |
3936 | continue; | 3634 | continue; |
3937 | } | 3635 | } |
3938 | 3636 | ||
3939 | len = asc_prt_line(cp, leftlen, " %X:%c", | 3637 | seq_printf(m, " %X:%c", |
3940 | i, | 3638 | i, |
3941 | (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : | 3639 | (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N'); |
3942 | 'N'); | ||
3943 | ASC_PRT_NEXT(); | ||
3944 | } | 3640 | } |
3945 | len = asc_prt_line(cp, leftlen, "\n"); | 3641 | seq_printf(m, "\n"); |
3946 | ASC_PRT_NEXT(); | ||
3947 | 3642 | ||
3948 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done); | 3643 | AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done); |
3949 | for (i = 0; i <= ADV_MAX_TID; i++) { | 3644 | for (i = 0; i <= ADV_MAX_TID; i++) { |
@@ -3959,358 +3654,170 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) | |||
3959 | continue; | 3654 | continue; |
3960 | } | 3655 | } |
3961 | 3656 | ||
3962 | len = asc_prt_line(cp, leftlen, " %X:", i); | 3657 | seq_printf(m, " %X:", i); |
3963 | ASC_PRT_NEXT(); | ||
3964 | 3658 | ||
3965 | if ((lramword & 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */ | 3659 | if ((lramword & 0x1F) == 0) { /* Check for REQ/ACK Offset 0. */ |
3966 | len = asc_prt_line(cp, leftlen, " Asynchronous"); | 3660 | seq_printf(m, " Asynchronous"); |
3967 | ASC_PRT_NEXT(); | ||
3968 | } else { | 3661 | } else { |
3969 | len = | 3662 | seq_printf(m, " Transfer Period Factor: "); |
3970 | asc_prt_line(cp, leftlen, | ||
3971 | " Transfer Period Factor: "); | ||
3972 | ASC_PRT_NEXT(); | ||
3973 | 3663 | ||
3974 | if ((lramword & 0x1F00) == 0x1100) { /* 80 Mhz */ | 3664 | if ((lramword & 0x1F00) == 0x1100) { /* 80 Mhz */ |
3975 | len = | 3665 | seq_printf(m, "9 (80.0 Mhz),"); |
3976 | asc_prt_line(cp, leftlen, "9 (80.0 Mhz),"); | ||
3977 | ASC_PRT_NEXT(); | ||
3978 | } else if ((lramword & 0x1F00) == 0x1000) { /* 40 Mhz */ | 3666 | } else if ((lramword & 0x1F00) == 0x1000) { /* 40 Mhz */ |
3979 | len = | 3667 | seq_printf(m, "10 (40.0 Mhz),"); |
3980 | asc_prt_line(cp, leftlen, "10 (40.0 Mhz),"); | ||
3981 | ASC_PRT_NEXT(); | ||
3982 | } else { /* 20 Mhz or below. */ | 3668 | } else { /* 20 Mhz or below. */ |
3983 | 3669 | ||
3984 | period = (((lramword >> 8) * 25) + 50) / 4; | 3670 | period = (((lramword >> 8) * 25) + 50) / 4; |
3985 | 3671 | ||
3986 | if (period == 0) { /* Should never happen. */ | 3672 | if (period == 0) { /* Should never happen. */ |
3987 | len = | 3673 | seq_printf(m, "%d (? Mhz), ", period); |
3988 | asc_prt_line(cp, leftlen, | ||
3989 | "%d (? Mhz), "); | ||
3990 | ASC_PRT_NEXT(); | ||
3991 | } else { | 3674 | } else { |
3992 | len = asc_prt_line(cp, leftlen, | 3675 | seq_printf(m, |
3993 | "%d (%d.%d Mhz),", | 3676 | "%d (%d.%d Mhz),", |
3994 | period, 250 / period, | 3677 | period, 250 / period, |
3995 | ASC_TENTHS(250, | 3678 | ASC_TENTHS(250, period)); |
3996 | period)); | ||
3997 | ASC_PRT_NEXT(); | ||
3998 | } | 3679 | } |
3999 | } | 3680 | } |
4000 | 3681 | ||
4001 | len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d", | 3682 | seq_printf(m, " REQ/ACK Offset: %d", |
4002 | lramword & 0x1F); | 3683 | lramword & 0x1F); |
4003 | ASC_PRT_NEXT(); | ||
4004 | } | 3684 | } |
4005 | 3685 | ||
4006 | if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { | 3686 | if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) { |
4007 | len = asc_prt_line(cp, leftlen, "*\n"); | 3687 | seq_printf(m, "*\n"); |
4008 | renegotiate = 1; | 3688 | renegotiate = 1; |
4009 | } else { | 3689 | } else { |
4010 | len = asc_prt_line(cp, leftlen, "\n"); | 3690 | seq_printf(m, "\n"); |
4011 | } | 3691 | } |
4012 | ASC_PRT_NEXT(); | ||
4013 | } | 3692 | } |
4014 | 3693 | ||
4015 | if (renegotiate) { | 3694 | if (renegotiate) { |
4016 | len = asc_prt_line(cp, leftlen, | 3695 | seq_printf(m, |
4017 | " * = Re-negotiation pending before next command.\n"); | 3696 | " * = Re-negotiation pending before next command.\n"); |
4018 | ASC_PRT_NEXT(); | ||
4019 | } | 3697 | } |
4020 | |||
4021 | return totlen; | ||
4022 | } | ||
4023 | |||
4024 | /* | ||
4025 | * asc_proc_copy() | ||
4026 | * | ||
4027 | * Copy proc information to a read buffer taking into account the current | ||
4028 | * read offset in the file and the remaining space in the read buffer. | ||
4029 | */ | ||
4030 | static int | ||
4031 | asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, | ||
4032 | char *cp, int cplen) | ||
4033 | { | ||
4034 | int cnt = 0; | ||
4035 | |||
4036 | ASC_DBG(2, "offset %d, advoffset %d, cplen %d\n", | ||
4037 | (unsigned)offset, (unsigned)advoffset, cplen); | ||
4038 | if (offset <= advoffset) { | ||
4039 | /* Read offset below current offset, copy everything. */ | ||
4040 | cnt = min(cplen, leftlen); | ||
4041 | ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n", | ||
4042 | (ulong)curbuf, (ulong)cp, cnt); | ||
4043 | memcpy(curbuf, cp, cnt); | ||
4044 | } else if (offset < advoffset + cplen) { | ||
4045 | /* Read offset within current range, partial copy. */ | ||
4046 | cnt = (advoffset + cplen) - offset; | ||
4047 | cp = (cp + cplen) - cnt; | ||
4048 | cnt = min(cnt, leftlen); | ||
4049 | ASC_DBG(2, "curbuf 0x%lx, cp 0x%lx, cnt %d\n", | ||
4050 | (ulong)curbuf, (ulong)cp, cnt); | ||
4051 | memcpy(curbuf, cp, cnt); | ||
4052 | } | ||
4053 | return cnt; | ||
4054 | } | 3698 | } |
4055 | 3699 | ||
4056 | #ifdef ADVANSYS_STATS | 3700 | #ifdef ADVANSYS_STATS |
4057 | /* | 3701 | /* |
4058 | * asc_prt_board_stats() | 3702 | * asc_prt_board_stats() |
4059 | * | ||
4060 | * Note: no single line should be greater than ASC_PRTLINE_SIZE, | ||
4061 | * cf. asc_prt_line(). | ||
4062 | * | ||
4063 | * Return the number of characters copied into 'cp'. No more than | ||
4064 | * 'cplen' characters will be copied to 'cp'. | ||
4065 | */ | 3703 | */ |
4066 | static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen) | 3704 | static void asc_prt_board_stats(struct seq_file *m, struct Scsi_Host *shost) |
4067 | { | 3705 | { |
4068 | struct asc_board *boardp = shost_priv(shost); | 3706 | struct asc_board *boardp = shost_priv(shost); |
4069 | struct asc_stats *s = &boardp->asc_stats; | 3707 | struct asc_stats *s = &boardp->asc_stats; |
4070 | 3708 | ||
4071 | int leftlen = cplen; | 3709 | seq_printf(m, |
4072 | int len, totlen = 0; | 3710 | "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", |
3711 | shost->host_no); | ||
4073 | 3712 | ||
4074 | len = asc_prt_line(cp, leftlen, | 3713 | seq_printf(m, |
4075 | "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", | 3714 | " queuecommand %u, reset %u, biosparam %u, interrupt %u\n", |
4076 | shost->host_no); | 3715 | s->queuecommand, s->reset, s->biosparam, |
4077 | ASC_PRT_NEXT(); | 3716 | s->interrupt); |
4078 | 3717 | ||
4079 | len = asc_prt_line(cp, leftlen, | 3718 | seq_printf(m, |
4080 | " queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n", | 3719 | " callback %u, done %u, build_error %u, build_noreq %u, build_nosg %u\n", |
4081 | s->queuecommand, s->reset, s->biosparam, | 3720 | s->callback, s->done, s->build_error, |
4082 | s->interrupt); | 3721 | s->adv_build_noreq, s->adv_build_nosg); |
4083 | ASC_PRT_NEXT(); | ||
4084 | 3722 | ||
4085 | len = asc_prt_line(cp, leftlen, | 3723 | seq_printf(m, |
4086 | " callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n", | 3724 | " exe_noerror %u, exe_busy %u, exe_error %u, exe_unknown %u\n", |
4087 | s->callback, s->done, s->build_error, | 3725 | s->exe_noerror, s->exe_busy, s->exe_error, |
4088 | s->adv_build_noreq, s->adv_build_nosg); | 3726 | s->exe_unknown); |
4089 | ASC_PRT_NEXT(); | ||
4090 | |||
4091 | len = asc_prt_line(cp, leftlen, | ||
4092 | " exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n", | ||
4093 | s->exe_noerror, s->exe_busy, s->exe_error, | ||
4094 | s->exe_unknown); | ||
4095 | ASC_PRT_NEXT(); | ||
4096 | 3727 | ||
4097 | /* | 3728 | /* |
4098 | * Display data transfer statistics. | 3729 | * Display data transfer statistics. |
4099 | */ | 3730 | */ |
4100 | if (s->xfer_cnt > 0) { | 3731 | if (s->xfer_cnt > 0) { |
4101 | len = asc_prt_line(cp, leftlen, " xfer_cnt %lu, xfer_elem %lu, ", | 3732 | seq_printf(m, " xfer_cnt %u, xfer_elem %u, ", |
4102 | s->xfer_cnt, s->xfer_elem); | 3733 | s->xfer_cnt, s->xfer_elem); |
4103 | ASC_PRT_NEXT(); | ||
4104 | 3734 | ||
4105 | len = asc_prt_line(cp, leftlen, "xfer_bytes %lu.%01lu kb\n", | 3735 | seq_printf(m, "xfer_bytes %u.%01u kb\n", |
4106 | s->xfer_sect / 2, ASC_TENTHS(s->xfer_sect, 2)); | 3736 | s->xfer_sect / 2, ASC_TENTHS(s->xfer_sect, 2)); |
4107 | ASC_PRT_NEXT(); | ||
4108 | 3737 | ||
4109 | /* Scatter gather transfer statistics */ | 3738 | /* Scatter gather transfer statistics */ |
4110 | len = asc_prt_line(cp, leftlen, " avg_num_elem %lu.%01lu, ", | 3739 | seq_printf(m, " avg_num_elem %u.%01u, ", |
4111 | s->xfer_elem / s->xfer_cnt, | 3740 | s->xfer_elem / s->xfer_cnt, |
4112 | ASC_TENTHS(s->xfer_elem, s->xfer_cnt)); | 3741 | ASC_TENTHS(s->xfer_elem, s->xfer_cnt)); |
4113 | ASC_PRT_NEXT(); | ||
4114 | 3742 | ||
4115 | len = asc_prt_line(cp, leftlen, "avg_elem_size %lu.%01lu kb, ", | 3743 | seq_printf(m, "avg_elem_size %u.%01u kb, ", |
4116 | (s->xfer_sect / 2) / s->xfer_elem, | 3744 | (s->xfer_sect / 2) / s->xfer_elem, |
4117 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_elem)); | 3745 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_elem)); |
4118 | ASC_PRT_NEXT(); | ||
4119 | 3746 | ||
4120 | len = asc_prt_line(cp, leftlen, "avg_xfer_size %lu.%01lu kb\n", | 3747 | seq_printf(m, "avg_xfer_size %u.%01u kb\n", |
4121 | (s->xfer_sect / 2) / s->xfer_cnt, | 3748 | (s->xfer_sect / 2) / s->xfer_cnt, |
4122 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_cnt)); | 3749 | ASC_TENTHS((s->xfer_sect / 2), s->xfer_cnt)); |
4123 | ASC_PRT_NEXT(); | ||
4124 | } | 3750 | } |
4125 | |||
4126 | return totlen; | ||
4127 | } | 3751 | } |
4128 | #endif /* ADVANSYS_STATS */ | 3752 | #endif /* ADVANSYS_STATS */ |
4129 | 3753 | ||
4130 | /* | 3754 | /* |
4131 | * advansys_proc_info() - /proc/scsi/advansys/{0,1,2,3,...} | 3755 | * advansys_show_info() - /proc/scsi/advansys/{0,1,2,3,...} |
4132 | * | 3756 | * |
4133 | * *buffer: I/O buffer | 3757 | * m: seq_file to print into |
4134 | * **start: if inout == FALSE pointer into buffer where user read should start | 3758 | * shost: Scsi_Host |
4135 | * offset: current offset into a /proc/scsi/advansys/[0...] file | ||
4136 | * length: length of buffer | ||
4137 | * hostno: Scsi_Host host_no | ||
4138 | * inout: TRUE - user is writing; FALSE - user is reading | ||
4139 | * | 3759 | * |
4140 | * Return the number of bytes read from or written to a | 3760 | * Return the number of bytes read from or written to a |
4141 | * /proc/scsi/advansys/[0...] file. | 3761 | * /proc/scsi/advansys/[0...] file. |
4142 | * | ||
4143 | * Note: This function uses the per board buffer 'prtbuf' which is | ||
4144 | * allocated when the board is initialized in advansys_detect(). The | ||
4145 | * buffer is ASC_PRTBUF_SIZE bytes. The function asc_proc_copy() is | ||
4146 | * used to write to the buffer. The way asc_proc_copy() is written | ||
4147 | * if 'prtbuf' is too small it will not be overwritten. Instead the | ||
4148 | * user just won't get all the available statistics. | ||
4149 | */ | 3762 | */ |
4150 | static int | 3763 | static int |
4151 | advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 3764 | advansys_show_info(struct seq_file *m, struct Scsi_Host *shost) |
4152 | off_t offset, int length, int inout) | ||
4153 | { | 3765 | { |
4154 | struct asc_board *boardp = shost_priv(shost); | 3766 | struct asc_board *boardp = shost_priv(shost); |
4155 | char *cp; | ||
4156 | int cplen; | ||
4157 | int cnt; | ||
4158 | int totcnt; | ||
4159 | int leftlen; | ||
4160 | char *curbuf; | ||
4161 | off_t advoffset; | ||
4162 | 3767 | ||
4163 | ASC_DBG(1, "begin\n"); | 3768 | ASC_DBG(1, "begin\n"); |
4164 | 3769 | ||
4165 | /* | 3770 | /* |
4166 | * User write not supported. | ||
4167 | */ | ||
4168 | if (inout == TRUE) | ||
4169 | return -ENOSYS; | ||
4170 | |||
4171 | /* | ||
4172 | * User read of /proc/scsi/advansys/[0...] file. | 3771 | * User read of /proc/scsi/advansys/[0...] file. |
4173 | */ | 3772 | */ |
4174 | 3773 | ||
4175 | /* Copy read data starting at the beginning of the buffer. */ | ||
4176 | *start = buffer; | ||
4177 | curbuf = buffer; | ||
4178 | advoffset = 0; | ||
4179 | totcnt = 0; | ||
4180 | leftlen = length; | ||
4181 | |||
4182 | /* | 3774 | /* |
4183 | * Get board configuration information. | 3775 | * Get board configuration information. |
4184 | * | 3776 | * |
4185 | * advansys_info() returns the board string from its own static buffer. | 3777 | * advansys_info() returns the board string from its own static buffer. |
4186 | */ | 3778 | */ |
4187 | cp = (char *)advansys_info(shost); | ||
4188 | strcat(cp, "\n"); | ||
4189 | cplen = strlen(cp); | ||
4190 | /* Copy board information. */ | 3779 | /* Copy board information. */ |
4191 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | 3780 | seq_printf(m, "%s\n", (char *)advansys_info(shost)); |
4192 | totcnt += cnt; | ||
4193 | leftlen -= cnt; | ||
4194 | if (leftlen == 0) { | ||
4195 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4196 | return totcnt; | ||
4197 | } | ||
4198 | advoffset += cplen; | ||
4199 | curbuf += cnt; | ||
4200 | |||
4201 | /* | 3781 | /* |
4202 | * Display Wide Board BIOS Information. | 3782 | * Display Wide Board BIOS Information. |
4203 | */ | 3783 | */ |
4204 | if (!ASC_NARROW_BOARD(boardp)) { | 3784 | if (!ASC_NARROW_BOARD(boardp)) |
4205 | cp = boardp->prtbuf; | 3785 | asc_prt_adv_bios(m, shost); |
4206 | cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE); | ||
4207 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4208 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, | ||
4209 | cplen); | ||
4210 | totcnt += cnt; | ||
4211 | leftlen -= cnt; | ||
4212 | if (leftlen == 0) { | ||
4213 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4214 | return totcnt; | ||
4215 | } | ||
4216 | advoffset += cplen; | ||
4217 | curbuf += cnt; | ||
4218 | } | ||
4219 | 3786 | ||
4220 | /* | 3787 | /* |
4221 | * Display driver information for each device attached to the board. | 3788 | * Display driver information for each device attached to the board. |
4222 | */ | 3789 | */ |
4223 | cp = boardp->prtbuf; | 3790 | asc_prt_board_devices(m, shost); |
4224 | cplen = asc_prt_board_devices(shost, cp, ASC_PRTBUF_SIZE); | ||
4225 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4226 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4227 | totcnt += cnt; | ||
4228 | leftlen -= cnt; | ||
4229 | if (leftlen == 0) { | ||
4230 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4231 | return totcnt; | ||
4232 | } | ||
4233 | advoffset += cplen; | ||
4234 | curbuf += cnt; | ||
4235 | 3791 | ||
4236 | /* | 3792 | /* |
4237 | * Display EEPROM configuration for the board. | 3793 | * Display EEPROM configuration for the board. |
4238 | */ | 3794 | */ |
4239 | cp = boardp->prtbuf; | 3795 | if (ASC_NARROW_BOARD(boardp)) |
4240 | if (ASC_NARROW_BOARD(boardp)) { | 3796 | asc_prt_asc_board_eeprom(m, shost); |
4241 | cplen = asc_prt_asc_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); | 3797 | else |
4242 | } else { | 3798 | asc_prt_adv_board_eeprom(m, shost); |
4243 | cplen = asc_prt_adv_board_eeprom(shost, cp, ASC_PRTBUF_SIZE); | ||
4244 | } | ||
4245 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4246 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4247 | totcnt += cnt; | ||
4248 | leftlen -= cnt; | ||
4249 | if (leftlen == 0) { | ||
4250 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4251 | return totcnt; | ||
4252 | } | ||
4253 | advoffset += cplen; | ||
4254 | curbuf += cnt; | ||
4255 | 3799 | ||
4256 | /* | 3800 | /* |
4257 | * Display driver configuration and information for the board. | 3801 | * Display driver configuration and information for the board. |
4258 | */ | 3802 | */ |
4259 | cp = boardp->prtbuf; | 3803 | asc_prt_driver_conf(m, shost); |
4260 | cplen = asc_prt_driver_conf(shost, cp, ASC_PRTBUF_SIZE); | ||
4261 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4262 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4263 | totcnt += cnt; | ||
4264 | leftlen -= cnt; | ||
4265 | if (leftlen == 0) { | ||
4266 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4267 | return totcnt; | ||
4268 | } | ||
4269 | advoffset += cplen; | ||
4270 | curbuf += cnt; | ||
4271 | 3804 | ||
4272 | #ifdef ADVANSYS_STATS | 3805 | #ifdef ADVANSYS_STATS |
4273 | /* | 3806 | /* |
4274 | * Display driver statistics for the board. | 3807 | * Display driver statistics for the board. |
4275 | */ | 3808 | */ |
4276 | cp = boardp->prtbuf; | 3809 | asc_prt_board_stats(m, shost); |
4277 | cplen = asc_prt_board_stats(shost, cp, ASC_PRTBUF_SIZE); | ||
4278 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4279 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4280 | totcnt += cnt; | ||
4281 | leftlen -= cnt; | ||
4282 | if (leftlen == 0) { | ||
4283 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4284 | return totcnt; | ||
4285 | } | ||
4286 | advoffset += cplen; | ||
4287 | curbuf += cnt; | ||
4288 | #endif /* ADVANSYS_STATS */ | 3810 | #endif /* ADVANSYS_STATS */ |
4289 | 3811 | ||
4290 | /* | 3812 | /* |
4291 | * Display Asc Library dynamic configuration information | 3813 | * Display Asc Library dynamic configuration information |
4292 | * for the board. | 3814 | * for the board. |
4293 | */ | 3815 | */ |
4294 | cp = boardp->prtbuf; | 3816 | if (ASC_NARROW_BOARD(boardp)) |
4295 | if (ASC_NARROW_BOARD(boardp)) { | 3817 | asc_prt_asc_board_info(m, shost); |
4296 | cplen = asc_prt_asc_board_info(shost, cp, ASC_PRTBUF_SIZE); | 3818 | else |
4297 | } else { | 3819 | asc_prt_adv_board_info(m, shost); |
4298 | cplen = asc_prt_adv_board_info(shost, cp, ASC_PRTBUF_SIZE); | 3820 | return 0; |
4299 | } | ||
4300 | BUG_ON(cplen >= ASC_PRTBUF_SIZE); | ||
4301 | cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen); | ||
4302 | totcnt += cnt; | ||
4303 | leftlen -= cnt; | ||
4304 | if (leftlen == 0) { | ||
4305 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4306 | return totcnt; | ||
4307 | } | ||
4308 | advoffset += cplen; | ||
4309 | curbuf += cnt; | ||
4310 | |||
4311 | ASC_DBG(1, "totcnt %d\n", totcnt); | ||
4312 | |||
4313 | return totcnt; | ||
4314 | } | 3821 | } |
4315 | #endif /* CONFIG_PROC_FS */ | 3822 | #endif /* CONFIG_PROC_FS */ |
4316 | 3823 | ||
@@ -11743,7 +11250,7 @@ static int AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost) | |||
11743 | static struct scsi_host_template advansys_template = { | 11250 | static struct scsi_host_template advansys_template = { |
11744 | .proc_name = DRV_NAME, | 11251 | .proc_name = DRV_NAME, |
11745 | #ifdef CONFIG_PROC_FS | 11252 | #ifdef CONFIG_PROC_FS |
11746 | .proc_info = advansys_proc_info, | 11253 | .show_info = advansys_show_info, |
11747 | #endif | 11254 | #endif |
11748 | .name = DRV_NAME, | 11255 | .name = DRV_NAME, |
11749 | .info = advansys_info, | 11256 | .info = advansys_info, |
@@ -11939,20 +11446,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
11939 | #endif /* CONFIG_PCI */ | 11446 | #endif /* CONFIG_PCI */ |
11940 | } | 11447 | } |
11941 | 11448 | ||
11942 | #ifdef CONFIG_PROC_FS | ||
11943 | /* | ||
11944 | * Allocate buffer for printing information from | ||
11945 | * /proc/scsi/advansys/[0...]. | ||
11946 | */ | ||
11947 | boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_KERNEL); | ||
11948 | if (!boardp->prtbuf) { | ||
11949 | shost_printk(KERN_ERR, shost, "kmalloc(%d) returned NULL\n", | ||
11950 | ASC_PRTBUF_SIZE); | ||
11951 | ret = -ENOMEM; | ||
11952 | goto err_unmap; | ||
11953 | } | ||
11954 | #endif /* CONFIG_PROC_FS */ | ||
11955 | |||
11956 | if (ASC_NARROW_BOARD(boardp)) { | 11449 | if (ASC_NARROW_BOARD(boardp)) { |
11957 | /* | 11450 | /* |
11958 | * Set the board bus type and PCI IRQ before | 11451 | * Set the board bus type and PCI IRQ before |
@@ -12010,7 +11503,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12010 | } | 11503 | } |
12011 | 11504 | ||
12012 | if (ret) | 11505 | if (ret) |
12013 | goto err_free_proc; | 11506 | goto err_unmap; |
12014 | 11507 | ||
12015 | /* | 11508 | /* |
12016 | * Save the EEPROM configuration so that it can be displayed | 11509 | * Save the EEPROM configuration so that it can be displayed |
@@ -12055,7 +11548,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12055 | ASC_DBG(2, "AscInitSetConfig()\n"); | 11548 | ASC_DBG(2, "AscInitSetConfig()\n"); |
12056 | ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; | 11549 | ret = AscInitSetConfig(pdev, shost) ? -ENODEV : 0; |
12057 | if (ret) | 11550 | if (ret) |
12058 | goto err_free_proc; | 11551 | goto err_unmap; |
12059 | } else { | 11552 | } else { |
12060 | ADVEEP_3550_CONFIG *ep_3550; | 11553 | ADVEEP_3550_CONFIG *ep_3550; |
12061 | ADVEEP_38C0800_CONFIG *ep_38C0800; | 11554 | ADVEEP_38C0800_CONFIG *ep_38C0800; |
@@ -12290,7 +11783,7 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12290 | shost_printk(KERN_ERR, shost, "request_dma() " | 11783 | shost_printk(KERN_ERR, shost, "request_dma() " |
12291 | "%d failed %d\n", | 11784 | "%d failed %d\n", |
12292 | shost->dma_channel, ret); | 11785 | shost->dma_channel, ret); |
12293 | goto err_free_proc; | 11786 | goto err_unmap; |
12294 | } | 11787 | } |
12295 | AscEnableIsaDma(shost->dma_channel); | 11788 | AscEnableIsaDma(shost->dma_channel); |
12296 | } | 11789 | } |
@@ -12371,8 +11864,6 @@ static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop, | |||
12371 | if (shost->dma_channel != NO_ISA_DMA) | 11864 | if (shost->dma_channel != NO_ISA_DMA) |
12372 | free_dma(shost->dma_channel); | 11865 | free_dma(shost->dma_channel); |
12373 | #endif | 11866 | #endif |
12374 | err_free_proc: | ||
12375 | kfree(boardp->prtbuf); | ||
12376 | err_unmap: | 11867 | err_unmap: |
12377 | if (boardp->ioremap_addr) | 11868 | if (boardp->ioremap_addr) |
12378 | iounmap(boardp->ioremap_addr); | 11869 | iounmap(boardp->ioremap_addr); |
@@ -12406,7 +11897,6 @@ static int advansys_release(struct Scsi_Host *shost) | |||
12406 | iounmap(board->ioremap_addr); | 11897 | iounmap(board->ioremap_addr); |
12407 | advansys_wide_free_mem(board); | 11898 | advansys_wide_free_mem(board); |
12408 | } | 11899 | } |
12409 | kfree(board->prtbuf); | ||
12410 | scsi_host_put(shost); | 11900 | scsi_host_put(shost); |
12411 | ASC_DBG(1, "end\n"); | 11901 | ASC_DBG(1, "end\n"); |
12412 | return 0; | 11902 | return 0; |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index a284be17699f..3f7b6fee0a74 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -2977,11 +2977,10 @@ static void show_queues(struct Scsi_Host *shpnt) | |||
2977 | } | 2977 | } |
2978 | 2978 | ||
2979 | #undef SPRINTF | 2979 | #undef SPRINTF |
2980 | #define SPRINTF(args...) pos += sprintf(pos, ## args) | 2980 | #define SPRINTF(args...) seq_printf(m, ##args) |
2981 | 2981 | ||
2982 | static int get_command(char *pos, Scsi_Cmnd * ptr) | 2982 | static void get_command(struct seq_file *m, Scsi_Cmnd * ptr) |
2983 | { | 2983 | { |
2984 | char *start = pos; | ||
2985 | int i; | 2984 | int i; |
2986 | 2985 | ||
2987 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", | 2986 | SPRINTF("%p: target=%d; lun=%d; cmnd=( ", |
@@ -3011,13 +3010,10 @@ static int get_command(char *pos, Scsi_Cmnd * ptr) | |||
3011 | if (ptr->SCp.phase & syncneg) | 3010 | if (ptr->SCp.phase & syncneg) |
3012 | SPRINTF("syncneg|"); | 3011 | SPRINTF("syncneg|"); |
3013 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); | 3012 | SPRINTF("; next=0x%p\n", SCNEXT(ptr)); |
3014 | |||
3015 | return (pos - start); | ||
3016 | } | 3013 | } |
3017 | 3014 | ||
3018 | static int get_ports(struct Scsi_Host *shpnt, char *pos) | 3015 | static void get_ports(struct seq_file *m, struct Scsi_Host *shpnt) |
3019 | { | 3016 | { |
3020 | char *start = pos; | ||
3021 | int s; | 3017 | int s; |
3022 | 3018 | ||
3023 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); | 3019 | SPRINTF("\n%s: %s(%s) ", CURRENT_SC ? "on bus" : "waiting", states[STATE].name, states[PREVSTATE].name); |
@@ -3273,11 +3269,9 @@ static int get_ports(struct Scsi_Host *shpnt, char *pos) | |||
3273 | if (s & ENREQINIT) | 3269 | if (s & ENREQINIT) |
3274 | SPRINTF("ENREQINIT "); | 3270 | SPRINTF("ENREQINIT "); |
3275 | SPRINTF(")\n"); | 3271 | SPRINTF(")\n"); |
3276 | |||
3277 | return (pos - start); | ||
3278 | } | 3272 | } |
3279 | 3273 | ||
3280 | static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | 3274 | static int aha152x_set_info(struct Scsi_Host *shpnt, char *buffer, int length) |
3281 | { | 3275 | { |
3282 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) | 3276 | if(!shpnt || !buffer || length<8 || strncmp("aha152x ", buffer, 8)!=0) |
3283 | return -EINVAL; | 3277 | return -EINVAL; |
@@ -3320,26 +3314,11 @@ static int aha152x_set_info(char *buffer, int length, struct Scsi_Host *shpnt) | |||
3320 | return length; | 3314 | return length; |
3321 | } | 3315 | } |
3322 | 3316 | ||
3323 | #undef SPRINTF | 3317 | static int aha152x_show_info(struct seq_file *m, struct Scsi_Host *shpnt) |
3324 | #define SPRINTF(args...) \ | ||
3325 | do { if(pos < buffer + length) pos += sprintf(pos, ## args); } while(0) | ||
3326 | |||
3327 | static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start, | ||
3328 | off_t offset, int length, int inout) | ||
3329 | { | 3318 | { |
3330 | int i; | 3319 | int i; |
3331 | char *pos = buffer; | ||
3332 | Scsi_Cmnd *ptr; | 3320 | Scsi_Cmnd *ptr; |
3333 | unsigned long flags; | 3321 | unsigned long flags; |
3334 | int thislength; | ||
3335 | |||
3336 | DPRINTK(debug_procinfo, | ||
3337 | KERN_DEBUG "aha152x_proc_info: buffer=%p offset=%ld length=%d hostno=%d inout=%d\n", | ||
3338 | buffer, offset, length, shpnt->host_no, inout); | ||
3339 | |||
3340 | |||
3341 | if (inout) | ||
3342 | return aha152x_set_info(buffer, length, shpnt); | ||
3343 | 3322 | ||
3344 | SPRINTF(AHA152X_REVID "\n"); | 3323 | SPRINTF(AHA152X_REVID "\n"); |
3345 | 3324 | ||
@@ -3392,25 +3371,25 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3392 | if (ISSUE_SC) { | 3371 | if (ISSUE_SC) { |
3393 | SPRINTF("not yet issued commands:\n"); | 3372 | SPRINTF("not yet issued commands:\n"); |
3394 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) | 3373 | for (ptr = ISSUE_SC; ptr; ptr = SCNEXT(ptr)) |
3395 | pos += get_command(pos, ptr); | 3374 | get_command(m, ptr); |
3396 | } else | 3375 | } else |
3397 | SPRINTF("no not yet issued commands\n"); | 3376 | SPRINTF("no not yet issued commands\n"); |
3398 | DO_UNLOCK(flags); | 3377 | DO_UNLOCK(flags); |
3399 | 3378 | ||
3400 | if (CURRENT_SC) { | 3379 | if (CURRENT_SC) { |
3401 | SPRINTF("current command:\n"); | 3380 | SPRINTF("current command:\n"); |
3402 | pos += get_command(pos, CURRENT_SC); | 3381 | get_command(m, CURRENT_SC); |
3403 | } else | 3382 | } else |
3404 | SPRINTF("no current command\n"); | 3383 | SPRINTF("no current command\n"); |
3405 | 3384 | ||
3406 | if (DISCONNECTED_SC) { | 3385 | if (DISCONNECTED_SC) { |
3407 | SPRINTF("disconnected commands:\n"); | 3386 | SPRINTF("disconnected commands:\n"); |
3408 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) | 3387 | for (ptr = DISCONNECTED_SC; ptr; ptr = SCNEXT(ptr)) |
3409 | pos += get_command(pos, ptr); | 3388 | get_command(m, ptr); |
3410 | } else | 3389 | } else |
3411 | SPRINTF("no disconnected commands\n"); | 3390 | SPRINTF("no disconnected commands\n"); |
3412 | 3391 | ||
3413 | pos += get_ports(shpnt, pos); | 3392 | get_ports(m, shpnt); |
3414 | 3393 | ||
3415 | #if defined(AHA152X_STAT) | 3394 | #if defined(AHA152X_STAT) |
3416 | SPRINTF("statistics:\n" | 3395 | SPRINTF("statistics:\n" |
@@ -3440,24 +3419,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start | |||
3440 | HOSTDATA(shpnt)->time[i]); | 3419 | HOSTDATA(shpnt)->time[i]); |
3441 | } | 3420 | } |
3442 | #endif | 3421 | #endif |
3443 | 3422 | return 0; | |
3444 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: pos=%p\n", pos); | ||
3445 | |||
3446 | thislength = pos - (buffer + offset); | ||
3447 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: length=%d thislength=%d\n", length, thislength); | ||
3448 | |||
3449 | if(thislength<0) { | ||
3450 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: output too short\n"); | ||
3451 | *start = NULL; | ||
3452 | return 0; | ||
3453 | } | ||
3454 | |||
3455 | thislength = thislength<length ? thislength : length; | ||
3456 | |||
3457 | DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: return %d\n", thislength); | ||
3458 | |||
3459 | *start = buffer + offset; | ||
3460 | return thislength < length ? thislength : length; | ||
3461 | } | 3423 | } |
3462 | 3424 | ||
3463 | static int aha152x_adjust_queue(struct scsi_device *device) | 3425 | static int aha152x_adjust_queue(struct scsi_device *device) |
@@ -3470,7 +3432,8 @@ static struct scsi_host_template aha152x_driver_template = { | |||
3470 | .module = THIS_MODULE, | 3432 | .module = THIS_MODULE, |
3471 | .name = AHA152X_REVID, | 3433 | .name = AHA152X_REVID, |
3472 | .proc_name = "aha152x", | 3434 | .proc_name = "aha152x", |
3473 | .proc_info = aha152x_proc_info, | 3435 | .show_info = aha152x_show_info, |
3436 | .write_info = aha152x_set_info, | ||
3474 | .queuecommand = aha152x_queue, | 3437 | .queuecommand = aha152x_queue, |
3475 | .eh_abort_handler = aha152x_abort, | 3438 | .eh_abort_handler = aha152x_abort, |
3476 | .eh_device_reset_handler = aha152x_device_reset, | 3439 | .eh_device_reset_handler = aha152x_device_reset, |
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index df775e6ba579..5f3101797c93 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c | |||
@@ -106,33 +106,14 @@ static inline dma_addr_t ecb_cpu_to_dma (struct Scsi_Host *host, void *cpu) | |||
106 | return hdata->ecb_dma_addr + offset; | 106 | return hdata->ecb_dma_addr + offset; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int aha1740_proc_info(struct Scsi_Host *shpnt, char *buffer, | 109 | static int aha1740_show_info(struct seq_file *m, struct Scsi_Host *shpnt) |
110 | char **start, off_t offset, | ||
111 | int length, int inout) | ||
112 | { | 110 | { |
113 | int len; | 111 | struct aha1740_hostdata *host = HOSTDATA(shpnt); |
114 | struct aha1740_hostdata *host; | 112 | seq_printf(m, "aha174x at IO:%lx, IRQ %d, SLOT %d.\n" |
115 | |||
116 | if (inout) | ||
117 | return-ENOSYS; | ||
118 | |||
119 | host = HOSTDATA(shpnt); | ||
120 | |||
121 | len = sprintf(buffer, "aha174x at IO:%lx, IRQ %d, SLOT %d.\n" | ||
122 | "Extended translation %sabled.\n", | 113 | "Extended translation %sabled.\n", |
123 | shpnt->io_port, shpnt->irq, host->edev->slot, | 114 | shpnt->io_port, shpnt->irq, host->edev->slot, |
124 | host->translation ? "en" : "dis"); | 115 | host->translation ? "en" : "dis"); |
125 | 116 | return 0; | |
126 | if (offset > len) { | ||
127 | *start = buffer; | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | *start = buffer + offset; | ||
132 | len -= offset; | ||
133 | if (len > length) | ||
134 | len = length; | ||
135 | return len; | ||
136 | } | 117 | } |
137 | 118 | ||
138 | static int aha1740_makecode(unchar *sense, unchar *status) | 119 | static int aha1740_makecode(unchar *sense, unchar *status) |
@@ -556,7 +537,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy) | |||
556 | static struct scsi_host_template aha1740_template = { | 537 | static struct scsi_host_template aha1740_template = { |
557 | .module = THIS_MODULE, | 538 | .module = THIS_MODULE, |
558 | .proc_name = "aha1740", | 539 | .proc_name = "aha1740", |
559 | .proc_info = aha1740_proc_info, | 540 | .show_info = aha1740_show_info, |
560 | .name = "Adaptec 174x (EISA)", | 541 | .name = "Adaptec 174x (EISA)", |
561 | .queuecommand = aha1740_queuecommand, | 542 | .queuecommand = aha1740_queuecommand, |
562 | .bios_param = aha1740_biosparam, | 543 | .bios_param = aha1740_biosparam, |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 9328121804bb..69d5c43a65e5 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -906,7 +906,8 @@ struct scsi_host_template aic79xx_driver_template = { | |||
906 | .module = THIS_MODULE, | 906 | .module = THIS_MODULE, |
907 | .name = "aic79xx", | 907 | .name = "aic79xx", |
908 | .proc_name = "aic79xx", | 908 | .proc_name = "aic79xx", |
909 | .proc_info = ahd_linux_proc_info, | 909 | .show_info = ahd_linux_show_info, |
910 | .write_info = ahd_proc_write_seeprom, | ||
910 | .info = ahd_linux_info, | 911 | .info = ahd_linux_info, |
911 | .queuecommand = ahd_linux_queue, | 912 | .queuecommand = ahd_linux_queue, |
912 | .eh_abort_handler = ahd_linux_abort, | 913 | .eh_abort_handler = ahd_linux_abort, |
@@ -1702,19 +1703,13 @@ ahd_send_async(struct ahd_softc *ahd, char channel, | |||
1702 | switch (code) { | 1703 | switch (code) { |
1703 | case AC_TRANSFER_NEG: | 1704 | case AC_TRANSFER_NEG: |
1704 | { | 1705 | { |
1705 | char buf[80]; | ||
1706 | struct scsi_target *starget; | 1706 | struct scsi_target *starget; |
1707 | struct info_str info; | ||
1708 | struct ahd_initiator_tinfo *tinfo; | 1707 | struct ahd_initiator_tinfo *tinfo; |
1709 | struct ahd_tmode_tstate *tstate; | 1708 | struct ahd_tmode_tstate *tstate; |
1710 | unsigned int target_ppr_options; | 1709 | unsigned int target_ppr_options; |
1711 | 1710 | ||
1712 | BUG_ON(target == CAM_TARGET_WILDCARD); | 1711 | BUG_ON(target == CAM_TARGET_WILDCARD); |
1713 | 1712 | ||
1714 | info.buffer = buf; | ||
1715 | info.length = sizeof(buf); | ||
1716 | info.offset = 0; | ||
1717 | info.pos = 0; | ||
1718 | tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, | 1713 | tinfo = ahd_fetch_transinfo(ahd, channel, ahd->our_id, |
1719 | target, &tstate); | 1714 | target, &tstate); |
1720 | 1715 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 28e43498cdff..c58fa33c6592 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -379,14 +379,6 @@ void ahd_insb(struct ahd_softc * ahd, long port, | |||
379 | int ahd_linux_register_host(struct ahd_softc *, | 379 | int ahd_linux_register_host(struct ahd_softc *, |
380 | struct scsi_host_template *); | 380 | struct scsi_host_template *); |
381 | 381 | ||
382 | /*************************** Pretty Printing **********************************/ | ||
383 | struct info_str { | ||
384 | char *buffer; | ||
385 | int length; | ||
386 | off_t offset; | ||
387 | int pos; | ||
388 | }; | ||
389 | |||
390 | /******************************** Locking *************************************/ | 382 | /******************************** Locking *************************************/ |
391 | static inline void | 383 | static inline void |
392 | ahd_lockinit(struct ahd_softc *ahd) | 384 | ahd_lockinit(struct ahd_softc *ahd) |
@@ -513,8 +505,8 @@ ahd_flush_device_writes(struct ahd_softc *ahd) | |||
513 | } | 505 | } |
514 | 506 | ||
515 | /**************************** Proc FS Support *********************************/ | 507 | /**************************** Proc FS Support *********************************/ |
516 | int ahd_linux_proc_info(struct Scsi_Host *, char *, char **, | 508 | int ahd_proc_write_seeprom(struct Scsi_Host *, char *, int); |
517 | off_t, int, int); | 509 | int ahd_linux_show_info(struct seq_file *,struct Scsi_Host *); |
518 | 510 | ||
519 | /*********************** Transaction Access Wrappers **************************/ | 511 | /*********************** Transaction Access Wrappers **************************/ |
520 | static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t); | 512 | static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c index 59c85d5a153a..e9778b4f7e32 100644 --- a/drivers/scsi/aic7xxx/aic79xx_proc.c +++ b/drivers/scsi/aic7xxx/aic79xx_proc.c | |||
@@ -42,16 +42,12 @@ | |||
42 | #include "aic79xx_osm.h" | 42 | #include "aic79xx_osm.h" |
43 | #include "aic79xx_inline.h" | 43 | #include "aic79xx_inline.h" |
44 | 44 | ||
45 | static void copy_mem_info(struct info_str *info, char *data, int len); | ||
46 | static int copy_info(struct info_str *info, char *fmt, ...); | ||
47 | static void ahd_dump_target_state(struct ahd_softc *ahd, | 45 | static void ahd_dump_target_state(struct ahd_softc *ahd, |
48 | struct info_str *info, | 46 | struct seq_file *m, |
49 | u_int our_id, char channel, | 47 | u_int our_id, char channel, |
50 | u_int target_id); | 48 | u_int target_id); |
51 | static void ahd_dump_device_state(struct info_str *info, | 49 | static void ahd_dump_device_state(struct seq_file *m, |
52 | struct scsi_device *sdev); | 50 | struct scsi_device *sdev); |
53 | static int ahd_proc_write_seeprom(struct ahd_softc *ahd, | ||
54 | char *buffer, int length); | ||
55 | 51 | ||
56 | /* | 52 | /* |
57 | * Table of syncrates that don't follow the "divisible by 4" | 53 | * Table of syncrates that don't follow the "divisible by 4" |
@@ -93,58 +89,15 @@ ahd_calc_syncsrate(u_int period_factor) | |||
93 | return (10000000 / (period_factor * 4 * 10)); | 89 | return (10000000 / (period_factor * 4 * 10)); |
94 | } | 90 | } |
95 | 91 | ||
96 | |||
97 | static void | ||
98 | copy_mem_info(struct info_str *info, char *data, int len) | ||
99 | { | ||
100 | if (info->pos + len > info->offset + info->length) | ||
101 | len = info->offset + info->length - info->pos; | ||
102 | |||
103 | if (info->pos + len < info->offset) { | ||
104 | info->pos += len; | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | if (info->pos < info->offset) { | ||
109 | off_t partial; | ||
110 | |||
111 | partial = info->offset - info->pos; | ||
112 | data += partial; | ||
113 | info->pos += partial; | ||
114 | len -= partial; | ||
115 | } | ||
116 | |||
117 | if (len > 0) { | ||
118 | memcpy(info->buffer, data, len); | ||
119 | info->pos += len; | ||
120 | info->buffer += len; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | static int | ||
125 | copy_info(struct info_str *info, char *fmt, ...) | ||
126 | { | ||
127 | va_list args; | ||
128 | char buf[256]; | ||
129 | int len; | ||
130 | |||
131 | va_start(args, fmt); | ||
132 | len = vsprintf(buf, fmt, args); | ||
133 | va_end(args); | ||
134 | |||
135 | copy_mem_info(info, buf, len); | ||
136 | return (len); | ||
137 | } | ||
138 | |||
139 | static void | 92 | static void |
140 | ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | 93 | ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo) |
141 | { | 94 | { |
142 | u_int speed; | 95 | u_int speed; |
143 | u_int freq; | 96 | u_int freq; |
144 | u_int mb; | 97 | u_int mb; |
145 | 98 | ||
146 | if (tinfo->period == AHD_PERIOD_UNKNOWN) { | 99 | if (tinfo->period == AHD_PERIOD_UNKNOWN) { |
147 | copy_info(info, "Renegotiation Pending\n"); | 100 | seq_printf(m, "Renegotiation Pending\n"); |
148 | return; | 101 | return; |
149 | } | 102 | } |
150 | speed = 3300; | 103 | speed = 3300; |
@@ -156,34 +109,34 @@ ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | |||
156 | speed *= (0x01 << tinfo->width); | 109 | speed *= (0x01 << tinfo->width); |
157 | mb = speed / 1000; | 110 | mb = speed / 1000; |
158 | if (mb > 0) | 111 | if (mb > 0) |
159 | copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); | 112 | seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); |
160 | else | 113 | else |
161 | copy_info(info, "%dKB/s transfers", speed); | 114 | seq_printf(m, "%dKB/s transfers", speed); |
162 | 115 | ||
163 | if (freq != 0) { | 116 | if (freq != 0) { |
164 | int printed_options; | 117 | int printed_options; |
165 | 118 | ||
166 | printed_options = 0; | 119 | printed_options = 0; |
167 | copy_info(info, " (%d.%03dMHz", freq / 1000, freq % 1000); | 120 | seq_printf(m, " (%d.%03dMHz", freq / 1000, freq % 1000); |
168 | if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { | 121 | if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) { |
169 | copy_info(info, " RDSTRM"); | 122 | seq_printf(m, " RDSTRM"); |
170 | printed_options++; | 123 | printed_options++; |
171 | } | 124 | } |
172 | if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { | 125 | if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) { |
173 | copy_info(info, "%s", printed_options ? "|DT" : " DT"); | 126 | seq_printf(m, "%s", printed_options ? "|DT" : " DT"); |
174 | printed_options++; | 127 | printed_options++; |
175 | } | 128 | } |
176 | if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { | 129 | if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) { |
177 | copy_info(info, "%s", printed_options ? "|IU" : " IU"); | 130 | seq_printf(m, "%s", printed_options ? "|IU" : " IU"); |
178 | printed_options++; | 131 | printed_options++; |
179 | } | 132 | } |
180 | if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { | 133 | if ((tinfo->ppr_options & MSG_EXT_PPR_RTI) != 0) { |
181 | copy_info(info, "%s", | 134 | seq_printf(m, "%s", |
182 | printed_options ? "|RTI" : " RTI"); | 135 | printed_options ? "|RTI" : " RTI"); |
183 | printed_options++; | 136 | printed_options++; |
184 | } | 137 | } |
185 | if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { | 138 | if ((tinfo->ppr_options & MSG_EXT_PPR_QAS_REQ) != 0) { |
186 | copy_info(info, "%s", | 139 | seq_printf(m, "%s", |
187 | printed_options ? "|QAS" : " QAS"); | 140 | printed_options ? "|QAS" : " QAS"); |
188 | printed_options++; | 141 | printed_options++; |
189 | } | 142 | } |
@@ -191,19 +144,19 @@ ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo) | |||
191 | 144 | ||
192 | if (tinfo->width > 0) { | 145 | if (tinfo->width > 0) { |
193 | if (freq != 0) { | 146 | if (freq != 0) { |
194 | copy_info(info, ", "); | 147 | seq_printf(m, ", "); |
195 | } else { | 148 | } else { |
196 | copy_info(info, " ("); | 149 | seq_printf(m, " ("); |
197 | } | 150 | } |
198 | copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); | 151 | seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); |
199 | } else if (freq != 0) { | 152 | } else if (freq != 0) { |
200 | copy_info(info, ")"); | 153 | seq_printf(m, ")"); |
201 | } | 154 | } |
202 | copy_info(info, "\n"); | 155 | seq_printf(m, "\n"); |
203 | } | 156 | } |
204 | 157 | ||
205 | static void | 158 | static void |
206 | ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | 159 | ahd_dump_target_state(struct ahd_softc *ahd, struct seq_file *m, |
207 | u_int our_id, char channel, u_int target_id) | 160 | u_int our_id, char channel, u_int target_id) |
208 | { | 161 | { |
209 | struct scsi_target *starget; | 162 | struct scsi_target *starget; |
@@ -213,17 +166,17 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | |||
213 | 166 | ||
214 | tinfo = ahd_fetch_transinfo(ahd, channel, our_id, | 167 | tinfo = ahd_fetch_transinfo(ahd, channel, our_id, |
215 | target_id, &tstate); | 168 | target_id, &tstate); |
216 | copy_info(info, "Target %d Negotiation Settings\n", target_id); | 169 | seq_printf(m, "Target %d Negotiation Settings\n", target_id); |
217 | copy_info(info, "\tUser: "); | 170 | seq_printf(m, "\tUser: "); |
218 | ahd_format_transinfo(info, &tinfo->user); | 171 | ahd_format_transinfo(m, &tinfo->user); |
219 | starget = ahd->platform_data->starget[target_id]; | 172 | starget = ahd->platform_data->starget[target_id]; |
220 | if (starget == NULL) | 173 | if (starget == NULL) |
221 | return; | 174 | return; |
222 | 175 | ||
223 | copy_info(info, "\tGoal: "); | 176 | seq_printf(m, "\tGoal: "); |
224 | ahd_format_transinfo(info, &tinfo->goal); | 177 | ahd_format_transinfo(m, &tinfo->goal); |
225 | copy_info(info, "\tCurr: "); | 178 | seq_printf(m, "\tCurr: "); |
226 | ahd_format_transinfo(info, &tinfo->curr); | 179 | ahd_format_transinfo(m, &tinfo->curr); |
227 | 180 | ||
228 | for (lun = 0; lun < AHD_NUM_LUNS; lun++) { | 181 | for (lun = 0; lun < AHD_NUM_LUNS; lun++) { |
229 | struct scsi_device *dev; | 182 | struct scsi_device *dev; |
@@ -233,29 +186,30 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, | |||
233 | if (dev == NULL) | 186 | if (dev == NULL) |
234 | continue; | 187 | continue; |
235 | 188 | ||
236 | ahd_dump_device_state(info, dev); | 189 | ahd_dump_device_state(m, dev); |
237 | } | 190 | } |
238 | } | 191 | } |
239 | 192 | ||
240 | static void | 193 | static void |
241 | ahd_dump_device_state(struct info_str *info, struct scsi_device *sdev) | 194 | ahd_dump_device_state(struct seq_file *m, struct scsi_device *sdev) |
242 | { | 195 | { |
243 | struct ahd_linux_device *dev = scsi_transport_device_data(sdev); | 196 | struct ahd_linux_device *dev = scsi_transport_device_data(sdev); |
244 | 197 | ||
245 | copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", | 198 | seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", |
246 | sdev->sdev_target->channel + 'A', | 199 | sdev->sdev_target->channel + 'A', |
247 | sdev->sdev_target->id, sdev->lun); | 200 | sdev->sdev_target->id, sdev->lun); |
248 | 201 | ||
249 | copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); | 202 | seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); |
250 | copy_info(info, "\t\tCommands Active %d\n", dev->active); | 203 | seq_printf(m, "\t\tCommands Active %d\n", dev->active); |
251 | copy_info(info, "\t\tCommand Openings %d\n", dev->openings); | 204 | seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); |
252 | copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); | 205 | seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); |
253 | copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); | 206 | seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); |
254 | } | 207 | } |
255 | 208 | ||
256 | static int | 209 | int |
257 | ahd_proc_write_seeprom(struct ahd_softc *ahd, char *buffer, int length) | 210 | ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) |
258 | { | 211 | { |
212 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; | ||
259 | ahd_mode_state saved_modes; | 213 | ahd_mode_state saved_modes; |
260 | int have_seeprom; | 214 | int have_seeprom; |
261 | u_long s; | 215 | u_long s; |
@@ -319,64 +273,45 @@ done: | |||
319 | * Return information to handle /proc support for the driver. | 273 | * Return information to handle /proc support for the driver. |
320 | */ | 274 | */ |
321 | int | 275 | int |
322 | ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 276 | ahd_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) |
323 | off_t offset, int length, int inout) | ||
324 | { | 277 | { |
325 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; | 278 | struct ahd_softc *ahd = *(struct ahd_softc **)shost->hostdata; |
326 | struct info_str info; | ||
327 | char ahd_info[256]; | 279 | char ahd_info[256]; |
328 | u_int max_targ; | 280 | u_int max_targ; |
329 | u_int i; | 281 | u_int i; |
330 | int retval; | ||
331 | 282 | ||
332 | /* Has data been written to the file? */ | 283 | seq_printf(m, "Adaptec AIC79xx driver version: %s\n", |
333 | if (inout == TRUE) { | ||
334 | retval = ahd_proc_write_seeprom(ahd, buffer, length); | ||
335 | goto done; | ||
336 | } | ||
337 | |||
338 | if (start) | ||
339 | *start = buffer; | ||
340 | |||
341 | info.buffer = buffer; | ||
342 | info.length = length; | ||
343 | info.offset = offset; | ||
344 | info.pos = 0; | ||
345 | |||
346 | copy_info(&info, "Adaptec AIC79xx driver version: %s\n", | ||
347 | AIC79XX_DRIVER_VERSION); | 284 | AIC79XX_DRIVER_VERSION); |
348 | copy_info(&info, "%s\n", ahd->description); | 285 | seq_printf(m, "%s\n", ahd->description); |
349 | ahd_controller_info(ahd, ahd_info); | 286 | ahd_controller_info(ahd, ahd_info); |
350 | copy_info(&info, "%s\n", ahd_info); | 287 | seq_printf(m, "%s\n", ahd_info); |
351 | copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", | 288 | seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", |
352 | ahd->scb_data.numscbs, AHD_NSEG); | 289 | ahd->scb_data.numscbs, AHD_NSEG); |
353 | 290 | ||
354 | max_targ = 16; | 291 | max_targ = 16; |
355 | 292 | ||
356 | if (ahd->seep_config == NULL) | 293 | if (ahd->seep_config == NULL) |
357 | copy_info(&info, "No Serial EEPROM\n"); | 294 | seq_printf(m, "No Serial EEPROM\n"); |
358 | else { | 295 | else { |
359 | copy_info(&info, "Serial EEPROM:\n"); | 296 | seq_printf(m, "Serial EEPROM:\n"); |
360 | for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { | 297 | for (i = 0; i < sizeof(*ahd->seep_config)/2; i++) { |
361 | if (((i % 8) == 0) && (i != 0)) { | 298 | if (((i % 8) == 0) && (i != 0)) { |
362 | copy_info(&info, "\n"); | 299 | seq_printf(m, "\n"); |
363 | } | 300 | } |
364 | copy_info(&info, "0x%.4x ", | 301 | seq_printf(m, "0x%.4x ", |
365 | ((uint16_t*)ahd->seep_config)[i]); | 302 | ((uint16_t*)ahd->seep_config)[i]); |
366 | } | 303 | } |
367 | copy_info(&info, "\n"); | 304 | seq_printf(m, "\n"); |
368 | } | 305 | } |
369 | copy_info(&info, "\n"); | 306 | seq_printf(m, "\n"); |
370 | 307 | ||
371 | if ((ahd->features & AHD_WIDE) == 0) | 308 | if ((ahd->features & AHD_WIDE) == 0) |
372 | max_targ = 8; | 309 | max_targ = 8; |
373 | 310 | ||
374 | for (i = 0; i < max_targ; i++) { | 311 | for (i = 0; i < max_targ; i++) { |
375 | 312 | ||
376 | ahd_dump_target_state(ahd, &info, ahd->our_id, 'A', | 313 | ahd_dump_target_state(ahd, m, ahd->our_id, 'A', |
377 | /*target_id*/i); | 314 | /*target_id*/i); |
378 | } | 315 | } |
379 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 316 | return 0; |
380 | done: | ||
381 | return (retval); | ||
382 | } | 317 | } |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 5a477cdc780d..c0c62583b542 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -803,7 +803,8 @@ struct scsi_host_template aic7xxx_driver_template = { | |||
803 | .module = THIS_MODULE, | 803 | .module = THIS_MODULE, |
804 | .name = "aic7xxx", | 804 | .name = "aic7xxx", |
805 | .proc_name = "aic7xxx", | 805 | .proc_name = "aic7xxx", |
806 | .proc_info = ahc_linux_proc_info, | 806 | .show_info = ahc_linux_show_info, |
807 | .write_info = ahc_proc_write_seeprom, | ||
807 | .info = ahc_linux_info, | 808 | .info = ahc_linux_info, |
808 | .queuecommand = ahc_linux_queue, | 809 | .queuecommand = ahc_linux_queue, |
809 | .eh_abort_handler = ahc_linux_abort, | 810 | .eh_abort_handler = ahc_linux_abort, |
@@ -1631,10 +1632,8 @@ ahc_send_async(struct ahc_softc *ahc, char channel, | |||
1631 | switch (code) { | 1632 | switch (code) { |
1632 | case AC_TRANSFER_NEG: | 1633 | case AC_TRANSFER_NEG: |
1633 | { | 1634 | { |
1634 | char buf[80]; | ||
1635 | struct scsi_target *starget; | 1635 | struct scsi_target *starget; |
1636 | struct ahc_linux_target *targ; | 1636 | struct ahc_linux_target *targ; |
1637 | struct info_str info; | ||
1638 | struct ahc_initiator_tinfo *tinfo; | 1637 | struct ahc_initiator_tinfo *tinfo; |
1639 | struct ahc_tmode_tstate *tstate; | 1638 | struct ahc_tmode_tstate *tstate; |
1640 | int target_offset; | 1639 | int target_offset; |
@@ -1642,10 +1641,6 @@ ahc_send_async(struct ahc_softc *ahc, char channel, | |||
1642 | 1641 | ||
1643 | BUG_ON(target == CAM_TARGET_WILDCARD); | 1642 | BUG_ON(target == CAM_TARGET_WILDCARD); |
1644 | 1643 | ||
1645 | info.buffer = buf; | ||
1646 | info.length = sizeof(buf); | ||
1647 | info.offset = 0; | ||
1648 | info.pos = 0; | ||
1649 | tinfo = ahc_fetch_transinfo(ahc, channel, | 1644 | tinfo = ahc_fetch_transinfo(ahc, channel, |
1650 | channel == 'A' ? ahc->our_id | 1645 | channel == 'A' ? ahc->our_id |
1651 | : ahc->our_id_b, | 1646 | : ahc->our_id_b, |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index bca0fb83f553..bc4cca92ff04 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
@@ -383,14 +383,6 @@ void ahc_insb(struct ahc_softc * ahc, long port, | |||
383 | int ahc_linux_register_host(struct ahc_softc *, | 383 | int ahc_linux_register_host(struct ahc_softc *, |
384 | struct scsi_host_template *); | 384 | struct scsi_host_template *); |
385 | 385 | ||
386 | /*************************** Pretty Printing **********************************/ | ||
387 | struct info_str { | ||
388 | char *buffer; | ||
389 | int length; | ||
390 | off_t offset; | ||
391 | int pos; | ||
392 | }; | ||
393 | |||
394 | /******************************** Locking *************************************/ | 386 | /******************************** Locking *************************************/ |
395 | /* Lock protecting internal data structures */ | 387 | /* Lock protecting internal data structures */ |
396 | 388 | ||
@@ -523,8 +515,8 @@ ahc_flush_device_writes(struct ahc_softc *ahc) | |||
523 | } | 515 | } |
524 | 516 | ||
525 | /**************************** Proc FS Support *********************************/ | 517 | /**************************** Proc FS Support *********************************/ |
526 | int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, | 518 | int ahc_proc_write_seeprom(struct Scsi_Host *, char *, int); |
527 | off_t, int, int); | 519 | int ahc_linux_show_info(struct seq_file *, struct Scsi_Host *); |
528 | 520 | ||
529 | /*************************** Domain Validation ********************************/ | 521 | /*************************** Domain Validation ********************************/ |
530 | /*********************** Transaction Access Wrappers *************************/ | 522 | /*********************** Transaction Access Wrappers *************************/ |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index f2525f8ed1c7..383a3d11652d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
@@ -43,16 +43,12 @@ | |||
43 | #include "aic7xxx_inline.h" | 43 | #include "aic7xxx_inline.h" |
44 | #include "aic7xxx_93cx6.h" | 44 | #include "aic7xxx_93cx6.h" |
45 | 45 | ||
46 | static void copy_mem_info(struct info_str *info, char *data, int len); | ||
47 | static int copy_info(struct info_str *info, char *fmt, ...); | ||
48 | static void ahc_dump_target_state(struct ahc_softc *ahc, | 46 | static void ahc_dump_target_state(struct ahc_softc *ahc, |
49 | struct info_str *info, | 47 | struct seq_file *m, |
50 | u_int our_id, char channel, | 48 | u_int our_id, char channel, |
51 | u_int target_id, u_int target_offset); | 49 | u_int target_id, u_int target_offset); |
52 | static void ahc_dump_device_state(struct info_str *info, | 50 | static void ahc_dump_device_state(struct seq_file *m, |
53 | struct scsi_device *dev); | 51 | struct scsi_device *dev); |
54 | static int ahc_proc_write_seeprom(struct ahc_softc *ahc, | ||
55 | char *buffer, int length); | ||
56 | 52 | ||
57 | /* | 53 | /* |
58 | * Table of syncrates that don't follow the "divisible by 4" | 54 | * Table of syncrates that don't follow the "divisible by 4" |
@@ -94,51 +90,8 @@ ahc_calc_syncsrate(u_int period_factor) | |||
94 | return (10000000 / (period_factor * 4 * 10)); | 90 | return (10000000 / (period_factor * 4 * 10)); |
95 | } | 91 | } |
96 | 92 | ||
97 | |||
98 | static void | ||
99 | copy_mem_info(struct info_str *info, char *data, int len) | ||
100 | { | ||
101 | if (info->pos + len > info->offset + info->length) | ||
102 | len = info->offset + info->length - info->pos; | ||
103 | |||
104 | if (info->pos + len < info->offset) { | ||
105 | info->pos += len; | ||
106 | return; | ||
107 | } | ||
108 | |||
109 | if (info->pos < info->offset) { | ||
110 | off_t partial; | ||
111 | |||
112 | partial = info->offset - info->pos; | ||
113 | data += partial; | ||
114 | info->pos += partial; | ||
115 | len -= partial; | ||
116 | } | ||
117 | |||
118 | if (len > 0) { | ||
119 | memcpy(info->buffer, data, len); | ||
120 | info->pos += len; | ||
121 | info->buffer += len; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | static int | ||
126 | copy_info(struct info_str *info, char *fmt, ...) | ||
127 | { | ||
128 | va_list args; | ||
129 | char buf[256]; | ||
130 | int len; | ||
131 | |||
132 | va_start(args, fmt); | ||
133 | len = vsprintf(buf, fmt, args); | ||
134 | va_end(args); | ||
135 | |||
136 | copy_mem_info(info, buf, len); | ||
137 | return (len); | ||
138 | } | ||
139 | |||
140 | static void | 93 | static void |
141 | ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | 94 | ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo) |
142 | { | 95 | { |
143 | u_int speed; | 96 | u_int speed; |
144 | u_int freq; | 97 | u_int freq; |
@@ -153,12 +106,12 @@ ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | |||
153 | speed *= (0x01 << tinfo->width); | 106 | speed *= (0x01 << tinfo->width); |
154 | mb = speed / 1000; | 107 | mb = speed / 1000; |
155 | if (mb > 0) | 108 | if (mb > 0) |
156 | copy_info(info, "%d.%03dMB/s transfers", mb, speed % 1000); | 109 | seq_printf(m, "%d.%03dMB/s transfers", mb, speed % 1000); |
157 | else | 110 | else |
158 | copy_info(info, "%dKB/s transfers", speed); | 111 | seq_printf(m, "%dKB/s transfers", speed); |
159 | 112 | ||
160 | if (freq != 0) { | 113 | if (freq != 0) { |
161 | copy_info(info, " (%d.%03dMHz%s, offset %d", | 114 | seq_printf(m, " (%d.%03dMHz%s, offset %d", |
162 | freq / 1000, freq % 1000, | 115 | freq / 1000, freq % 1000, |
163 | (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 | 116 | (tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0 |
164 | ? " DT" : "", tinfo->offset); | 117 | ? " DT" : "", tinfo->offset); |
@@ -166,19 +119,19 @@ ahc_format_transinfo(struct info_str *info, struct ahc_transinfo *tinfo) | |||
166 | 119 | ||
167 | if (tinfo->width > 0) { | 120 | if (tinfo->width > 0) { |
168 | if (freq != 0) { | 121 | if (freq != 0) { |
169 | copy_info(info, ", "); | 122 | seq_printf(m, ", "); |
170 | } else { | 123 | } else { |
171 | copy_info(info, " ("); | 124 | seq_printf(m, " ("); |
172 | } | 125 | } |
173 | copy_info(info, "%dbit)", 8 * (0x01 << tinfo->width)); | 126 | seq_printf(m, "%dbit)", 8 * (0x01 << tinfo->width)); |
174 | } else if (freq != 0) { | 127 | } else if (freq != 0) { |
175 | copy_info(info, ")"); | 128 | seq_printf(m, ")"); |
176 | } | 129 | } |
177 | copy_info(info, "\n"); | 130 | seq_printf(m, "\n"); |
178 | } | 131 | } |
179 | 132 | ||
180 | static void | 133 | static void |
181 | ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | 134 | ahc_dump_target_state(struct ahc_softc *ahc, struct seq_file *m, |
182 | u_int our_id, char channel, u_int target_id, | 135 | u_int our_id, char channel, u_int target_id, |
183 | u_int target_offset) | 136 | u_int target_offset) |
184 | { | 137 | { |
@@ -190,18 +143,18 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
190 | tinfo = ahc_fetch_transinfo(ahc, channel, our_id, | 143 | tinfo = ahc_fetch_transinfo(ahc, channel, our_id, |
191 | target_id, &tstate); | 144 | target_id, &tstate); |
192 | if ((ahc->features & AHC_TWIN) != 0) | 145 | if ((ahc->features & AHC_TWIN) != 0) |
193 | copy_info(info, "Channel %c ", channel); | 146 | seq_printf(m, "Channel %c ", channel); |
194 | copy_info(info, "Target %d Negotiation Settings\n", target_id); | 147 | seq_printf(m, "Target %d Negotiation Settings\n", target_id); |
195 | copy_info(info, "\tUser: "); | 148 | seq_printf(m, "\tUser: "); |
196 | ahc_format_transinfo(info, &tinfo->user); | 149 | ahc_format_transinfo(m, &tinfo->user); |
197 | starget = ahc->platform_data->starget[target_offset]; | 150 | starget = ahc->platform_data->starget[target_offset]; |
198 | if (!starget) | 151 | if (!starget) |
199 | return; | 152 | return; |
200 | 153 | ||
201 | copy_info(info, "\tGoal: "); | 154 | seq_printf(m, "\tGoal: "); |
202 | ahc_format_transinfo(info, &tinfo->goal); | 155 | ahc_format_transinfo(m, &tinfo->goal); |
203 | copy_info(info, "\tCurr: "); | 156 | seq_printf(m, "\tCurr: "); |
204 | ahc_format_transinfo(info, &tinfo->curr); | 157 | ahc_format_transinfo(m, &tinfo->curr); |
205 | 158 | ||
206 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { | 159 | for (lun = 0; lun < AHC_NUM_LUNS; lun++) { |
207 | struct scsi_device *sdev; | 160 | struct scsi_device *sdev; |
@@ -211,29 +164,30 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, | |||
211 | if (sdev == NULL) | 164 | if (sdev == NULL) |
212 | continue; | 165 | continue; |
213 | 166 | ||
214 | ahc_dump_device_state(info, sdev); | 167 | ahc_dump_device_state(m, sdev); |
215 | } | 168 | } |
216 | } | 169 | } |
217 | 170 | ||
218 | static void | 171 | static void |
219 | ahc_dump_device_state(struct info_str *info, struct scsi_device *sdev) | 172 | ahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev) |
220 | { | 173 | { |
221 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); | 174 | struct ahc_linux_device *dev = scsi_transport_device_data(sdev); |
222 | 175 | ||
223 | copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", | 176 | seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", |
224 | sdev->sdev_target->channel + 'A', | 177 | sdev->sdev_target->channel + 'A', |
225 | sdev->sdev_target->id, sdev->lun); | 178 | sdev->sdev_target->id, sdev->lun); |
226 | 179 | ||
227 | copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); | 180 | seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); |
228 | copy_info(info, "\t\tCommands Active %d\n", dev->active); | 181 | seq_printf(m, "\t\tCommands Active %d\n", dev->active); |
229 | copy_info(info, "\t\tCommand Openings %d\n", dev->openings); | 182 | seq_printf(m, "\t\tCommand Openings %d\n", dev->openings); |
230 | copy_info(info, "\t\tMax Tagged Openings %d\n", dev->maxtags); | 183 | seq_printf(m, "\t\tMax Tagged Openings %d\n", dev->maxtags); |
231 | copy_info(info, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); | 184 | seq_printf(m, "\t\tDevice Queue Frozen Count %d\n", dev->qfrozen); |
232 | } | 185 | } |
233 | 186 | ||
234 | static int | 187 | int |
235 | ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length) | 188 | ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length) |
236 | { | 189 | { |
190 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; | ||
237 | struct seeprom_descriptor sd; | 191 | struct seeprom_descriptor sd; |
238 | int have_seeprom; | 192 | int have_seeprom; |
239 | u_long s; | 193 | u_long s; |
@@ -332,53 +286,36 @@ done: | |||
332 | * Return information to handle /proc support for the driver. | 286 | * Return information to handle /proc support for the driver. |
333 | */ | 287 | */ |
334 | int | 288 | int |
335 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 289 | ahc_linux_show_info(struct seq_file *m, struct Scsi_Host *shost) |
336 | off_t offset, int length, int inout) | ||
337 | { | 290 | { |
338 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; | 291 | struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; |
339 | struct info_str info; | ||
340 | char ahc_info[256]; | 292 | char ahc_info[256]; |
341 | u_int max_targ; | 293 | u_int max_targ; |
342 | u_int i; | 294 | u_int i; |
343 | int retval; | ||
344 | 295 | ||
345 | /* Has data been written to the file? */ | 296 | seq_printf(m, "Adaptec AIC7xxx driver version: %s\n", |
346 | if (inout == TRUE) { | ||
347 | retval = ahc_proc_write_seeprom(ahc, buffer, length); | ||
348 | goto done; | ||
349 | } | ||
350 | |||
351 | if (start) | ||
352 | *start = buffer; | ||
353 | |||
354 | info.buffer = buffer; | ||
355 | info.length = length; | ||
356 | info.offset = offset; | ||
357 | info.pos = 0; | ||
358 | |||
359 | copy_info(&info, "Adaptec AIC7xxx driver version: %s\n", | ||
360 | AIC7XXX_DRIVER_VERSION); | 297 | AIC7XXX_DRIVER_VERSION); |
361 | copy_info(&info, "%s\n", ahc->description); | 298 | seq_printf(m, "%s\n", ahc->description); |
362 | ahc_controller_info(ahc, ahc_info); | 299 | ahc_controller_info(ahc, ahc_info); |
363 | copy_info(&info, "%s\n", ahc_info); | 300 | seq_printf(m, "%s\n", ahc_info); |
364 | copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", | 301 | seq_printf(m, "Allocated SCBs: %d, SG List Length: %d\n\n", |
365 | ahc->scb_data->numscbs, AHC_NSEG); | 302 | ahc->scb_data->numscbs, AHC_NSEG); |
366 | 303 | ||
367 | 304 | ||
368 | if (ahc->seep_config == NULL) | 305 | if (ahc->seep_config == NULL) |
369 | copy_info(&info, "No Serial EEPROM\n"); | 306 | seq_printf(m, "No Serial EEPROM\n"); |
370 | else { | 307 | else { |
371 | copy_info(&info, "Serial EEPROM:\n"); | 308 | seq_printf(m, "Serial EEPROM:\n"); |
372 | for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { | 309 | for (i = 0; i < sizeof(*ahc->seep_config)/2; i++) { |
373 | if (((i % 8) == 0) && (i != 0)) { | 310 | if (((i % 8) == 0) && (i != 0)) { |
374 | copy_info(&info, "\n"); | 311 | seq_printf(m, "\n"); |
375 | } | 312 | } |
376 | copy_info(&info, "0x%.4x ", | 313 | seq_printf(m, "0x%.4x ", |
377 | ((uint16_t*)ahc->seep_config)[i]); | 314 | ((uint16_t*)ahc->seep_config)[i]); |
378 | } | 315 | } |
379 | copy_info(&info, "\n"); | 316 | seq_printf(m, "\n"); |
380 | } | 317 | } |
381 | copy_info(&info, "\n"); | 318 | seq_printf(m, "\n"); |
382 | 319 | ||
383 | max_targ = 16; | 320 | max_targ = 16; |
384 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) | 321 | if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) |
@@ -398,10 +335,8 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
398 | target_id = i % 8; | 335 | target_id = i % 8; |
399 | } | 336 | } |
400 | 337 | ||
401 | ahc_dump_target_state(ahc, &info, our_id, | 338 | ahc_dump_target_state(ahc, m, our_id, |
402 | channel, target_id, i); | 339 | channel, target_id, i); |
403 | } | 340 | } |
404 | retval = info.pos > info.offset ? info.pos - info.offset : 0; | 341 | return 0; |
405 | done: | ||
406 | return (retval); | ||
407 | } | 342 | } |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 5b212f0df898..33ec9c643400 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -11108,7 +11108,7 @@ MODULE_VERSION(AIC7XXX_H_VERSION); | |||
11108 | 11108 | ||
11109 | 11109 | ||
11110 | static struct scsi_host_template driver_template = { | 11110 | static struct scsi_host_template driver_template = { |
11111 | .proc_info = aic7xxx_proc_info, | 11111 | .show_info = aic7xxx_show_info, |
11112 | .detect = aic7xxx_detect, | 11112 | .detect = aic7xxx_detect, |
11113 | .release = aic7xxx_release, | 11113 | .release = aic7xxx_release, |
11114 | .info = aic7xxx_info, | 11114 | .info = aic7xxx_info, |
diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c index b07e4f04fd00..976f45ccf2cf 100644 --- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c | |||
@@ -30,62 +30,23 @@ | |||
30 | *-M*************************************************************************/ | 30 | *-M*************************************************************************/ |
31 | 31 | ||
32 | 32 | ||
33 | #define BLS (&aic7xxx_buffer[size]) | ||
34 | #define HDRB \ | 33 | #define HDRB \ |
35 | " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" | 34 | " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+" |
36 | 35 | ||
37 | #ifdef PROC_DEBUG | ||
38 | extern int vsprintf(char *, const char *, va_list); | ||
39 | |||
40 | static void | ||
41 | proc_debug(const char *fmt, ...) | ||
42 | { | ||
43 | va_list ap; | ||
44 | char buf[256]; | ||
45 | |||
46 | va_start(ap, fmt); | ||
47 | vsprintf(buf, fmt, ap); | ||
48 | printk(buf); | ||
49 | va_end(ap); | ||
50 | } | ||
51 | #else /* PROC_DEBUG */ | ||
52 | # define proc_debug(fmt, args...) | ||
53 | #endif /* PROC_DEBUG */ | ||
54 | |||
55 | static int aic7xxx_buffer_size = 0; | ||
56 | static char *aic7xxx_buffer = NULL; | ||
57 | |||
58 | 36 | ||
59 | /*+F************************************************************************* | 37 | /*+F************************************************************************* |
60 | * Function: | 38 | * Function: |
61 | * aic7xxx_set_info | 39 | * aic7xxx_show_info |
62 | * | ||
63 | * Description: | ||
64 | * Set parameters for the driver from the /proc filesystem. | ||
65 | *-F*************************************************************************/ | ||
66 | static int | ||
67 | aic7xxx_set_info(char *buffer, int length, struct Scsi_Host *HBAptr) | ||
68 | { | ||
69 | proc_debug("aic7xxx_set_info(): %s\n", buffer); | ||
70 | return (-ENOSYS); /* Currently this is a no-op */ | ||
71 | } | ||
72 | |||
73 | |||
74 | /*+F************************************************************************* | ||
75 | * Function: | ||
76 | * aic7xxx_proc_info | ||
77 | * | 40 | * |
78 | * Description: | 41 | * Description: |
79 | * Return information to handle /proc support for the driver. | 42 | * Return information to handle /proc support for the driver. |
80 | *-F*************************************************************************/ | 43 | *-F*************************************************************************/ |
81 | int | 44 | int |
82 | aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, | 45 | aic7xxx_show_info(struct seq_file *m, struct Scsi_Host *HBAptr) |
83 | int inout) | ||
84 | { | 46 | { |
85 | struct aic7xxx_host *p; | 47 | struct aic7xxx_host *p; |
86 | struct aic_dev_data *aic_dev; | 48 | struct aic_dev_data *aic_dev; |
87 | struct scsi_device *sdptr; | 49 | struct scsi_device *sdptr; |
88 | int size = 0; | ||
89 | unsigned char i; | 50 | unsigned char i; |
90 | unsigned char tindex; | 51 | unsigned char tindex; |
91 | 52 | ||
@@ -94,66 +55,21 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
94 | 55 | ||
95 | if (!p) | 56 | if (!p) |
96 | { | 57 | { |
97 | size += sprintf(buffer, "Can't find adapter for host number %d\n", HBAptr->host_no); | 58 | seq_printf(m, "Can't find adapter for host number %d\n", HBAptr->host_no); |
98 | if (size > length) | 59 | return 0; |
99 | { | ||
100 | return (size); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | return (length); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | if (inout == TRUE) /* Has data been written to the file? */ | ||
109 | { | ||
110 | return (aic7xxx_set_info(buffer, length, HBAptr)); | ||
111 | } | 60 | } |
112 | 61 | ||
113 | p = (struct aic7xxx_host *) HBAptr->hostdata; | 62 | p = (struct aic7xxx_host *) HBAptr->hostdata; |
114 | 63 | ||
115 | /* | 64 | seq_printf(m, "Adaptec AIC7xxx driver version: "); |
116 | * It takes roughly 1K of space to hold all relevant card info, not | 65 | seq_printf(m, "%s/", AIC7XXX_C_VERSION); |
117 | * counting any proc stats, so we start out with a 1.5k buffer size and | 66 | seq_printf(m, "%s", AIC7XXX_H_VERSION); |
118 | * if proc_stats is defined, then we sweep the stats structure to see | 67 | seq_printf(m, "\n"); |
119 | * how many drives we will be printing out for and add 384 bytes per | 68 | seq_printf(m, "Adapter Configuration:\n"); |
120 | * device with active stats. | 69 | seq_printf(m, " SCSI Adapter: %s\n", |
121 | * | ||
122 | * Hmmmm...that 1.5k seems to keep growing as items get added so they | ||
123 | * can be easily viewed for debugging purposes. So, we bumped that | ||
124 | * 1.5k to 4k so we can quit having to bump it all the time. | ||
125 | */ | ||
126 | |||
127 | size = 4096; | ||
128 | list_for_each_entry(aic_dev, &p->aic_devs, list) | ||
129 | size += 512; | ||
130 | if (aic7xxx_buffer_size != size) | ||
131 | { | ||
132 | if (aic7xxx_buffer != NULL) | ||
133 | { | ||
134 | kfree(aic7xxx_buffer); | ||
135 | aic7xxx_buffer_size = 0; | ||
136 | } | ||
137 | aic7xxx_buffer = kmalloc(size, GFP_KERNEL); | ||
138 | } | ||
139 | if (aic7xxx_buffer == NULL) | ||
140 | { | ||
141 | size = sprintf(buffer, "AIC7xxx - kmalloc error at line %d\n", | ||
142 | __LINE__); | ||
143 | return size; | ||
144 | } | ||
145 | aic7xxx_buffer_size = size; | ||
146 | |||
147 | size = 0; | ||
148 | size += sprintf(BLS, "Adaptec AIC7xxx driver version: "); | ||
149 | size += sprintf(BLS, "%s/", AIC7XXX_C_VERSION); | ||
150 | size += sprintf(BLS, "%s", AIC7XXX_H_VERSION); | ||
151 | size += sprintf(BLS, "\n"); | ||
152 | size += sprintf(BLS, "Adapter Configuration:\n"); | ||
153 | size += sprintf(BLS, " SCSI Adapter: %s\n", | ||
154 | board_names[p->board_name_index]); | 70 | board_names[p->board_name_index]); |
155 | if (p->flags & AHC_TWIN) | 71 | if (p->flags & AHC_TWIN) |
156 | size += sprintf(BLS, " Twin Channel Controller "); | 72 | seq_printf(m, " Twin Channel Controller "); |
157 | else | 73 | else |
158 | { | 74 | { |
159 | char *channel = ""; | 75 | char *channel = ""; |
@@ -184,86 +100,86 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
184 | ultra = "Ultra-2 LVD/SE "; | 100 | ultra = "Ultra-2 LVD/SE "; |
185 | else if (p->features & AHC_ULTRA) | 101 | else if (p->features & AHC_ULTRA) |
186 | ultra = "Ultra "; | 102 | ultra = "Ultra "; |
187 | size += sprintf(BLS, " %s%sController%s ", | 103 | seq_printf(m, " %s%sController%s ", |
188 | ultra, wide, channel); | 104 | ultra, wide, channel); |
189 | } | 105 | } |
190 | switch(p->chip & ~AHC_CHIPID_MASK) | 106 | switch(p->chip & ~AHC_CHIPID_MASK) |
191 | { | 107 | { |
192 | case AHC_VL: | 108 | case AHC_VL: |
193 | size += sprintf(BLS, "at VLB slot %d\n", p->pci_device_fn); | 109 | seq_printf(m, "at VLB slot %d\n", p->pci_device_fn); |
194 | break; | 110 | break; |
195 | case AHC_EISA: | 111 | case AHC_EISA: |
196 | size += sprintf(BLS, "at EISA slot %d\n", p->pci_device_fn); | 112 | seq_printf(m, "at EISA slot %d\n", p->pci_device_fn); |
197 | break; | 113 | break; |
198 | default: | 114 | default: |
199 | size += sprintf(BLS, "at PCI %d/%d/%d\n", p->pci_bus, | 115 | seq_printf(m, "at PCI %d/%d/%d\n", p->pci_bus, |
200 | PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); | 116 | PCI_SLOT(p->pci_device_fn), PCI_FUNC(p->pci_device_fn)); |
201 | break; | 117 | break; |
202 | } | 118 | } |
203 | if( !(p->maddr) ) | 119 | if( !(p->maddr) ) |
204 | { | 120 | { |
205 | size += sprintf(BLS, " Programmed I/O Base: %lx\n", p->base); | 121 | seq_printf(m, " Programmed I/O Base: %lx\n", p->base); |
206 | } | 122 | } |
207 | else | 123 | else |
208 | { | 124 | { |
209 | size += sprintf(BLS, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); | 125 | seq_printf(m, " PCI MMAPed I/O Base: 0x%lx\n", p->mbase); |
210 | } | 126 | } |
211 | if( (p->chip & (AHC_VL | AHC_EISA)) ) | 127 | if( (p->chip & (AHC_VL | AHC_EISA)) ) |
212 | { | 128 | { |
213 | size += sprintf(BLS, " BIOS Memory Address: 0x%08x\n", p->bios_address); | 129 | seq_printf(m, " BIOS Memory Address: 0x%08x\n", p->bios_address); |
214 | } | 130 | } |
215 | size += sprintf(BLS, " Adapter SEEPROM Config: %s\n", | 131 | seq_printf(m, " Adapter SEEPROM Config: %s\n", |
216 | (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : | 132 | (p->flags & AHC_SEEPROM_FOUND) ? "SEEPROM found and used." : |
217 | ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : | 133 | ((p->flags & AHC_USEDEFAULTS) ? "SEEPROM not found, using defaults." : |
218 | "SEEPROM not found, using leftover BIOS values.") ); | 134 | "SEEPROM not found, using leftover BIOS values.") ); |
219 | size += sprintf(BLS, " Adaptec SCSI BIOS: %s\n", | 135 | seq_printf(m, " Adaptec SCSI BIOS: %s\n", |
220 | (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); | 136 | (p->flags & AHC_BIOS_ENABLED) ? "Enabled" : "Disabled"); |
221 | size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); | 137 | seq_printf(m, " IRQ: %d\n", HBAptr->irq); |
222 | size += sprintf(BLS, " SCBs: Active %d, Max Active %d,\n", | 138 | seq_printf(m, " SCBs: Active %d, Max Active %d,\n", |
223 | p->activescbs, p->max_activescbs); | 139 | p->activescbs, p->max_activescbs); |
224 | size += sprintf(BLS, " Allocated %d, HW %d, " | 140 | seq_printf(m, " Allocated %d, HW %d, " |
225 | "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, | 141 | "Page %d\n", p->scb_data->numscbs, p->scb_data->maxhscbs, |
226 | p->scb_data->maxscbs); | 142 | p->scb_data->maxscbs); |
227 | if (p->flags & AHC_EXTERNAL_SRAM) | 143 | if (p->flags & AHC_EXTERNAL_SRAM) |
228 | size += sprintf(BLS, " Using External SCB SRAM\n"); | 144 | seq_printf(m, " Using External SCB SRAM\n"); |
229 | size += sprintf(BLS, " Interrupts: %ld", p->isr_count); | 145 | seq_printf(m, " Interrupts: %ld", p->isr_count); |
230 | if (p->chip & AHC_EISA) | 146 | if (p->chip & AHC_EISA) |
231 | { | 147 | { |
232 | size += sprintf(BLS, " %s\n", | 148 | seq_printf(m, " %s\n", |
233 | (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); | 149 | (p->pause & IRQMS) ? "(Level Sensitive)" : "(Edge Triggered)"); |
234 | } | 150 | } |
235 | else | 151 | else |
236 | { | 152 | { |
237 | size += sprintf(BLS, "\n"); | 153 | seq_printf(m, "\n"); |
238 | } | 154 | } |
239 | size += sprintf(BLS, " BIOS Control Word: 0x%04x\n", | 155 | seq_printf(m, " BIOS Control Word: 0x%04x\n", |
240 | p->bios_control); | 156 | p->bios_control); |
241 | size += sprintf(BLS, " Adapter Control Word: 0x%04x\n", | 157 | seq_printf(m, " Adapter Control Word: 0x%04x\n", |
242 | p->adapter_control); | 158 | p->adapter_control); |
243 | size += sprintf(BLS, " Extended Translation: %sabled\n", | 159 | seq_printf(m, " Extended Translation: %sabled\n", |
244 | (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); | 160 | (p->flags & AHC_EXTEND_TRANS_A) ? "En" : "Dis"); |
245 | size += sprintf(BLS, "Disconnect Enable Flags: 0x%04x\n", p->discenable); | 161 | seq_printf(m, "Disconnect Enable Flags: 0x%04x\n", p->discenable); |
246 | if (p->features & (AHC_ULTRA | AHC_ULTRA2)) | 162 | if (p->features & (AHC_ULTRA | AHC_ULTRA2)) |
247 | { | 163 | { |
248 | size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); | 164 | seq_printf(m, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); |
249 | } | 165 | } |
250 | size += sprintf(BLS, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); | 166 | seq_printf(m, "Default Tag Queue Depth: %d\n", aic7xxx_default_queue_depth); |
251 | size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host " | 167 | seq_printf(m, " Tagged Queue By Device array for aic7xxx host " |
252 | "instance %d:\n", p->instance); | 168 | "instance %d:\n", p->instance); |
253 | size += sprintf(BLS, " {"); | 169 | seq_printf(m, " {"); |
254 | for(i=0; i < (MAX_TARGETS - 1); i++) | 170 | for(i=0; i < (MAX_TARGETS - 1); i++) |
255 | size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); | 171 | seq_printf(m, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); |
256 | size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); | 172 | seq_printf(m, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); |
257 | 173 | ||
258 | size += sprintf(BLS, "\n"); | 174 | seq_printf(m, "\n"); |
259 | size += sprintf(BLS, "Statistics:\n\n"); | 175 | seq_printf(m, "Statistics:\n\n"); |
260 | list_for_each_entry(aic_dev, &p->aic_devs, list) | 176 | list_for_each_entry(aic_dev, &p->aic_devs, list) |
261 | { | 177 | { |
262 | sdptr = aic_dev->SDptr; | 178 | sdptr = aic_dev->SDptr; |
263 | tindex = sdptr->channel << 3 | sdptr->id; | 179 | tindex = sdptr->channel << 3 | sdptr->id; |
264 | size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n", | 180 | seq_printf(m, "(scsi%d:%d:%d:%d)\n", |
265 | p->host_no, sdptr->channel, sdptr->id, sdptr->lun); | 181 | p->host_no, sdptr->channel, sdptr->id, sdptr->lun); |
266 | size += sprintf(BLS, " Device using %s/%s", | 182 | seq_printf(m, " Device using %s/%s", |
267 | (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? | 183 | (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ? |
268 | "Wide" : "Narrow", | 184 | "Wide" : "Narrow", |
269 | (aic_dev->cur.offset != 0) ? | 185 | (aic_dev->cur.offset != 0) ? |
@@ -279,78 +195,59 @@ aic7xxx_proc_info ( struct Scsi_Host *HBAptr, char *buffer, char **start, off_t | |||
279 | sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); | 195 | sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); |
280 | if (sync_rate != NULL) | 196 | if (sync_rate != NULL) |
281 | { | 197 | { |
282 | size += sprintf(BLS, "%s MByte/sec, offset %d\n", | 198 | seq_printf(m, "%s MByte/sec, offset %d\n", |
283 | sync_rate->rate[rate], | 199 | sync_rate->rate[rate], |
284 | aic_dev->cur.offset ); | 200 | aic_dev->cur.offset ); |
285 | } | 201 | } |
286 | else | 202 | else |
287 | { | 203 | { |
288 | size += sprintf(BLS, "3.3 MByte/sec, offset %d\n", | 204 | seq_printf(m, "3.3 MByte/sec, offset %d\n", |
289 | aic_dev->cur.offset ); | 205 | aic_dev->cur.offset ); |
290 | } | 206 | } |
291 | } | 207 | } |
292 | size += sprintf(BLS, " Transinfo settings: "); | 208 | seq_printf(m, " Transinfo settings: "); |
293 | size += sprintf(BLS, "current(%d/%d/%d/%d), ", | 209 | seq_printf(m, "current(%d/%d/%d/%d), ", |
294 | aic_dev->cur.period, | 210 | aic_dev->cur.period, |
295 | aic_dev->cur.offset, | 211 | aic_dev->cur.offset, |
296 | aic_dev->cur.width, | 212 | aic_dev->cur.width, |
297 | aic_dev->cur.options); | 213 | aic_dev->cur.options); |
298 | size += sprintf(BLS, "goal(%d/%d/%d/%d), ", | 214 | seq_printf(m, "goal(%d/%d/%d/%d), ", |
299 | aic_dev->goal.period, | 215 | aic_dev->goal.period, |
300 | aic_dev->goal.offset, | 216 | aic_dev->goal.offset, |
301 | aic_dev->goal.width, | 217 | aic_dev->goal.width, |
302 | aic_dev->goal.options); | 218 | aic_dev->goal.options); |
303 | size += sprintf(BLS, "user(%d/%d/%d/%d)\n", | 219 | seq_printf(m, "user(%d/%d/%d/%d)\n", |
304 | p->user[tindex].period, | 220 | p->user[tindex].period, |
305 | p->user[tindex].offset, | 221 | p->user[tindex].offset, |
306 | p->user[tindex].width, | 222 | p->user[tindex].width, |
307 | p->user[tindex].options); | 223 | p->user[tindex].options); |
308 | if(sdptr->simple_tags) | 224 | if(sdptr->simple_tags) |
309 | { | 225 | { |
310 | size += sprintf(BLS, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); | 226 | seq_printf(m, " Tagged Command Queueing Enabled, Ordered Tags %s, Depth %d/%d\n", sdptr->ordered_tags ? "Enabled" : "Disabled", sdptr->queue_depth, aic_dev->max_q_depth); |
311 | } | 227 | } |
312 | if(aic_dev->barrier_total) | 228 | if(aic_dev->barrier_total) |
313 | size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", | 229 | seq_printf(m, " Total transfers %ld:\n (%ld/%ld/%ld/%ld reads/writes/REQ_BARRIER/Ordered Tags)\n", |
314 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, | 230 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total, |
315 | aic_dev->barrier_total, aic_dev->ordered_total); | 231 | aic_dev->barrier_total, aic_dev->ordered_total); |
316 | else | 232 | else |
317 | size += sprintf(BLS, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", | 233 | seq_printf(m, " Total transfers %ld:\n (%ld/%ld reads/writes)\n", |
318 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); | 234 | aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total); |
319 | size += sprintf(BLS, "%s\n", HDRB); | 235 | seq_printf(m, "%s\n", HDRB); |
320 | size += sprintf(BLS, " Reads:"); | 236 | seq_printf(m, " Reads:"); |
321 | for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) | 237 | for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++) |
322 | { | 238 | { |
323 | size += sprintf(BLS, " %10ld", aic_dev->r_bins[i]); | 239 | seq_printf(m, " %10ld", aic_dev->r_bins[i]); |
324 | } | 240 | } |
325 | size += sprintf(BLS, "\n"); | 241 | seq_printf(m, "\n"); |
326 | size += sprintf(BLS, " Writes:"); | 242 | seq_printf(m, " Writes:"); |
327 | for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) | 243 | for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++) |
328 | { | 244 | { |
329 | size += sprintf(BLS, " %10ld", aic_dev->w_bins[i]); | 245 | seq_printf(m, " %10ld", aic_dev->w_bins[i]); |
330 | } | 246 | } |
331 | size += sprintf(BLS, "\n"); | 247 | seq_printf(m, "\n"); |
332 | size += sprintf(BLS, "\n\n"); | 248 | seq_printf(m, "\n\n"); |
333 | } | ||
334 | if (size >= aic7xxx_buffer_size) | ||
335 | { | ||
336 | printk(KERN_WARNING "aic7xxx: Overflow in aic7xxx_proc.c\n"); | ||
337 | } | ||
338 | |||
339 | if (offset > size - 1) | ||
340 | { | ||
341 | kfree(aic7xxx_buffer); | ||
342 | aic7xxx_buffer = NULL; | ||
343 | aic7xxx_buffer_size = length = 0; | ||
344 | *start = NULL; | ||
345 | } | 249 | } |
346 | else | 250 | return 0; |
347 | { | ||
348 | *start = buffer; | ||
349 | length = min_t(int, length, size - offset); | ||
350 | memcpy(buffer, &aic7xxx_buffer[offset], length); | ||
351 | } | ||
352 | |||
353 | return (length); | ||
354 | } | 251 | } |
355 | 252 | ||
356 | /* | 253 | /* |
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index 3e1172adb37b..09ba1869d366 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c | |||
@@ -2836,20 +2836,15 @@ char *acornscsi_info(struct Scsi_Host *host) | |||
2836 | return string; | 2836 | return string; |
2837 | } | 2837 | } |
2838 | 2838 | ||
2839 | int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, off_t offset, | 2839 | static int acornscsi_show_info(struct seq_file *m, struct Scsi_Host *instance) |
2840 | int length, int inout) | ||
2841 | { | 2840 | { |
2842 | int pos, begin = 0, devidx; | 2841 | int devidx; |
2843 | struct scsi_device *scd; | 2842 | struct scsi_device *scd; |
2844 | AS_Host *host; | 2843 | AS_Host *host; |
2845 | char *p = buffer; | ||
2846 | |||
2847 | if (inout == 1) | ||
2848 | return -EINVAL; | ||
2849 | 2844 | ||
2850 | host = (AS_Host *)instance->hostdata; | 2845 | host = (AS_Host *)instance->hostdata; |
2851 | 2846 | ||
2852 | p += sprintf(p, "AcornSCSI driver v%d.%d.%d" | 2847 | seq_printf(m, "AcornSCSI driver v%d.%d.%d" |
2853 | #ifdef CONFIG_SCSI_ACORNSCSI_SYNC | 2848 | #ifdef CONFIG_SCSI_ACORNSCSI_SYNC |
2854 | " SYNC" | 2849 | " SYNC" |
2855 | #endif | 2850 | #endif |
@@ -2864,14 +2859,14 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2864 | #endif | 2859 | #endif |
2865 | "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH); | 2860 | "\n\n", VER_MAJOR, VER_MINOR, VER_PATCH); |
2866 | 2861 | ||
2867 | p += sprintf(p, "SBIC: WD33C93A Address: %p IRQ : %d\n", | 2862 | seq_printf(m, "SBIC: WD33C93A Address: %p IRQ : %d\n", |
2868 | host->base + SBIC_REGIDX, host->scsi.irq); | 2863 | host->base + SBIC_REGIDX, host->scsi.irq); |
2869 | #ifdef USE_DMAC | 2864 | #ifdef USE_DMAC |
2870 | p += sprintf(p, "DMAC: uPC71071 Address: %p IRQ : %d\n\n", | 2865 | seq_printf(m, "DMAC: uPC71071 Address: %p IRQ : %d\n\n", |
2871 | host->base + DMAC_OFFSET, host->scsi.irq); | 2866 | host->base + DMAC_OFFSET, host->scsi.irq); |
2872 | #endif | 2867 | #endif |
2873 | 2868 | ||
2874 | p += sprintf(p, "Statistics:\n" | 2869 | seq_printf(m, "Statistics:\n" |
2875 | "Queued commands: %-10u Issued commands: %-10u\n" | 2870 | "Queued commands: %-10u Issued commands: %-10u\n" |
2876 | "Done commands : %-10u Reads : %-10u\n" | 2871 | "Done commands : %-10u Reads : %-10u\n" |
2877 | "Writes : %-10u Others : %-10u\n" | 2872 | "Writes : %-10u Others : %-10u\n" |
@@ -2886,7 +2881,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2886 | for (devidx = 0; devidx < 9; devidx ++) { | 2881 | for (devidx = 0; devidx < 9; devidx ++) { |
2887 | unsigned int statptr, prev; | 2882 | unsigned int statptr, prev; |
2888 | 2883 | ||
2889 | p += sprintf(p, "\n%c:", devidx == 8 ? 'H' : ('0' + devidx)); | 2884 | seq_printf(m, "\n%c:", devidx == 8 ? 'H' : ('0' + devidx)); |
2890 | statptr = host->status_ptr[devidx] - 10; | 2885 | statptr = host->status_ptr[devidx] - 10; |
2891 | 2886 | ||
2892 | if ((signed int)statptr < 0) | 2887 | if ((signed int)statptr < 0) |
@@ -2896,7 +2891,7 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2896 | 2891 | ||
2897 | for (; statptr != host->status_ptr[devidx]; statptr = (statptr + 1) & (STATUS_BUFFER_SIZE - 1)) { | 2892 | for (; statptr != host->status_ptr[devidx]; statptr = (statptr + 1) & (STATUS_BUFFER_SIZE - 1)) { |
2898 | if (host->status[devidx][statptr].when) { | 2893 | if (host->status[devidx][statptr].when) { |
2899 | p += sprintf(p, "%c%02X:%02X+%2ld", | 2894 | seq_printf(m, "%c%02X:%02X+%2ld", |
2900 | host->status[devidx][statptr].irq ? '-' : ' ', | 2895 | host->status[devidx][statptr].irq ? '-' : ' ', |
2901 | host->status[devidx][statptr].ph, | 2896 | host->status[devidx][statptr].ph, |
2902 | host->status[devidx][statptr].ssr, | 2897 | host->status[devidx][statptr].ssr, |
@@ -2907,51 +2902,32 @@ int acornscsi_proc_info(struct Scsi_Host *instance, char *buffer, char **start, | |||
2907 | } | 2902 | } |
2908 | } | 2903 | } |
2909 | 2904 | ||
2910 | p += sprintf(p, "\nAttached devices:\n"); | 2905 | seq_printf(m, "\nAttached devices:\n"); |
2911 | 2906 | ||
2912 | shost_for_each_device(scd, instance) { | 2907 | shost_for_each_device(scd, instance) { |
2913 | p += sprintf(p, "Device/Lun TaggedQ Sync\n"); | 2908 | seq_printf(m, "Device/Lun TaggedQ Sync\n"); |
2914 | p += sprintf(p, " %d/%d ", scd->id, scd->lun); | 2909 | seq_printf(m, " %d/%d ", scd->id, scd->lun); |
2915 | if (scd->tagged_supported) | 2910 | if (scd->tagged_supported) |
2916 | p += sprintf(p, "%3sabled(%3d) ", | 2911 | seq_printf(m, "%3sabled(%3d) ", |
2917 | scd->simple_tags ? "en" : "dis", | 2912 | scd->simple_tags ? "en" : "dis", |
2918 | scd->current_tag); | 2913 | scd->current_tag); |
2919 | else | 2914 | else |
2920 | p += sprintf(p, "unsupported "); | 2915 | seq_printf(m, "unsupported "); |
2921 | 2916 | ||
2922 | if (host->device[scd->id].sync_xfer & 15) | 2917 | if (host->device[scd->id].sync_xfer & 15) |
2923 | p += sprintf(p, "offset %d, %d ns\n", | 2918 | seq_printf(m, "offset %d, %d ns\n", |
2924 | host->device[scd->id].sync_xfer & 15, | 2919 | host->device[scd->id].sync_xfer & 15, |
2925 | acornscsi_getperiod(host->device[scd->id].sync_xfer)); | 2920 | acornscsi_getperiod(host->device[scd->id].sync_xfer)); |
2926 | else | 2921 | else |
2927 | p += sprintf(p, "async\n"); | 2922 | seq_printf(m, "async\n"); |
2928 | 2923 | ||
2929 | pos = p - buffer; | ||
2930 | if (pos + begin < offset) { | ||
2931 | begin += pos; | ||
2932 | p = buffer; | ||
2933 | } | ||
2934 | pos = p - buffer; | ||
2935 | if (pos + begin > offset + length) { | ||
2936 | scsi_device_put(scd); | ||
2937 | break; | ||
2938 | } | ||
2939 | } | 2924 | } |
2940 | 2925 | return 0; | |
2941 | pos = p - buffer; | ||
2942 | |||
2943 | *start = buffer + (offset - begin); | ||
2944 | pos -= offset - begin; | ||
2945 | |||
2946 | if (pos > length) | ||
2947 | pos = length; | ||
2948 | |||
2949 | return pos; | ||
2950 | } | 2926 | } |
2951 | 2927 | ||
2952 | static struct scsi_host_template acornscsi_template = { | 2928 | static struct scsi_host_template acornscsi_template = { |
2953 | .module = THIS_MODULE, | 2929 | .module = THIS_MODULE, |
2954 | .proc_info = acornscsi_proc_info, | 2930 | .show_info = acornscsi_show_info, |
2955 | .name = "AcornSCSI", | 2931 | .name = "AcornSCSI", |
2956 | .info = acornscsi_info, | 2932 | .info = acornscsi_info, |
2957 | .queuecommand = acornscsi_queuecmd, | 2933 | .queuecommand = acornscsi_queuecmd, |
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c index 9274510294ac..32d23212de48 100644 --- a/drivers/scsi/arm/arxescsi.c +++ b/drivers/scsi/arm/arxescsi.c | |||
@@ -220,47 +220,21 @@ static const char *arxescsi_info(struct Scsi_Host *host) | |||
220 | return string; | 220 | return string; |
221 | } | 221 | } |
222 | 222 | ||
223 | /* | ||
224 | * Function: int arxescsi_proc_info(char *buffer, char **start, off_t offset, | ||
225 | * int length, int host_no, int inout) | ||
226 | * Purpose : Return information about the driver to a user process accessing | ||
227 | * the /proc filesystem. | ||
228 | * Params : buffer - a buffer to write information to | ||
229 | * start - a pointer into this buffer set by this routine to the start | ||
230 | * of the required information. | ||
231 | * offset - offset into information that we have read up to. | ||
232 | * length - length of buffer | ||
233 | * host_no - host number to return information for | ||
234 | * inout - 0 for reading, 1 for writing. | ||
235 | * Returns : length of data written to buffer. | ||
236 | */ | ||
237 | static int | 223 | static int |
238 | arxescsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, | 224 | arxescsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
239 | int inout) | ||
240 | { | 225 | { |
241 | struct arxescsi_info *info; | 226 | struct arxescsi_info *info; |
242 | char *p = buffer; | ||
243 | int pos; | ||
244 | |||
245 | info = (struct arxescsi_info *)host->hostdata; | 227 | info = (struct arxescsi_info *)host->hostdata; |
246 | if (inout == 1) | ||
247 | return -EINVAL; | ||
248 | |||
249 | p += sprintf(p, "ARXE 16-bit SCSI driver v%s\n", VERSION); | ||
250 | p += fas216_print_host(&info->info, p); | ||
251 | p += fas216_print_stats(&info->info, p); | ||
252 | p += fas216_print_devices(&info->info, p); | ||
253 | |||
254 | *start = buffer + offset; | ||
255 | pos = p - buffer - offset; | ||
256 | if (pos > length) | ||
257 | pos = length; | ||
258 | 228 | ||
259 | return pos; | 229 | seq_printf(m, "ARXE 16-bit SCSI driver v%s\n", VERSION); |
230 | fas216_print_host(&info->info, m); | ||
231 | fas216_print_stats(&info->info, m); | ||
232 | fas216_print_devices(&info->info, m); | ||
233 | return 0; | ||
260 | } | 234 | } |
261 | 235 | ||
262 | static struct scsi_host_template arxescsi_template = { | 236 | static struct scsi_host_template arxescsi_template = { |
263 | .proc_info = arxescsi_proc_info, | 237 | .show_info = arxescsi_show_info, |
264 | .name = "ARXE SCSI card", | 238 | .name = "ARXE SCSI card", |
265 | .info = arxescsi_info, | 239 | .info = arxescsi_info, |
266 | .queuecommand = fas216_noqueue_command, | 240 | .queuecommand = fas216_noqueue_command, |
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index c93938b246d5..b679778376c5 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) | 30 | #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) |
31 | #define NCR5380_intr cumanascsi_intr | 31 | #define NCR5380_intr cumanascsi_intr |
32 | #define NCR5380_queue_command cumanascsi_queue_command | 32 | #define NCR5380_queue_command cumanascsi_queue_command |
33 | #define NCR5380_proc_info cumanascsi_proc_info | ||
34 | 33 | ||
35 | #define NCR5380_implementation_fields \ | 34 | #define NCR5380_implementation_fields \ |
36 | unsigned ctrl; \ | 35 | unsigned ctrl; \ |
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index e3bae93c3c22..58915f29055b 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c | |||
@@ -337,50 +337,25 @@ cumanascsi_2_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
337 | return ret; | 337 | return ret; |
338 | } | 338 | } |
339 | 339 | ||
340 | /* Prototype: int cumanascsi_2_proc_info(char *buffer, char **start, off_t offset, | 340 | static int cumanascsi_2_show_info(struct seq_file *m, struct Scsi_Host *host) |
341 | * int length, int host_no, int inout) | ||
342 | * Purpose : Return information about the driver to a user process accessing | ||
343 | * the /proc filesystem. | ||
344 | * Params : buffer - a buffer to write information to | ||
345 | * start - a pointer into this buffer set by this routine to the start | ||
346 | * of the required information. | ||
347 | * offset - offset into information that we have read up to. | ||
348 | * length - length of buffer | ||
349 | * host_no - host number to return information for | ||
350 | * inout - 0 for reading, 1 for writing. | ||
351 | * Returns : length of data written to buffer. | ||
352 | */ | ||
353 | int cumanascsi_2_proc_info (struct Scsi_Host *host, char *buffer, char **start, off_t offset, | ||
354 | int length, int inout) | ||
355 | { | 341 | { |
356 | struct cumanascsi2_info *info; | 342 | struct cumanascsi2_info *info; |
357 | char *p = buffer; | ||
358 | int pos; | ||
359 | |||
360 | if (inout == 1) | ||
361 | return cumanascsi_2_set_proc_info(host, buffer, length); | ||
362 | |||
363 | info = (struct cumanascsi2_info *)host->hostdata; | 343 | info = (struct cumanascsi2_info *)host->hostdata; |
364 | 344 | ||
365 | p += sprintf(p, "Cumana SCSI II driver v%s\n", VERSION); | 345 | seq_printf(m, "Cumana SCSI II driver v%s\n", VERSION); |
366 | p += fas216_print_host(&info->info, p); | 346 | fas216_print_host(&info->info, m); |
367 | p += sprintf(p, "Term : o%s\n", | 347 | seq_printf(m, "Term : o%s\n", |
368 | info->terms ? "n" : "ff"); | 348 | info->terms ? "n" : "ff"); |
369 | 349 | ||
370 | p += fas216_print_stats(&info->info, p); | 350 | fas216_print_stats(&info->info, m); |
371 | p += fas216_print_devices(&info->info, p); | 351 | fas216_print_devices(&info->info, m); |
372 | 352 | return 0; | |
373 | *start = buffer + offset; | ||
374 | pos = p - buffer - offset; | ||
375 | if (pos > length) | ||
376 | pos = length; | ||
377 | |||
378 | return pos; | ||
379 | } | 353 | } |
380 | 354 | ||
381 | static struct scsi_host_template cumanascsi2_template = { | 355 | static struct scsi_host_template cumanascsi2_template = { |
382 | .module = THIS_MODULE, | 356 | .module = THIS_MODULE, |
383 | .proc_info = cumanascsi_2_proc_info, | 357 | .show_info = cumanascsi_2_show_info, |
358 | .write_info = cumanascsi_2_set_proc_info, | ||
384 | .name = "Cumana SCSI II", | 359 | .name = "Cumana SCSI II", |
385 | .info = cumanascsi_2_info, | 360 | .info = cumanascsi_2_info, |
386 | .queuecommand = fas216_queue_command, | 361 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 8e36908415ec..5bf3c0d134b4 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -422,45 +422,20 @@ eesoxscsi_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
422 | return ret; | 422 | return ret; |
423 | } | 423 | } |
424 | 424 | ||
425 | /* Prototype: int eesoxscsi_proc_info(char *buffer, char **start, off_t offset, | 425 | static int eesoxscsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
426 | * int length, int host_no, int inout) | ||
427 | * Purpose : Return information about the driver to a user process accessing | ||
428 | * the /proc filesystem. | ||
429 | * Params : buffer - a buffer to write information to | ||
430 | * start - a pointer into this buffer set by this routine to the start | ||
431 | * of the required information. | ||
432 | * offset - offset into information that we have read up to. | ||
433 | * length - length of buffer | ||
434 | * host_no - host number to return information for | ||
435 | * inout - 0 for reading, 1 for writing. | ||
436 | * Returns : length of data written to buffer. | ||
437 | */ | ||
438 | int eesoxscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | ||
439 | int length, int inout) | ||
440 | { | 426 | { |
441 | struct eesoxscsi_info *info; | 427 | struct eesoxscsi_info *info; |
442 | char *p = buffer; | ||
443 | int pos; | ||
444 | |||
445 | if (inout == 1) | ||
446 | return eesoxscsi_set_proc_info(host, buffer, length); | ||
447 | 428 | ||
448 | info = (struct eesoxscsi_info *)host->hostdata; | 429 | info = (struct eesoxscsi_info *)host->hostdata; |
449 | 430 | ||
450 | p += sprintf(p, "EESOX SCSI driver v%s\n", VERSION); | 431 | seq_printf(m, "EESOX SCSI driver v%s\n", VERSION); |
451 | p += fas216_print_host(&info->info, p); | 432 | fas216_print_host(&info->info, m); |
452 | p += sprintf(p, "Term : o%s\n", | 433 | seq_printf(m, "Term : o%s\n", |
453 | info->control & EESOX_TERM_ENABLE ? "n" : "ff"); | 434 | info->control & EESOX_TERM_ENABLE ? "n" : "ff"); |
454 | 435 | ||
455 | p += fas216_print_stats(&info->info, p); | 436 | fas216_print_stats(&info->info, m); |
456 | p += fas216_print_devices(&info->info, p); | 437 | fas216_print_devices(&info->info, m); |
457 | 438 | return 0; | |
458 | *start = buffer + offset; | ||
459 | pos = p - buffer - offset; | ||
460 | if (pos > length) | ||
461 | pos = length; | ||
462 | |||
463 | return pos; | ||
464 | } | 439 | } |
465 | 440 | ||
466 | static ssize_t eesoxscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) | 441 | static ssize_t eesoxscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -498,7 +473,8 @@ static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, | |||
498 | 473 | ||
499 | static struct scsi_host_template eesox_template = { | 474 | static struct scsi_host_template eesox_template = { |
500 | .module = THIS_MODULE, | 475 | .module = THIS_MODULE, |
501 | .proc_info = eesoxscsi_proc_info, | 476 | .show_info = eesoxscsi_show_info, |
477 | .write_info = eesoxscsi_set_proc_info, | ||
502 | .name = "EESOX SCSI", | 478 | .name = "EESOX SCSI", |
503 | .info = eesoxscsi_info, | 479 | .info = eesoxscsi_info, |
504 | .queuecommand = fas216_queue_command, | 480 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c index 737554c37d9e..b46a6f6c0eb3 100644 --- a/drivers/scsi/arm/fas216.c +++ b/drivers/scsi/arm/fas216.c | |||
@@ -2958,9 +2958,9 @@ void fas216_release(struct Scsi_Host *host) | |||
2958 | queue_free(&info->queues.issue); | 2958 | queue_free(&info->queues.issue); |
2959 | } | 2959 | } |
2960 | 2960 | ||
2961 | int fas216_print_host(FAS216_Info *info, char *buffer) | 2961 | void fas216_print_host(FAS216_Info *info, struct seq_file *m) |
2962 | { | 2962 | { |
2963 | return sprintf(buffer, | 2963 | seq_printf(m, |
2964 | "\n" | 2964 | "\n" |
2965 | "Chip : %s\n" | 2965 | "Chip : %s\n" |
2966 | " Address: 0x%p\n" | 2966 | " Address: 0x%p\n" |
@@ -2970,11 +2970,9 @@ int fas216_print_host(FAS216_Info *info, char *buffer) | |||
2970 | info->scsi.irq, info->scsi.dma); | 2970 | info->scsi.irq, info->scsi.dma); |
2971 | } | 2971 | } |
2972 | 2972 | ||
2973 | int fas216_print_stats(FAS216_Info *info, char *buffer) | 2973 | void fas216_print_stats(FAS216_Info *info, struct seq_file *m) |
2974 | { | 2974 | { |
2975 | char *p = buffer; | 2975 | seq_printf(m, "\n" |
2976 | |||
2977 | p += sprintf(p, "\n" | ||
2978 | "Command Statistics:\n" | 2976 | "Command Statistics:\n" |
2979 | " Queued : %u\n" | 2977 | " Queued : %u\n" |
2980 | " Issued : %u\n" | 2978 | " Issued : %u\n" |
@@ -2991,38 +2989,33 @@ int fas216_print_stats(FAS216_Info *info, char *buffer) | |||
2991 | info->stats.writes, info->stats.miscs, | 2989 | info->stats.writes, info->stats.miscs, |
2992 | info->stats.disconnects, info->stats.aborts, | 2990 | info->stats.disconnects, info->stats.aborts, |
2993 | info->stats.bus_resets, info->stats.host_resets); | 2991 | info->stats.bus_resets, info->stats.host_resets); |
2994 | |||
2995 | return p - buffer; | ||
2996 | } | 2992 | } |
2997 | 2993 | ||
2998 | int fas216_print_devices(FAS216_Info *info, char *buffer) | 2994 | void fas216_print_devices(FAS216_Info *info, struct seq_file *m) |
2999 | { | 2995 | { |
3000 | struct fas216_device *dev; | 2996 | struct fas216_device *dev; |
3001 | struct scsi_device *scd; | 2997 | struct scsi_device *scd; |
3002 | char *p = buffer; | ||
3003 | 2998 | ||
3004 | p += sprintf(p, "Device/Lun TaggedQ Parity Sync\n"); | 2999 | seq_printf(m, "Device/Lun TaggedQ Parity Sync\n"); |
3005 | 3000 | ||
3006 | shost_for_each_device(scd, info->host) { | 3001 | shost_for_each_device(scd, info->host) { |
3007 | dev = &info->device[scd->id]; | 3002 | dev = &info->device[scd->id]; |
3008 | p += sprintf(p, " %d/%d ", scd->id, scd->lun); | 3003 | seq_printf(m, " %d/%d ", scd->id, scd->lun); |
3009 | if (scd->tagged_supported) | 3004 | if (scd->tagged_supported) |
3010 | p += sprintf(p, "%3sabled(%3d) ", | 3005 | seq_printf(m, "%3sabled(%3d) ", |
3011 | scd->simple_tags ? "en" : "dis", | 3006 | scd->simple_tags ? "en" : "dis", |
3012 | scd->current_tag); | 3007 | scd->current_tag); |
3013 | else | 3008 | else |
3014 | p += sprintf(p, "unsupported "); | 3009 | seq_printf(m, "unsupported "); |
3015 | 3010 | ||
3016 | p += sprintf(p, "%3sabled ", dev->parity_enabled ? "en" : "dis"); | 3011 | seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis"); |
3017 | 3012 | ||
3018 | if (dev->sof) | 3013 | if (dev->sof) |
3019 | p += sprintf(p, "offset %d, %d ns\n", | 3014 | seq_printf(m, "offset %d, %d ns\n", |
3020 | dev->sof, dev->period * 4); | 3015 | dev->sof, dev->period * 4); |
3021 | else | 3016 | else |
3022 | p += sprintf(p, "async\n"); | 3017 | seq_printf(m, "async\n"); |
3023 | } | 3018 | } |
3024 | |||
3025 | return p - buffer; | ||
3026 | } | 3019 | } |
3027 | 3020 | ||
3028 | EXPORT_SYMBOL(fas216_init); | 3021 | EXPORT_SYMBOL(fas216_init); |
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h index df2e1b3ddfe2..c57c16ef8193 100644 --- a/drivers/scsi/arm/fas216.h +++ b/drivers/scsi/arm/fas216.h | |||
@@ -358,9 +358,9 @@ extern void fas216_remove (struct Scsi_Host *instance); | |||
358 | */ | 358 | */ |
359 | extern void fas216_release (struct Scsi_Host *instance); | 359 | extern void fas216_release (struct Scsi_Host *instance); |
360 | 360 | ||
361 | extern int fas216_print_host(FAS216_Info *info, char *buffer); | 361 | extern void fas216_print_host(FAS216_Info *info, struct seq_file *m); |
362 | extern int fas216_print_stats(FAS216_Info *info, char *buffer); | 362 | extern void fas216_print_stats(FAS216_Info *info, struct seq_file *m); |
363 | extern int fas216_print_devices(FAS216_Info *info, char *buffer); | 363 | extern void fas216_print_devices(FAS216_Info *info, struct seq_file *m); |
364 | 364 | ||
365 | /* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt) | 365 | /* Function: int fas216_eh_abort(struct scsi_cmnd *SCpnt) |
366 | * Purpose : abort this command | 366 | * Purpose : abort this command |
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index 48facdc18002..4266eef8aca1 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) | 31 | #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) |
32 | #define NCR5380_intr oakscsi_intr | 32 | #define NCR5380_intr oakscsi_intr |
33 | #define NCR5380_queue_command oakscsi_queue_command | 33 | #define NCR5380_queue_command oakscsi_queue_command |
34 | #define NCR5380_proc_info oakscsi_proc_info | 34 | #define NCR5380_show_info oakscsi_show_info |
35 | #define NCR5380_write_info oakscsi_write_info | ||
35 | 36 | ||
36 | #define NCR5380_implementation_fields \ | 37 | #define NCR5380_implementation_fields \ |
37 | void __iomem *base | 38 | void __iomem *base |
@@ -115,7 +116,8 @@ printk("reading %p len %d\n", addr, len); | |||
115 | 116 | ||
116 | static struct scsi_host_template oakscsi_template = { | 117 | static struct scsi_host_template oakscsi_template = { |
117 | .module = THIS_MODULE, | 118 | .module = THIS_MODULE, |
118 | .proc_info = oakscsi_proc_info, | 119 | .show_info = oakscsi_show_info, |
120 | .write_info = oakscsi_write_info, | ||
119 | .name = "Oak 16-bit SCSI", | 121 | .name = "Oak 16-bit SCSI", |
120 | .info = oakscsi_info, | 122 | .info = oakscsi_info, |
121 | .queuecommand = oakscsi_queue_command, | 123 | .queuecommand = oakscsi_queue_command, |
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 246600b93555..abc9593615e9 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c | |||
@@ -237,32 +237,20 @@ powertecscsi_set_proc_info(struct Scsi_Host *host, char *buffer, int length) | |||
237 | * inout - 0 for reading, 1 for writing. | 237 | * inout - 0 for reading, 1 for writing. |
238 | * Returns : length of data written to buffer. | 238 | * Returns : length of data written to buffer. |
239 | */ | 239 | */ |
240 | int powertecscsi_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 240 | static int powertecscsi_show_info(struct seq_file *m, struct Scsi_Host *host) |
241 | int length, int inout) | ||
242 | { | 241 | { |
243 | struct powertec_info *info; | 242 | struct powertec_info *info; |
244 | char *p = buffer; | ||
245 | int pos; | ||
246 | |||
247 | if (inout == 1) | ||
248 | return powertecscsi_set_proc_info(host, buffer, length); | ||
249 | 243 | ||
250 | info = (struct powertec_info *)host->hostdata; | 244 | info = (struct powertec_info *)host->hostdata; |
251 | 245 | ||
252 | p += sprintf(p, "PowerTec SCSI driver v%s\n", VERSION); | 246 | seq_printf(m, "PowerTec SCSI driver v%s\n", VERSION); |
253 | p += fas216_print_host(&info->info, p); | 247 | fas216_print_host(&info->info, m); |
254 | p += sprintf(p, "Term : o%s\n", | 248 | seq_printf(m, "Term : o%s\n", |
255 | info->term_ctl ? "n" : "ff"); | 249 | info->term_ctl ? "n" : "ff"); |
256 | 250 | ||
257 | p += fas216_print_stats(&info->info, p); | 251 | fas216_print_stats(&info->info, m); |
258 | p += fas216_print_devices(&info->info, p); | 252 | fas216_print_devices(&info->info, m); |
259 | 253 | return 0; | |
260 | *start = buffer + offset; | ||
261 | pos = p - buffer - offset; | ||
262 | if (pos > length) | ||
263 | pos = length; | ||
264 | |||
265 | return pos; | ||
266 | } | 254 | } |
267 | 255 | ||
268 | static ssize_t powertecscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) | 256 | static ssize_t powertecscsi_show_term(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -291,7 +279,8 @@ static DEVICE_ATTR(bus_term, S_IRUGO | S_IWUSR, | |||
291 | 279 | ||
292 | static struct scsi_host_template powertecscsi_template = { | 280 | static struct scsi_host_template powertecscsi_template = { |
293 | .module = THIS_MODULE, | 281 | .module = THIS_MODULE, |
294 | .proc_info = powertecscsi_proc_info, | 282 | .show_info = powertecscsi_show_info, |
283 | .write_info = powertecscsi_set_proc_info, | ||
295 | .name = "PowerTec SCSI", | 284 | .name = "PowerTec SCSI", |
296 | .info = powertecscsi_info, | 285 | .info = powertecscsi_info, |
297 | .queuecommand = fas216_queue_command, | 286 | .queuecommand = fas216_queue_command, |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 2db79b469d9e..0f3cdbc80ba6 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -719,119 +719,94 @@ static void __init NCR5380_print_options(struct Scsi_Host *instance) | |||
719 | * Inputs : instance, pointer to this instance. | 719 | * Inputs : instance, pointer to this instance. |
720 | */ | 720 | */ |
721 | 721 | ||
722 | static void NCR5380_print_status(struct Scsi_Host *instance) | 722 | static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd) |
723 | { | 723 | { |
724 | char *pr_bfr; | 724 | int i, s; |
725 | char *start; | 725 | unsigned char *command; |
726 | int len; | 726 | printk("scsi%d: destination target %d, lun %d\n", |
727 | 727 | H_NO(cmd), cmd->device->id, cmd->device->lun); | |
728 | NCR_PRINT(NDEBUG_ANY); | 728 | printk(KERN_CONT " command = "); |
729 | NCR_PRINT_PHASE(NDEBUG_ANY); | 729 | command = cmd->cmnd; |
730 | 730 | printk(KERN_CONT "%2d (0x%02x)", command[0], command[0]); | |
731 | pr_bfr = (char *)__get_free_page(GFP_ATOMIC); | 731 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
732 | if (!pr_bfr) { | 732 | printk(KERN_CONT " %02x", command[i]); |
733 | printk("NCR5380_print_status: no memory for print buffer\n"); | 733 | printk("\n"); |
734 | return; | ||
735 | } | ||
736 | len = NCR5380_proc_info(instance, pr_bfr, &start, 0, PAGE_SIZE, 0); | ||
737 | pr_bfr[len] = 0; | ||
738 | printk("\n%s\n", pr_bfr); | ||
739 | free_page((unsigned long)pr_bfr); | ||
740 | } | 734 | } |
741 | 735 | ||
742 | 736 | static void NCR5380_print_status(struct Scsi_Host *instance) | |
743 | /******************************************/ | ||
744 | /* | ||
745 | * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] | ||
746 | * | ||
747 | * *buffer: I/O buffer | ||
748 | * **start: if inout == FALSE pointer into buffer where user read should start | ||
749 | * offset: current offset | ||
750 | * length: length of buffer | ||
751 | * hostno: Scsi_Host host_no | ||
752 | * inout: TRUE - user is writing; FALSE - user is reading | ||
753 | * | ||
754 | * Return the number of bytes read from or written | ||
755 | */ | ||
756 | |||
757 | #undef SPRINTF | ||
758 | #define SPRINTF(fmt,args...) \ | ||
759 | do { \ | ||
760 | if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ | ||
761 | pos += sprintf(pos, fmt , ## args); \ | ||
762 | } while(0) | ||
763 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length); | ||
764 | |||
765 | static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, | ||
766 | char **start, off_t offset, int length, int inout) | ||
767 | { | 737 | { |
768 | char *pos = buffer; | ||
769 | struct NCR5380_hostdata *hostdata; | 738 | struct NCR5380_hostdata *hostdata; |
770 | Scsi_Cmnd *ptr; | 739 | Scsi_Cmnd *ptr; |
771 | unsigned long flags; | 740 | unsigned long flags; |
772 | off_t begin = 0; | 741 | |
773 | #define check_offset() \ | 742 | NCR_PRINT(NDEBUG_ANY); |
774 | do { \ | 743 | NCR_PRINT_PHASE(NDEBUG_ANY); |
775 | if (pos - buffer < offset - begin) { \ | ||
776 | begin += pos - buffer; \ | ||
777 | pos = buffer; \ | ||
778 | } \ | ||
779 | } while (0) | ||
780 | 744 | ||
781 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; | 745 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; |
782 | 746 | ||
783 | if (inout) /* Has data been written to the file ? */ | 747 | printk("\nNCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); |
784 | return -ENOSYS; /* Currently this is a no-op */ | ||
785 | SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); | ||
786 | check_offset(); | ||
787 | local_irq_save(flags); | 748 | local_irq_save(flags); |
788 | SPRINTF("NCR5380: coroutine is%s running.\n", | 749 | printk("NCR5380: coroutine is%s running.\n", |
789 | main_running ? "" : "n't"); | 750 | main_running ? "" : "n't"); |
790 | check_offset(); | ||
791 | if (!hostdata->connected) | 751 | if (!hostdata->connected) |
792 | SPRINTF("scsi%d: no currently connected command\n", HOSTNO); | 752 | printk("scsi%d: no currently connected command\n", HOSTNO); |
793 | else | 753 | else |
794 | pos = lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, | 754 | lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected); |
795 | pos, buffer, length); | 755 | printk("scsi%d: issue_queue\n", HOSTNO); |
796 | SPRINTF("scsi%d: issue_queue\n", HOSTNO); | 756 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) |
797 | check_offset(); | 757 | lprint_Scsi_Cmnd(ptr); |
798 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) { | ||
799 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | ||
800 | check_offset(); | ||
801 | } | ||
802 | 758 | ||
803 | SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); | 759 | printk("scsi%d: disconnected_queue\n", HOSTNO); |
804 | check_offset(); | ||
805 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; | 760 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; |
806 | ptr = NEXT(ptr)) { | 761 | ptr = NEXT(ptr)) |
807 | pos = lprint_Scsi_Cmnd(ptr, pos, buffer, length); | 762 | lprint_Scsi_Cmnd(ptr); |
808 | check_offset(); | ||
809 | } | ||
810 | 763 | ||
811 | local_irq_restore(flags); | 764 | local_irq_restore(flags); |
812 | *start = buffer + (offset - begin); | 765 | printk("\n"); |
813 | if (pos - buffer < offset - begin) | ||
814 | return 0; | ||
815 | else if (pos - buffer - (offset - begin) < length) | ||
816 | return pos - buffer - (offset - begin); | ||
817 | return length; | ||
818 | } | 766 | } |
819 | 767 | ||
820 | static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length) | 768 | static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m) |
821 | { | 769 | { |
822 | int i, s; | 770 | int i, s; |
823 | unsigned char *command; | 771 | unsigned char *command; |
824 | SPRINTF("scsi%d: destination target %d, lun %d\n", | 772 | seq_printf(m, "scsi%d: destination target %d, lun %d\n", |
825 | H_NO(cmd), cmd->device->id, cmd->device->lun); | 773 | H_NO(cmd), cmd->device->id, cmd->device->lun); |
826 | SPRINTF(" command = "); | 774 | seq_printf(m, " command = "); |
827 | command = cmd->cmnd; | 775 | command = cmd->cmnd; |
828 | SPRINTF("%2d (0x%02x)", command[0], command[0]); | 776 | seq_printf(m, "%2d (0x%02x)", command[0], command[0]); |
829 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 777 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
830 | SPRINTF(" %02x", command[i]); | 778 | seq_printf(m, " %02x", command[i]); |
831 | SPRINTF("\n"); | 779 | seq_printf(m, "\n"); |
832 | return pos; | ||
833 | } | 780 | } |
834 | 781 | ||
782 | static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
783 | { | ||
784 | struct NCR5380_hostdata *hostdata; | ||
785 | Scsi_Cmnd *ptr; | ||
786 | unsigned long flags; | ||
787 | |||
788 | hostdata = (struct NCR5380_hostdata *)instance->hostdata; | ||
789 | |||
790 | seq_printf(m, "NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); | ||
791 | local_irq_save(flags); | ||
792 | seq_printf(m, "NCR5380: coroutine is%s running.\n", | ||
793 | main_running ? "" : "n't"); | ||
794 | if (!hostdata->connected) | ||
795 | seq_printf(m, "scsi%d: no currently connected command\n", HOSTNO); | ||
796 | else | ||
797 | show_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); | ||
798 | seq_printf(m, "scsi%d: issue_queue\n", HOSTNO); | ||
799 | for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) | ||
800 | show_Scsi_Cmnd(ptr, m); | ||
801 | |||
802 | seq_printf(m, "scsi%d: disconnected_queue\n", HOSTNO); | ||
803 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; | ||
804 | ptr = NEXT(ptr)) | ||
805 | show_Scsi_Cmnd(ptr, m); | ||
806 | |||
807 | local_irq_restore(flags); | ||
808 | return 0; | ||
809 | } | ||
835 | 810 | ||
836 | /* | 811 | /* |
837 | * Function : void NCR5380_init (struct Scsi_Host *instance) | 812 | * Function : void NCR5380_init (struct Scsi_Host *instance) |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index df740cbbaef4..a3e6c8a3ff0f 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -1100,7 +1100,7 @@ static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value) | |||
1100 | #include "atari_NCR5380.c" | 1100 | #include "atari_NCR5380.c" |
1101 | 1101 | ||
1102 | static struct scsi_host_template driver_template = { | 1102 | static struct scsi_host_template driver_template = { |
1103 | .proc_info = atari_scsi_proc_info, | 1103 | .show_info = atari_scsi_show_info, |
1104 | .name = "Atari native SCSI", | 1104 | .name = "Atari native SCSI", |
1105 | .detect = atari_scsi_detect, | 1105 | .detect = atari_scsi_detect, |
1106 | .release = atari_scsi_release, | 1106 | .release = atari_scsi_release, |
diff --git a/drivers/scsi/atari_scsi.h b/drivers/scsi/atari_scsi.h index bd52df78b209..11c624bb122d 100644 --- a/drivers/scsi/atari_scsi.h +++ b/drivers/scsi/atari_scsi.h | |||
@@ -47,7 +47,7 @@ | |||
47 | #define NCR5380_intr atari_scsi_intr | 47 | #define NCR5380_intr atari_scsi_intr |
48 | #define NCR5380_queue_command atari_scsi_queue_command | 48 | #define NCR5380_queue_command atari_scsi_queue_command |
49 | #define NCR5380_abort atari_scsi_abort | 49 | #define NCR5380_abort atari_scsi_abort |
50 | #define NCR5380_proc_info atari_scsi_proc_info | 50 | #define NCR5380_show_info atari_scsi_show_info |
51 | #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0) | 51 | #define NCR5380_dma_read_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 0) |
52 | #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1) | 52 | #define NCR5380_dma_write_setup(inst,d,c) atari_scsi_dma_setup (inst, d, c, 1) |
53 | #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst ) | 53 | #define NCR5380_dma_residual(inst) atari_scsi_dma_residual( inst ) |
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index cfc73041f102..15a629d8ed08 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -3099,38 +3099,14 @@ static const char *atp870u_info(struct Scsi_Host *notused) | |||
3099 | return buffer; | 3099 | return buffer; |
3100 | } | 3100 | } |
3101 | 3101 | ||
3102 | #define BLS buffer + len + size | 3102 | static int atp870u_show_info(struct seq_file *m, struct Scsi_Host *HBAptr) |
3103 | static int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer, | ||
3104 | char **start, off_t offset, int length, int inout) | ||
3105 | { | 3103 | { |
3106 | static u8 buff[512]; | 3104 | seq_printf(m, "ACARD AEC-671X Driver Version: 2.6+ac\n"); |
3107 | int size = 0; | 3105 | seq_printf(m, "\n"); |
3108 | int len = 0; | 3106 | seq_printf(m, "Adapter Configuration:\n"); |
3109 | off_t begin = 0; | 3107 | seq_printf(m, " Base IO: %#.4lx\n", HBAptr->io_port); |
3110 | off_t pos = 0; | 3108 | seq_printf(m, " IRQ: %d\n", HBAptr->irq); |
3111 | 3109 | return 0; | |
3112 | if (inout) | ||
3113 | return -EINVAL; | ||
3114 | if (offset == 0) | ||
3115 | memset(buff, 0, sizeof(buff)); | ||
3116 | size += sprintf(BLS, "ACARD AEC-671X Driver Version: 2.6+ac\n"); | ||
3117 | len += size; | ||
3118 | pos = begin + len; | ||
3119 | size = 0; | ||
3120 | |||
3121 | size += sprintf(BLS, "\n"); | ||
3122 | size += sprintf(BLS, "Adapter Configuration:\n"); | ||
3123 | size += sprintf(BLS, " Base IO: %#.4lx\n", HBAptr->io_port); | ||
3124 | size += sprintf(BLS, " IRQ: %d\n", HBAptr->irq); | ||
3125 | len += size; | ||
3126 | pos = begin + len; | ||
3127 | |||
3128 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
3129 | len -= (offset - begin); /* Start slop */ | ||
3130 | if (len > length) { | ||
3131 | len = length; /* Ending slop */ | ||
3132 | } | ||
3133 | return (len); | ||
3134 | } | 3110 | } |
3135 | 3111 | ||
3136 | 3112 | ||
@@ -3177,7 +3153,7 @@ static struct scsi_host_template atp870u_template = { | |||
3177 | .module = THIS_MODULE, | 3153 | .module = THIS_MODULE, |
3178 | .name = "atp870u" /* name */, | 3154 | .name = "atp870u" /* name */, |
3179 | .proc_name = "atp870u", | 3155 | .proc_name = "atp870u", |
3180 | .proc_info = atp870u_proc_info, | 3156 | .show_info = atp870u_show_info, |
3181 | .info = atp870u_info /* info */, | 3157 | .info = atp870u_info /* info */, |
3182 | .queuecommand = atp870u_queuecommand /* queuecommand */, | 3158 | .queuecommand = atp870u_queuecommand /* queuecommand */, |
3183 | .eh_abort_handler = atp870u_abort /* abort */, | 3159 | .eh_abort_handler = atp870u_abort /* abort */, |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index fed486bfd3f4..694e13c45dfd 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -4616,26 +4616,21 @@ static void adapter_uninit(struct AdapterCtlBlk *acb) | |||
4616 | 4616 | ||
4617 | 4617 | ||
4618 | #undef SPRINTF | 4618 | #undef SPRINTF |
4619 | #define SPRINTF(args...) pos += sprintf(pos, args) | 4619 | #define SPRINTF(args...) seq_printf(m,##args) |
4620 | 4620 | ||
4621 | #undef YESNO | 4621 | #undef YESNO |
4622 | #define YESNO(YN) \ | 4622 | #define YESNO(YN) \ |
4623 | if (YN) SPRINTF(" Yes ");\ | 4623 | if (YN) SPRINTF(" Yes ");\ |
4624 | else SPRINTF(" No ") | 4624 | else SPRINTF(" No ") |
4625 | 4625 | ||
4626 | static int dc395x_proc_info(struct Scsi_Host *host, char *buffer, | 4626 | static int dc395x_show_info(struct seq_file *m, struct Scsi_Host *host) |
4627 | char **start, off_t offset, int length, int inout) | ||
4628 | { | 4627 | { |
4629 | struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata; | 4628 | struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata; |
4630 | int spd, spd1; | 4629 | int spd, spd1; |
4631 | char *pos = buffer; | ||
4632 | struct DeviceCtlBlk *dcb; | 4630 | struct DeviceCtlBlk *dcb; |
4633 | unsigned long flags; | 4631 | unsigned long flags; |
4634 | int dev; | 4632 | int dev; |
4635 | 4633 | ||
4636 | if (inout) /* Has data been written to the file ? */ | ||
4637 | return -EPERM; | ||
4638 | |||
4639 | SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n"); | 4634 | SPRINTF(DC395X_BANNER " PCI SCSI Host Adapter\n"); |
4640 | SPRINTF(" Driver Version " DC395X_VERSION "\n"); | 4635 | SPRINTF(" Driver Version " DC395X_VERSION "\n"); |
4641 | 4636 | ||
@@ -4735,22 +4730,15 @@ static int dc395x_proc_info(struct Scsi_Host *host, char *buffer, | |||
4735 | SPRINTF("END\n"); | 4730 | SPRINTF("END\n"); |
4736 | } | 4731 | } |
4737 | 4732 | ||
4738 | *start = buffer + offset; | ||
4739 | DC395x_UNLOCK_IO(acb->scsi_host, flags); | 4733 | DC395x_UNLOCK_IO(acb->scsi_host, flags); |
4740 | 4734 | return 0; | |
4741 | if (pos - buffer < offset) | ||
4742 | return 0; | ||
4743 | else if (pos - buffer - offset < length) | ||
4744 | return pos - buffer - offset; | ||
4745 | else | ||
4746 | return length; | ||
4747 | } | 4735 | } |
4748 | 4736 | ||
4749 | 4737 | ||
4750 | static struct scsi_host_template dc395x_driver_template = { | 4738 | static struct scsi_host_template dc395x_driver_template = { |
4751 | .module = THIS_MODULE, | 4739 | .module = THIS_MODULE, |
4752 | .proc_name = DC395X_NAME, | 4740 | .proc_name = DC395X_NAME, |
4753 | .proc_info = dc395x_proc_info, | 4741 | .show_info = dc395x_show_info, |
4754 | .name = DC395X_BANNER " " DC395X_VERSION, | 4742 | .name = DC395X_BANNER " " DC395X_VERSION, |
4755 | .queuecommand = dc395x_queue_command, | 4743 | .queuecommand = dc395x_queue_command, |
4756 | .bios_param = dc395x_bios_param, | 4744 | .bios_param = dc395x_bios_param, |
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b6e2700ec1c6..19e1b422260a 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -553,36 +553,14 @@ static const char *adpt_info(struct Scsi_Host *host) | |||
553 | return (char *) (pHba->detail); | 553 | return (char *) (pHba->detail); |
554 | } | 554 | } |
555 | 555 | ||
556 | static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 556 | static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host) |
557 | int length, int inout) | ||
558 | { | 557 | { |
559 | struct adpt_device* d; | 558 | struct adpt_device* d; |
560 | int id; | 559 | int id; |
561 | int chan; | 560 | int chan; |
562 | int len = 0; | ||
563 | int begin = 0; | ||
564 | int pos = 0; | ||
565 | adpt_hba* pHba; | 561 | adpt_hba* pHba; |
566 | int unit; | 562 | int unit; |
567 | 563 | ||
568 | *start = buffer; | ||
569 | if (inout == TRUE) { | ||
570 | /* | ||
571 | * The user has done a write and wants us to take the | ||
572 | * data in the buffer and do something with it. | ||
573 | * proc_scsiwrite calls us with inout = 1 | ||
574 | * | ||
575 | * Read data from buffer (writing to us) - NOT SUPPORTED | ||
576 | */ | ||
577 | return -EINVAL; | ||
578 | } | ||
579 | |||
580 | /* | ||
581 | * inout = 0 means the user has done a read and wants information | ||
582 | * returned, so we write information about the cards into the buffer | ||
583 | * proc_scsiread() calls us with inout = 0 | ||
584 | */ | ||
585 | |||
586 | // Find HBA (host bus adapter) we are looking for | 564 | // Find HBA (host bus adapter) we are looking for |
587 | mutex_lock(&adpt_configuration_lock); | 565 | mutex_lock(&adpt_configuration_lock); |
588 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 566 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
@@ -596,86 +574,30 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of | |||
596 | } | 574 | } |
597 | host = pHba->host; | 575 | host = pHba->host; |
598 | 576 | ||
599 | len = sprintf(buffer , "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); | 577 | seq_printf(m, "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); |
600 | len += sprintf(buffer+len, "%s\n", pHba->detail); | 578 | seq_printf(m, "%s\n", pHba->detail); |
601 | len += sprintf(buffer+len, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", | 579 | seq_printf(m, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", |
602 | pHba->host->host_no, pHba->name, host->irq); | 580 | pHba->host->host_no, pHba->name, host->irq); |
603 | len += sprintf(buffer+len, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", | 581 | seq_printf(m, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", |
604 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); | 582 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); |
605 | 583 | ||
606 | pos = begin + len; | 584 | seq_printf(m, "Devices:\n"); |
607 | |||
608 | /* CHECKPOINT */ | ||
609 | if(pos > offset + length) { | ||
610 | goto stop_output; | ||
611 | } | ||
612 | if(pos <= offset) { | ||
613 | /* | ||
614 | * If we haven't even written to where we last left | ||
615 | * off (the last time we were called), reset the | ||
616 | * beginning pointer. | ||
617 | */ | ||
618 | len = 0; | ||
619 | begin = pos; | ||
620 | } | ||
621 | len += sprintf(buffer+len, "Devices:\n"); | ||
622 | for(chan = 0; chan < MAX_CHANNEL; chan++) { | 585 | for(chan = 0; chan < MAX_CHANNEL; chan++) { |
623 | for(id = 0; id < MAX_ID; id++) { | 586 | for(id = 0; id < MAX_ID; id++) { |
624 | d = pHba->channel[chan].device[id]; | 587 | d = pHba->channel[chan].device[id]; |
625 | while(d){ | 588 | while(d) { |
626 | len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor); | 589 | seq_printf(m,"\t%-24.24s", d->pScsi_dev->vendor); |
627 | len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev); | 590 | seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev); |
628 | pos = begin + len; | ||
629 | |||
630 | |||
631 | /* CHECKPOINT */ | ||
632 | if(pos > offset + length) { | ||
633 | goto stop_output; | ||
634 | } | ||
635 | if(pos <= offset) { | ||
636 | len = 0; | ||
637 | begin = pos; | ||
638 | } | ||
639 | 591 | ||
640 | unit = d->pI2o_dev->lct_data.tid; | 592 | unit = d->pI2o_dev->lct_data.tid; |
641 | len += sprintf(buffer+len, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", | 593 | seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", |
642 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, | 594 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, |
643 | scsi_device_online(d->pScsi_dev)? "online":"offline"); | 595 | scsi_device_online(d->pScsi_dev)? "online":"offline"); |
644 | pos = begin + len; | ||
645 | |||
646 | /* CHECKPOINT */ | ||
647 | if(pos > offset + length) { | ||
648 | goto stop_output; | ||
649 | } | ||
650 | if(pos <= offset) { | ||
651 | len = 0; | ||
652 | begin = pos; | ||
653 | } | ||
654 | |||
655 | d = d->next_lun; | 596 | d = d->next_lun; |
656 | } | 597 | } |
657 | } | 598 | } |
658 | } | 599 | } |
659 | 600 | return 0; | |
660 | /* | ||
661 | * begin is where we last checked our position with regards to offset | ||
662 | * begin is always less than offset. len is relative to begin. It | ||
663 | * is the number of bytes written past begin | ||
664 | * | ||
665 | */ | ||
666 | stop_output: | ||
667 | /* stop the output and calculate the correct length */ | ||
668 | *(buffer + len) = '\0'; | ||
669 | |||
670 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
671 | len -= (offset - begin); | ||
672 | if(len > length) { | ||
673 | len = length; | ||
674 | } else if(len < 0){ | ||
675 | len = 0; | ||
676 | **start = '\0'; | ||
677 | } | ||
678 | return len; | ||
679 | } | 601 | } |
680 | 602 | ||
681 | /* | 603 | /* |
@@ -3639,7 +3561,7 @@ static struct scsi_host_template driver_template = { | |||
3639 | .module = THIS_MODULE, | 3561 | .module = THIS_MODULE, |
3640 | .name = "dpt_i2o", | 3562 | .name = "dpt_i2o", |
3641 | .proc_name = "dpt_i2o", | 3563 | .proc_name = "dpt_i2o", |
3642 | .proc_info = adpt_proc_info, | 3564 | .show_info = adpt_show_info, |
3643 | .info = adpt_info, | 3565 | .info = adpt_info, |
3644 | .queuecommand = adpt_queue, | 3566 | .queuecommand = adpt_queue, |
3645 | .eh_abort_handler = adpt_abort, | 3567 | .eh_abort_handler = adpt_abort, |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 4b11bb04f5c4..d01f01604140 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -216,7 +216,8 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) | |||
216 | int sig, count; | 216 | int sig, count; |
217 | 217 | ||
218 | tpnt->proc_name = "dtc3x80"; | 218 | tpnt->proc_name = "dtc3x80"; |
219 | tpnt->proc_info = &dtc_proc_info; | 219 | tpnt->show_info = dtc_show_info; |
220 | tpnt->write_info = dtc_write_info; | ||
220 | 221 | ||
221 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { | 222 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { |
222 | addr = 0; | 223 | addr = 0; |
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h index cdc621204b66..92d7cfc3f4fc 100644 --- a/drivers/scsi/dtc.h +++ b/drivers/scsi/dtc.h | |||
@@ -88,7 +88,8 @@ static int dtc_bus_reset(Scsi_Cmnd *); | |||
88 | #define NCR5380_queue_command dtc_queue_command | 88 | #define NCR5380_queue_command dtc_queue_command |
89 | #define NCR5380_abort dtc_abort | 89 | #define NCR5380_abort dtc_abort |
90 | #define NCR5380_bus_reset dtc_bus_reset | 90 | #define NCR5380_bus_reset dtc_bus_reset |
91 | #define NCR5380_proc_info dtc_proc_info | 91 | #define NCR5380_show_info dtc_show_info |
92 | #define NCR5380_write_info dtc_write_info | ||
92 | 93 | ||
93 | /* 15 12 11 10 | 94 | /* 15 12 11 10 |
94 | 1001 1100 0000 0000 */ | 95 | 1001 1100 0000 0000 */ |
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index d5f8362335d3..356def44ce58 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -92,58 +92,22 @@ static unsigned long queue_counter; | |||
92 | 92 | ||
93 | static struct scsi_host_template driver_template; | 93 | static struct scsi_host_template driver_template; |
94 | 94 | ||
95 | /* | 95 | static int eata_pio_show_info(struct seq_file *m, struct Scsi_Host *shost) |
96 | * eata_proc_info | ||
97 | * inout : decides on the direction of the dataflow and the meaning of the | ||
98 | * variables | ||
99 | * buffer: If inout==FALSE data is being written to it else read from it | ||
100 | * *start: If inout==FALSE start of the valid data in the buffer | ||
101 | * offset: If inout==FALSE offset from the beginning of the imaginary file | ||
102 | * from which we start writing into the buffer | ||
103 | * length: If inout==FALSE max number of bytes to be written into the buffer | ||
104 | * else number of bytes in the buffer | ||
105 | */ | ||
106 | static int eata_pio_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, | ||
107 | int length, int rw) | ||
108 | { | 96 | { |
109 | int len = 0; | 97 | seq_printf(m, "EATA (Extended Attachment) PIO driver version: " |
110 | off_t begin = 0, pos = 0; | ||
111 | |||
112 | if (rw) | ||
113 | return -ENOSYS; | ||
114 | |||
115 | len += sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: " | ||
116 | "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB); | 98 | "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB); |
117 | len += sprintf(buffer + len, "queued commands: %10ld\n" | 99 | seq_printf(m, "queued commands: %10ld\n" |
118 | "processed interrupts:%10ld\n", queue_counter, int_counter); | 100 | "processed interrupts:%10ld\n", queue_counter, int_counter); |
119 | len += sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n", | 101 | seq_printf(m, "\nscsi%-2d: HBA %.10s\n", |
120 | shost->host_no, SD(shost)->name); | 102 | shost->host_no, SD(shost)->name); |
121 | len += sprintf(buffer + len, "Firmware revision: v%s\n", | 103 | seq_printf(m, "Firmware revision: v%s\n", |
122 | SD(shost)->revision); | 104 | SD(shost)->revision); |
123 | len += sprintf(buffer + len, "IO: PIO\n"); | 105 | seq_printf(m, "IO: PIO\n"); |
124 | len += sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base); | 106 | seq_printf(m, "Base IO : %#.4x\n", (u32) shost->base); |
125 | len += sprintf(buffer + len, "Host Bus: %s\n", | 107 | seq_printf(m, "Host Bus: %s\n", |
126 | (SD(shost)->bustype == 'P')?"PCI ": | 108 | (SD(shost)->bustype == 'P')?"PCI ": |
127 | (SD(shost)->bustype == 'E')?"EISA":"ISA "); | 109 | (SD(shost)->bustype == 'E')?"EISA":"ISA "); |
128 | 110 | return 0; | |
129 | pos = begin + len; | ||
130 | |||
131 | if (pos < offset) { | ||
132 | len = 0; | ||
133 | begin = pos; | ||
134 | } | ||
135 | if (pos > offset + length) | ||
136 | goto stop_output; | ||
137 | |||
138 | stop_output: | ||
139 | DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len)); | ||
140 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
141 | len -= (offset - begin); /* Start slop */ | ||
142 | if (len > length) | ||
143 | len = length; /* Ending slop */ | ||
144 | DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len)); | ||
145 | |||
146 | return len; | ||
147 | } | 111 | } |
148 | 112 | ||
149 | static int eata_pio_release(struct Scsi_Host *sh) | 113 | static int eata_pio_release(struct Scsi_Host *sh) |
@@ -985,7 +949,7 @@ static int eata_pio_detect(struct scsi_host_template *tpnt) | |||
985 | static struct scsi_host_template driver_template = { | 949 | static struct scsi_host_template driver_template = { |
986 | .proc_name = "eata_pio", | 950 | .proc_name = "eata_pio", |
987 | .name = "EATA (Extended Attachment) PIO driver", | 951 | .name = "EATA (Extended Attachment) PIO driver", |
988 | .proc_info = eata_pio_proc_info, | 952 | .show_info = eata_pio_show_info, |
989 | .detect = eata_pio_detect, | 953 | .detect = eata_pio_detect, |
990 | .release = eata_pio_release, | 954 | .release = eata_pio_release, |
991 | .queuecommand = eata_pio_queue, | 955 | .queuecommand = eata_pio_queue, |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 5041f925c191..5cec6c60ca22 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -745,42 +745,36 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
745 | 745 | ||
746 | #include "NCR5380.c" | 746 | #include "NCR5380.c" |
747 | 747 | ||
748 | #define PRINTP(x) len += sprintf(buffer+len, x) | 748 | #define PRINTP(x) seq_printf(m, x) |
749 | #define ANDP , | 749 | #define ANDP , |
750 | 750 | ||
751 | static int sprint_opcode(char *buffer, int len, int opcode) | 751 | static void sprint_opcode(struct seq_file *m, int opcode) |
752 | { | 752 | { |
753 | int start = len; | ||
754 | PRINTP("0x%02x " ANDP opcode); | 753 | PRINTP("0x%02x " ANDP opcode); |
755 | return len - start; | ||
756 | } | 754 | } |
757 | 755 | ||
758 | static int sprint_command(char *buffer, int len, unsigned char *command) | 756 | static void sprint_command(struct seq_file *m, unsigned char *command) |
759 | { | 757 | { |
760 | int i, s, start = len; | 758 | int i, s; |
761 | len += sprint_opcode(buffer, len, command[0]); | 759 | sprint_opcode(m, command[0]); |
762 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) | 760 | for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) |
763 | PRINTP("%02x " ANDP command[i]); | 761 | PRINTP("%02x " ANDP command[i]); |
764 | PRINTP("\n"); | 762 | PRINTP("\n"); |
765 | return len - start; | ||
766 | } | 763 | } |
767 | 764 | ||
768 | /** | 765 | /** |
769 | * sprintf_Scsi_Cmnd - print a scsi command | 766 | * sprintf_Scsi_Cmnd - print a scsi command |
770 | * @buffer: buffr to print into | 767 | * @m: seq_fil to print into |
771 | * @len: buffer length | ||
772 | * @cmd: SCSI command block | 768 | * @cmd: SCSI command block |
773 | * | 769 | * |
774 | * Print out the target and command data in hex | 770 | * Print out the target and command data in hex |
775 | */ | 771 | */ |
776 | 772 | ||
777 | static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) | 773 | static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd) |
778 | { | 774 | { |
779 | int start = len; | ||
780 | PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); | 775 | PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); |
781 | PRINTP(" command = "); | 776 | PRINTP(" command = "); |
782 | len += sprint_command(buffer, len, cmd->cmnd); | 777 | sprint_command(m, cmd->cmnd); |
783 | return len - start; | ||
784 | } | 778 | } |
785 | 779 | ||
786 | /** | 780 | /** |
@@ -800,9 +794,8 @@ static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd) | |||
800 | * Locks: global cli/lock for queue walk | 794 | * Locks: global cli/lock for queue walk |
801 | */ | 795 | */ |
802 | 796 | ||
803 | static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, char **start, off_t offset, int length, int inout) | 797 | static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_ptr) |
804 | { | 798 | { |
805 | int len = 0; | ||
806 | NCR5380_local_declare(); | 799 | NCR5380_local_declare(); |
807 | unsigned long flags; | 800 | unsigned long flags; |
808 | unsigned char status; | 801 | unsigned char status; |
@@ -853,16 +846,16 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
853 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); | 846 | PRINTP(" T:%d %s " ANDP dev->id ANDP scsi_device_type(dev->type)); |
854 | for (i = 0; i < 8; i++) | 847 | for (i = 0; i < 8; i++) |
855 | if (dev->vendor[i] >= 0x20) | 848 | if (dev->vendor[i] >= 0x20) |
856 | *(buffer + (len++)) = dev->vendor[i]; | 849 | seq_putc(m, dev->vendor[i]); |
857 | *(buffer + (len++)) = ' '; | 850 | seq_putc(m, ' '); |
858 | for (i = 0; i < 16; i++) | 851 | for (i = 0; i < 16; i++) |
859 | if (dev->model[i] >= 0x20) | 852 | if (dev->model[i] >= 0x20) |
860 | *(buffer + (len++)) = dev->model[i]; | 853 | seq_putc(m, dev->model[i]); |
861 | *(buffer + (len++)) = ' '; | 854 | seq_putc(m, ' '); |
862 | for (i = 0; i < 4; i++) | 855 | for (i = 0; i < 4; i++) |
863 | if (dev->rev[i] >= 0x20) | 856 | if (dev->rev[i] >= 0x20) |
864 | *(buffer + (len++)) = dev->rev[i]; | 857 | seq_putc(m, dev->rev[i]); |
865 | *(buffer + (len++)) = ' '; | 858 | seq_putc(m, ' '); |
866 | 859 | ||
867 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); | 860 | PRINTP("\n%10ld kb read in %5ld secs" ANDP br / 1024 ANDP tr); |
868 | if (tr) | 861 | if (tr) |
@@ -886,32 +879,28 @@ static int generic_NCR5380_proc_info(struct Scsi_Host *scsi_ptr, char *buffer, c | |||
886 | if (!hostdata->connected) { | 879 | if (!hostdata->connected) { |
887 | PRINTP("No currently connected command\n"); | 880 | PRINTP("No currently connected command\n"); |
888 | } else { | 881 | } else { |
889 | len += sprint_Scsi_Cmnd(buffer, len, (Scsi_Cmnd *) hostdata->connected); | 882 | sprint_Scsi_Cmnd(m, (Scsi_Cmnd *) hostdata->connected); |
890 | } | 883 | } |
891 | 884 | ||
892 | PRINTP("issue_queue\n"); | 885 | PRINTP("issue_queue\n"); |
893 | 886 | ||
894 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 887 | for (ptr = (Scsi_Cmnd *) hostdata->issue_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
895 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 888 | sprint_Scsi_Cmnd(m, ptr); |
896 | 889 | ||
897 | PRINTP("disconnected_queue\n"); | 890 | PRINTP("disconnected_queue\n"); |
898 | 891 | ||
899 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) | 892 | for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; ptr = (Scsi_Cmnd *) ptr->host_scribble) |
900 | len += sprint_Scsi_Cmnd(buffer, len, ptr); | 893 | sprint_Scsi_Cmnd(m, ptr); |
901 | 894 | ||
902 | *start = buffer + offset; | ||
903 | len -= offset; | ||
904 | if (len > length) | ||
905 | len = length; | ||
906 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); | 895 | spin_unlock_irqrestore(scsi_ptr->host_lock, flags); |
907 | return len; | 896 | return 0; |
908 | } | 897 | } |
909 | 898 | ||
910 | #undef PRINTP | 899 | #undef PRINTP |
911 | #undef ANDP | 900 | #undef ANDP |
912 | 901 | ||
913 | static struct scsi_host_template driver_template = { | 902 | static struct scsi_host_template driver_template = { |
914 | .proc_info = generic_NCR5380_proc_info, | 903 | .show_info = generic_NCR5380_show_info, |
915 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", | 904 | .name = "Generic NCR5380/NCR53C400 Scsi Driver", |
916 | .detect = generic_NCR5380_detect, | 905 | .detect = generic_NCR5380_detect, |
917 | .release = generic_NCR5380_release_resources, | 906 | .release = generic_NCR5380_release_resources, |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 59bceac51a4c..6d55b4e7e792 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -4676,7 +4676,8 @@ static struct scsi_host_template gdth_template = { | |||
4676 | .eh_bus_reset_handler = gdth_eh_bus_reset, | 4676 | .eh_bus_reset_handler = gdth_eh_bus_reset, |
4677 | .slave_configure = gdth_slave_configure, | 4677 | .slave_configure = gdth_slave_configure, |
4678 | .bios_param = gdth_bios_param, | 4678 | .bios_param = gdth_bios_param, |
4679 | .proc_info = gdth_proc_info, | 4679 | .show_info = gdth_show_info, |
4680 | .write_info = gdth_set_info, | ||
4680 | .eh_timed_out = gdth_timed_out, | 4681 | .eh_timed_out = gdth_timed_out, |
4681 | .proc_name = "gdth", | 4682 | .proc_name = "gdth", |
4682 | .can_queue = GDTH_MAXCMDS, | 4683 | .can_queue = GDTH_MAXCMDS, |
diff --git a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h index fbf6f0f4b0dd..3fd8b83ffbf9 100644 --- a/drivers/scsi/gdth.h +++ b/drivers/scsi/gdth.h | |||
@@ -1007,6 +1007,7 @@ typedef struct { | |||
1007 | 1007 | ||
1008 | /* function prototyping */ | 1008 | /* function prototyping */ |
1009 | 1009 | ||
1010 | int gdth_proc_info(struct Scsi_Host *, char *,char **,off_t,int,int); | 1010 | int gdth_show_info(struct seq_file *, struct Scsi_Host *); |
1011 | int gdth_set_info(struct Scsi_Host *, char *, int); | ||
1011 | 1012 | ||
1012 | #endif | 1013 | #endif |
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 652754319a4b..9fb632684863 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -5,23 +5,9 @@ | |||
5 | #include <linux/completion.h> | 5 | #include <linux/completion.h> |
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | 7 | ||
8 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, | 8 | int gdth_set_info(struct Scsi_Host *host, char *buffer, int length) |
9 | int inout) | ||
10 | { | 9 | { |
11 | gdth_ha_str *ha = shost_priv(host); | 10 | gdth_ha_str *ha = shost_priv(host); |
12 | |||
13 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | ||
14 | length,(int)offset,inout)); | ||
15 | |||
16 | if (inout) | ||
17 | return(gdth_set_info(buffer,length,host,ha)); | ||
18 | else | ||
19 | return(gdth_get_info(buffer,start,offset,length,host,ha)); | ||
20 | } | ||
21 | |||
22 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | ||
23 | gdth_ha_str *ha) | ||
24 | { | ||
25 | int ret_val = -EINVAL; | 11 | int ret_val = -EINVAL; |
26 | 12 | ||
27 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); | 13 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); |
@@ -149,12 +135,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
149 | return(-EINVAL); | 135 | return(-EINVAL); |
150 | } | 136 | } |
151 | 137 | ||
152 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 138 | int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) |
153 | struct Scsi_Host *host, gdth_ha_str *ha) | ||
154 | { | 139 | { |
155 | int size = 0,len = 0; | 140 | gdth_ha_str *ha = shost_priv(host); |
156 | int hlen; | 141 | int hlen; |
157 | off_t begin = 0,pos = 0; | ||
158 | int id, i, j, k, sec, flag; | 142 | int id, i, j, k, sec, flag; |
159 | int no_mdrv = 0, drv_no, is_mirr; | 143 | int no_mdrv = 0, drv_no, is_mirr; |
160 | u32 cnt; | 144 | u32 cnt; |
@@ -189,8 +173,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
189 | /* request is i.e. "cat /proc/scsi/gdth/0" */ | 173 | /* request is i.e. "cat /proc/scsi/gdth/0" */ |
190 | /* format: %-15s\t%-10s\t%-15s\t%s */ | 174 | /* format: %-15s\t%-10s\t%-15s\t%s */ |
191 | /* driver parameters */ | 175 | /* driver parameters */ |
192 | size = sprintf(buffer+len,"Driver Parameters:\n"); | 176 | seq_printf(m, "Driver Parameters:\n"); |
193 | len += size; pos = begin + len; | ||
194 | if (reserve_list[0] == 0xff) | 177 | if (reserve_list[0] == 0xff) |
195 | strcpy(hrec, "--"); | 178 | strcpy(hrec, "--"); |
196 | else { | 179 | else { |
@@ -201,69 +184,50 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
201 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); | 184 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); |
202 | } | 185 | } |
203 | } | 186 | } |
204 | size = sprintf(buffer+len, | 187 | seq_printf(m, |
205 | " reserve_mode: \t%d \treserve_list: \t%s\n", | 188 | " reserve_mode: \t%d \treserve_list: \t%s\n", |
206 | reserve_mode, hrec); | 189 | reserve_mode, hrec); |
207 | len += size; pos = begin + len; | 190 | seq_printf(m, |
208 | size = sprintf(buffer+len, | ||
209 | " max_ids: \t%-3d \thdr_channel: \t%d\n", | 191 | " max_ids: \t%-3d \thdr_channel: \t%d\n", |
210 | max_ids, hdr_channel); | 192 | max_ids, hdr_channel); |
211 | len += size; pos = begin + len; | ||
212 | 193 | ||
213 | /* controller information */ | 194 | /* controller information */ |
214 | size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); | 195 | seq_printf(m,"\nDisk Array Controller Information:\n"); |
215 | len += size; pos = begin + len; | 196 | seq_printf(m, |
216 | strcpy(hrec, ha->binfo.type_string); | ||
217 | size = sprintf(buffer+len, | ||
218 | " Number: \t%d \tName: \t%s\n", | 197 | " Number: \t%d \tName: \t%s\n", |
219 | ha->hanum, hrec); | 198 | ha->hanum, ha->binfo.type_string); |
220 | len += size; pos = begin + len; | ||
221 | 199 | ||
200 | seq_printf(m, | ||
201 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t", | ||
202 | GDTH_VERSION_STR); | ||
222 | if (ha->more_proc) | 203 | if (ha->more_proc) |
223 | sprintf(hrec, "%d.%02d.%02d-%c%03X", | 204 | seq_printf(m, "%d.%02d.%02d-%c%03X\n", |
224 | (u8)(ha->binfo.upd_fw_ver>>24), | 205 | (u8)(ha->binfo.upd_fw_ver>>24), |
225 | (u8)(ha->binfo.upd_fw_ver>>16), | 206 | (u8)(ha->binfo.upd_fw_ver>>16), |
226 | (u8)(ha->binfo.upd_fw_ver), | 207 | (u8)(ha->binfo.upd_fw_ver), |
227 | ha->bfeat.raid ? 'R':'N', | 208 | ha->bfeat.raid ? 'R':'N', |
228 | ha->binfo.upd_revision); | 209 | ha->binfo.upd_revision); |
229 | else | 210 | else |
230 | sprintf(hrec, "%d.%02d", (u8)(ha->cpar.version>>8), | 211 | seq_printf(m, "%d.%02d\n", (u8)(ha->cpar.version>>8), |
231 | (u8)(ha->cpar.version)); | 212 | (u8)(ha->cpar.version)); |
232 | |||
233 | size = sprintf(buffer+len, | ||
234 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t%s\n", | ||
235 | GDTH_VERSION_STR, hrec); | ||
236 | len += size; pos = begin + len; | ||
237 | 213 | ||
238 | if (ha->more_proc) { | 214 | if (ha->more_proc) |
239 | /* more information: 1. about controller */ | 215 | /* more information: 1. about controller */ |
240 | size = sprintf(buffer+len, | 216 | seq_printf(m, |
241 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", | 217 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", |
242 | ha->binfo.ser_no, ha->binfo.memsize / 1024); | 218 | ha->binfo.ser_no, ha->binfo.memsize / 1024); |
243 | len += size; pos = begin + len; | ||
244 | } | ||
245 | 219 | ||
246 | #ifdef GDTH_DMA_STATISTICS | 220 | #ifdef GDTH_DMA_STATISTICS |
247 | /* controller statistics */ | 221 | /* controller statistics */ |
248 | size = sprintf(buffer+len,"\nController Statistics:\n"); | 222 | seq_printf(m,"\nController Statistics:\n"); |
249 | len += size; pos = begin + len; | 223 | seq_printf(m, |
250 | size = sprintf(buffer+len, | ||
251 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", | 224 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", |
252 | ha->dma32_cnt, ha->dma64_cnt); | 225 | ha->dma32_cnt, ha->dma64_cnt); |
253 | len += size; pos = begin + len; | ||
254 | #endif | 226 | #endif |
255 | 227 | ||
256 | if (pos < offset) { | ||
257 | len = 0; | ||
258 | begin = pos; | ||
259 | } | ||
260 | if (pos > offset + length) | ||
261 | goto stop_output; | ||
262 | |||
263 | if (ha->more_proc) { | 228 | if (ha->more_proc) { |
264 | /* more information: 2. about physical devices */ | 229 | /* more information: 2. about physical devices */ |
265 | size = sprintf(buffer+len,"\nPhysical Devices:"); | 230 | seq_printf(m, "\nPhysical Devices:"); |
266 | len += size; pos = begin + len; | ||
267 | flag = FALSE; | 231 | flag = FALSE; |
268 | 232 | ||
269 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 233 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -309,21 +273,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
309 | strncpy(hrec+8,pdi->product,16); | 273 | strncpy(hrec+8,pdi->product,16); |
310 | strncpy(hrec+24,pdi->revision,4); | 274 | strncpy(hrec+24,pdi->revision,4); |
311 | hrec[28] = 0; | 275 | hrec[28] = 0; |
312 | size = sprintf(buffer+len, | 276 | seq_printf(m, |
313 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", | 277 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", |
314 | 'A'+i,pdi->target_id,pdi->lun,hrec); | 278 | 'A'+i,pdi->target_id,pdi->lun,hrec); |
315 | len += size; pos = begin + len; | ||
316 | flag = TRUE; | 279 | flag = TRUE; |
317 | pdi->no_ldrive &= 0xffff; | 280 | pdi->no_ldrive &= 0xffff; |
318 | if (pdi->no_ldrive == 0xffff) | 281 | if (pdi->no_ldrive == 0xffff) |
319 | strcpy(hrec,"--"); | 282 | strcpy(hrec,"--"); |
320 | else | 283 | else |
321 | sprintf(hrec,"%d",pdi->no_ldrive); | 284 | sprintf(hrec,"%d",pdi->no_ldrive); |
322 | size = sprintf(buffer+len, | 285 | seq_printf(m, |
323 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", | 286 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", |
324 | pdi->blkcnt/(1024*1024/pdi->blksize), | 287 | pdi->blkcnt/(1024*1024/pdi->blksize), |
325 | hrec); | 288 | hrec); |
326 | len += size; pos = begin + len; | ||
327 | } else { | 289 | } else { |
328 | pdi->devtype = 0xff; | 290 | pdi->devtype = 0xff; |
329 | } | 291 | } |
@@ -333,11 +295,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
333 | for (k = 0; k < pds->count; ++k) { | 295 | for (k = 0; k < pds->count; ++k) { |
334 | if (pds->list[k].tid == pdi->target_id && | 296 | if (pds->list[k].tid == pdi->target_id && |
335 | pds->list[k].lun == pdi->lun) { | 297 | pds->list[k].lun == pdi->lun) { |
336 | size = sprintf(buffer+len, | 298 | seq_printf(m, |
337 | " Retries: \t%-6d \tReassigns: \t%d\n", | 299 | " Retries: \t%-6d \tReassigns: \t%d\n", |
338 | pds->list[k].retries, | 300 | pds->list[k].retries, |
339 | pds->list[k].reassigns); | 301 | pds->list[k].reassigns); |
340 | len += size; pos = begin + len; | ||
341 | break; | 302 | break; |
342 | } | 303 | } |
343 | } | 304 | } |
@@ -355,32 +316,20 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
355 | pdef->sddc_type = 0x08; | 316 | pdef->sddc_type = 0x08; |
356 | 317 | ||
357 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { | 318 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { |
358 | size = sprintf(buffer+len, | 319 | seq_printf(m, |
359 | " Grown Defects:\t%d\n", | 320 | " Grown Defects:\t%d\n", |
360 | pdef->sddc_cnt); | 321 | pdef->sddc_cnt); |
361 | len += size; pos = begin + len; | ||
362 | } | 322 | } |
363 | } | 323 | } |
364 | if (pos < offset) { | ||
365 | len = 0; | ||
366 | begin = pos; | ||
367 | } | ||
368 | if (pos > offset + length) { | ||
369 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
370 | goto stop_output; | ||
371 | } | ||
372 | } | 324 | } |
373 | } | 325 | } |
374 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 326 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
375 | 327 | ||
376 | if (!flag) { | 328 | if (!flag) |
377 | size = sprintf(buffer+len, "\n --\n"); | 329 | seq_printf(m, "\n --\n"); |
378 | len += size; pos = begin + len; | ||
379 | } | ||
380 | 330 | ||
381 | /* 3. about logical drives */ | 331 | /* 3. about logical drives */ |
382 | size = sprintf(buffer+len,"\nLogical Drives:"); | 332 | seq_printf(m,"\nLogical Drives:"); |
383 | len += size; pos = begin + len; | ||
384 | flag = FALSE; | 333 | flag = FALSE; |
385 | 334 | ||
386 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 335 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -418,10 +367,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
418 | } | 367 | } |
419 | 368 | ||
420 | if (drv_no == i) { | 369 | if (drv_no == i) { |
421 | size = sprintf(buffer+len, | 370 | seq_printf(m, |
422 | "\n Number: \t%-2d \tStatus: \t%s\n", | 371 | "\n Number: \t%-2d \tStatus: \t%s\n", |
423 | drv_no, hrec); | 372 | drv_no, hrec); |
424 | len += size; pos = begin + len; | ||
425 | flag = TRUE; | 373 | flag = TRUE; |
426 | no_mdrv = pcdi->cd_ldcnt; | 374 | no_mdrv = pcdi->cd_ldcnt; |
427 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { | 375 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { |
@@ -436,61 +384,37 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
436 | } else { | 384 | } else { |
437 | strcpy(hrec, "???"); | 385 | strcpy(hrec, "???"); |
438 | } | 386 | } |
439 | size = sprintf(buffer+len, | 387 | seq_printf(m, |
440 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 388 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
441 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), | 389 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), |
442 | hrec); | 390 | hrec); |
443 | len += size; pos = begin + len; | ||
444 | } else { | 391 | } else { |
445 | size = sprintf(buffer+len, | 392 | seq_printf(m, |
446 | " Slave Number: \t%-2d \tStatus: \t%s\n", | 393 | " Slave Number: \t%-2d \tStatus: \t%s\n", |
447 | drv_no & 0x7fff, hrec); | 394 | drv_no & 0x7fff, hrec); |
448 | len += size; pos = begin + len; | ||
449 | } | 395 | } |
450 | drv_no = pcdi->ld_slave; | 396 | drv_no = pcdi->ld_slave; |
451 | if (pos < offset) { | ||
452 | len = 0; | ||
453 | begin = pos; | ||
454 | } | ||
455 | if (pos > offset + length) { | ||
456 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
457 | goto stop_output; | ||
458 | } | ||
459 | } while (drv_no != -1); | 397 | } while (drv_no != -1); |
460 | 398 | ||
461 | if (is_mirr) { | 399 | if (is_mirr) |
462 | size = sprintf(buffer+len, | 400 | seq_printf(m, |
463 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", | 401 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", |
464 | no_mdrv - j - k, k); | 402 | no_mdrv - j - k, k); |
465 | len += size; pos = begin + len; | 403 | |
466 | } | ||
467 | |||
468 | if (!ha->hdr[i].is_arraydrv) | 404 | if (!ha->hdr[i].is_arraydrv) |
469 | strcpy(hrec, "--"); | 405 | strcpy(hrec, "--"); |
470 | else | 406 | else |
471 | sprintf(hrec, "%d", ha->hdr[i].master_no); | 407 | sprintf(hrec, "%d", ha->hdr[i].master_no); |
472 | size = sprintf(buffer+len, | 408 | seq_printf(m, |
473 | " To Array Drv.:\t%s\n", hrec); | 409 | " To Array Drv.:\t%s\n", hrec); |
474 | len += size; pos = begin + len; | ||
475 | if (pos < offset) { | ||
476 | len = 0; | ||
477 | begin = pos; | ||
478 | } | ||
479 | if (pos > offset + length) { | ||
480 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
481 | goto stop_output; | ||
482 | } | ||
483 | } | 410 | } |
484 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 411 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
485 | 412 | ||
486 | if (!flag) { | 413 | if (!flag) |
487 | size = sprintf(buffer+len, "\n --\n"); | 414 | seq_printf(m, "\n --\n"); |
488 | len += size; pos = begin + len; | ||
489 | } | ||
490 | 415 | ||
491 | /* 4. about array drives */ | 416 | /* 4. about array drives */ |
492 | size = sprintf(buffer+len,"\nArray Drives:"); | 417 | seq_printf(m,"\nArray Drives:"); |
493 | len += size; pos = begin + len; | ||
494 | flag = FALSE; | 418 | flag = FALSE; |
495 | 419 | ||
496 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 420 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -525,10 +449,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
525 | strcat(hrec, "/expand"); | 449 | strcat(hrec, "/expand"); |
526 | else if (pai->ai_ext_state & 0x1) | 450 | else if (pai->ai_ext_state & 0x1) |
527 | strcat(hrec, "/patch"); | 451 | strcat(hrec, "/patch"); |
528 | size = sprintf(buffer+len, | 452 | seq_printf(m, |
529 | "\n Number: \t%-2d \tStatus: \t%s\n", | 453 | "\n Number: \t%-2d \tStatus: \t%s\n", |
530 | i,hrec); | 454 | i,hrec); |
531 | len += size; pos = begin + len; | ||
532 | flag = TRUE; | 455 | flag = TRUE; |
533 | 456 | ||
534 | if (pai->ai_type == 0) | 457 | if (pai->ai_type == 0) |
@@ -539,31 +462,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
539 | strcpy(hrec, "RAID-5"); | 462 | strcpy(hrec, "RAID-5"); |
540 | else | 463 | else |
541 | strcpy(hrec, "RAID-10"); | 464 | strcpy(hrec, "RAID-10"); |
542 | size = sprintf(buffer+len, | 465 | seq_printf(m, |
543 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 466 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
544 | pai->ai_size/(1024*1024/pai->ai_secsize), | 467 | pai->ai_size/(1024*1024/pai->ai_secsize), |
545 | hrec); | 468 | hrec); |
546 | len += size; pos = begin + len; | ||
547 | if (pos < offset) { | ||
548 | len = 0; | ||
549 | begin = pos; | ||
550 | } | ||
551 | if (pos > offset + length) { | ||
552 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
553 | goto stop_output; | ||
554 | } | ||
555 | } | 469 | } |
556 | } | 470 | } |
557 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 471 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
558 | 472 | ||
559 | if (!flag) { | 473 | if (!flag) |
560 | size = sprintf(buffer+len, "\n --\n"); | 474 | seq_printf(m, "\n --\n"); |
561 | len += size; pos = begin + len; | ||
562 | } | ||
563 | 475 | ||
564 | /* 5. about host drives */ | 476 | /* 5. about host drives */ |
565 | size = sprintf(buffer+len,"\nHost Drives:"); | 477 | seq_printf(m,"\nHost Drives:"); |
566 | len += size; pos = begin + len; | ||
567 | flag = FALSE; | 478 | flag = FALSE; |
568 | 479 | ||
569 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); | 480 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); |
@@ -605,33 +516,22 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
605 | if (!(ha->hdr[i].present)) | 516 | if (!(ha->hdr[i].present)) |
606 | continue; | 517 | continue; |
607 | 518 | ||
608 | size = sprintf(buffer+len, | 519 | seq_printf(m, |
609 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", | 520 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", |
610 | i, ha->hdr[i].ldr_no); | 521 | i, ha->hdr[i].ldr_no); |
611 | len += size; pos = begin + len; | ||
612 | flag = TRUE; | 522 | flag = TRUE; |
613 | 523 | ||
614 | size = sprintf(buffer+len, | 524 | seq_printf(m, |
615 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", | 525 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", |
616 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); | 526 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); |
617 | len += size; pos = begin + len; | ||
618 | if (pos < offset) { | ||
619 | len = 0; | ||
620 | begin = pos; | ||
621 | } | ||
622 | if (pos > offset + length) | ||
623 | goto stop_output; | ||
624 | } | 527 | } |
625 | 528 | ||
626 | if (!flag) { | 529 | if (!flag) |
627 | size = sprintf(buffer+len, "\n --\n"); | 530 | seq_printf(m, "\n --\n"); |
628 | len += size; pos = begin + len; | ||
629 | } | ||
630 | } | 531 | } |
631 | 532 | ||
632 | /* controller events */ | 533 | /* controller events */ |
633 | size = sprintf(buffer+len,"\nController Events:\n"); | 534 | seq_printf(m,"\nController Events:\n"); |
634 | len += size; pos = begin + len; | ||
635 | 535 | ||
636 | for (id = -1;;) { | 536 | for (id = -1;;) { |
637 | id = gdth_read_event(ha, id, estr); | 537 | id = gdth_read_event(ha, id, estr); |
@@ -643,29 +543,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
643 | do_gettimeofday(&tv); | 543 | do_gettimeofday(&tv); |
644 | sec = (int)(tv.tv_sec - estr->first_stamp); | 544 | sec = (int)(tv.tv_sec - estr->first_stamp); |
645 | if (sec < 0) sec = 0; | 545 | if (sec < 0) sec = 0; |
646 | size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n", | 546 | seq_printf(m," date- %02d:%02d:%02d\t%s\n", |
647 | sec/3600, sec%3600/60, sec%60, hrec); | 547 | sec/3600, sec%3600/60, sec%60, hrec); |
648 | len += size; pos = begin + len; | ||
649 | if (pos < offset) { | ||
650 | len = 0; | ||
651 | begin = pos; | ||
652 | } | ||
653 | if (pos > offset + length) | ||
654 | goto stop_output; | ||
655 | } | 548 | } |
656 | if (id == -1) | 549 | if (id == -1) |
657 | break; | 550 | break; |
658 | } | 551 | } |
659 | |||
660 | stop_output: | 552 | stop_output: |
661 | *start = buffer +(offset-begin); | 553 | rc = 0; |
662 | len -= (offset-begin); | ||
663 | if (len > length) | ||
664 | len = length; | ||
665 | TRACE2(("get_info() len %d pos %d begin %d offset %d length %d size %d\n", | ||
666 | len,(int)pos,(int)begin,(int)offset,length,size)); | ||
667 | rc = len; | ||
668 | |||
669 | free_fail: | 554 | free_fail: |
670 | kfree(gdtcmd); | 555 | kfree(gdtcmd); |
671 | kfree(estr); | 556 | kfree(estr); |
diff --git a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h index dab15f59f2cc..aaa618198972 100644 --- a/drivers/scsi/gdth_proc.h +++ b/drivers/scsi/gdth_proc.h | |||
@@ -8,11 +8,6 @@ | |||
8 | int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, | 8 | int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, |
9 | int timeout, u32 *info); | 9 | int timeout, u32 *info); |
10 | 10 | ||
11 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | ||
12 | gdth_ha_str *ha); | ||
13 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | ||
14 | struct Scsi_Host *host, gdth_ha_str *ha); | ||
15 | |||
16 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | 11 | static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, |
17 | int length, gdth_ha_str *ha); | 12 | int length, gdth_ha_str *ha); |
18 | 13 | ||
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index dbe4cc6b9f8b..2203ac281103 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c | |||
@@ -191,7 +191,8 @@ static int gvp11_bus_reset(struct scsi_cmnd *cmd) | |||
191 | static struct scsi_host_template gvp11_scsi_template = { | 191 | static struct scsi_host_template gvp11_scsi_template = { |
192 | .module = THIS_MODULE, | 192 | .module = THIS_MODULE, |
193 | .name = "GVP Series II SCSI", | 193 | .name = "GVP Series II SCSI", |
194 | .proc_info = wd33c93_proc_info, | 194 | .show_info = wd33c93_show_info, |
195 | .write_info = wd33c93_write_info, | ||
195 | .proc_name = "GVP11", | 196 | .proc_name = "GVP11", |
196 | .queuecommand = wd33c93_queuecommand, | 197 | .queuecommand = wd33c93_queuecommand, |
197 | .eh_abort_handler = wd33c93_abort, | 198 | .eh_abort_handler = wd33c93_abort, |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 26cd9d1d7571..89a8266560d0 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -121,45 +121,26 @@ static inline void imm_pb_release(imm_struct *dev) | |||
121 | * testing... | 121 | * testing... |
122 | * Also gives a method to use a script to obtain optimum timings (TODO) | 122 | * Also gives a method to use a script to obtain optimum timings (TODO) |
123 | */ | 123 | */ |
124 | static inline int imm_proc_write(imm_struct *dev, char *buffer, int length) | 124 | static int imm_write_info(struct Scsi_Host *host, char *buffer, int length) |
125 | { | 125 | { |
126 | unsigned long x; | 126 | imm_struct *dev = imm_dev(host); |
127 | 127 | ||
128 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { | 128 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { |
129 | x = simple_strtoul(buffer + 5, NULL, 0); | 129 | dev->mode = simple_strtoul(buffer + 5, NULL, 0); |
130 | dev->mode = x; | ||
131 | return length; | 130 | return length; |
132 | } | 131 | } |
133 | printk("imm /proc: invalid variable\n"); | 132 | printk("imm /proc: invalid variable\n"); |
134 | return (-EINVAL); | 133 | return -EINVAL; |
135 | } | 134 | } |
136 | 135 | ||
137 | static int imm_proc_info(struct Scsi_Host *host, char *buffer, char **start, | 136 | static int imm_show_info(struct seq_file *m, struct Scsi_Host *host) |
138 | off_t offset, int length, int inout) | ||
139 | { | 137 | { |
140 | imm_struct *dev = imm_dev(host); | 138 | imm_struct *dev = imm_dev(host); |
141 | int len = 0; | ||
142 | |||
143 | if (inout) | ||
144 | return imm_proc_write(dev, buffer, length); | ||
145 | |||
146 | len += sprintf(buffer + len, "Version : %s\n", IMM_VERSION); | ||
147 | len += | ||
148 | sprintf(buffer + len, "Parport : %s\n", | ||
149 | dev->dev->port->name); | ||
150 | len += | ||
151 | sprintf(buffer + len, "Mode : %s\n", | ||
152 | IMM_MODE_STRING[dev->mode]); | ||
153 | 139 | ||
154 | /* Request for beyond end of buffer */ | 140 | seq_printf(m, "Version : %s\n", IMM_VERSION); |
155 | if (offset > len) | 141 | seq_printf(m, "Parport : %s\n", dev->dev->port->name); |
156 | return 0; | 142 | seq_printf(m, "Mode : %s\n", IMM_MODE_STRING[dev->mode]); |
157 | 143 | return 0; | |
158 | *start = buffer + offset; | ||
159 | len -= offset; | ||
160 | if (len > length) | ||
161 | len = length; | ||
162 | return len; | ||
163 | } | 144 | } |
164 | 145 | ||
165 | #if IMM_DEBUG > 0 | 146 | #if IMM_DEBUG > 0 |
@@ -1118,7 +1099,8 @@ static int imm_adjust_queue(struct scsi_device *device) | |||
1118 | static struct scsi_host_template imm_template = { | 1099 | static struct scsi_host_template imm_template = { |
1119 | .module = THIS_MODULE, | 1100 | .module = THIS_MODULE, |
1120 | .proc_name = "imm", | 1101 | .proc_name = "imm", |
1121 | .proc_info = imm_proc_info, | 1102 | .show_info = imm_show_info, |
1103 | .write_info = imm_write_info, | ||
1122 | .name = "Iomega VPI2 (imm) interface", | 1104 | .name = "Iomega VPI2 (imm) interface", |
1123 | .queuecommand = imm_queuecommand, | 1105 | .queuecommand = imm_queuecommand, |
1124 | .eh_abort_handler = imm_abort, | 1106 | .eh_abort_handler = imm_abort, |
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index deb5b6d8398e..bf028218ac36 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c | |||
@@ -2166,152 +2166,117 @@ static int in2000_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |||
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | 2168 | ||
2169 | static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) | 2169 | static int in2000_write_info(struct Scsi_Host *instance, char *buf, int len) |
2170 | { | 2170 | { |
2171 | 2171 | ||
2172 | #ifdef PROC_INTERFACE | 2172 | #ifdef PROC_INTERFACE |
2173 | 2173 | ||
2174 | char *bp; | 2174 | char *bp; |
2175 | char tbuf[128]; | ||
2176 | unsigned long flags; | ||
2177 | struct IN2000_hostdata *hd; | 2175 | struct IN2000_hostdata *hd; |
2178 | Scsi_Cmnd *cmd; | ||
2179 | int x, i; | 2176 | int x, i; |
2180 | static int stop = 0; | ||
2181 | 2177 | ||
2182 | hd = (struct IN2000_hostdata *) instance->hostdata; | 2178 | hd = (struct IN2000_hostdata *) instance->hostdata; |
2183 | 2179 | ||
2184 | /* If 'in' is TRUE we need to _read_ the proc file. We accept the following | 2180 | buf[len] = '\0'; |
2185 | * keywords (same format as command-line, but only ONE per read): | 2181 | bp = buf; |
2186 | * debug | 2182 | if (!strncmp(bp, "debug:", 6)) { |
2187 | * disconnect | 2183 | bp += 6; |
2188 | * period | 2184 | hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK; |
2189 | * resync | 2185 | } else if (!strncmp(bp, "disconnect:", 11)) { |
2190 | * proc | 2186 | bp += 11; |
2191 | */ | 2187 | x = simple_strtoul(bp, NULL, 0); |
2192 | 2188 | if (x < DIS_NEVER || x > DIS_ALWAYS) | |
2193 | if (in) { | 2189 | x = DIS_ADAPTIVE; |
2194 | buf[len] = '\0'; | 2190 | hd->disconnect = x; |
2195 | bp = buf; | 2191 | } else if (!strncmp(bp, "period:", 7)) { |
2196 | if (!strncmp(bp, "debug:", 6)) { | 2192 | bp += 7; |
2197 | bp += 6; | 2193 | x = simple_strtoul(bp, NULL, 0); |
2198 | hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK; | 2194 | hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns; |
2199 | } else if (!strncmp(bp, "disconnect:", 11)) { | 2195 | } else if (!strncmp(bp, "resync:", 7)) { |
2200 | bp += 11; | 2196 | bp += 7; |
2201 | x = simple_strtoul(bp, NULL, 0); | 2197 | x = simple_strtoul(bp, NULL, 0); |
2202 | if (x < DIS_NEVER || x > DIS_ALWAYS) | 2198 | for (i = 0; i < 7; i++) |
2203 | x = DIS_ADAPTIVE; | 2199 | if (x & (1 << i)) |
2204 | hd->disconnect = x; | 2200 | hd->sync_stat[i] = SS_UNSET; |
2205 | } else if (!strncmp(bp, "period:", 7)) { | 2201 | } else if (!strncmp(bp, "proc:", 5)) { |
2206 | bp += 7; | 2202 | bp += 5; |
2207 | x = simple_strtoul(bp, NULL, 0); | 2203 | hd->proc = simple_strtoul(bp, NULL, 0); |
2208 | hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns; | 2204 | } else if (!strncmp(bp, "level2:", 7)) { |
2209 | } else if (!strncmp(bp, "resync:", 7)) { | 2205 | bp += 7; |
2210 | bp += 7; | 2206 | hd->level2 = simple_strtoul(bp, NULL, 0); |
2211 | x = simple_strtoul(bp, NULL, 0); | ||
2212 | for (i = 0; i < 7; i++) | ||
2213 | if (x & (1 << i)) | ||
2214 | hd->sync_stat[i] = SS_UNSET; | ||
2215 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2216 | bp += 5; | ||
2217 | hd->proc = simple_strtoul(bp, NULL, 0); | ||
2218 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2219 | bp += 7; | ||
2220 | hd->level2 = simple_strtoul(bp, NULL, 0); | ||
2221 | } | ||
2222 | return len; | ||
2223 | } | 2207 | } |
2208 | #endif | ||
2209 | return len; | ||
2210 | } | ||
2211 | |||
2212 | static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
2213 | { | ||
2214 | |||
2215 | #ifdef PROC_INTERFACE | ||
2216 | unsigned long flags; | ||
2217 | struct IN2000_hostdata *hd; | ||
2218 | Scsi_Cmnd *cmd; | ||
2219 | int x; | ||
2220 | |||
2221 | hd = (struct IN2000_hostdata *) instance->hostdata; | ||
2224 | 2222 | ||
2225 | spin_lock_irqsave(instance->host_lock, flags); | 2223 | spin_lock_irqsave(instance->host_lock, flags); |
2226 | bp = buf; | 2224 | if (hd->proc & PR_VERSION) |
2227 | *bp = '\0'; | 2225 | seq_printf(m, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE); |
2228 | if (hd->proc & PR_VERSION) { | 2226 | |
2229 | sprintf(tbuf, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE); | ||
2230 | strcat(bp, tbuf); | ||
2231 | } | ||
2232 | if (hd->proc & PR_INFO) { | 2227 | if (hd->proc & PR_INFO) { |
2233 | sprintf(tbuf, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); | 2228 | seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); |
2234 | strcat(bp, tbuf); | 2229 | seq_printf(m, "\nsync_xfer[] = "); |
2235 | strcat(bp, "\nsync_xfer[] = "); | 2230 | for (x = 0; x < 7; x++) |
2236 | for (x = 0; x < 7; x++) { | 2231 | seq_printf(m, "\t%02x", hd->sync_xfer[x]); |
2237 | sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); | 2232 | seq_printf(m, "\nsync_stat[] = "); |
2238 | strcat(bp, tbuf); | 2233 | for (x = 0; x < 7; x++) |
2239 | } | 2234 | seq_printf(m, "\t%02x", hd->sync_stat[x]); |
2240 | strcat(bp, "\nsync_stat[] = "); | ||
2241 | for (x = 0; x < 7; x++) { | ||
2242 | sprintf(tbuf, "\t%02x", hd->sync_stat[x]); | ||
2243 | strcat(bp, tbuf); | ||
2244 | } | ||
2245 | } | 2235 | } |
2246 | #ifdef PROC_STATISTICS | 2236 | #ifdef PROC_STATISTICS |
2247 | if (hd->proc & PR_STATISTICS) { | 2237 | if (hd->proc & PR_STATISTICS) { |
2248 | strcat(bp, "\ncommands issued: "); | 2238 | seq_printf(m, "\ncommands issued: "); |
2249 | for (x = 0; x < 7; x++) { | 2239 | for (x = 0; x < 7; x++) |
2250 | sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); | 2240 | seq_printf(m, "\t%ld", hd->cmd_cnt[x]); |
2251 | strcat(bp, tbuf); | 2241 | seq_printf(m, "\ndisconnects allowed:"); |
2252 | } | 2242 | for (x = 0; x < 7; x++) |
2253 | strcat(bp, "\ndisconnects allowed:"); | 2243 | seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); |
2254 | for (x = 0; x < 7; x++) { | 2244 | seq_printf(m, "\ndisconnects done: "); |
2255 | sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); | 2245 | for (x = 0; x < 7; x++) |
2256 | strcat(bp, tbuf); | 2246 | seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); |
2257 | } | 2247 | seq_printf(m, "\ninterrupts: \t%ld", hd->int_cnt); |
2258 | strcat(bp, "\ndisconnects done: "); | ||
2259 | for (x = 0; x < 7; x++) { | ||
2260 | sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); | ||
2261 | strcat(bp, tbuf); | ||
2262 | } | ||
2263 | sprintf(tbuf, "\ninterrupts: \t%ld", hd->int_cnt); | ||
2264 | strcat(bp, tbuf); | ||
2265 | } | 2248 | } |
2266 | #endif | 2249 | #endif |
2267 | if (hd->proc & PR_CONNECTED) { | 2250 | if (hd->proc & PR_CONNECTED) { |
2268 | strcat(bp, "\nconnected: "); | 2251 | seq_printf(m, "\nconnected: "); |
2269 | if (hd->connected) { | 2252 | if (hd->connected) { |
2270 | cmd = (Scsi_Cmnd *) hd->connected; | 2253 | cmd = (Scsi_Cmnd *) hd->connected; |
2271 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2254 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2272 | strcat(bp, tbuf); | ||
2273 | } | 2255 | } |
2274 | } | 2256 | } |
2275 | if (hd->proc & PR_INPUTQ) { | 2257 | if (hd->proc & PR_INPUTQ) { |
2276 | strcat(bp, "\ninput_Q: "); | 2258 | seq_printf(m, "\ninput_Q: "); |
2277 | cmd = (Scsi_Cmnd *) hd->input_Q; | 2259 | cmd = (Scsi_Cmnd *) hd->input_Q; |
2278 | while (cmd) { | 2260 | while (cmd) { |
2279 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2261 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2280 | strcat(bp, tbuf); | ||
2281 | cmd = (Scsi_Cmnd *) cmd->host_scribble; | 2262 | cmd = (Scsi_Cmnd *) cmd->host_scribble; |
2282 | } | 2263 | } |
2283 | } | 2264 | } |
2284 | if (hd->proc & PR_DISCQ) { | 2265 | if (hd->proc & PR_DISCQ) { |
2285 | strcat(bp, "\ndisconnected_Q:"); | 2266 | seq_printf(m, "\ndisconnected_Q:"); |
2286 | cmd = (Scsi_Cmnd *) hd->disconnected_Q; | 2267 | cmd = (Scsi_Cmnd *) hd->disconnected_Q; |
2287 | while (cmd) { | 2268 | while (cmd) { |
2288 | sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2269 | seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2289 | strcat(bp, tbuf); | ||
2290 | cmd = (Scsi_Cmnd *) cmd->host_scribble; | 2270 | cmd = (Scsi_Cmnd *) cmd->host_scribble; |
2291 | } | 2271 | } |
2292 | } | 2272 | } |
2293 | if (hd->proc & PR_TEST) { | 2273 | if (hd->proc & PR_TEST) { |
2294 | ; /* insert your own custom function here */ | 2274 | ; /* insert your own custom function here */ |
2295 | } | 2275 | } |
2296 | strcat(bp, "\n"); | 2276 | seq_printf(m, "\n"); |
2297 | spin_unlock_irqrestore(instance->host_lock, flags); | 2277 | spin_unlock_irqrestore(instance->host_lock, flags); |
2298 | *start = buf; | ||
2299 | if (stop) { | ||
2300 | stop = 0; | ||
2301 | return 0; /* return 0 to signal end-of-file */ | ||
2302 | } | ||
2303 | if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */ | ||
2304 | stop = 1; | ||
2305 | if (hd->proc & PR_STOP) /* stop every other time */ | ||
2306 | stop = 1; | ||
2307 | return strlen(bp); | ||
2308 | |||
2309 | #else /* PROC_INTERFACE */ | ||
2310 | |||
2311 | return 0; | ||
2312 | |||
2313 | #endif /* PROC_INTERFACE */ | 2278 | #endif /* PROC_INTERFACE */ |
2314 | 2279 | return 0; | |
2315 | } | 2280 | } |
2316 | 2281 | ||
2317 | MODULE_LICENSE("GPL"); | 2282 | MODULE_LICENSE("GPL"); |
@@ -2319,7 +2284,8 @@ MODULE_LICENSE("GPL"); | |||
2319 | 2284 | ||
2320 | static struct scsi_host_template driver_template = { | 2285 | static struct scsi_host_template driver_template = { |
2321 | .proc_name = "in2000", | 2286 | .proc_name = "in2000", |
2322 | .proc_info = in2000_proc_info, | 2287 | .write_info = in2000_write_info, |
2288 | .show_info = in2000_show_info, | ||
2323 | .name = "Always IN2000", | 2289 | .name = "Always IN2000", |
2324 | .detect = in2000_detect, | 2290 | .detect = in2000_detect, |
2325 | .release = in2000_release, | 2291 | .release = in2000_release, |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 9aa86a315a08..8d5ea8a1e5a6 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -326,10 +326,9 @@ static void ips_scmd_buf_write(struct scsi_cmnd * scmd, void *data, | |||
326 | static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, | 326 | static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, |
327 | unsigned int count); | 327 | unsigned int count); |
328 | 328 | ||
329 | static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | 329 | static int ips_write_info(struct Scsi_Host *, char *, int); |
330 | static int ips_host_info(ips_ha_t *, char *, off_t, int); | 330 | static int ips_show_info(struct seq_file *, struct Scsi_Host *); |
331 | static void copy_mem_info(IPS_INFOSTR *, char *, int); | 331 | static int ips_host_info(ips_ha_t *, struct seq_file *); |
332 | static int copy_info(IPS_INFOSTR *, char *, ...); | ||
333 | static int ips_abort_init(ips_ha_t * ha, int index); | 332 | static int ips_abort_init(ips_ha_t * ha, int index); |
334 | static int ips_init_phase2(int index); | 333 | static int ips_init_phase2(int index); |
335 | 334 | ||
@@ -367,7 +366,8 @@ static struct scsi_host_template ips_driver_template = { | |||
367 | .eh_abort_handler = ips_eh_abort, | 366 | .eh_abort_handler = ips_eh_abort, |
368 | .eh_host_reset_handler = ips_eh_reset, | 367 | .eh_host_reset_handler = ips_eh_reset, |
369 | .proc_name = "ips", | 368 | .proc_name = "ips", |
370 | .proc_info = ips_proc_info, | 369 | .show_info = ips_show_info, |
370 | .write_info = ips_write_info, | ||
371 | .slave_configure = ips_slave_configure, | 371 | .slave_configure = ips_slave_configure, |
372 | .bios_param = ips_biosparam, | 372 | .bios_param = ips_biosparam, |
373 | .this_id = -1, | 373 | .this_id = -1, |
@@ -1433,25 +1433,12 @@ ips_info(struct Scsi_Host *SH) | |||
1433 | return (bp); | 1433 | return (bp); |
1434 | } | 1434 | } |
1435 | 1435 | ||
1436 | /****************************************************************************/ | ||
1437 | /* */ | ||
1438 | /* Routine Name: ips_proc_info */ | ||
1439 | /* */ | ||
1440 | /* Routine Description: */ | ||
1441 | /* */ | ||
1442 | /* The passthru interface for the driver */ | ||
1443 | /* */ | ||
1444 | /****************************************************************************/ | ||
1445 | static int | 1436 | static int |
1446 | ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 1437 | ips_write_info(struct Scsi_Host *host, char *buffer, int length) |
1447 | int length, int func) | ||
1448 | { | 1438 | { |
1449 | int i; | 1439 | int i; |
1450 | int ret; | ||
1451 | ips_ha_t *ha = NULL; | 1440 | ips_ha_t *ha = NULL; |
1452 | 1441 | ||
1453 | METHOD_TRACE("ips_proc_info", 1); | ||
1454 | |||
1455 | /* Find our host structure */ | 1442 | /* Find our host structure */ |
1456 | for (i = 0; i < ips_next_controller; i++) { | 1443 | for (i = 0; i < ips_next_controller; i++) { |
1457 | if (ips_sh[i]) { | 1444 | if (ips_sh[i]) { |
@@ -1465,18 +1452,29 @@ ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | |||
1465 | if (!ha) | 1452 | if (!ha) |
1466 | return (-EINVAL); | 1453 | return (-EINVAL); |
1467 | 1454 | ||
1468 | if (func) { | 1455 | return 0; |
1469 | /* write */ | 1456 | } |
1470 | return (0); | ||
1471 | } else { | ||
1472 | /* read */ | ||
1473 | if (start) | ||
1474 | *start = buffer; | ||
1475 | 1457 | ||
1476 | ret = ips_host_info(ha, buffer, offset, length); | 1458 | static int |
1459 | ips_show_info(struct seq_file *m, struct Scsi_Host *host) | ||
1460 | { | ||
1461 | int i; | ||
1462 | ips_ha_t *ha = NULL; | ||
1477 | 1463 | ||
1478 | return (ret); | 1464 | /* Find our host structure */ |
1465 | for (i = 0; i < ips_next_controller; i++) { | ||
1466 | if (ips_sh[i]) { | ||
1467 | if (ips_sh[i] == host) { | ||
1468 | ha = (ips_ha_t *) ips_sh[i]->hostdata; | ||
1469 | break; | ||
1470 | } | ||
1471 | } | ||
1479 | } | 1472 | } |
1473 | |||
1474 | if (!ha) | ||
1475 | return (-EINVAL); | ||
1476 | |||
1477 | return ips_host_info(ha, m); | ||
1480 | } | 1478 | } |
1481 | 1479 | ||
1482 | /*--------------------------------------------------------------------------*/ | 1480 | /*--------------------------------------------------------------------------*/ |
@@ -2035,183 +2033,113 @@ ips_cleanup_passthru(ips_ha_t * ha, ips_scb_t * scb) | |||
2035 | /* */ | 2033 | /* */ |
2036 | /****************************************************************************/ | 2034 | /****************************************************************************/ |
2037 | static int | 2035 | static int |
2038 | ips_host_info(ips_ha_t * ha, char *ptr, off_t offset, int len) | 2036 | ips_host_info(ips_ha_t *ha, struct seq_file *m) |
2039 | { | 2037 | { |
2040 | IPS_INFOSTR info; | ||
2041 | |||
2042 | METHOD_TRACE("ips_host_info", 1); | 2038 | METHOD_TRACE("ips_host_info", 1); |
2043 | 2039 | ||
2044 | info.buffer = ptr; | 2040 | seq_printf(m, "\nIBM ServeRAID General Information:\n\n"); |
2045 | info.length = len; | ||
2046 | info.offset = offset; | ||
2047 | info.pos = 0; | ||
2048 | info.localpos = 0; | ||
2049 | |||
2050 | copy_info(&info, "\nIBM ServeRAID General Information:\n\n"); | ||
2051 | 2041 | ||
2052 | if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && | 2042 | if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && |
2053 | (le16_to_cpu(ha->nvram->adapter_type) != 0)) | 2043 | (le16_to_cpu(ha->nvram->adapter_type) != 0)) |
2054 | copy_info(&info, "\tController Type : %s\n", | 2044 | seq_printf(m, "\tController Type : %s\n", |
2055 | ips_adapter_name[ha->ad_type - 1]); | 2045 | ips_adapter_name[ha->ad_type - 1]); |
2056 | else | 2046 | else |
2057 | copy_info(&info, | 2047 | seq_printf(m, |
2058 | "\tController Type : Unknown\n"); | 2048 | "\tController Type : Unknown\n"); |
2059 | 2049 | ||
2060 | if (ha->io_addr) | 2050 | if (ha->io_addr) |
2061 | copy_info(&info, | 2051 | seq_printf(m, |
2062 | "\tIO region : 0x%lx (%d bytes)\n", | 2052 | "\tIO region : 0x%x (%d bytes)\n", |
2063 | ha->io_addr, ha->io_len); | 2053 | ha->io_addr, ha->io_len); |
2064 | 2054 | ||
2065 | if (ha->mem_addr) { | 2055 | if (ha->mem_addr) { |
2066 | copy_info(&info, | 2056 | seq_printf(m, |
2067 | "\tMemory region : 0x%lx (%d bytes)\n", | 2057 | "\tMemory region : 0x%x (%d bytes)\n", |
2068 | ha->mem_addr, ha->mem_len); | 2058 | ha->mem_addr, ha->mem_len); |
2069 | copy_info(&info, | 2059 | seq_printf(m, |
2070 | "\tShared memory address : 0x%lx\n", | 2060 | "\tShared memory address : 0x%lx\n", |
2071 | ha->mem_ptr); | 2061 | (unsigned long)ha->mem_ptr); |
2072 | } | 2062 | } |
2073 | 2063 | ||
2074 | copy_info(&info, "\tIRQ number : %d\n", ha->pcidev->irq); | 2064 | seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); |
2075 | 2065 | ||
2076 | /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ | 2066 | /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ |
2077 | /* That keeps everything happy for "text" operations on the proc file. */ | 2067 | /* That keeps everything happy for "text" operations on the proc file. */ |
2078 | 2068 | ||
2079 | if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { | 2069 | if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { |
2080 | if (ha->nvram->bios_low[3] == 0) { | 2070 | if (ha->nvram->bios_low[3] == 0) { |
2081 | copy_info(&info, | 2071 | seq_printf(m, |
2082 | "\tBIOS Version : %c%c%c%c%c%c%c\n", | 2072 | "\tBIOS Version : %c%c%c%c%c%c%c\n", |
2083 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], | 2073 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], |
2084 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], | 2074 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], |
2085 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], | 2075 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], |
2086 | ha->nvram->bios_low[2]); | 2076 | ha->nvram->bios_low[2]); |
2087 | 2077 | ||
2088 | } else { | 2078 | } else { |
2089 | copy_info(&info, | 2079 | seq_printf(m, |
2090 | "\tBIOS Version : %c%c%c%c%c%c%c%c\n", | 2080 | "\tBIOS Version : %c%c%c%c%c%c%c%c\n", |
2091 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], | 2081 | ha->nvram->bios_high[0], ha->nvram->bios_high[1], |
2092 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], | 2082 | ha->nvram->bios_high[2], ha->nvram->bios_high[3], |
2093 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], | 2083 | ha->nvram->bios_low[0], ha->nvram->bios_low[1], |
2094 | ha->nvram->bios_low[2], ha->nvram->bios_low[3]); | 2084 | ha->nvram->bios_low[2], ha->nvram->bios_low[3]); |
2095 | } | 2085 | } |
2096 | 2086 | ||
2097 | } | 2087 | } |
2098 | 2088 | ||
2099 | if (ha->enq->CodeBlkVersion[7] == 0) { | 2089 | if (ha->enq->CodeBlkVersion[7] == 0) { |
2100 | copy_info(&info, | 2090 | seq_printf(m, |
2101 | "\tFirmware Version : %c%c%c%c%c%c%c\n", | 2091 | "\tFirmware Version : %c%c%c%c%c%c%c\n", |
2102 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], | 2092 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], |
2103 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], | 2093 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], |
2104 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], | 2094 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], |
2105 | ha->enq->CodeBlkVersion[6]); | 2095 | ha->enq->CodeBlkVersion[6]); |
2106 | } else { | 2096 | } else { |
2107 | copy_info(&info, | 2097 | seq_printf(m, |
2108 | "\tFirmware Version : %c%c%c%c%c%c%c%c\n", | 2098 | "\tFirmware Version : %c%c%c%c%c%c%c%c\n", |
2109 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], | 2099 | ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], |
2110 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], | 2100 | ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], |
2111 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], | 2101 | ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], |
2112 | ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); | 2102 | ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); |
2113 | } | 2103 | } |
2114 | 2104 | ||
2115 | if (ha->enq->BootBlkVersion[7] == 0) { | 2105 | if (ha->enq->BootBlkVersion[7] == 0) { |
2116 | copy_info(&info, | 2106 | seq_printf(m, |
2117 | "\tBoot Block Version : %c%c%c%c%c%c%c\n", | 2107 | "\tBoot Block Version : %c%c%c%c%c%c%c\n", |
2118 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], | 2108 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], |
2119 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], | 2109 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], |
2120 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], | 2110 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], |
2121 | ha->enq->BootBlkVersion[6]); | 2111 | ha->enq->BootBlkVersion[6]); |
2122 | } else { | 2112 | } else { |
2123 | copy_info(&info, | 2113 | seq_printf(m, |
2124 | "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", | 2114 | "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", |
2125 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], | 2115 | ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], |
2126 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], | 2116 | ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], |
2127 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], | 2117 | ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], |
2128 | ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); | 2118 | ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); |
2129 | } | 2119 | } |
2130 | 2120 | ||
2131 | copy_info(&info, "\tDriver Version : %s%s\n", | 2121 | seq_printf(m, "\tDriver Version : %s%s\n", |
2132 | IPS_VERSION_HIGH, IPS_VERSION_LOW); | 2122 | IPS_VERSION_HIGH, IPS_VERSION_LOW); |
2133 | 2123 | ||
2134 | copy_info(&info, "\tDriver Build : %d\n", | 2124 | seq_printf(m, "\tDriver Build : %d\n", |
2135 | IPS_BUILD_IDENT); | 2125 | IPS_BUILD_IDENT); |
2136 | 2126 | ||
2137 | copy_info(&info, "\tMax Physical Devices : %d\n", | 2127 | seq_printf(m, "\tMax Physical Devices : %d\n", |
2138 | ha->enq->ucMaxPhysicalDevices); | 2128 | ha->enq->ucMaxPhysicalDevices); |
2139 | copy_info(&info, "\tMax Active Commands : %d\n", | 2129 | seq_printf(m, "\tMax Active Commands : %d\n", |
2140 | ha->max_cmds); | 2130 | ha->max_cmds); |
2141 | copy_info(&info, "\tCurrent Queued Commands : %d\n", | 2131 | seq_printf(m, "\tCurrent Queued Commands : %d\n", |
2142 | ha->scb_waitlist.count); | 2132 | ha->scb_waitlist.count); |
2143 | copy_info(&info, "\tCurrent Active Commands : %d\n", | 2133 | seq_printf(m, "\tCurrent Active Commands : %d\n", |
2144 | ha->scb_activelist.count - ha->num_ioctl); | 2134 | ha->scb_activelist.count - ha->num_ioctl); |
2145 | copy_info(&info, "\tCurrent Queued PT Commands : %d\n", | 2135 | seq_printf(m, "\tCurrent Queued PT Commands : %d\n", |
2146 | ha->copp_waitlist.count); | 2136 | ha->copp_waitlist.count); |
2147 | copy_info(&info, "\tCurrent Active PT Commands : %d\n", | 2137 | seq_printf(m, "\tCurrent Active PT Commands : %d\n", |
2148 | ha->num_ioctl); | 2138 | ha->num_ioctl); |
2149 | 2139 | ||
2150 | copy_info(&info, "\n"); | 2140 | seq_printf(m, "\n"); |
2151 | |||
2152 | return (info.localpos); | ||
2153 | } | ||
2154 | |||
2155 | /****************************************************************************/ | ||
2156 | /* */ | ||
2157 | /* Routine Name: copy_mem_info */ | ||
2158 | /* */ | ||
2159 | /* Routine Description: */ | ||
2160 | /* */ | ||
2161 | /* Copy data into an IPS_INFOSTR structure */ | ||
2162 | /* */ | ||
2163 | /****************************************************************************/ | ||
2164 | static void | ||
2165 | copy_mem_info(IPS_INFOSTR * info, char *data, int len) | ||
2166 | { | ||
2167 | METHOD_TRACE("copy_mem_info", 1); | ||
2168 | |||
2169 | if (info->pos + len < info->offset) { | ||
2170 | info->pos += len; | ||
2171 | return; | ||
2172 | } | ||
2173 | |||
2174 | if (info->pos < info->offset) { | ||
2175 | data += (info->offset - info->pos); | ||
2176 | len -= (info->offset - info->pos); | ||
2177 | info->pos += (info->offset - info->pos); | ||
2178 | } | ||
2179 | |||
2180 | if (info->localpos + len > info->length) | ||
2181 | len = info->length - info->localpos; | ||
2182 | 2141 | ||
2183 | if (len > 0) { | 2142 | return 0; |
2184 | memcpy(info->buffer + info->localpos, data, len); | ||
2185 | info->pos += len; | ||
2186 | info->localpos += len; | ||
2187 | } | ||
2188 | } | ||
2189 | |||
2190 | /****************************************************************************/ | ||
2191 | /* */ | ||
2192 | /* Routine Name: copy_info */ | ||
2193 | /* */ | ||
2194 | /* Routine Description: */ | ||
2195 | /* */ | ||
2196 | /* printf style wrapper for an info structure */ | ||
2197 | /* */ | ||
2198 | /****************************************************************************/ | ||
2199 | static int | ||
2200 | copy_info(IPS_INFOSTR * info, char *fmt, ...) | ||
2201 | { | ||
2202 | va_list args; | ||
2203 | char buf[128]; | ||
2204 | int len; | ||
2205 | |||
2206 | METHOD_TRACE("copy_info", 1); | ||
2207 | |||
2208 | va_start(args, fmt); | ||
2209 | len = vsprintf(buf, fmt, args); | ||
2210 | va_end(args); | ||
2211 | |||
2212 | copy_mem_info(info, buf, len); | ||
2213 | |||
2214 | return (len); | ||
2215 | } | 2143 | } |
2216 | 2144 | ||
2217 | /****************************************************************************/ | 2145 | /****************************************************************************/ |
diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index f2df0593332b..45b9566b928e 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h | |||
@@ -416,7 +416,6 @@ | |||
416 | /* | 416 | /* |
417 | * Scsi_Host Template | 417 | * Scsi_Host Template |
418 | */ | 418 | */ |
419 | static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | ||
420 | static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, | 419 | static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
421 | sector_t capacity, int geom[]); | 420 | sector_t capacity, int geom[]); |
422 | static int ips_slave_configure(struct scsi_device *SDptr); | 421 | static int ips_slave_configure(struct scsi_device *SDptr); |
@@ -959,14 +958,6 @@ typedef union { | |||
959 | IPS_ENH_SG_LIST *enh_list; | 958 | IPS_ENH_SG_LIST *enh_list; |
960 | } IPS_SG_LIST; | 959 | } IPS_SG_LIST; |
961 | 960 | ||
962 | typedef struct _IPS_INFOSTR { | ||
963 | char *buffer; | ||
964 | int length; | ||
965 | int offset; | ||
966 | int pos; | ||
967 | int localpos; | ||
968 | } IPS_INFOSTR; | ||
969 | |||
970 | typedef struct { | 961 | typedef struct { |
971 | char *option_name; | 962 | char *option_name; |
972 | int *option_flag; | 963 | int *option_flag; |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 5da297290262..90b8b0515e23 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -10394,36 +10394,6 @@ lpfc_io_resume(struct pci_dev *pdev) | |||
10394 | return; | 10394 | return; |
10395 | } | 10395 | } |
10396 | 10396 | ||
10397 | /** | ||
10398 | * lpfc_mgmt_open - method called when 'lpfcmgmt' is opened from userspace | ||
10399 | * @inode: pointer to the inode representing the lpfcmgmt device | ||
10400 | * @filep: pointer to the file representing the open lpfcmgmt device | ||
10401 | * | ||
10402 | * This routine puts a reference count on the lpfc module whenever the | ||
10403 | * character device is opened | ||
10404 | **/ | ||
10405 | static int | ||
10406 | lpfc_mgmt_open(struct inode *inode, struct file *filep) | ||
10407 | { | ||
10408 | try_module_get(THIS_MODULE); | ||
10409 | return 0; | ||
10410 | } | ||
10411 | |||
10412 | /** | ||
10413 | * lpfc_mgmt_release - method called when 'lpfcmgmt' is closed in userspace | ||
10414 | * @inode: pointer to the inode representing the lpfcmgmt device | ||
10415 | * @filep: pointer to the file representing the open lpfcmgmt device | ||
10416 | * | ||
10417 | * This routine removes a reference count from the lpfc module when the | ||
10418 | * character device is closed | ||
10419 | **/ | ||
10420 | static int | ||
10421 | lpfc_mgmt_release(struct inode *inode, struct file *filep) | ||
10422 | { | ||
10423 | module_put(THIS_MODULE); | ||
10424 | return 0; | ||
10425 | } | ||
10426 | |||
10427 | static struct pci_device_id lpfc_id_table[] = { | 10397 | static struct pci_device_id lpfc_id_table[] = { |
10428 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, | 10398 | {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, |
10429 | PCI_ANY_ID, PCI_ANY_ID, }, | 10399 | PCI_ANY_ID, PCI_ANY_ID, }, |
@@ -10541,8 +10511,7 @@ static struct pci_driver lpfc_driver = { | |||
10541 | }; | 10511 | }; |
10542 | 10512 | ||
10543 | static const struct file_operations lpfc_mgmt_fop = { | 10513 | static const struct file_operations lpfc_mgmt_fop = { |
10544 | .open = lpfc_mgmt_open, | 10514 | .owner = THIS_MODULE, |
10545 | .release = lpfc_mgmt_release, | ||
10546 | }; | 10515 | }; |
10547 | 10516 | ||
10548 | static struct miscdevice lpfc_mgmt_dev = { | 10517 | static struct miscdevice lpfc_mgmt_dev = { |
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index 24828b54773a..858075723c87 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -561,7 +561,8 @@ static int macscsi_pwrite (struct Scsi_Host *instance, | |||
561 | 561 | ||
562 | static struct scsi_host_template driver_template = { | 562 | static struct scsi_host_template driver_template = { |
563 | .proc_name = "Mac5380", | 563 | .proc_name = "Mac5380", |
564 | .proc_info = macscsi_proc_info, | 564 | .show_info = macscsi_show_info, |
565 | .write_info = macscsi_write_info, | ||
565 | .name = "Macintosh NCR5380 SCSI", | 566 | .name = "Macintosh NCR5380 SCSI", |
566 | .detect = macscsi_detect, | 567 | .detect = macscsi_detect, |
567 | .release = macscsi_release, | 568 | .release = macscsi_release, |
diff --git a/drivers/scsi/mac_scsi.h b/drivers/scsi/mac_scsi.h index d26e331c6c12..7dc62fce1c4c 100644 --- a/drivers/scsi/mac_scsi.h +++ b/drivers/scsi/mac_scsi.h | |||
@@ -72,7 +72,8 @@ | |||
72 | #define NCR5380_queue_command macscsi_queue_command | 72 | #define NCR5380_queue_command macscsi_queue_command |
73 | #define NCR5380_abort macscsi_abort | 73 | #define NCR5380_abort macscsi_abort |
74 | #define NCR5380_bus_reset macscsi_bus_reset | 74 | #define NCR5380_bus_reset macscsi_bus_reset |
75 | #define NCR5380_proc_info macscsi_proc_info | 75 | #define NCR5380_show_info macscsi_show_info |
76 | #define NCR5380_write_info macscsi_write_info | ||
76 | 77 | ||
77 | #define BOARD_NORMAL 0 | 78 | #define BOARD_NORMAL 0 |
78 | #define BOARD_NCR53C400 1 | 79 | #define BOARD_NCR53C400 1 |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 9504ec0ec682..7373255aa1e8 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/completion.h> | 39 | #include <linux/completion.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/proc_fs.h> | 41 | #include <linux/proc_fs.h> |
42 | #include <linux/seq_file.h> | ||
42 | #include <linux/reboot.h> | 43 | #include <linux/reboot.h> |
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
44 | #include <linux/list.h> | 45 | #include <linux/list.h> |
@@ -2069,385 +2070,201 @@ mega_free_inquiry(void *inquiry, dma_addr_t dma_handle, struct pci_dev *pdev) | |||
2069 | #ifdef CONFIG_PROC_FS | 2070 | #ifdef CONFIG_PROC_FS |
2070 | /* Following code handles /proc fs */ | 2071 | /* Following code handles /proc fs */ |
2071 | 2072 | ||
2072 | #define CREATE_READ_PROC(string, func) create_proc_read_entry(string, \ | ||
2073 | S_IRUSR | S_IFREG, \ | ||
2074 | controller_proc_dir_entry, \ | ||
2075 | func, adapter) | ||
2076 | |||
2077 | /** | ||
2078 | * mega_create_proc_entry() | ||
2079 | * @index - index in soft state array | ||
2080 | * @parent - parent node for this /proc entry | ||
2081 | * | ||
2082 | * Creates /proc entries for our controllers. | ||
2083 | */ | ||
2084 | static void | ||
2085 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) | ||
2086 | { | ||
2087 | struct proc_dir_entry *controller_proc_dir_entry = NULL; | ||
2088 | u8 string[64] = { 0 }; | ||
2089 | adapter_t *adapter = hba_soft_state[index]; | ||
2090 | |||
2091 | sprintf(string, "hba%d", adapter->host->host_no); | ||
2092 | |||
2093 | controller_proc_dir_entry = | ||
2094 | adapter->controller_proc_dir_entry = proc_mkdir(string, parent); | ||
2095 | |||
2096 | if(!controller_proc_dir_entry) { | ||
2097 | printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n"); | ||
2098 | return; | ||
2099 | } | ||
2100 | adapter->proc_read = CREATE_READ_PROC("config", proc_read_config); | ||
2101 | adapter->proc_stat = CREATE_READ_PROC("stat", proc_read_stat); | ||
2102 | adapter->proc_mbox = CREATE_READ_PROC("mailbox", proc_read_mbox); | ||
2103 | #if MEGA_HAVE_ENH_PROC | ||
2104 | adapter->proc_rr = CREATE_READ_PROC("rebuild-rate", proc_rebuild_rate); | ||
2105 | adapter->proc_battery = CREATE_READ_PROC("battery-status", | ||
2106 | proc_battery); | ||
2107 | |||
2108 | /* | ||
2109 | * Display each physical drive on its channel | ||
2110 | */ | ||
2111 | adapter->proc_pdrvstat[0] = CREATE_READ_PROC("diskdrives-ch0", | ||
2112 | proc_pdrv_ch0); | ||
2113 | adapter->proc_pdrvstat[1] = CREATE_READ_PROC("diskdrives-ch1", | ||
2114 | proc_pdrv_ch1); | ||
2115 | adapter->proc_pdrvstat[2] = CREATE_READ_PROC("diskdrives-ch2", | ||
2116 | proc_pdrv_ch2); | ||
2117 | adapter->proc_pdrvstat[3] = CREATE_READ_PROC("diskdrives-ch3", | ||
2118 | proc_pdrv_ch3); | ||
2119 | |||
2120 | /* | ||
2121 | * Display a set of up to 10 logical drive through each of following | ||
2122 | * /proc entries | ||
2123 | */ | ||
2124 | adapter->proc_rdrvstat[0] = CREATE_READ_PROC("raiddrives-0-9", | ||
2125 | proc_rdrv_10); | ||
2126 | adapter->proc_rdrvstat[1] = CREATE_READ_PROC("raiddrives-10-19", | ||
2127 | proc_rdrv_20); | ||
2128 | adapter->proc_rdrvstat[2] = CREATE_READ_PROC("raiddrives-20-29", | ||
2129 | proc_rdrv_30); | ||
2130 | adapter->proc_rdrvstat[3] = CREATE_READ_PROC("raiddrives-30-39", | ||
2131 | proc_rdrv_40); | ||
2132 | #endif | ||
2133 | } | ||
2134 | |||
2135 | |||
2136 | /** | 2073 | /** |
2137 | * proc_read_config() | 2074 | * proc_show_config() |
2138 | * @page - buffer to write the data in | 2075 | * @m - Synthetic file construction data |
2139 | * @start - where the actual data has been written in page | 2076 | * @v - File iterator |
2140 | * @offset - same meaning as the read system call | ||
2141 | * @count - same meaning as the read system call | ||
2142 | * @eof - set if no more data needs to be returned | ||
2143 | * @data - pointer to our soft state | ||
2144 | * | 2077 | * |
2145 | * Display configuration information about the controller. | 2078 | * Display configuration information about the controller. |
2146 | */ | 2079 | */ |
2147 | static int | 2080 | static int |
2148 | proc_read_config(char *page, char **start, off_t offset, int count, int *eof, | 2081 | proc_show_config(struct seq_file *m, void *v) |
2149 | void *data) | ||
2150 | { | 2082 | { |
2151 | 2083 | ||
2152 | adapter_t *adapter = (adapter_t *)data; | 2084 | adapter_t *adapter = m->private; |
2153 | int len = 0; | ||
2154 | |||
2155 | len += sprintf(page+len, "%s", MEGARAID_VERSION); | ||
2156 | 2085 | ||
2086 | seq_puts(m, MEGARAID_VERSION); | ||
2157 | if(adapter->product_info.product_name[0]) | 2087 | if(adapter->product_info.product_name[0]) |
2158 | len += sprintf(page+len, "%s\n", | 2088 | seq_printf(m, "%s\n", adapter->product_info.product_name); |
2159 | adapter->product_info.product_name); | ||
2160 | |||
2161 | len += sprintf(page+len, "Controller Type: "); | ||
2162 | 2089 | ||
2163 | if( adapter->flag & BOARD_MEMMAP ) { | 2090 | seq_puts(m, "Controller Type: "); |
2164 | len += sprintf(page+len, | ||
2165 | "438/466/467/471/493/518/520/531/532\n"); | ||
2166 | } | ||
2167 | else { | ||
2168 | len += sprintf(page+len, | ||
2169 | "418/428/434\n"); | ||
2170 | } | ||
2171 | 2091 | ||
2172 | if(adapter->flag & BOARD_40LD) { | 2092 | if( adapter->flag & BOARD_MEMMAP ) |
2173 | len += sprintf(page+len, | 2093 | seq_puts(m, "438/466/467/471/493/518/520/531/532\n"); |
2174 | "Controller Supports 40 Logical Drives\n"); | 2094 | else |
2175 | } | 2095 | seq_puts(m, "418/428/434\n"); |
2176 | 2096 | ||
2177 | if(adapter->flag & BOARD_64BIT) { | 2097 | if(adapter->flag & BOARD_40LD) |
2178 | len += sprintf(page+len, | 2098 | seq_puts(m, "Controller Supports 40 Logical Drives\n"); |
2179 | "Controller capable of 64-bit memory addressing\n"); | ||
2180 | } | ||
2181 | if( adapter->has_64bit_addr ) { | ||
2182 | len += sprintf(page+len, | ||
2183 | "Controller using 64-bit memory addressing\n"); | ||
2184 | } | ||
2185 | else { | ||
2186 | len += sprintf(page+len, | ||
2187 | "Controller is not using 64-bit memory addressing\n"); | ||
2188 | } | ||
2189 | 2099 | ||
2190 | len += sprintf(page+len, "Base = %08lx, Irq = %d, ", adapter->base, | 2100 | if(adapter->flag & BOARD_64BIT) |
2191 | adapter->host->irq); | 2101 | seq_puts(m, "Controller capable of 64-bit memory addressing\n"); |
2192 | 2102 | if( adapter->has_64bit_addr ) | |
2193 | len += sprintf(page+len, "Logical Drives = %d, Channels = %d\n", | 2103 | seq_puts(m, "Controller using 64-bit memory addressing\n"); |
2194 | adapter->numldrv, adapter->product_info.nchannels); | 2104 | else |
2195 | 2105 | seq_puts(m, "Controller is not using 64-bit memory addressing\n"); | |
2196 | len += sprintf(page+len, "Version =%s:%s, DRAM = %dMb\n", | 2106 | |
2197 | adapter->fw_version, adapter->bios_version, | 2107 | seq_printf(m, "Base = %08lx, Irq = %d, ", |
2198 | adapter->product_info.dram_size); | 2108 | adapter->base, adapter->host->irq); |
2199 | 2109 | ||
2200 | len += sprintf(page+len, | 2110 | seq_printf(m, "Logical Drives = %d, Channels = %d\n", |
2201 | "Controller Queue Depth = %d, Driver Queue Depth = %d\n", | 2111 | adapter->numldrv, adapter->product_info.nchannels); |
2202 | adapter->product_info.max_commands, adapter->max_cmds); | 2112 | |
2203 | 2113 | seq_printf(m, "Version =%s:%s, DRAM = %dMb\n", | |
2204 | len += sprintf(page+len, "support_ext_cdb = %d\n", | 2114 | adapter->fw_version, adapter->bios_version, |
2205 | adapter->support_ext_cdb); | 2115 | adapter->product_info.dram_size); |
2206 | len += sprintf(page+len, "support_random_del = %d\n", | 2116 | |
2207 | adapter->support_random_del); | 2117 | seq_printf(m, "Controller Queue Depth = %d, Driver Queue Depth = %d\n", |
2208 | len += sprintf(page+len, "boot_ldrv_enabled = %d\n", | 2118 | adapter->product_info.max_commands, adapter->max_cmds); |
2209 | adapter->boot_ldrv_enabled); | 2119 | |
2210 | len += sprintf(page+len, "boot_ldrv = %d\n", | 2120 | seq_printf(m, "support_ext_cdb = %d\n", adapter->support_ext_cdb); |
2211 | adapter->boot_ldrv); | 2121 | seq_printf(m, "support_random_del = %d\n", adapter->support_random_del); |
2212 | len += sprintf(page+len, "boot_pdrv_enabled = %d\n", | 2122 | seq_printf(m, "boot_ldrv_enabled = %d\n", adapter->boot_ldrv_enabled); |
2213 | adapter->boot_pdrv_enabled); | 2123 | seq_printf(m, "boot_ldrv = %d\n", adapter->boot_ldrv); |
2214 | len += sprintf(page+len, "boot_pdrv_ch = %d\n", | 2124 | seq_printf(m, "boot_pdrv_enabled = %d\n", adapter->boot_pdrv_enabled); |
2215 | adapter->boot_pdrv_ch); | 2125 | seq_printf(m, "boot_pdrv_ch = %d\n", adapter->boot_pdrv_ch); |
2216 | len += sprintf(page+len, "boot_pdrv_tgt = %d\n", | 2126 | seq_printf(m, "boot_pdrv_tgt = %d\n", adapter->boot_pdrv_tgt); |
2217 | adapter->boot_pdrv_tgt); | 2127 | seq_printf(m, "quiescent = %d\n", |
2218 | len += sprintf(page+len, "quiescent = %d\n", | 2128 | atomic_read(&adapter->quiescent)); |
2219 | atomic_read(&adapter->quiescent)); | 2129 | seq_printf(m, "has_cluster = %d\n", adapter->has_cluster); |
2220 | len += sprintf(page+len, "has_cluster = %d\n", | 2130 | |
2221 | adapter->has_cluster); | 2131 | seq_puts(m, "\nModule Parameters:\n"); |
2222 | 2132 | seq_printf(m, "max_cmd_per_lun = %d\n", max_cmd_per_lun); | |
2223 | len += sprintf(page+len, "\nModule Parameters:\n"); | 2133 | seq_printf(m, "max_sectors_per_io = %d\n", max_sectors_per_io); |
2224 | len += sprintf(page+len, "max_cmd_per_lun = %d\n", | 2134 | return 0; |
2225 | max_cmd_per_lun); | ||
2226 | len += sprintf(page+len, "max_sectors_per_io = %d\n", | ||
2227 | max_sectors_per_io); | ||
2228 | |||
2229 | *eof = 1; | ||
2230 | |||
2231 | return len; | ||
2232 | } | 2135 | } |
2233 | 2136 | ||
2234 | |||
2235 | |||
2236 | /** | 2137 | /** |
2237 | * proc_read_stat() | 2138 | * proc_show_stat() |
2238 | * @page - buffer to write the data in | 2139 | * @m - Synthetic file construction data |
2239 | * @start - where the actual data has been written in page | 2140 | * @v - File iterator |
2240 | * @offset - same meaning as the read system call | ||
2241 | * @count - same meaning as the read system call | ||
2242 | * @eof - set if no more data needs to be returned | ||
2243 | * @data - pointer to our soft state | ||
2244 | * | 2141 | * |
2245 | * Diaplay statistical information about the I/O activity. | 2142 | * Display statistical information about the I/O activity. |
2246 | */ | 2143 | */ |
2247 | static int | 2144 | static int |
2248 | proc_read_stat(char *page, char **start, off_t offset, int count, int *eof, | 2145 | proc_show_stat(struct seq_file *m, void *v) |
2249 | void *data) | ||
2250 | { | 2146 | { |
2251 | adapter_t *adapter; | 2147 | adapter_t *adapter = m->private; |
2252 | int len; | 2148 | #if MEGA_HAVE_STATS |
2253 | int i; | 2149 | int i; |
2150 | #endif | ||
2254 | 2151 | ||
2255 | i = 0; /* avoid compilation warnings */ | 2152 | seq_puts(m, "Statistical Information for this controller\n"); |
2256 | len = 0; | 2153 | seq_printf(m, "pend_cmds = %d\n", atomic_read(&adapter->pend_cmds)); |
2257 | adapter = (adapter_t *)data; | ||
2258 | |||
2259 | len = sprintf(page, "Statistical Information for this controller\n"); | ||
2260 | len += sprintf(page+len, "pend_cmds = %d\n", | ||
2261 | atomic_read(&adapter->pend_cmds)); | ||
2262 | #if MEGA_HAVE_STATS | 2154 | #if MEGA_HAVE_STATS |
2263 | for(i = 0; i < adapter->numldrv; i++) { | 2155 | for(i = 0; i < adapter->numldrv; i++) { |
2264 | len += sprintf(page+len, "Logical Drive %d:\n", i); | 2156 | seq_printf(m, "Logical Drive %d:\n", i); |
2265 | 2157 | seq_printf(m, "\tReads Issued = %lu, Writes Issued = %lu\n", | |
2266 | len += sprintf(page+len, | 2158 | adapter->nreads[i], adapter->nwrites[i]); |
2267 | "\tReads Issued = %lu, Writes Issued = %lu\n", | 2159 | seq_printf(m, "\tSectors Read = %lu, Sectors Written = %lu\n", |
2268 | adapter->nreads[i], adapter->nwrites[i]); | 2160 | adapter->nreadblocks[i], adapter->nwriteblocks[i]); |
2269 | 2161 | seq_printf(m, "\tRead errors = %lu, Write errors = %lu\n\n", | |
2270 | len += sprintf(page+len, | 2162 | adapter->rd_errors[i], adapter->wr_errors[i]); |
2271 | "\tSectors Read = %lu, Sectors Written = %lu\n", | ||
2272 | adapter->nreadblocks[i], adapter->nwriteblocks[i]); | ||
2273 | |||
2274 | len += sprintf(page+len, | ||
2275 | "\tRead errors = %lu, Write errors = %lu\n\n", | ||
2276 | adapter->rd_errors[i], adapter->wr_errors[i]); | ||
2277 | } | 2163 | } |
2278 | #else | 2164 | #else |
2279 | len += sprintf(page+len, | 2165 | seq_puts(m, "IO and error counters not compiled in driver.\n"); |
2280 | "IO and error counters not compiled in driver.\n"); | ||
2281 | #endif | 2166 | #endif |
2282 | 2167 | return 0; | |
2283 | *eof = 1; | ||
2284 | |||
2285 | return len; | ||
2286 | } | 2168 | } |
2287 | 2169 | ||
2288 | 2170 | ||
2289 | /** | 2171 | /** |
2290 | * proc_read_mbox() | 2172 | * proc_show_mbox() |
2291 | * @page - buffer to write the data in | 2173 | * @m - Synthetic file construction data |
2292 | * @start - where the actual data has been written in page | 2174 | * @v - File iterator |
2293 | * @offset - same meaning as the read system call | ||
2294 | * @count - same meaning as the read system call | ||
2295 | * @eof - set if no more data needs to be returned | ||
2296 | * @data - pointer to our soft state | ||
2297 | * | 2175 | * |
2298 | * Display mailbox information for the last command issued. This information | 2176 | * Display mailbox information for the last command issued. This information |
2299 | * is good for debugging. | 2177 | * is good for debugging. |
2300 | */ | 2178 | */ |
2301 | static int | 2179 | static int |
2302 | proc_read_mbox(char *page, char **start, off_t offset, int count, int *eof, | 2180 | proc_show_mbox(struct seq_file *m, void *v) |
2303 | void *data) | ||
2304 | { | 2181 | { |
2305 | 2182 | adapter_t *adapter = m->private; | |
2306 | adapter_t *adapter = (adapter_t *)data; | ||
2307 | volatile mbox_t *mbox = adapter->mbox; | 2183 | volatile mbox_t *mbox = adapter->mbox; |
2308 | int len = 0; | 2184 | |
2309 | 2185 | seq_puts(m, "Contents of Mail Box Structure\n"); | |
2310 | len = sprintf(page, "Contents of Mail Box Structure\n"); | 2186 | seq_printf(m, " Fw Command = 0x%02x\n", mbox->m_out.cmd); |
2311 | len += sprintf(page+len, " Fw Command = 0x%02x\n", | 2187 | seq_printf(m, " Cmd Sequence = 0x%02x\n", mbox->m_out.cmdid); |
2312 | mbox->m_out.cmd); | 2188 | seq_printf(m, " No of Sectors= %04d\n", mbox->m_out.numsectors); |
2313 | len += sprintf(page+len, " Cmd Sequence = 0x%02x\n", | 2189 | seq_printf(m, " LBA = 0x%02x\n", mbox->m_out.lba); |
2314 | mbox->m_out.cmdid); | 2190 | seq_printf(m, " DTA = 0x%08x\n", mbox->m_out.xferaddr); |
2315 | len += sprintf(page+len, " No of Sectors= %04d\n", | 2191 | seq_printf(m, " Logical Drive= 0x%02x\n", mbox->m_out.logdrv); |
2316 | mbox->m_out.numsectors); | 2192 | seq_printf(m, " No of SG Elmt= 0x%02x\n", mbox->m_out.numsgelements); |
2317 | len += sprintf(page+len, " LBA = 0x%02x\n", | 2193 | seq_printf(m, " Busy = %01x\n", mbox->m_in.busy); |
2318 | mbox->m_out.lba); | 2194 | seq_printf(m, " Status = 0x%02x\n", mbox->m_in.status); |
2319 | len += sprintf(page+len, " DTA = 0x%08x\n", | 2195 | return 0; |
2320 | mbox->m_out.xferaddr); | ||
2321 | len += sprintf(page+len, " Logical Drive= 0x%02x\n", | ||
2322 | mbox->m_out.logdrv); | ||
2323 | len += sprintf(page+len, " No of SG Elmt= 0x%02x\n", | ||
2324 | mbox->m_out.numsgelements); | ||
2325 | len += sprintf(page+len, " Busy = %01x\n", | ||
2326 | mbox->m_in.busy); | ||
2327 | len += sprintf(page+len, " Status = 0x%02x\n", | ||
2328 | mbox->m_in.status); | ||
2329 | |||
2330 | *eof = 1; | ||
2331 | |||
2332 | return len; | ||
2333 | } | 2196 | } |
2334 | 2197 | ||
2335 | 2198 | ||
2336 | /** | 2199 | /** |
2337 | * proc_rebuild_rate() | 2200 | * proc_show_rebuild_rate() |
2338 | * @page - buffer to write the data in | 2201 | * @m - Synthetic file construction data |
2339 | * @start - where the actual data has been written in page | 2202 | * @v - File iterator |
2340 | * @offset - same meaning as the read system call | ||
2341 | * @count - same meaning as the read system call | ||
2342 | * @eof - set if no more data needs to be returned | ||
2343 | * @data - pointer to our soft state | ||
2344 | * | 2203 | * |
2345 | * Display current rebuild rate | 2204 | * Display current rebuild rate |
2346 | */ | 2205 | */ |
2347 | static int | 2206 | static int |
2348 | proc_rebuild_rate(char *page, char **start, off_t offset, int count, int *eof, | 2207 | proc_show_rebuild_rate(struct seq_file *m, void *v) |
2349 | void *data) | ||
2350 | { | 2208 | { |
2351 | adapter_t *adapter = (adapter_t *)data; | 2209 | adapter_t *adapter = m->private; |
2352 | dma_addr_t dma_handle; | 2210 | dma_addr_t dma_handle; |
2353 | caddr_t inquiry; | 2211 | caddr_t inquiry; |
2354 | struct pci_dev *pdev; | 2212 | struct pci_dev *pdev; |
2355 | int len = 0; | ||
2356 | 2213 | ||
2357 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2214 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2358 | *eof = 1; | 2215 | return 0; |
2359 | return len; | ||
2360 | } | ||
2361 | 2216 | ||
2362 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2217 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2363 | free_local_pdev(pdev); | 2218 | goto free_pdev; |
2364 | *eof = 1; | ||
2365 | return len; | ||
2366 | } | ||
2367 | 2219 | ||
2368 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2220 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2369 | 2221 | seq_puts(m, "Adapter inquiry failed.\n"); | |
2370 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2371 | |||
2372 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2222 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2373 | 2223 | goto free_inquiry; | |
2374 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2375 | |||
2376 | free_local_pdev(pdev); | ||
2377 | |||
2378 | *eof = 1; | ||
2379 | |||
2380 | return len; | ||
2381 | } | 2224 | } |
2382 | 2225 | ||
2383 | if( adapter->flag & BOARD_40LD ) { | 2226 | if( adapter->flag & BOARD_40LD ) |
2384 | len = sprintf(page, "Rebuild Rate: [%d%%]\n", | 2227 | seq_printf(m, "Rebuild Rate: [%d%%]\n", |
2385 | ((mega_inquiry3 *)inquiry)->rebuild_rate); | 2228 | ((mega_inquiry3 *)inquiry)->rebuild_rate); |
2386 | } | 2229 | else |
2387 | else { | 2230 | seq_printf(m, "Rebuild Rate: [%d%%]\n", |
2388 | len = sprintf(page, "Rebuild Rate: [%d%%]\n", | ||
2389 | ((mraid_ext_inquiry *) | 2231 | ((mraid_ext_inquiry *) |
2390 | inquiry)->raid_inq.adapter_info.rebuild_rate); | 2232 | inquiry)->raid_inq.adapter_info.rebuild_rate); |
2391 | } | ||
2392 | |||
2393 | 2233 | ||
2234 | free_inquiry: | ||
2394 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2235 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2395 | 2236 | free_pdev: | |
2396 | free_local_pdev(pdev); | 2237 | free_local_pdev(pdev); |
2397 | 2238 | return 0; | |
2398 | *eof = 1; | ||
2399 | |||
2400 | return len; | ||
2401 | } | 2239 | } |
2402 | 2240 | ||
2403 | 2241 | ||
2404 | /** | 2242 | /** |
2405 | * proc_battery() | 2243 | * proc_show_battery() |
2406 | * @page - buffer to write the data in | 2244 | * @m - Synthetic file construction data |
2407 | * @start - where the actual data has been written in page | 2245 | * @v - File iterator |
2408 | * @offset - same meaning as the read system call | ||
2409 | * @count - same meaning as the read system call | ||
2410 | * @eof - set if no more data needs to be returned | ||
2411 | * @data - pointer to our soft state | ||
2412 | * | 2246 | * |
2413 | * Display information about the battery module on the controller. | 2247 | * Display information about the battery module on the controller. |
2414 | */ | 2248 | */ |
2415 | static int | 2249 | static int |
2416 | proc_battery(char *page, char **start, off_t offset, int count, int *eof, | 2250 | proc_show_battery(struct seq_file *m, void *v) |
2417 | void *data) | ||
2418 | { | 2251 | { |
2419 | adapter_t *adapter = (adapter_t *)data; | 2252 | adapter_t *adapter = m->private; |
2420 | dma_addr_t dma_handle; | 2253 | dma_addr_t dma_handle; |
2421 | caddr_t inquiry; | 2254 | caddr_t inquiry; |
2422 | struct pci_dev *pdev; | 2255 | struct pci_dev *pdev; |
2423 | u8 battery_status = 0; | 2256 | u8 battery_status; |
2424 | char str[256]; | ||
2425 | int len = 0; | ||
2426 | 2257 | ||
2427 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2258 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2428 | *eof = 1; | 2259 | return 0; |
2429 | return len; | ||
2430 | } | ||
2431 | 2260 | ||
2432 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2261 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2433 | free_local_pdev(pdev); | 2262 | goto free_pdev; |
2434 | *eof = 1; | ||
2435 | return len; | ||
2436 | } | ||
2437 | 2263 | ||
2438 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2264 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2439 | 2265 | seq_printf(m, "Adapter inquiry failed.\n"); | |
2440 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2441 | |||
2442 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2266 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2443 | 2267 | goto free_inquiry; | |
2444 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2445 | |||
2446 | free_local_pdev(pdev); | ||
2447 | |||
2448 | *eof = 1; | ||
2449 | |||
2450 | return len; | ||
2451 | } | 2268 | } |
2452 | 2269 | ||
2453 | if( adapter->flag & BOARD_40LD ) { | 2270 | if( adapter->flag & BOARD_40LD ) { |
@@ -2461,146 +2278,80 @@ proc_battery(char *page, char **start, off_t offset, int count, int *eof, | |||
2461 | /* | 2278 | /* |
2462 | * Decode the battery status | 2279 | * Decode the battery status |
2463 | */ | 2280 | */ |
2464 | sprintf(str, "Battery Status:[%d]", battery_status); | 2281 | seq_printf(m, "Battery Status:[%d]", battery_status); |
2465 | 2282 | ||
2466 | if(battery_status == MEGA_BATT_CHARGE_DONE) | 2283 | if(battery_status == MEGA_BATT_CHARGE_DONE) |
2467 | strcat(str, " Charge Done"); | 2284 | seq_puts(m, " Charge Done"); |
2468 | 2285 | ||
2469 | if(battery_status & MEGA_BATT_MODULE_MISSING) | 2286 | if(battery_status & MEGA_BATT_MODULE_MISSING) |
2470 | strcat(str, " Module Missing"); | 2287 | seq_puts(m, " Module Missing"); |
2471 | 2288 | ||
2472 | if(battery_status & MEGA_BATT_LOW_VOLTAGE) | 2289 | if(battery_status & MEGA_BATT_LOW_VOLTAGE) |
2473 | strcat(str, " Low Voltage"); | 2290 | seq_puts(m, " Low Voltage"); |
2474 | 2291 | ||
2475 | if(battery_status & MEGA_BATT_TEMP_HIGH) | 2292 | if(battery_status & MEGA_BATT_TEMP_HIGH) |
2476 | strcat(str, " Temperature High"); | 2293 | seq_puts(m, " Temperature High"); |
2477 | 2294 | ||
2478 | if(battery_status & MEGA_BATT_PACK_MISSING) | 2295 | if(battery_status & MEGA_BATT_PACK_MISSING) |
2479 | strcat(str, " Pack Missing"); | 2296 | seq_puts(m, " Pack Missing"); |
2480 | 2297 | ||
2481 | if(battery_status & MEGA_BATT_CHARGE_INPROG) | 2298 | if(battery_status & MEGA_BATT_CHARGE_INPROG) |
2482 | strcat(str, " Charge In-progress"); | 2299 | seq_puts(m, " Charge In-progress"); |
2483 | 2300 | ||
2484 | if(battery_status & MEGA_BATT_CHARGE_FAIL) | 2301 | if(battery_status & MEGA_BATT_CHARGE_FAIL) |
2485 | strcat(str, " Charge Fail"); | 2302 | seq_puts(m, " Charge Fail"); |
2486 | 2303 | ||
2487 | if(battery_status & MEGA_BATT_CYCLES_EXCEEDED) | 2304 | if(battery_status & MEGA_BATT_CYCLES_EXCEEDED) |
2488 | strcat(str, " Cycles Exceeded"); | 2305 | seq_puts(m, " Cycles Exceeded"); |
2489 | |||
2490 | len = sprintf(page, "%s\n", str); | ||
2491 | 2306 | ||
2307 | seq_putc(m, '\n'); | ||
2492 | 2308 | ||
2309 | free_inquiry: | ||
2493 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2310 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2494 | 2311 | free_pdev: | |
2495 | free_local_pdev(pdev); | 2312 | free_local_pdev(pdev); |
2496 | 2313 | return 0; | |
2497 | *eof = 1; | ||
2498 | |||
2499 | return len; | ||
2500 | } | ||
2501 | |||
2502 | |||
2503 | /** | ||
2504 | * proc_pdrv_ch0() | ||
2505 | * @page - buffer to write the data in | ||
2506 | * @start - where the actual data has been written in page | ||
2507 | * @offset - same meaning as the read system call | ||
2508 | * @count - same meaning as the read system call | ||
2509 | * @eof - set if no more data needs to be returned | ||
2510 | * @data - pointer to our soft state | ||
2511 | * | ||
2512 | * Display information about the physical drives on physical channel 0. | ||
2513 | */ | ||
2514 | static int | ||
2515 | proc_pdrv_ch0(char *page, char **start, off_t offset, int count, int *eof, | ||
2516 | void *data) | ||
2517 | { | ||
2518 | adapter_t *adapter = (adapter_t *)data; | ||
2519 | |||
2520 | *eof = 1; | ||
2521 | |||
2522 | return (proc_pdrv(adapter, page, 0)); | ||
2523 | } | ||
2524 | |||
2525 | |||
2526 | /** | ||
2527 | * proc_pdrv_ch1() | ||
2528 | * @page - buffer to write the data in | ||
2529 | * @start - where the actual data has been written in page | ||
2530 | * @offset - same meaning as the read system call | ||
2531 | * @count - same meaning as the read system call | ||
2532 | * @eof - set if no more data needs to be returned | ||
2533 | * @data - pointer to our soft state | ||
2534 | * | ||
2535 | * Display information about the physical drives on physical channel 1. | ||
2536 | */ | ||
2537 | static int | ||
2538 | proc_pdrv_ch1(char *page, char **start, off_t offset, int count, int *eof, | ||
2539 | void *data) | ||
2540 | { | ||
2541 | adapter_t *adapter = (adapter_t *)data; | ||
2542 | |||
2543 | *eof = 1; | ||
2544 | |||
2545 | return (proc_pdrv(adapter, page, 1)); | ||
2546 | } | 2314 | } |
2547 | 2315 | ||
2548 | 2316 | ||
2549 | /** | 2317 | /* |
2550 | * proc_pdrv_ch2() | 2318 | * Display scsi inquiry |
2551 | * @page - buffer to write the data in | ||
2552 | * @start - where the actual data has been written in page | ||
2553 | * @offset - same meaning as the read system call | ||
2554 | * @count - same meaning as the read system call | ||
2555 | * @eof - set if no more data needs to be returned | ||
2556 | * @data - pointer to our soft state | ||
2557 | * | ||
2558 | * Display information about the physical drives on physical channel 2. | ||
2559 | */ | 2319 | */ |
2560 | static int | 2320 | static void |
2561 | proc_pdrv_ch2(char *page, char **start, off_t offset, int count, int *eof, | 2321 | mega_print_inquiry(struct seq_file *m, char *scsi_inq) |
2562 | void *data) | ||
2563 | { | 2322 | { |
2564 | adapter_t *adapter = (adapter_t *)data; | 2323 | int i; |
2565 | |||
2566 | *eof = 1; | ||
2567 | |||
2568 | return (proc_pdrv(adapter, page, 2)); | ||
2569 | } | ||
2570 | 2324 | ||
2325 | seq_puts(m, " Vendor: "); | ||
2326 | seq_write(m, scsi_inq + 8, 8); | ||
2327 | seq_puts(m, " Model: "); | ||
2328 | seq_write(m, scsi_inq + 16, 16); | ||
2329 | seq_puts(m, " Rev: "); | ||
2330 | seq_write(m, scsi_inq + 32, 4); | ||
2331 | seq_putc(m, '\n'); | ||
2571 | 2332 | ||
2572 | /** | 2333 | i = scsi_inq[0] & 0x1f; |
2573 | * proc_pdrv_ch3() | 2334 | seq_printf(m, " Type: %s ", scsi_device_type(i)); |
2574 | * @page - buffer to write the data in | ||
2575 | * @start - where the actual data has been written in page | ||
2576 | * @offset - same meaning as the read system call | ||
2577 | * @count - same meaning as the read system call | ||
2578 | * @eof - set if no more data needs to be returned | ||
2579 | * @data - pointer to our soft state | ||
2580 | * | ||
2581 | * Display information about the physical drives on physical channel 3. | ||
2582 | */ | ||
2583 | static int | ||
2584 | proc_pdrv_ch3(char *page, char **start, off_t offset, int count, int *eof, | ||
2585 | void *data) | ||
2586 | { | ||
2587 | adapter_t *adapter = (adapter_t *)data; | ||
2588 | 2335 | ||
2589 | *eof = 1; | 2336 | seq_printf(m, " ANSI SCSI revision: %02x", |
2337 | scsi_inq[2] & 0x07); | ||
2590 | 2338 | ||
2591 | return (proc_pdrv(adapter, page, 3)); | 2339 | if( (scsi_inq[2] & 0x07) == 1 && (scsi_inq[3] & 0x0f) == 1 ) |
2340 | seq_puts(m, " CCS\n"); | ||
2341 | else | ||
2342 | seq_putc(m, '\n'); | ||
2592 | } | 2343 | } |
2593 | 2344 | ||
2594 | |||
2595 | /** | 2345 | /** |
2596 | * proc_pdrv() | 2346 | * proc_show_pdrv() |
2347 | * @m - Synthetic file construction data | ||
2597 | * @page - buffer to write the data in | 2348 | * @page - buffer to write the data in |
2598 | * @adapter - pointer to our soft state | 2349 | * @adapter - pointer to our soft state |
2599 | * | 2350 | * |
2600 | * Display information about the physical drives. | 2351 | * Display information about the physical drives. |
2601 | */ | 2352 | */ |
2602 | static int | 2353 | static int |
2603 | proc_pdrv(adapter_t *adapter, char *page, int channel) | 2354 | proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel) |
2604 | { | 2355 | { |
2605 | dma_addr_t dma_handle; | 2356 | dma_addr_t dma_handle; |
2606 | char *scsi_inq; | 2357 | char *scsi_inq; |
@@ -2611,32 +2362,24 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2611 | u8 state; | 2362 | u8 state; |
2612 | int tgt; | 2363 | int tgt; |
2613 | int max_channels; | 2364 | int max_channels; |
2614 | int len = 0; | ||
2615 | char str[80]; | ||
2616 | int i; | 2365 | int i; |
2617 | 2366 | ||
2618 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2367 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2619 | return len; | 2368 | return 0; |
2620 | } | ||
2621 | 2369 | ||
2622 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2370 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2623 | goto free_pdev; | 2371 | goto free_pdev; |
2624 | } | ||
2625 | 2372 | ||
2626 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2373 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2627 | len = sprintf(page, "Adapter inquiry failed.\n"); | 2374 | seq_puts(m, "Adapter inquiry failed.\n"); |
2628 | |||
2629 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2375 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2630 | |||
2631 | goto free_inquiry; | 2376 | goto free_inquiry; |
2632 | } | 2377 | } |
2633 | 2378 | ||
2634 | 2379 | ||
2635 | scsi_inq = pci_alloc_consistent(pdev, 256, &scsi_inq_dma_handle); | 2380 | scsi_inq = pci_alloc_consistent(pdev, 256, &scsi_inq_dma_handle); |
2636 | |||
2637 | if( scsi_inq == NULL ) { | 2381 | if( scsi_inq == NULL ) { |
2638 | len = sprintf(page, "memory not available for scsi inq.\n"); | 2382 | seq_puts(m, "memory not available for scsi inq.\n"); |
2639 | |||
2640 | goto free_inquiry; | 2383 | goto free_inquiry; |
2641 | } | 2384 | } |
2642 | 2385 | ||
@@ -2659,39 +2402,31 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2659 | i = channel*16 + tgt; | 2402 | i = channel*16 + tgt; |
2660 | 2403 | ||
2661 | state = *(pdrv_state + i); | 2404 | state = *(pdrv_state + i); |
2662 | |||
2663 | switch( state & 0x0F ) { | 2405 | switch( state & 0x0F ) { |
2664 | |||
2665 | case PDRV_ONLINE: | 2406 | case PDRV_ONLINE: |
2666 | sprintf(str, | 2407 | seq_printf(m, "Channel:%2d Id:%2d State: Online", |
2667 | "Channel:%2d Id:%2d State: Online", | 2408 | channel, tgt); |
2668 | channel, tgt); | ||
2669 | break; | 2409 | break; |
2670 | 2410 | ||
2671 | case PDRV_FAILED: | 2411 | case PDRV_FAILED: |
2672 | sprintf(str, | 2412 | seq_printf(m, "Channel:%2d Id:%2d State: Failed", |
2673 | "Channel:%2d Id:%2d State: Failed", | 2413 | channel, tgt); |
2674 | channel, tgt); | ||
2675 | break; | 2414 | break; |
2676 | 2415 | ||
2677 | case PDRV_RBLD: | 2416 | case PDRV_RBLD: |
2678 | sprintf(str, | 2417 | seq_printf(m, "Channel:%2d Id:%2d State: Rebuild", |
2679 | "Channel:%2d Id:%2d State: Rebuild", | 2418 | channel, tgt); |
2680 | channel, tgt); | ||
2681 | break; | 2419 | break; |
2682 | 2420 | ||
2683 | case PDRV_HOTSPARE: | 2421 | case PDRV_HOTSPARE: |
2684 | sprintf(str, | 2422 | seq_printf(m, "Channel:%2d Id:%2d State: Hot spare", |
2685 | "Channel:%2d Id:%2d State: Hot spare", | 2423 | channel, tgt); |
2686 | channel, tgt); | ||
2687 | break; | 2424 | break; |
2688 | 2425 | ||
2689 | default: | 2426 | default: |
2690 | sprintf(str, | 2427 | seq_printf(m, "Channel:%2d Id:%2d State: Un-configured", |
2691 | "Channel:%2d Id:%2d State: Un-configured", | 2428 | channel, tgt); |
2692 | channel, tgt); | ||
2693 | break; | 2429 | break; |
2694 | |||
2695 | } | 2430 | } |
2696 | 2431 | ||
2697 | /* | 2432 | /* |
@@ -2710,11 +2445,8 @@ proc_pdrv(adapter_t *adapter, char *page, int channel) | |||
2710 | * Check for overflow. We print less than 240 | 2445 | * Check for overflow. We print less than 240 |
2711 | * characters for inquiry | 2446 | * characters for inquiry |
2712 | */ | 2447 | */ |
2713 | if( (len + 240) >= PAGE_SIZE ) break; | 2448 | seq_puts(m, ".\n"); |
2714 | 2449 | mega_print_inquiry(m, scsi_inq); | |
2715 | len += sprintf(page+len, "%s.\n", str); | ||
2716 | |||
2717 | len += mega_print_inquiry(page+len, scsi_inq); | ||
2718 | } | 2450 | } |
2719 | 2451 | ||
2720 | free_pci: | 2452 | free_pci: |
@@ -2723,150 +2455,68 @@ free_inquiry: | |||
2723 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2455 | mega_free_inquiry(inquiry, dma_handle, pdev); |
2724 | free_pdev: | 2456 | free_pdev: |
2725 | free_local_pdev(pdev); | 2457 | free_local_pdev(pdev); |
2726 | 2458 | return 0; | |
2727 | return len; | ||
2728 | } | ||
2729 | |||
2730 | |||
2731 | /* | ||
2732 | * Display scsi inquiry | ||
2733 | */ | ||
2734 | static int | ||
2735 | mega_print_inquiry(char *page, char *scsi_inq) | ||
2736 | { | ||
2737 | int len = 0; | ||
2738 | int i; | ||
2739 | |||
2740 | len = sprintf(page, " Vendor: "); | ||
2741 | for( i = 8; i < 16; i++ ) { | ||
2742 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2743 | } | ||
2744 | |||
2745 | len += sprintf(page+len, " Model: "); | ||
2746 | |||
2747 | for( i = 16; i < 32; i++ ) { | ||
2748 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2749 | } | ||
2750 | |||
2751 | len += sprintf(page+len, " Rev: "); | ||
2752 | |||
2753 | for( i = 32; i < 36; i++ ) { | ||
2754 | len += sprintf(page+len, "%c", scsi_inq[i]); | ||
2755 | } | ||
2756 | |||
2757 | len += sprintf(page+len, "\n"); | ||
2758 | |||
2759 | i = scsi_inq[0] & 0x1f; | ||
2760 | |||
2761 | len += sprintf(page+len, " Type: %s ", scsi_device_type(i)); | ||
2762 | |||
2763 | len += sprintf(page+len, | ||
2764 | " ANSI SCSI revision: %02x", scsi_inq[2] & 0x07); | ||
2765 | |||
2766 | if( (scsi_inq[2] & 0x07) == 1 && (scsi_inq[3] & 0x0f) == 1 ) | ||
2767 | len += sprintf(page+len, " CCS\n"); | ||
2768 | else | ||
2769 | len += sprintf(page+len, "\n"); | ||
2770 | |||
2771 | return len; | ||
2772 | } | 2459 | } |
2773 | 2460 | ||
2774 | |||
2775 | /** | 2461 | /** |
2776 | * proc_rdrv_10() | 2462 | * proc_show_pdrv_ch0() |
2777 | * @page - buffer to write the data in | 2463 | * @m - Synthetic file construction data |
2778 | * @start - where the actual data has been written in page | 2464 | * @v - File iterator |
2779 | * @offset - same meaning as the read system call | ||
2780 | * @count - same meaning as the read system call | ||
2781 | * @eof - set if no more data needs to be returned | ||
2782 | * @data - pointer to our soft state | ||
2783 | * | 2465 | * |
2784 | * Display real time information about the logical drives 0 through 9. | 2466 | * Display information about the physical drives on physical channel 0. |
2785 | */ | 2467 | */ |
2786 | static int | 2468 | static int |
2787 | proc_rdrv_10(char *page, char **start, off_t offset, int count, int *eof, | 2469 | proc_show_pdrv_ch0(struct seq_file *m, void *v) |
2788 | void *data) | ||
2789 | { | 2470 | { |
2790 | adapter_t *adapter = (adapter_t *)data; | 2471 | return proc_show_pdrv(m, m->private, 0); |
2791 | |||
2792 | *eof = 1; | ||
2793 | |||
2794 | return (proc_rdrv(adapter, page, 0, 9)); | ||
2795 | } | 2472 | } |
2796 | 2473 | ||
2797 | 2474 | ||
2798 | /** | 2475 | /** |
2799 | * proc_rdrv_20() | 2476 | * proc_show_pdrv_ch1() |
2800 | * @page - buffer to write the data in | 2477 | * @m - Synthetic file construction data |
2801 | * @start - where the actual data has been written in page | 2478 | * @v - File iterator |
2802 | * @offset - same meaning as the read system call | ||
2803 | * @count - same meaning as the read system call | ||
2804 | * @eof - set if no more data needs to be returned | ||
2805 | * @data - pointer to our soft state | ||
2806 | * | 2479 | * |
2807 | * Display real time information about the logical drives 0 through 9. | 2480 | * Display information about the physical drives on physical channel 1. |
2808 | */ | 2481 | */ |
2809 | static int | 2482 | static int |
2810 | proc_rdrv_20(char *page, char **start, off_t offset, int count, int *eof, | 2483 | proc_show_pdrv_ch1(struct seq_file *m, void *v) |
2811 | void *data) | ||
2812 | { | 2484 | { |
2813 | adapter_t *adapter = (adapter_t *)data; | 2485 | return proc_show_pdrv(m, m->private, 1); |
2814 | |||
2815 | *eof = 1; | ||
2816 | |||
2817 | return (proc_rdrv(adapter, page, 10, 19)); | ||
2818 | } | 2486 | } |
2819 | 2487 | ||
2820 | 2488 | ||
2821 | /** | 2489 | /** |
2822 | * proc_rdrv_30() | 2490 | * proc_show_pdrv_ch2() |
2823 | * @page - buffer to write the data in | 2491 | * @m - Synthetic file construction data |
2824 | * @start - where the actual data has been written in page | 2492 | * @v - File iterator |
2825 | * @offset - same meaning as the read system call | ||
2826 | * @count - same meaning as the read system call | ||
2827 | * @eof - set if no more data needs to be returned | ||
2828 | * @data - pointer to our soft state | ||
2829 | * | 2493 | * |
2830 | * Display real time information about the logical drives 0 through 9. | 2494 | * Display information about the physical drives on physical channel 2. |
2831 | */ | 2495 | */ |
2832 | static int | 2496 | static int |
2833 | proc_rdrv_30(char *page, char **start, off_t offset, int count, int *eof, | 2497 | proc_show_pdrv_ch2(struct seq_file *m, void *v) |
2834 | void *data) | ||
2835 | { | 2498 | { |
2836 | adapter_t *adapter = (adapter_t *)data; | 2499 | return proc_show_pdrv(m, m->private, 2); |
2837 | |||
2838 | *eof = 1; | ||
2839 | |||
2840 | return (proc_rdrv(adapter, page, 20, 29)); | ||
2841 | } | 2500 | } |
2842 | 2501 | ||
2843 | 2502 | ||
2844 | /** | 2503 | /** |
2845 | * proc_rdrv_40() | 2504 | * proc_show_pdrv_ch3() |
2846 | * @page - buffer to write the data in | 2505 | * @m - Synthetic file construction data |
2847 | * @start - where the actual data has been written in page | 2506 | * @v - File iterator |
2848 | * @offset - same meaning as the read system call | ||
2849 | * @count - same meaning as the read system call | ||
2850 | * @eof - set if no more data needs to be returned | ||
2851 | * @data - pointer to our soft state | ||
2852 | * | 2507 | * |
2853 | * Display real time information about the logical drives 0 through 9. | 2508 | * Display information about the physical drives on physical channel 3. |
2854 | */ | 2509 | */ |
2855 | static int | 2510 | static int |
2856 | proc_rdrv_40(char *page, char **start, off_t offset, int count, int *eof, | 2511 | proc_show_pdrv_ch3(struct seq_file *m, void *v) |
2857 | void *data) | ||
2858 | { | 2512 | { |
2859 | adapter_t *adapter = (adapter_t *)data; | 2513 | return proc_show_pdrv(m, m->private, 3); |
2860 | |||
2861 | *eof = 1; | ||
2862 | |||
2863 | return (proc_rdrv(adapter, page, 30, 39)); | ||
2864 | } | 2514 | } |
2865 | 2515 | ||
2866 | 2516 | ||
2867 | /** | 2517 | /** |
2868 | * proc_rdrv() | 2518 | * proc_show_rdrv() |
2869 | * @page - buffer to write the data in | 2519 | * @m - Synthetic file construction data |
2870 | * @adapter - pointer to our soft state | 2520 | * @adapter - pointer to our soft state |
2871 | * @start - starting logical drive to display | 2521 | * @start - starting logical drive to display |
2872 | * @end - ending logical drive to display | 2522 | * @end - ending logical drive to display |
@@ -2875,7 +2525,7 @@ proc_rdrv_40(char *page, char **start, off_t offset, int count, int *eof, | |||
2875 | * /proc/scsi/scsi interface | 2525 | * /proc/scsi/scsi interface |
2876 | */ | 2526 | */ |
2877 | static int | 2527 | static int |
2878 | proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | 2528 | proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end ) |
2879 | { | 2529 | { |
2880 | dma_addr_t dma_handle; | 2530 | dma_addr_t dma_handle; |
2881 | logdrv_param *lparam; | 2531 | logdrv_param *lparam; |
@@ -2887,29 +2537,18 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2887 | u8 *rdrv_state; | 2537 | u8 *rdrv_state; |
2888 | int num_ldrv; | 2538 | int num_ldrv; |
2889 | u32 array_sz; | 2539 | u32 array_sz; |
2890 | int len = 0; | ||
2891 | int i; | 2540 | int i; |
2892 | 2541 | ||
2893 | if( make_local_pdev(adapter, &pdev) != 0 ) { | 2542 | if( make_local_pdev(adapter, &pdev) != 0 ) |
2894 | return len; | 2543 | return 0; |
2895 | } | ||
2896 | 2544 | ||
2897 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) { | 2545 | if( (inquiry = mega_allocate_inquiry(&dma_handle, pdev)) == NULL ) |
2898 | free_local_pdev(pdev); | 2546 | goto free_pdev; |
2899 | return len; | ||
2900 | } | ||
2901 | 2547 | ||
2902 | if( mega_adapinq(adapter, dma_handle) != 0 ) { | 2548 | if( mega_adapinq(adapter, dma_handle) != 0 ) { |
2903 | 2549 | seq_puts(m, "Adapter inquiry failed.\n"); | |
2904 | len = sprintf(page, "Adapter inquiry failed.\n"); | ||
2905 | |||
2906 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); | 2550 | printk(KERN_WARNING "megaraid: inquiry failed.\n"); |
2907 | 2551 | goto free_inquiry; | |
2908 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2909 | |||
2910 | free_local_pdev(pdev); | ||
2911 | |||
2912 | return len; | ||
2913 | } | 2552 | } |
2914 | 2553 | ||
2915 | memset(&mc, 0, sizeof(megacmd_t)); | 2554 | memset(&mc, 0, sizeof(megacmd_t)); |
@@ -2935,13 +2574,8 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2935 | &disk_array_dma_handle); | 2574 | &disk_array_dma_handle); |
2936 | 2575 | ||
2937 | if( disk_array == NULL ) { | 2576 | if( disk_array == NULL ) { |
2938 | len = sprintf(page, "memory not available.\n"); | 2577 | seq_puts(m, "memory not available.\n"); |
2939 | 2578 | goto free_inquiry; | |
2940 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2941 | |||
2942 | free_local_pdev(pdev); | ||
2943 | |||
2944 | return len; | ||
2945 | } | 2579 | } |
2946 | 2580 | ||
2947 | mc.xferaddr = (u32)disk_array_dma_handle; | 2581 | mc.xferaddr = (u32)disk_array_dma_handle; |
@@ -2951,17 +2585,8 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2951 | mc.opcode = OP_DCMD_READ_CONFIG; | 2585 | mc.opcode = OP_DCMD_READ_CONFIG; |
2952 | 2586 | ||
2953 | if( mega_internal_command(adapter, &mc, NULL) ) { | 2587 | if( mega_internal_command(adapter, &mc, NULL) ) { |
2954 | 2588 | seq_puts(m, "40LD read config failed.\n"); | |
2955 | len = sprintf(page, "40LD read config failed.\n"); | 2589 | goto free_pci; |
2956 | |||
2957 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2958 | |||
2959 | pci_free_consistent(pdev, array_sz, disk_array, | ||
2960 | disk_array_dma_handle); | ||
2961 | |||
2962 | free_local_pdev(pdev); | ||
2963 | |||
2964 | return len; | ||
2965 | } | 2590 | } |
2966 | 2591 | ||
2967 | } | 2592 | } |
@@ -2969,24 +2594,10 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
2969 | mc.cmd = NEW_READ_CONFIG_8LD; | 2594 | mc.cmd = NEW_READ_CONFIG_8LD; |
2970 | 2595 | ||
2971 | if( mega_internal_command(adapter, &mc, NULL) ) { | 2596 | if( mega_internal_command(adapter, &mc, NULL) ) { |
2972 | |||
2973 | mc.cmd = READ_CONFIG_8LD; | 2597 | mc.cmd = READ_CONFIG_8LD; |
2974 | 2598 | if( mega_internal_command(adapter, &mc, NULL) ) { | |
2975 | if( mega_internal_command(adapter, &mc, | 2599 | seq_puts(m, "8LD read config failed.\n"); |
2976 | NULL) ){ | 2600 | goto free_pci; |
2977 | |||
2978 | len = sprintf(page, | ||
2979 | "8LD read config failed.\n"); | ||
2980 | |||
2981 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2982 | |||
2983 | pci_free_consistent(pdev, array_sz, | ||
2984 | disk_array, | ||
2985 | disk_array_dma_handle); | ||
2986 | |||
2987 | free_local_pdev(pdev); | ||
2988 | |||
2989 | return len; | ||
2990 | } | 2601 | } |
2991 | } | 2602 | } |
2992 | } | 2603 | } |
@@ -3006,29 +2617,23 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
3006 | * Check for overflow. We print less than 240 characters for | 2617 | * Check for overflow. We print less than 240 characters for |
3007 | * information about each logical drive. | 2618 | * information about each logical drive. |
3008 | */ | 2619 | */ |
3009 | if( (len + 240) >= PAGE_SIZE ) break; | 2620 | seq_printf(m, "Logical drive:%2d:, ", i); |
3010 | |||
3011 | len += sprintf(page+len, "Logical drive:%2d:, ", i); | ||
3012 | 2621 | ||
3013 | switch( rdrv_state[i] & 0x0F ) { | 2622 | switch( rdrv_state[i] & 0x0F ) { |
3014 | case RDRV_OFFLINE: | 2623 | case RDRV_OFFLINE: |
3015 | len += sprintf(page+len, "state: offline"); | 2624 | seq_puts(m, "state: offline"); |
3016 | break; | 2625 | break; |
3017 | |||
3018 | case RDRV_DEGRADED: | 2626 | case RDRV_DEGRADED: |
3019 | len += sprintf(page+len, "state: degraded"); | 2627 | seq_puts(m, "state: degraded"); |
3020 | break; | 2628 | break; |
3021 | |||
3022 | case RDRV_OPTIMAL: | 2629 | case RDRV_OPTIMAL: |
3023 | len += sprintf(page+len, "state: optimal"); | 2630 | seq_puts(m, "state: optimal"); |
3024 | break; | 2631 | break; |
3025 | |||
3026 | case RDRV_DELETED: | 2632 | case RDRV_DELETED: |
3027 | len += sprintf(page+len, "state: deleted"); | 2633 | seq_puts(m, "state: deleted"); |
3028 | break; | 2634 | break; |
3029 | |||
3030 | default: | 2635 | default: |
3031 | len += sprintf(page+len, "state: unknown"); | 2636 | seq_puts(m, "state: unknown"); |
3032 | break; | 2637 | break; |
3033 | } | 2638 | } |
3034 | 2639 | ||
@@ -3036,84 +2641,203 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) | |||
3036 | * Check if check consistency or initialization is going on | 2641 | * Check if check consistency or initialization is going on |
3037 | * for this logical drive. | 2642 | * for this logical drive. |
3038 | */ | 2643 | */ |
3039 | if( (rdrv_state[i] & 0xF0) == 0x20 ) { | 2644 | if( (rdrv_state[i] & 0xF0) == 0x20 ) |
3040 | len += sprintf(page+len, | 2645 | seq_puts(m, ", check-consistency in progress"); |
3041 | ", check-consistency in progress"); | 2646 | else if( (rdrv_state[i] & 0xF0) == 0x10 ) |
3042 | } | 2647 | seq_puts(m, ", initialization in progress"); |
3043 | else if( (rdrv_state[i] & 0xF0) == 0x10 ) { | ||
3044 | len += sprintf(page+len, | ||
3045 | ", initialization in progress"); | ||
3046 | } | ||
3047 | 2648 | ||
3048 | len += sprintf(page+len, "\n"); | 2649 | seq_putc(m, '\n'); |
3049 | |||
3050 | len += sprintf(page+len, "Span depth:%3d, ", | ||
3051 | lparam->span_depth); | ||
3052 | |||
3053 | len += sprintf(page+len, "RAID level:%3d, ", | ||
3054 | lparam->level); | ||
3055 | |||
3056 | len += sprintf(page+len, "Stripe size:%3d, ", | ||
3057 | lparam->stripe_sz ? lparam->stripe_sz/2: 128); | ||
3058 | |||
3059 | len += sprintf(page+len, "Row size:%3d\n", | ||
3060 | lparam->row_size); | ||
3061 | 2650 | ||
2651 | seq_printf(m, "Span depth:%3d, ", lparam->span_depth); | ||
2652 | seq_printf(m, "RAID level:%3d, ", lparam->level); | ||
2653 | seq_printf(m, "Stripe size:%3d, ", | ||
2654 | lparam->stripe_sz ? lparam->stripe_sz/2: 128); | ||
2655 | seq_printf(m, "Row size:%3d\n", lparam->row_size); | ||
3062 | 2656 | ||
3063 | len += sprintf(page+len, "Read Policy: "); | 2657 | seq_puts(m, "Read Policy: "); |
3064 | |||
3065 | switch(lparam->read_ahead) { | 2658 | switch(lparam->read_ahead) { |
3066 | |||
3067 | case NO_READ_AHEAD: | 2659 | case NO_READ_AHEAD: |
3068 | len += sprintf(page+len, "No read ahead, "); | 2660 | seq_puts(m, "No read ahead, "); |
3069 | break; | 2661 | break; |
3070 | |||
3071 | case READ_AHEAD: | 2662 | case READ_AHEAD: |
3072 | len += sprintf(page+len, "Read ahead, "); | 2663 | seq_puts(m, "Read ahead, "); |
3073 | break; | 2664 | break; |
3074 | |||
3075 | case ADAP_READ_AHEAD: | 2665 | case ADAP_READ_AHEAD: |
3076 | len += sprintf(page+len, "Adaptive, "); | 2666 | seq_puts(m, "Adaptive, "); |
3077 | break; | 2667 | break; |
3078 | 2668 | ||
3079 | } | 2669 | } |
3080 | 2670 | ||
3081 | len += sprintf(page+len, "Write Policy: "); | 2671 | seq_puts(m, "Write Policy: "); |
3082 | |||
3083 | switch(lparam->write_mode) { | 2672 | switch(lparam->write_mode) { |
3084 | |||
3085 | case WRMODE_WRITE_THRU: | 2673 | case WRMODE_WRITE_THRU: |
3086 | len += sprintf(page+len, "Write thru, "); | 2674 | seq_puts(m, "Write thru, "); |
3087 | break; | 2675 | break; |
3088 | |||
3089 | case WRMODE_WRITE_BACK: | 2676 | case WRMODE_WRITE_BACK: |
3090 | len += sprintf(page+len, "Write back, "); | 2677 | seq_puts(m, "Write back, "); |
3091 | break; | 2678 | break; |
3092 | } | 2679 | } |
3093 | 2680 | ||
3094 | len += sprintf(page+len, "Cache Policy: "); | 2681 | seq_puts(m, "Cache Policy: "); |
3095 | |||
3096 | switch(lparam->direct_io) { | 2682 | switch(lparam->direct_io) { |
3097 | |||
3098 | case CACHED_IO: | 2683 | case CACHED_IO: |
3099 | len += sprintf(page+len, "Cached IO\n\n"); | 2684 | seq_puts(m, "Cached IO\n\n"); |
3100 | break; | 2685 | break; |
3101 | |||
3102 | case DIRECT_IO: | 2686 | case DIRECT_IO: |
3103 | len += sprintf(page+len, "Direct IO\n\n"); | 2687 | seq_puts(m, "Direct IO\n\n"); |
3104 | break; | 2688 | break; |
3105 | } | 2689 | } |
3106 | } | 2690 | } |
3107 | 2691 | ||
3108 | mega_free_inquiry(inquiry, dma_handle, pdev); | 2692 | free_pci: |
3109 | |||
3110 | pci_free_consistent(pdev, array_sz, disk_array, | 2693 | pci_free_consistent(pdev, array_sz, disk_array, |
3111 | disk_array_dma_handle); | 2694 | disk_array_dma_handle); |
3112 | 2695 | free_inquiry: | |
2696 | mega_free_inquiry(inquiry, dma_handle, pdev); | ||
2697 | free_pdev: | ||
3113 | free_local_pdev(pdev); | 2698 | free_local_pdev(pdev); |
2699 | return 0; | ||
2700 | } | ||
2701 | |||
2702 | /** | ||
2703 | * proc_show_rdrv_10() | ||
2704 | * @m - Synthetic file construction data | ||
2705 | * @v - File iterator | ||
2706 | * | ||
2707 | * Display real time information about the logical drives 0 through 9. | ||
2708 | */ | ||
2709 | static int | ||
2710 | proc_show_rdrv_10(struct seq_file *m, void *v) | ||
2711 | { | ||
2712 | return proc_show_rdrv(m, m->private, 0, 9); | ||
2713 | } | ||
2714 | |||
2715 | |||
2716 | /** | ||
2717 | * proc_show_rdrv_20() | ||
2718 | * @m - Synthetic file construction data | ||
2719 | * @v - File iterator | ||
2720 | * | ||
2721 | * Display real time information about the logical drives 0 through 9. | ||
2722 | */ | ||
2723 | static int | ||
2724 | proc_show_rdrv_20(struct seq_file *m, void *v) | ||
2725 | { | ||
2726 | return proc_show_rdrv(m, m->private, 10, 19); | ||
2727 | } | ||
2728 | |||
2729 | |||
2730 | /** | ||
2731 | * proc_show_rdrv_30() | ||
2732 | * @m - Synthetic file construction data | ||
2733 | * @v - File iterator | ||
2734 | * | ||
2735 | * Display real time information about the logical drives 0 through 9. | ||
2736 | */ | ||
2737 | static int | ||
2738 | proc_show_rdrv_30(struct seq_file *m, void *v) | ||
2739 | { | ||
2740 | return proc_show_rdrv(m, m->private, 20, 29); | ||
2741 | } | ||
2742 | |||
2743 | |||
2744 | /** | ||
2745 | * proc_show_rdrv_40() | ||
2746 | * @m - Synthetic file construction data | ||
2747 | * @v - File iterator | ||
2748 | * | ||
2749 | * Display real time information about the logical drives 0 through 9. | ||
2750 | */ | ||
2751 | static int | ||
2752 | proc_show_rdrv_40(struct seq_file *m, void *v) | ||
2753 | { | ||
2754 | return proc_show_rdrv(m, m->private, 30, 39); | ||
2755 | } | ||
2756 | |||
2757 | |||
2758 | /* | ||
2759 | * seq_file wrappers for procfile show routines. | ||
2760 | */ | ||
2761 | static int mega_proc_open(struct inode *inode, struct file *file) | ||
2762 | { | ||
2763 | adapter_t *adapter = proc_get_parent_data(inode); | ||
2764 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
2765 | |||
2766 | return single_open(file, show, adapter); | ||
2767 | } | ||
2768 | |||
2769 | static const struct file_operations mega_proc_fops = { | ||
2770 | .open = mega_proc_open, | ||
2771 | .read = seq_read, | ||
2772 | .llseek = seq_lseek, | ||
2773 | .release = seq_release, | ||
2774 | }; | ||
2775 | |||
2776 | /* | ||
2777 | * Table of proc files we need to create. | ||
2778 | */ | ||
2779 | struct mega_proc_file { | ||
2780 | const char *name; | ||
2781 | unsigned short ptr_offset; | ||
2782 | int (*show) (struct seq_file *m, void *v); | ||
2783 | }; | ||
2784 | |||
2785 | static const struct mega_proc_file mega_proc_files[] = { | ||
2786 | { "config", offsetof(adapter_t, proc_read), proc_show_config }, | ||
2787 | { "stat", offsetof(adapter_t, proc_stat), proc_show_stat }, | ||
2788 | { "mailbox", offsetof(adapter_t, proc_mbox), proc_show_mbox }, | ||
2789 | #if MEGA_HAVE_ENH_PROC | ||
2790 | { "rebuild-rate", offsetof(adapter_t, proc_rr), proc_show_rebuild_rate }, | ||
2791 | { "battery-status", offsetof(adapter_t, proc_battery), proc_show_battery }, | ||
2792 | { "diskdrives-ch0", offsetof(adapter_t, proc_pdrvstat[0]), proc_show_pdrv_ch0 }, | ||
2793 | { "diskdrives-ch1", offsetof(adapter_t, proc_pdrvstat[1]), proc_show_pdrv_ch1 }, | ||
2794 | { "diskdrives-ch2", offsetof(adapter_t, proc_pdrvstat[2]), proc_show_pdrv_ch2 }, | ||
2795 | { "diskdrives-ch3", offsetof(adapter_t, proc_pdrvstat[3]), proc_show_pdrv_ch3 }, | ||
2796 | { "raiddrives-0-9", offsetof(adapter_t, proc_rdrvstat[0]), proc_show_rdrv_10 }, | ||
2797 | { "raiddrives-10-19", offsetof(adapter_t, proc_rdrvstat[1]), proc_show_rdrv_20 }, | ||
2798 | { "raiddrives-20-29", offsetof(adapter_t, proc_rdrvstat[2]), proc_show_rdrv_30 }, | ||
2799 | { "raiddrives-30-39", offsetof(adapter_t, proc_rdrvstat[3]), proc_show_rdrv_40 }, | ||
2800 | #endif | ||
2801 | { NULL } | ||
2802 | }; | ||
3114 | 2803 | ||
3115 | return len; | 2804 | /** |
2805 | * mega_create_proc_entry() | ||
2806 | * @index - index in soft state array | ||
2807 | * @parent - parent node for this /proc entry | ||
2808 | * | ||
2809 | * Creates /proc entries for our controllers. | ||
2810 | */ | ||
2811 | static void | ||
2812 | mega_create_proc_entry(int index, struct proc_dir_entry *parent) | ||
2813 | { | ||
2814 | const struct mega_proc_file *f; | ||
2815 | adapter_t *adapter = hba_soft_state[index]; | ||
2816 | struct proc_dir_entry *dir, *de, **ppde; | ||
2817 | u8 string[16]; | ||
2818 | |||
2819 | sprintf(string, "hba%d", adapter->host->host_no); | ||
2820 | |||
2821 | dir = adapter->controller_proc_dir_entry = | ||
2822 | proc_mkdir_data(string, 0, parent, adapter); | ||
2823 | if(!dir) { | ||
2824 | printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n"); | ||
2825 | return; | ||
2826 | } | ||
2827 | |||
2828 | for (f = mega_proc_files; f->name; f++) { | ||
2829 | de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops, | ||
2830 | f->show); | ||
2831 | if (!de) { | ||
2832 | printk(KERN_WARNING "\nmegaraid: proc_create failed\n"); | ||
2833 | return; | ||
2834 | } | ||
2835 | |||
2836 | ppde = (void *)adapter + f->ptr_offset; | ||
2837 | *ppde = de; | ||
2838 | } | ||
3116 | } | 2839 | } |
2840 | |||
3117 | #else | 2841 | #else |
3118 | static inline void mega_create_proc_entry(int index, struct proc_dir_entry *parent) | 2842 | static inline void mega_create_proc_entry(int index, struct proc_dir_entry *parent) |
3119 | { | 2843 | { |
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index 4fb2adf6b80d..4d0ce4e78dfd 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h | |||
@@ -987,24 +987,7 @@ static int mega_init_scb (adapter_t *); | |||
987 | static int mega_is_bios_enabled (adapter_t *); | 987 | static int mega_is_bios_enabled (adapter_t *); |
988 | 988 | ||
989 | #ifdef CONFIG_PROC_FS | 989 | #ifdef CONFIG_PROC_FS |
990 | static int mega_print_inquiry(char *, char *); | ||
991 | static void mega_create_proc_entry(int, struct proc_dir_entry *); | 990 | static void mega_create_proc_entry(int, struct proc_dir_entry *); |
992 | static int proc_read_config(char *, char **, off_t, int, int *, void *); | ||
993 | static int proc_read_stat(char *, char **, off_t, int, int *, void *); | ||
994 | static int proc_read_mbox(char *, char **, off_t, int, int *, void *); | ||
995 | static int proc_rebuild_rate(char *, char **, off_t, int, int *, void *); | ||
996 | static int proc_battery(char *, char **, off_t, int, int *, void *); | ||
997 | static int proc_pdrv_ch0(char *, char **, off_t, int, int *, void *); | ||
998 | static int proc_pdrv_ch1(char *, char **, off_t, int, int *, void *); | ||
999 | static int proc_pdrv_ch2(char *, char **, off_t, int, int *, void *); | ||
1000 | static int proc_pdrv_ch3(char *, char **, off_t, int, int *, void *); | ||
1001 | static int proc_pdrv(adapter_t *, char *, int); | ||
1002 | static int proc_rdrv_10(char *, char **, off_t, int, int *, void *); | ||
1003 | static int proc_rdrv_20(char *, char **, off_t, int, int *, void *); | ||
1004 | static int proc_rdrv_30(char *, char **, off_t, int, int *, void *); | ||
1005 | static int proc_rdrv_40(char *, char **, off_t, int, int *, void *); | ||
1006 | static int proc_rdrv(adapter_t *, char *, int, int); | ||
1007 | |||
1008 | static int mega_adapinq(adapter_t *, dma_addr_t); | 991 | static int mega_adapinq(adapter_t *, dma_addr_t); |
1009 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); | 992 | static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t); |
1010 | #endif | 993 | #endif |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 08685c4cf231..eec052c2670a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -505,19 +505,6 @@ _ctl_fasync(int fd, struct file *filep, int mode) | |||
505 | } | 505 | } |
506 | 506 | ||
507 | /** | 507 | /** |
508 | * _ctl_release - | ||
509 | * @inode - | ||
510 | * @filep - | ||
511 | * | ||
512 | * Called when application releases the fasyn callback handler. | ||
513 | */ | ||
514 | static int | ||
515 | _ctl_release(struct inode *inode, struct file *filep) | ||
516 | { | ||
517 | return fasync_helper(-1, filep, 0, &async_queue); | ||
518 | } | ||
519 | |||
520 | /** | ||
521 | * _ctl_poll - | 508 | * _ctl_poll - |
522 | * @file - | 509 | * @file - |
523 | * @wait - | 510 | * @wait - |
@@ -3027,7 +3014,6 @@ struct device_attribute *mpt2sas_dev_attrs[] = { | |||
3027 | static const struct file_operations ctl_fops = { | 3014 | static const struct file_operations ctl_fops = { |
3028 | .owner = THIS_MODULE, | 3015 | .owner = THIS_MODULE, |
3029 | .unlocked_ioctl = _ctl_ioctl, | 3016 | .unlocked_ioctl = _ctl_ioctl, |
3030 | .release = _ctl_release, | ||
3031 | .poll = _ctl_poll, | 3017 | .poll = _ctl_poll, |
3032 | .fasync = _ctl_fasync, | 3018 | .fasync = _ctl_fasync, |
3033 | #ifdef CONFIG_COMPAT | 3019 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index 054d5231c974..0b402b6f2d26 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c | |||
@@ -503,19 +503,6 @@ _ctl_fasync(int fd, struct file *filep, int mode) | |||
503 | } | 503 | } |
504 | 504 | ||
505 | /** | 505 | /** |
506 | * _ctl_release - | ||
507 | * @inode - | ||
508 | * @filep - | ||
509 | * | ||
510 | * Called when application releases the fasyn callback handler. | ||
511 | */ | ||
512 | static int | ||
513 | _ctl_release(struct inode *inode, struct file *filep) | ||
514 | { | ||
515 | return fasync_helper(-1, filep, 0, &async_queue); | ||
516 | } | ||
517 | |||
518 | /** | ||
519 | * _ctl_poll - | 506 | * _ctl_poll - |
520 | * @file - | 507 | * @file - |
521 | * @wait - | 508 | * @wait - |
@@ -3233,7 +3220,6 @@ struct device_attribute *mpt3sas_dev_attrs[] = { | |||
3233 | static const struct file_operations ctl_fops = { | 3220 | static const struct file_operations ctl_fops = { |
3234 | .owner = THIS_MODULE, | 3221 | .owner = THIS_MODULE, |
3235 | .unlocked_ioctl = _ctl_ioctl, | 3222 | .unlocked_ioctl = _ctl_ioctl, |
3236 | .release = _ctl_release, | ||
3237 | .poll = _ctl_poll, | 3223 | .poll = _ctl_poll, |
3238 | .fasync = _ctl_fasync, | 3224 | .fasync = _ctl_fasync, |
3239 | #ifdef CONFIG_COMPAT | 3225 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c index c29d0dbb9660..e7f6661a8862 100644 --- a/drivers/scsi/mvme147.c +++ b/drivers/scsi/mvme147.c | |||
@@ -76,7 +76,8 @@ int mvme147_detect(struct scsi_host_template *tpnt) | |||
76 | called++; | 76 | called++; |
77 | 77 | ||
78 | tpnt->proc_name = "MVME147"; | 78 | tpnt->proc_name = "MVME147"; |
79 | tpnt->proc_info = &wd33c93_proc_info; | 79 | tpnt->show_info = wd33c93_show_info, |
80 | tpnt->write_info = wd33c93_write_info, | ||
80 | 81 | ||
81 | instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); | 82 | instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata)); |
82 | if (!instance) | 83 | if (!instance) |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 1cc0c1c69c88..1e3879dcbdcc 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -192,7 +192,7 @@ static int __init init_nsp32 (void); | |||
192 | static void __exit exit_nsp32 (void); | 192 | static void __exit exit_nsp32 (void); |
193 | 193 | ||
194 | /* struct struct scsi_host_template */ | 194 | /* struct struct scsi_host_template */ |
195 | static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); | 195 | static int nsp32_show_info (struct seq_file *, struct Scsi_Host *); |
196 | 196 | ||
197 | static int nsp32_detect (struct pci_dev *pdev); | 197 | static int nsp32_detect (struct pci_dev *pdev); |
198 | static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); | 198 | static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
@@ -268,7 +268,7 @@ static void nsp32_dmessage(const char *, int, int, char *, ...); | |||
268 | static struct scsi_host_template nsp32_template = { | 268 | static struct scsi_host_template nsp32_template = { |
269 | .proc_name = "nsp32", | 269 | .proc_name = "nsp32", |
270 | .name = "Workbit NinjaSCSI-32Bi/UDE", | 270 | .name = "Workbit NinjaSCSI-32Bi/UDE", |
271 | .proc_info = nsp32_proc_info, | 271 | .show_info = nsp32_show_info, |
272 | .info = nsp32_info, | 272 | .info = nsp32_info, |
273 | .queuecommand = nsp32_queuecommand, | 273 | .queuecommand = nsp32_queuecommand, |
274 | .can_queue = 1, | 274 | .can_queue = 1, |
@@ -1442,19 +1442,10 @@ static irqreturn_t do_nsp32_isr(int irq, void *dev_id) | |||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | #undef SPRINTF | 1444 | #undef SPRINTF |
1445 | #define SPRINTF(args...) \ | 1445 | #define SPRINTF(args...) seq_printf(m, ##args) |
1446 | do { \ | 1446 | |
1447 | if(length > (pos - buffer)) { \ | 1447 | static int nsp32_show_info(struct seq_file *m, struct Scsi_Host *host) |
1448 | pos += snprintf(pos, length - (pos - buffer) + 1, ## args); \ | ||
1449 | nsp32_dbg(NSP32_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | ||
1450 | } \ | ||
1451 | } while(0) | ||
1452 | |||
1453 | static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | ||
1454 | off_t offset, int length, int inout) | ||
1455 | { | 1448 | { |
1456 | char *pos = buffer; | ||
1457 | int thislength; | ||
1458 | unsigned long flags; | 1449 | unsigned long flags; |
1459 | nsp32_hw_data *data; | 1450 | nsp32_hw_data *data; |
1460 | int hostno; | 1451 | int hostno; |
@@ -1463,11 +1454,6 @@ static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1463 | int id, speed; | 1454 | int id, speed; |
1464 | long model; | 1455 | long model; |
1465 | 1456 | ||
1466 | /* Write is not supported, just return. */ | ||
1467 | if (inout == TRUE) { | ||
1468 | return -EINVAL; | ||
1469 | } | ||
1470 | |||
1471 | hostno = host->host_no; | 1457 | hostno = host->host_no; |
1472 | data = (nsp32_hw_data *)host->hostdata; | 1458 | data = (nsp32_hw_data *)host->hostdata; |
1473 | base = host->io_port; | 1459 | base = host->io_port; |
@@ -1527,20 +1513,7 @@ static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1527 | } | 1513 | } |
1528 | SPRINTF("\n"); | 1514 | SPRINTF("\n"); |
1529 | } | 1515 | } |
1530 | 1516 | return 0; | |
1531 | |||
1532 | thislength = pos - (buffer + offset); | ||
1533 | |||
1534 | if(thislength < 0) { | ||
1535 | *start = NULL; | ||
1536 | return 0; | ||
1537 | } | ||
1538 | |||
1539 | |||
1540 | thislength = min(thislength, length); | ||
1541 | *start = buffer + offset; | ||
1542 | |||
1543 | return thislength; | ||
1544 | } | 1517 | } |
1545 | #undef SPRINTF | 1518 | #undef SPRINTF |
1546 | 1519 | ||
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index 2f72c9807b12..62f1a6031765 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -388,7 +388,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt) | |||
388 | int count; | 388 | int count; |
389 | 389 | ||
390 | tpnt->proc_name = "pas16"; | 390 | tpnt->proc_name = "pas16"; |
391 | tpnt->proc_info = &pas16_proc_info; | 391 | tpnt->show_info = pas16_show_info; |
392 | tpnt->write_info = pas16_write_info; | ||
392 | 393 | ||
393 | if (pas16_addr != 0) { | 394 | if (pas16_addr != 0) { |
394 | overrides[0].io_port = pas16_addr; | 395 | overrides[0].io_port = pas16_addr; |
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h index a04281cace2e..3721342835e9 100644 --- a/drivers/scsi/pas16.h +++ b/drivers/scsi/pas16.h | |||
@@ -163,7 +163,8 @@ static int pas16_bus_reset(Scsi_Cmnd *); | |||
163 | #define NCR5380_queue_command pas16_queue_command | 163 | #define NCR5380_queue_command pas16_queue_command |
164 | #define NCR5380_abort pas16_abort | 164 | #define NCR5380_abort pas16_abort |
165 | #define NCR5380_bus_reset pas16_bus_reset | 165 | #define NCR5380_bus_reset pas16_bus_reset |
166 | #define NCR5380_proc_info pas16_proc_info | 166 | #define NCR5380_show_info pas16_show_info |
167 | #define NCR5380_write_info pas16_write_info | ||
167 | 168 | ||
168 | /* 15 14 12 10 7 5 3 | 169 | /* 15 14 12 10 7 5 3 |
169 | 1101 0100 1010 1000 */ | 170 | 1101 0100 1010 1000 */ |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index b61a753eb896..987fbb1b244e 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -76,7 +76,7 @@ MODULE_PARM_DESC(free_ports, "Release IO ports after configuration? (default: 0 | |||
76 | 76 | ||
77 | static struct scsi_host_template nsp_driver_template = { | 77 | static struct scsi_host_template nsp_driver_template = { |
78 | .proc_name = "nsp_cs", | 78 | .proc_name = "nsp_cs", |
79 | .proc_info = nsp_proc_info, | 79 | .show_info = nsp_show_info, |
80 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", | 80 | .name = "WorkBit NinjaSCSI-3/32Bi(16bit)", |
81 | .info = nsp_info, | 81 | .info = nsp_info, |
82 | .queuecommand = nsp_queuecommand, | 82 | .queuecommand = nsp_queuecommand, |
@@ -1365,33 +1365,19 @@ static const char *nsp_info(struct Scsi_Host *shpnt) | |||
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | #undef SPRINTF | 1367 | #undef SPRINTF |
1368 | #define SPRINTF(args...) \ | 1368 | #define SPRINTF(args...) seq_printf(m, ##args) |
1369 | do { \ | 1369 | |
1370 | if(length > (pos - buffer)) { \ | 1370 | static int nsp_show_info(struct seq_file *m, struct Scsi_Host *host) |
1371 | pos += snprintf(pos, length - (pos - buffer) + 1, ## args); \ | ||
1372 | nsp_dbg(NSP_DEBUG_PROC, "buffer=0x%p pos=0x%p length=%d %d\n", buffer, pos, length, length - (pos - buffer));\ | ||
1373 | } \ | ||
1374 | } while(0) | ||
1375 | |||
1376 | static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start, | ||
1377 | off_t offset, int length, int inout) | ||
1378 | { | 1371 | { |
1379 | int id; | 1372 | int id; |
1380 | char *pos = buffer; | ||
1381 | int thislength; | ||
1382 | int speed; | 1373 | int speed; |
1383 | unsigned long flags; | 1374 | unsigned long flags; |
1384 | nsp_hw_data *data; | 1375 | nsp_hw_data *data; |
1385 | int hostno; | 1376 | int hostno; |
1386 | 1377 | ||
1387 | if (inout) { | ||
1388 | return -EINVAL; | ||
1389 | } | ||
1390 | |||
1391 | hostno = host->host_no; | 1378 | hostno = host->host_no; |
1392 | data = (nsp_hw_data *)host->hostdata; | 1379 | data = (nsp_hw_data *)host->hostdata; |
1393 | 1380 | ||
1394 | |||
1395 | SPRINTF("NinjaSCSI status\n\n"); | 1381 | SPRINTF("NinjaSCSI status\n\n"); |
1396 | SPRINTF("Driver version: $Revision: 1.23 $\n"); | 1382 | SPRINTF("Driver version: $Revision: 1.23 $\n"); |
1397 | SPRINTF("SCSI host No.: %d\n", hostno); | 1383 | SPRINTF("SCSI host No.: %d\n", hostno); |
@@ -1458,19 +1444,7 @@ static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1458 | } | 1444 | } |
1459 | SPRINTF("\n"); | 1445 | SPRINTF("\n"); |
1460 | } | 1446 | } |
1461 | 1447 | return 0; | |
1462 | thislength = pos - (buffer + offset); | ||
1463 | |||
1464 | if(thislength < 0) { | ||
1465 | *start = NULL; | ||
1466 | return 0; | ||
1467 | } | ||
1468 | |||
1469 | |||
1470 | thislength = min(thislength, length); | ||
1471 | *start = buffer + offset; | ||
1472 | |||
1473 | return thislength; | ||
1474 | } | 1448 | } |
1475 | #undef SPRINTF | 1449 | #undef SPRINTF |
1476 | 1450 | ||
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index 7fc9a9d0a448..afd64f0adc4b 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -292,13 +292,8 @@ static int nsp_cs_config (struct pcmcia_device *link); | |||
292 | /* Linux SCSI subsystem specific functions */ | 292 | /* Linux SCSI subsystem specific functions */ |
293 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); | 293 | static struct Scsi_Host *nsp_detect (struct scsi_host_template *sht); |
294 | static const char *nsp_info (struct Scsi_Host *shpnt); | 294 | static const char *nsp_info (struct Scsi_Host *shpnt); |
295 | static int nsp_proc_info ( | 295 | static int nsp_show_info (struct seq_file *m, |
296 | struct Scsi_Host *host, | 296 | struct Scsi_Host *host); |
297 | char *buffer, | ||
298 | char **start, | ||
299 | off_t offset, | ||
300 | int length, | ||
301 | int inout); | ||
302 | static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); | 297 | static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt); |
303 | 298 | ||
304 | /* Error handler */ | 299 | /* Error handler */ |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index b46f5e906837..8e1b73775065 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -3599,19 +3599,6 @@ static int pmcraid_chr_open(struct inode *inode, struct file *filep) | |||
3599 | } | 3599 | } |
3600 | 3600 | ||
3601 | /** | 3601 | /** |
3602 | * pmcraid_release - char node "release" entry point | ||
3603 | */ | ||
3604 | static int pmcraid_chr_release(struct inode *inode, struct file *filep) | ||
3605 | { | ||
3606 | struct pmcraid_instance *pinstance = filep->private_data; | ||
3607 | |||
3608 | filep->private_data = NULL; | ||
3609 | fasync_helper(-1, filep, 0, &pinstance->aen_queue); | ||
3610 | |||
3611 | return 0; | ||
3612 | } | ||
3613 | |||
3614 | /** | ||
3615 | * pmcraid_fasync - Async notifier registration from applications | 3602 | * pmcraid_fasync - Async notifier registration from applications |
3616 | * | 3603 | * |
3617 | * This function adds the calling process to a driver global queue. When an | 3604 | * This function adds the calling process to a driver global queue. When an |
@@ -4167,7 +4154,6 @@ static long pmcraid_chr_ioctl( | |||
4167 | static const struct file_operations pmcraid_fops = { | 4154 | static const struct file_operations pmcraid_fops = { |
4168 | .owner = THIS_MODULE, | 4155 | .owner = THIS_MODULE, |
4169 | .open = pmcraid_chr_open, | 4156 | .open = pmcraid_chr_open, |
4170 | .release = pmcraid_chr_release, | ||
4171 | .fasync = pmcraid_chr_fasync, | 4157 | .fasync = pmcraid_chr_fasync, |
4172 | .unlocked_ioctl = pmcraid_chr_ioctl, | 4158 | .unlocked_ioctl = pmcraid_chr_ioctl, |
4173 | #ifdef CONFIG_COMPAT | 4159 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index d164c9639361..1db8b26063b4 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -118,8 +118,9 @@ static inline void ppa_pb_release(ppa_struct *dev) | |||
118 | * Also gives a method to use a script to obtain optimum timings (TODO) | 118 | * Also gives a method to use a script to obtain optimum timings (TODO) |
119 | */ | 119 | */ |
120 | 120 | ||
121 | static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) | 121 | static inline int ppa_write_info(struct Scsi_Host *host, char *buffer, int length) |
122 | { | 122 | { |
123 | ppa_struct *dev = ppa_dev(host); | ||
123 | unsigned long x; | 124 | unsigned long x; |
124 | 125 | ||
125 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { | 126 | if ((length > 5) && (strncmp(buffer, "mode=", 5) == 0)) { |
@@ -137,35 +138,17 @@ static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) | |||
137 | return -EINVAL; | 138 | return -EINVAL; |
138 | } | 139 | } |
139 | 140 | ||
140 | static int ppa_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | 141 | static int ppa_show_info(struct seq_file *m, struct Scsi_Host *host) |
141 | { | 142 | { |
142 | int len = 0; | ||
143 | ppa_struct *dev = ppa_dev(host); | 143 | ppa_struct *dev = ppa_dev(host); |
144 | 144 | ||
145 | if (inout) | 145 | seq_printf(m, "Version : %s\n", PPA_VERSION); |
146 | return ppa_proc_write(dev, buffer, length); | 146 | seq_printf(m, "Parport : %s\n", dev->dev->port->name); |
147 | 147 | seq_printf(m, "Mode : %s\n", PPA_MODE_STRING[dev->mode]); | |
148 | len += sprintf(buffer + len, "Version : %s\n", PPA_VERSION); | ||
149 | len += | ||
150 | sprintf(buffer + len, "Parport : %s\n", | ||
151 | dev->dev->port->name); | ||
152 | len += | ||
153 | sprintf(buffer + len, "Mode : %s\n", | ||
154 | PPA_MODE_STRING[dev->mode]); | ||
155 | #if PPA_DEBUG > 0 | 148 | #if PPA_DEBUG > 0 |
156 | len += | 149 | seq_printf(m, "recon_tmo : %lu\n", dev->recon_tmo); |
157 | sprintf(buffer + len, "recon_tmo : %lu\n", dev->recon_tmo); | ||
158 | #endif | 150 | #endif |
159 | 151 | return 0; | |
160 | /* Request for beyond end of buffer */ | ||
161 | if (offset > length) | ||
162 | return 0; | ||
163 | |||
164 | *start = buffer + offset; | ||
165 | len -= offset; | ||
166 | if (len > length) | ||
167 | len = length; | ||
168 | return len; | ||
169 | } | 152 | } |
170 | 153 | ||
171 | static int device_check(ppa_struct *dev); | 154 | static int device_check(ppa_struct *dev); |
@@ -981,7 +964,8 @@ static int ppa_adjust_queue(struct scsi_device *device) | |||
981 | static struct scsi_host_template ppa_template = { | 964 | static struct scsi_host_template ppa_template = { |
982 | .module = THIS_MODULE, | 965 | .module = THIS_MODULE, |
983 | .proc_name = "ppa", | 966 | .proc_name = "ppa", |
984 | .proc_info = ppa_proc_info, | 967 | .show_info = ppa_show_info, |
968 | .write_info = ppa_write_info, | ||
985 | .name = "Iomega VPI0 (ppa) interface", | 969 | .name = "Iomega VPI0 (ppa) interface", |
986 | .queuecommand = ppa_queuecommand, | 970 | .queuecommand = ppa_queuecommand, |
987 | .eh_abort_handler = ppa_abort, | 971 | .eh_abort_handler = ppa_abort, |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index a083715843bd..5307bf86d5e0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -5539,7 +5539,7 @@ static struct pci_driver qla2xxx_pci_driver = { | |||
5539 | .err_handler = &qla2xxx_err_handler, | 5539 | .err_handler = &qla2xxx_err_handler, |
5540 | }; | 5540 | }; |
5541 | 5541 | ||
5542 | static struct file_operations apidev_fops = { | 5542 | static const struct file_operations apidev_fops = { |
5543 | .owner = THIS_MODULE, | 5543 | .owner = THIS_MODULE, |
5544 | .llseek = noop_llseek, | 5544 | .llseek = noop_llseek, |
5545 | }; | 5545 | }; |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 5cda11c07c68..5add6f4e7928 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -2823,31 +2823,27 @@ static const char * scsi_debug_info(struct Scsi_Host * shp) | |||
2823 | /* scsi_debug_proc_info | 2823 | /* scsi_debug_proc_info |
2824 | * Used if the driver currently has no own support for /proc/scsi | 2824 | * Used if the driver currently has no own support for /proc/scsi |
2825 | */ | 2825 | */ |
2826 | static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, | 2826 | static int scsi_debug_write_info(struct Scsi_Host *host, char *buffer, int length) |
2827 | int length, int inout) | ||
2828 | { | 2827 | { |
2829 | int len, pos, begin; | 2828 | char arr[16]; |
2830 | int orig_length; | 2829 | int opts; |
2830 | int minLen = length > 15 ? 15 : length; | ||
2831 | 2831 | ||
2832 | orig_length = length; | 2832 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
2833 | 2833 | return -EACCES; | |
2834 | if (inout == 1) { | 2834 | memcpy(arr, buffer, minLen); |
2835 | char arr[16]; | 2835 | arr[minLen] = '\0'; |
2836 | int minLen = length > 15 ? 15 : length; | 2836 | if (1 != sscanf(arr, "%d", &opts)) |
2837 | return -EINVAL; | ||
2838 | scsi_debug_opts = opts; | ||
2839 | if (scsi_debug_every_nth != 0) | ||
2840 | scsi_debug_cmnd_count = 0; | ||
2841 | return length; | ||
2842 | } | ||
2837 | 2843 | ||
2838 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 2844 | static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host) |
2839 | return -EACCES; | 2845 | { |
2840 | memcpy(arr, buffer, minLen); | 2846 | seq_printf(m, "scsi_debug adapter driver, version " |
2841 | arr[minLen] = '\0'; | ||
2842 | if (1 != sscanf(arr, "%d", &pos)) | ||
2843 | return -EINVAL; | ||
2844 | scsi_debug_opts = pos; | ||
2845 | if (scsi_debug_every_nth != 0) | ||
2846 | scsi_debug_cmnd_count = 0; | ||
2847 | return length; | ||
2848 | } | ||
2849 | begin = 0; | ||
2850 | pos = len = sprintf(buffer, "scsi_debug adapter driver, version " | ||
2851 | "%s [%s]\n" | 2847 | "%s [%s]\n" |
2852 | "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " | 2848 | "num_tgts=%d, shared (ram) size=%d MB, opts=0x%x, " |
2853 | "every_nth=%d(curr:%d)\n" | 2849 | "every_nth=%d(curr:%d)\n" |
@@ -2862,15 +2858,7 @@ static int scsi_debug_proc_info(struct Scsi_Host *host, char *buffer, char **sta | |||
2862 | scsi_debug_sector_size, sdebug_cylinders_per, sdebug_heads, | 2858 | scsi_debug_sector_size, sdebug_cylinders_per, sdebug_heads, |
2863 | sdebug_sectors_per, num_aborts, num_dev_resets, num_bus_resets, | 2859 | sdebug_sectors_per, num_aborts, num_dev_resets, num_bus_resets, |
2864 | num_host_resets, dix_reads, dix_writes, dif_errors); | 2860 | num_host_resets, dix_reads, dix_writes, dif_errors); |
2865 | if (pos < offset) { | 2861 | return 0; |
2866 | len = 0; | ||
2867 | begin = pos; | ||
2868 | } | ||
2869 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
2870 | len -= (offset - begin); | ||
2871 | if (len > length) | ||
2872 | len = length; | ||
2873 | return len; | ||
2874 | } | 2862 | } |
2875 | 2863 | ||
2876 | static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) | 2864 | static ssize_t sdebug_delay_show(struct device_driver * ddp, char * buf) |
@@ -3957,7 +3945,8 @@ write: | |||
3957 | static DEF_SCSI_QCMD(scsi_debug_queuecommand) | 3945 | static DEF_SCSI_QCMD(scsi_debug_queuecommand) |
3958 | 3946 | ||
3959 | static struct scsi_host_template sdebug_driver_template = { | 3947 | static struct scsi_host_template sdebug_driver_template = { |
3960 | .proc_info = scsi_debug_proc_info, | 3948 | .show_info = scsi_debug_show_info, |
3949 | .write_info = scsi_debug_write_info, | ||
3961 | .proc_name = sdebug_proc_name, | 3950 | .proc_name = sdebug_proc_name, |
3962 | .name = "SCSI DEBUG", | 3951 | .name = "SCSI DEBUG", |
3963 | .info = scsi_debug_info, | 3952 | .info = scsi_debug_info, |
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index ad747dc337da..db66357211ed 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
@@ -45,58 +45,50 @@ static struct proc_dir_entry *proc_scsi; | |||
45 | /* Protect sht->present and sht->proc_dir */ | 45 | /* Protect sht->present and sht->proc_dir */ |
46 | static DEFINE_MUTEX(global_host_template_mutex); | 46 | static DEFINE_MUTEX(global_host_template_mutex); |
47 | 47 | ||
48 | /** | 48 | static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf, |
49 | * proc_scsi_read - handle read from /proc by calling host's proc_info() command | 49 | size_t count, loff_t *ppos) |
50 | * @buffer: passed to proc_info | ||
51 | * @start: passed to proc_info | ||
52 | * @offset: passed to proc_info | ||
53 | * @length: passed to proc_info | ||
54 | * @eof: returns whether length read was less than requested | ||
55 | * @data: pointer to a &struct Scsi_Host | ||
56 | */ | ||
57 | |||
58 | static int proc_scsi_read(char *buffer, char **start, off_t offset, | ||
59 | int length, int *eof, void *data) | ||
60 | { | ||
61 | struct Scsi_Host *shost = data; | ||
62 | int n; | ||
63 | |||
64 | n = shost->hostt->proc_info(shost, buffer, start, offset, length, 0); | ||
65 | *eof = (n < length); | ||
66 | |||
67 | return n; | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * proc_scsi_write_proc - Handle write to /proc by calling host's proc_info() | ||
72 | * @file: not used | ||
73 | * @buf: source of data to write. | ||
74 | * @count: number of bytes (at most PROC_BLOCK_SIZE) to write. | ||
75 | * @data: pointer to &struct Scsi_Host | ||
76 | */ | ||
77 | static int proc_scsi_write_proc(struct file *file, const char __user *buf, | ||
78 | unsigned long count, void *data) | ||
79 | { | 50 | { |
80 | struct Scsi_Host *shost = data; | 51 | struct Scsi_Host *shost = PDE_DATA(file_inode(file)); |
81 | ssize_t ret = -ENOMEM; | 52 | ssize_t ret = -ENOMEM; |
82 | char *page; | 53 | char *page; |
83 | char *start; | ||
84 | 54 | ||
85 | if (count > PROC_BLOCK_SIZE) | 55 | if (count > PROC_BLOCK_SIZE) |
86 | return -EOVERFLOW; | 56 | return -EOVERFLOW; |
87 | 57 | ||
58 | if (!shost->hostt->write_info) | ||
59 | return -EINVAL; | ||
60 | |||
88 | page = (char *)__get_free_page(GFP_KERNEL); | 61 | page = (char *)__get_free_page(GFP_KERNEL); |
89 | if (page) { | 62 | if (page) { |
90 | ret = -EFAULT; | 63 | ret = -EFAULT; |
91 | if (copy_from_user(page, buf, count)) | 64 | if (copy_from_user(page, buf, count)) |
92 | goto out; | 65 | goto out; |
93 | ret = shost->hostt->proc_info(shost, page, &start, 0, count, 1); | 66 | ret = shost->hostt->write_info(shost, page, count); |
94 | } | 67 | } |
95 | out: | 68 | out: |
96 | free_page((unsigned long)page); | 69 | free_page((unsigned long)page); |
97 | return ret; | 70 | return ret; |
98 | } | 71 | } |
99 | 72 | ||
73 | static int proc_scsi_show(struct seq_file *m, void *v) | ||
74 | { | ||
75 | struct Scsi_Host *shost = m->private; | ||
76 | return shost->hostt->show_info(m, shost); | ||
77 | } | ||
78 | |||
79 | static int proc_scsi_host_open(struct inode *inode, struct file *file) | ||
80 | { | ||
81 | return single_open_size(file, proc_scsi_show, PDE_DATA(inode), | ||
82 | 4 * PAGE_SIZE); | ||
83 | } | ||
84 | |||
85 | static const struct file_operations proc_scsi_fops = { | ||
86 | .open = proc_scsi_host_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .write = proc_scsi_host_write | ||
90 | }; | ||
91 | |||
100 | /** | 92 | /** |
101 | * scsi_proc_hostdir_add - Create directory in /proc for a scsi host | 93 | * scsi_proc_hostdir_add - Create directory in /proc for a scsi host |
102 | * @sht: owner of this directory | 94 | * @sht: owner of this directory |
@@ -106,7 +98,7 @@ out: | |||
106 | 98 | ||
107 | void scsi_proc_hostdir_add(struct scsi_host_template *sht) | 99 | void scsi_proc_hostdir_add(struct scsi_host_template *sht) |
108 | { | 100 | { |
109 | if (!sht->proc_info) | 101 | if (!sht->show_info) |
110 | return; | 102 | return; |
111 | 103 | ||
112 | mutex_lock(&global_host_template_mutex); | 104 | mutex_lock(&global_host_template_mutex); |
@@ -125,7 +117,7 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht) | |||
125 | */ | 117 | */ |
126 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) | 118 | void scsi_proc_hostdir_rm(struct scsi_host_template *sht) |
127 | { | 119 | { |
128 | if (!sht->proc_info) | 120 | if (!sht->show_info) |
129 | return; | 121 | return; |
130 | 122 | ||
131 | mutex_lock(&global_host_template_mutex); | 123 | mutex_lock(&global_host_template_mutex); |
@@ -151,16 +143,12 @@ void scsi_proc_host_add(struct Scsi_Host *shost) | |||
151 | return; | 143 | return; |
152 | 144 | ||
153 | sprintf(name,"%d", shost->host_no); | 145 | sprintf(name,"%d", shost->host_no); |
154 | p = create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR, | 146 | p = proc_create_data(name, S_IRUGO | S_IWUSR, |
155 | sht->proc_dir, proc_scsi_read, shost); | 147 | sht->proc_dir, &proc_scsi_fops, shost); |
156 | if (!p) { | 148 | if (!p) |
157 | printk(KERN_ERR "%s: Failed to register host %d in" | 149 | printk(KERN_ERR "%s: Failed to register host %d in" |
158 | "%s\n", __func__, shost->host_no, | 150 | "%s\n", __func__, shost->host_no, |
159 | sht->proc_name); | 151 | sht->proc_name); |
160 | return; | ||
161 | } | ||
162 | |||
163 | p->write_proc = proc_scsi_write_proc; | ||
164 | } | 152 | } |
165 | 153 | ||
166 | /** | 154 | /** |
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 599568299fbe..bac55f7f69f9 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -1171,112 +1171,36 @@ printk("sym_user_command: data=%ld\n", uc->data); | |||
1171 | #endif /* SYM_LINUX_USER_COMMAND_SUPPORT */ | 1171 | #endif /* SYM_LINUX_USER_COMMAND_SUPPORT */ |
1172 | 1172 | ||
1173 | 1173 | ||
1174 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1175 | /* | ||
1176 | * Informations through the proc file system. | ||
1177 | */ | ||
1178 | struct info_str { | ||
1179 | char *buffer; | ||
1180 | int length; | ||
1181 | int offset; | ||
1182 | int pos; | ||
1183 | }; | ||
1184 | |||
1185 | static void copy_mem_info(struct info_str *info, char *data, int len) | ||
1186 | { | ||
1187 | if (info->pos + len > info->length) | ||
1188 | len = info->length - info->pos; | ||
1189 | |||
1190 | if (info->pos + len < info->offset) { | ||
1191 | info->pos += len; | ||
1192 | return; | ||
1193 | } | ||
1194 | if (info->pos < info->offset) { | ||
1195 | data += (info->offset - info->pos); | ||
1196 | len -= (info->offset - info->pos); | ||
1197 | } | ||
1198 | |||
1199 | if (len > 0) { | ||
1200 | memcpy(info->buffer + info->pos, data, len); | ||
1201 | info->pos += len; | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1205 | static int copy_info(struct info_str *info, char *fmt, ...) | ||
1206 | { | ||
1207 | va_list args; | ||
1208 | char buf[81]; | ||
1209 | int len; | ||
1210 | |||
1211 | va_start(args, fmt); | ||
1212 | len = vsprintf(buf, fmt, args); | ||
1213 | va_end(args); | ||
1214 | |||
1215 | copy_mem_info(info, buf, len); | ||
1216 | return len; | ||
1217 | } | ||
1218 | |||
1219 | /* | 1174 | /* |
1220 | * Copy formatted information into the input buffer. | 1175 | * Copy formatted information into the input buffer. |
1221 | */ | 1176 | */ |
1222 | static int sym_host_info(struct Scsi_Host *shost, char *ptr, off_t offset, int len) | 1177 | static int sym_show_info(struct seq_file *m, struct Scsi_Host *shost) |
1223 | { | 1178 | { |
1179 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1224 | struct sym_data *sym_data = shost_priv(shost); | 1180 | struct sym_data *sym_data = shost_priv(shost); |
1225 | struct pci_dev *pdev = sym_data->pdev; | 1181 | struct pci_dev *pdev = sym_data->pdev; |
1226 | struct sym_hcb *np = sym_data->ncb; | 1182 | struct sym_hcb *np = sym_data->ncb; |
1227 | struct info_str info; | ||
1228 | |||
1229 | info.buffer = ptr; | ||
1230 | info.length = len; | ||
1231 | info.offset = offset; | ||
1232 | info.pos = 0; | ||
1233 | 1183 | ||
1234 | copy_info(&info, "Chip " NAME53C "%s, device id 0x%x, " | 1184 | seq_printf(m, "Chip " NAME53C "%s, device id 0x%x, " |
1235 | "revision id 0x%x\n", np->s.chip_name, | 1185 | "revision id 0x%x\n", np->s.chip_name, |
1236 | pdev->device, pdev->revision); | 1186 | pdev->device, pdev->revision); |
1237 | copy_info(&info, "At PCI address %s, IRQ %u\n", | 1187 | seq_printf(m, "At PCI address %s, IRQ %u\n", |
1238 | pci_name(pdev), pdev->irq); | 1188 | pci_name(pdev), pdev->irq); |
1239 | copy_info(&info, "Min. period factor %d, %s SCSI BUS%s\n", | 1189 | seq_printf(m, "Min. period factor %d, %s SCSI BUS%s\n", |
1240 | (int) (np->minsync_dt ? np->minsync_dt : np->minsync), | 1190 | (int) (np->minsync_dt ? np->minsync_dt : np->minsync), |
1241 | np->maxwide ? "Wide" : "Narrow", | 1191 | np->maxwide ? "Wide" : "Narrow", |
1242 | np->minsync_dt ? ", DT capable" : ""); | 1192 | np->minsync_dt ? ", DT capable" : ""); |
1243 | 1193 | ||
1244 | copy_info(&info, "Max. started commands %d, " | 1194 | seq_printf(m, "Max. started commands %d, " |
1245 | "max. commands per LUN %d\n", | 1195 | "max. commands per LUN %d\n", |
1246 | SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); | 1196 | SYM_CONF_MAX_START, SYM_CONF_MAX_TAG); |
1247 | 1197 | ||
1248 | return info.pos > info.offset? info.pos - info.offset : 0; | 1198 | return 0; |
1249 | } | ||
1250 | #endif /* SYM_LINUX_USER_INFO_SUPPORT */ | ||
1251 | |||
1252 | /* | ||
1253 | * Entry point of the scsi proc fs of the driver. | ||
1254 | * - func = 0 means read (returns adapter infos) | ||
1255 | * - func = 1 means write (not yet merget from sym53c8xx) | ||
1256 | */ | ||
1257 | static int sym53c8xx_proc_info(struct Scsi_Host *shost, char *buffer, | ||
1258 | char **start, off_t offset, int length, int func) | ||
1259 | { | ||
1260 | int retv; | ||
1261 | |||
1262 | if (func) { | ||
1263 | #ifdef SYM_LINUX_USER_COMMAND_SUPPORT | ||
1264 | retv = sym_user_command(shost, buffer, length); | ||
1265 | #else | ||
1266 | retv = -EINVAL; | ||
1267 | #endif | ||
1268 | } else { | ||
1269 | if (start) | ||
1270 | *start = buffer; | ||
1271 | #ifdef SYM_LINUX_USER_INFO_SUPPORT | ||
1272 | retv = sym_host_info(shost, buffer, offset, length); | ||
1273 | #else | 1199 | #else |
1274 | retv = -EINVAL; | 1200 | return -EINVAL; |
1275 | #endif | 1201 | #endif /* SYM_LINUX_USER_INFO_SUPPORT */ |
1276 | } | ||
1277 | |||
1278 | return retv; | ||
1279 | } | 1202 | } |
1203 | |||
1280 | #endif /* SYM_LINUX_PROC_INFO_SUPPORT */ | 1204 | #endif /* SYM_LINUX_PROC_INFO_SUPPORT */ |
1281 | 1205 | ||
1282 | /* | 1206 | /* |
@@ -1742,7 +1666,10 @@ static struct scsi_host_template sym2_template = { | |||
1742 | .use_clustering = ENABLE_CLUSTERING, | 1666 | .use_clustering = ENABLE_CLUSTERING, |
1743 | .max_sectors = 0xFFFF, | 1667 | .max_sectors = 0xFFFF, |
1744 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT | 1668 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT |
1745 | .proc_info = sym53c8xx_proc_info, | 1669 | .show_info = sym_show_info, |
1670 | #ifdef SYM_LINUX_USER_COMMAND_SUPPORT | ||
1671 | .write_info = sym_user_command, | ||
1672 | #endif | ||
1746 | .proc_name = NAME53C8XX, | 1673 | .proc_name = NAME53C8XX, |
1747 | #endif | 1674 | #endif |
1748 | }; | 1675 | }; |
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index d672d97fb84a..f1e4b4148c75 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -201,7 +201,8 @@ int __init t128_detect(struct scsi_host_template * tpnt){ | |||
201 | int sig, count; | 201 | int sig, count; |
202 | 202 | ||
203 | tpnt->proc_name = "t128"; | 203 | tpnt->proc_name = "t128"; |
204 | tpnt->proc_info = &t128_proc_info; | 204 | tpnt->show_info = t128_show_info; |
205 | tpnt->write_info = t128_write_info; | ||
205 | 206 | ||
206 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { | 207 | for (count = 0; current_override < NO_OVERRIDES; ++current_override) { |
207 | base = 0; | 208 | base = 0; |
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index ada1115079c9..1df82c28e56d 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h | |||
@@ -140,7 +140,8 @@ static int t128_bus_reset(struct scsi_cmnd *); | |||
140 | #define NCR5380_queue_command t128_queue_command | 140 | #define NCR5380_queue_command t128_queue_command |
141 | #define NCR5380_abort t128_abort | 141 | #define NCR5380_abort t128_abort |
142 | #define NCR5380_bus_reset t128_bus_reset | 142 | #define NCR5380_bus_reset t128_bus_reset |
143 | #define NCR5380_proc_info t128_proc_info | 143 | #define NCR5380_show_info t128_show_info |
144 | #define NCR5380_write_info t128_write_info | ||
144 | 145 | ||
145 | /* 15 14 12 10 7 5 3 | 146 | /* 15 14 12 10 7 5 3 |
146 | 1101 0100 1010 1000 */ | 147 | 1101 0100 1010 1000 */ |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index c0ee4ea28a19..41883a87931d 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -2054,22 +2054,16 @@ wd33c93_init(struct Scsi_Host *instance, const wd33c93_regs regs, | |||
2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); | 2054 | printk(" Version %s - %s\n", WD33C93_VERSION, WD33C93_DATE); |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | int | 2057 | int wd33c93_write_info(struct Scsi_Host *instance, char *buf, int len) |
2058 | wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) | ||
2059 | { | 2058 | { |
2060 | |||
2061 | #ifdef PROC_INTERFACE | 2059 | #ifdef PROC_INTERFACE |
2062 | |||
2063 | char *bp; | 2060 | char *bp; |
2064 | char tbuf[128]; | ||
2065 | struct WD33C93_hostdata *hd; | 2061 | struct WD33C93_hostdata *hd; |
2066 | struct scsi_cmnd *cmd; | ||
2067 | int x; | 2062 | int x; |
2068 | static int stop = 0; | ||
2069 | 2063 | ||
2070 | hd = (struct WD33C93_hostdata *) instance->hostdata; | 2064 | hd = (struct WD33C93_hostdata *) instance->hostdata; |
2071 | 2065 | ||
2072 | /* If 'in' is TRUE we need to _read_ the proc file. We accept the following | 2066 | /* We accept the following |
2073 | * keywords (same format as command-line, but arguments are not optional): | 2067 | * keywords (same format as command-line, but arguments are not optional): |
2074 | * debug | 2068 | * debug |
2075 | * disconnect | 2069 | * disconnect |
@@ -2083,145 +2077,124 @@ wd33c93_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off | |||
2083 | * nosync | 2077 | * nosync |
2084 | */ | 2078 | */ |
2085 | 2079 | ||
2086 | if (in) { | 2080 | buf[len] = '\0'; |
2087 | buf[len] = '\0'; | 2081 | for (bp = buf; *bp; ) { |
2088 | for (bp = buf; *bp; ) { | 2082 | while (',' == *bp || ' ' == *bp) |
2089 | while (',' == *bp || ' ' == *bp) | 2083 | ++bp; |
2090 | ++bp; | 2084 | if (!strncmp(bp, "debug:", 6)) { |
2091 | if (!strncmp(bp, "debug:", 6)) { | 2085 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; |
2092 | hd->args = simple_strtoul(bp+6, &bp, 0) & DB_MASK; | 2086 | } else if (!strncmp(bp, "disconnect:", 11)) { |
2093 | } else if (!strncmp(bp, "disconnect:", 11)) { | 2087 | x = simple_strtoul(bp+11, &bp, 0); |
2094 | x = simple_strtoul(bp+11, &bp, 0); | 2088 | if (x < DIS_NEVER || x > DIS_ALWAYS) |
2095 | if (x < DIS_NEVER || x > DIS_ALWAYS) | 2089 | x = DIS_ADAPTIVE; |
2096 | x = DIS_ADAPTIVE; | 2090 | hd->disconnect = x; |
2097 | hd->disconnect = x; | 2091 | } else if (!strncmp(bp, "period:", 7)) { |
2098 | } else if (!strncmp(bp, "period:", 7)) { | 2092 | x = simple_strtoul(bp+7, &bp, 0); |
2093 | hd->default_sx_per = | ||
2094 | hd->sx_table[round_period((unsigned int) x, | ||
2095 | hd->sx_table)].period_ns; | ||
2096 | } else if (!strncmp(bp, "resync:", 7)) { | ||
2097 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2098 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2099 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2100 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2101 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2102 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2103 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2104 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2105 | hd->dma_mode = | ||
2106 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2107 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2108 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2109 | if (x != hd->fast) | ||
2110 | set_resync(hd, 0xff); | ||
2111 | hd->fast = x; | ||
2112 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2099 | x = simple_strtoul(bp+7, &bp, 0); | 2113 | x = simple_strtoul(bp+7, &bp, 0); |
2100 | hd->default_sx_per = | 2114 | set_resync(hd, x ^ hd->no_sync); |
2101 | hd->sx_table[round_period((unsigned int) x, | 2115 | hd->no_sync = x; |
2102 | hd->sx_table)].period_ns; | 2116 | } else { |
2103 | } else if (!strncmp(bp, "resync:", 7)) { | 2117 | break; /* unknown keyword,syntax-error,... */ |
2104 | set_resync(hd, (int)simple_strtoul(bp+7, &bp, 0)); | ||
2105 | } else if (!strncmp(bp, "proc:", 5)) { | ||
2106 | hd->proc = simple_strtoul(bp+5, &bp, 0); | ||
2107 | } else if (!strncmp(bp, "nodma:", 6)) { | ||
2108 | hd->no_dma = simple_strtoul(bp+6, &bp, 0); | ||
2109 | } else if (!strncmp(bp, "level2:", 7)) { | ||
2110 | hd->level2 = simple_strtoul(bp+7, &bp, 0); | ||
2111 | } else if (!strncmp(bp, "burst:", 6)) { | ||
2112 | hd->dma_mode = | ||
2113 | simple_strtol(bp+6, &bp, 0) ? CTRL_BURST:CTRL_DMA; | ||
2114 | } else if (!strncmp(bp, "fast:", 5)) { | ||
2115 | x = !!simple_strtol(bp+5, &bp, 0); | ||
2116 | if (x != hd->fast) | ||
2117 | set_resync(hd, 0xff); | ||
2118 | hd->fast = x; | ||
2119 | } else if (!strncmp(bp, "nosync:", 7)) { | ||
2120 | x = simple_strtoul(bp+7, &bp, 0); | ||
2121 | set_resync(hd, x ^ hd->no_sync); | ||
2122 | hd->no_sync = x; | ||
2123 | } else { | ||
2124 | break; /* unknown keyword,syntax-error,... */ | ||
2125 | } | ||
2126 | } | 2118 | } |
2127 | return len; | ||
2128 | } | 2119 | } |
2120 | return len; | ||
2121 | #else | ||
2122 | return 0; | ||
2123 | #endif | ||
2124 | } | ||
2125 | |||
2126 | int | ||
2127 | wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) | ||
2128 | { | ||
2129 | #ifdef PROC_INTERFACE | ||
2130 | struct WD33C93_hostdata *hd; | ||
2131 | struct scsi_cmnd *cmd; | ||
2132 | int x; | ||
2133 | |||
2134 | hd = (struct WD33C93_hostdata *) instance->hostdata; | ||
2129 | 2135 | ||
2130 | spin_lock_irq(&hd->lock); | 2136 | spin_lock_irq(&hd->lock); |
2131 | bp = buf; | 2137 | if (hd->proc & PR_VERSION) |
2132 | *bp = '\0'; | 2138 | seq_printf(m, "\nVersion %s - %s.", |
2133 | if (hd->proc & PR_VERSION) { | ||
2134 | sprintf(tbuf, "\nVersion %s - %s.", | ||
2135 | WD33C93_VERSION, WD33C93_DATE); | 2139 | WD33C93_VERSION, WD33C93_DATE); |
2136 | strcat(bp, tbuf); | 2140 | |
2137 | } | ||
2138 | if (hd->proc & PR_INFO) { | 2141 | if (hd->proc & PR_INFO) { |
2139 | sprintf(tbuf, "\nclock_freq=%02x no_sync=%02x no_dma=%d" | 2142 | seq_printf(m, "\nclock_freq=%02x no_sync=%02x no_dma=%d" |
2140 | " dma_mode=%02x fast=%d", | 2143 | " dma_mode=%02x fast=%d", |
2141 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); | 2144 | hd->clock_freq, hd->no_sync, hd->no_dma, hd->dma_mode, hd->fast); |
2142 | strcat(bp, tbuf); | 2145 | seq_printf(m, "\nsync_xfer[] = "); |
2143 | strcat(bp, "\nsync_xfer[] = "); | 2146 | for (x = 0; x < 7; x++) |
2144 | for (x = 0; x < 7; x++) { | 2147 | seq_printf(m, "\t%02x", hd->sync_xfer[x]); |
2145 | sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); | 2148 | seq_printf(m, "\nsync_stat[] = "); |
2146 | strcat(bp, tbuf); | 2149 | for (x = 0; x < 7; x++) |
2147 | } | 2150 | seq_printf(m, "\t%02x", hd->sync_stat[x]); |
2148 | strcat(bp, "\nsync_stat[] = "); | ||
2149 | for (x = 0; x < 7; x++) { | ||
2150 | sprintf(tbuf, "\t%02x", hd->sync_stat[x]); | ||
2151 | strcat(bp, tbuf); | ||
2152 | } | ||
2153 | } | 2151 | } |
2154 | #ifdef PROC_STATISTICS | 2152 | #ifdef PROC_STATISTICS |
2155 | if (hd->proc & PR_STATISTICS) { | 2153 | if (hd->proc & PR_STATISTICS) { |
2156 | strcat(bp, "\ncommands issued: "); | 2154 | seq_printf(m, "\ncommands issued: "); |
2157 | for (x = 0; x < 7; x++) { | 2155 | for (x = 0; x < 7; x++) |
2158 | sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); | 2156 | seq_printf(m, "\t%ld", hd->cmd_cnt[x]); |
2159 | strcat(bp, tbuf); | 2157 | seq_printf(m, "\ndisconnects allowed:"); |
2160 | } | 2158 | for (x = 0; x < 7; x++) |
2161 | strcat(bp, "\ndisconnects allowed:"); | 2159 | seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]); |
2162 | for (x = 0; x < 7; x++) { | 2160 | seq_printf(m, "\ndisconnects done: "); |
2163 | sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); | 2161 | for (x = 0; x < 7; x++) |
2164 | strcat(bp, tbuf); | 2162 | seq_printf(m, "\t%ld", hd->disc_done_cnt[x]); |
2165 | } | 2163 | seq_printf(m, |
2166 | strcat(bp, "\ndisconnects done: "); | ||
2167 | for (x = 0; x < 7; x++) { | ||
2168 | sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]); | ||
2169 | strcat(bp, tbuf); | ||
2170 | } | ||
2171 | sprintf(tbuf, | ||
2172 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", | 2164 | "\ninterrupts: %ld, DATA_PHASE ints: %ld DMA, %ld PIO", |
2173 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); | 2165 | hd->int_cnt, hd->dma_cnt, hd->pio_cnt); |
2174 | strcat(bp, tbuf); | ||
2175 | } | 2166 | } |
2176 | #endif | 2167 | #endif |
2177 | if (hd->proc & PR_CONNECTED) { | 2168 | if (hd->proc & PR_CONNECTED) { |
2178 | strcat(bp, "\nconnected: "); | 2169 | seq_printf(m, "\nconnected: "); |
2179 | if (hd->connected) { | 2170 | if (hd->connected) { |
2180 | cmd = (struct scsi_cmnd *) hd->connected; | 2171 | cmd = (struct scsi_cmnd *) hd->connected; |
2181 | sprintf(tbuf, " %d:%d(%02x)", | 2172 | seq_printf(m, " %d:%d(%02x)", |
2182 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2173 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2183 | strcat(bp, tbuf); | ||
2184 | } | 2174 | } |
2185 | } | 2175 | } |
2186 | if (hd->proc & PR_INPUTQ) { | 2176 | if (hd->proc & PR_INPUTQ) { |
2187 | strcat(bp, "\ninput_Q: "); | 2177 | seq_printf(m, "\ninput_Q: "); |
2188 | cmd = (struct scsi_cmnd *) hd->input_Q; | 2178 | cmd = (struct scsi_cmnd *) hd->input_Q; |
2189 | while (cmd) { | 2179 | while (cmd) { |
2190 | sprintf(tbuf, " %d:%d(%02x)", | 2180 | seq_printf(m, " %d:%d(%02x)", |
2191 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2181 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2192 | strcat(bp, tbuf); | ||
2193 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2182 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2194 | } | 2183 | } |
2195 | } | 2184 | } |
2196 | if (hd->proc & PR_DISCQ) { | 2185 | if (hd->proc & PR_DISCQ) { |
2197 | strcat(bp, "\ndisconnected_Q:"); | 2186 | seq_printf(m, "\ndisconnected_Q:"); |
2198 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; | 2187 | cmd = (struct scsi_cmnd *) hd->disconnected_Q; |
2199 | while (cmd) { | 2188 | while (cmd) { |
2200 | sprintf(tbuf, " %d:%d(%02x)", | 2189 | seq_printf(m, " %d:%d(%02x)", |
2201 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); | 2190 | cmd->device->id, cmd->device->lun, cmd->cmnd[0]); |
2202 | strcat(bp, tbuf); | ||
2203 | cmd = (struct scsi_cmnd *) cmd->host_scribble; | 2191 | cmd = (struct scsi_cmnd *) cmd->host_scribble; |
2204 | } | 2192 | } |
2205 | } | 2193 | } |
2206 | strcat(bp, "\n"); | 2194 | seq_printf(m, "\n"); |
2207 | spin_unlock_irq(&hd->lock); | 2195 | spin_unlock_irq(&hd->lock); |
2208 | *start = buf; | ||
2209 | if (stop) { | ||
2210 | stop = 0; | ||
2211 | return 0; | ||
2212 | } | ||
2213 | if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */ | ||
2214 | stop = 1; | ||
2215 | if (hd->proc & PR_STOP) /* stop every other time */ | ||
2216 | stop = 1; | ||
2217 | return strlen(bp); | ||
2218 | |||
2219 | #else /* PROC_INTERFACE */ | ||
2220 | |||
2221 | return 0; | ||
2222 | |||
2223 | #endif /* PROC_INTERFACE */ | 2196 | #endif /* PROC_INTERFACE */ |
2224 | 2197 | return 0; | |
2225 | } | 2198 | } |
2226 | 2199 | ||
2227 | EXPORT_SYMBOL(wd33c93_host_reset); | 2200 | EXPORT_SYMBOL(wd33c93_host_reset); |
@@ -2229,4 +2202,5 @@ EXPORT_SYMBOL(wd33c93_init); | |||
2229 | EXPORT_SYMBOL(wd33c93_abort); | 2202 | EXPORT_SYMBOL(wd33c93_abort); |
2230 | EXPORT_SYMBOL(wd33c93_queuecommand); | 2203 | EXPORT_SYMBOL(wd33c93_queuecommand); |
2231 | EXPORT_SYMBOL(wd33c93_intr); | 2204 | EXPORT_SYMBOL(wd33c93_intr); |
2232 | EXPORT_SYMBOL(wd33c93_proc_info); | 2205 | EXPORT_SYMBOL(wd33c93_show_info); |
2206 | EXPORT_SYMBOL(wd33c93_write_info); | ||
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 3b463d7304dc..08abe508e9ad 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h | |||
@@ -345,7 +345,8 @@ void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs, | |||
345 | int wd33c93_abort (struct scsi_cmnd *cmd); | 345 | int wd33c93_abort (struct scsi_cmnd *cmd); |
346 | int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd); | 346 | int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd); |
347 | void wd33c93_intr (struct Scsi_Host *instance); | 347 | void wd33c93_intr (struct Scsi_Host *instance); |
348 | int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); | 348 | int wd33c93_show_info(struct seq_file *, struct Scsi_Host *); |
349 | int wd33c93_write_info(struct Scsi_Host *, char *, int); | ||
349 | int wd33c93_host_reset (struct scsi_cmnd *); | 350 | int wd33c93_host_reset (struct scsi_cmnd *); |
350 | 351 | ||
351 | #endif /* WD33C93_H */ | 352 | #endif /* WD33C93_H */ |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index d89a5dfd3ade..f9a6e4b0affe 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1296,9 +1296,9 @@ static void wd7000_revision(Adapter * host) | |||
1296 | 1296 | ||
1297 | 1297 | ||
1298 | #undef SPRINTF | 1298 | #undef SPRINTF |
1299 | #define SPRINTF(args...) { if (pos < (buffer + length)) pos += sprintf (pos, ## args); } | 1299 | #define SPRINTF(args...) { seq_printf(m, ## args); } |
1300 | 1300 | ||
1301 | static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host) | 1301 | static int wd7000_set_info(struct Scsi_Host *host, char *buffer, int length) |
1302 | { | 1302 | { |
1303 | dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length); | 1303 | dprintk("Buffer = <%.*s>, length = %d\n", length, buffer, length); |
1304 | 1304 | ||
@@ -1310,22 +1310,15 @@ static int wd7000_set_info(char *buffer, int length, struct Scsi_Host *host) | |||
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | 1312 | ||
1313 | static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | 1313 | static int wd7000_show_info(struct seq_file *m, struct Scsi_Host *host) |
1314 | { | 1314 | { |
1315 | Adapter *adapter = (Adapter *)host->hostdata; | 1315 | Adapter *adapter = (Adapter *)host->hostdata; |
1316 | unsigned long flags; | 1316 | unsigned long flags; |
1317 | char *pos = buffer; | ||
1318 | #ifdef WD7000_DEBUG | 1317 | #ifdef WD7000_DEBUG |
1319 | Mailbox *ogmbs, *icmbs; | 1318 | Mailbox *ogmbs, *icmbs; |
1320 | short count; | 1319 | short count; |
1321 | #endif | 1320 | #endif |
1322 | 1321 | ||
1323 | /* | ||
1324 | * Has data been written to the file ? | ||
1325 | */ | ||
1326 | if (inout) | ||
1327 | return (wd7000_set_info(buffer, length, host)); | ||
1328 | |||
1329 | spin_lock_irqsave(host->host_lock, flags); | 1322 | spin_lock_irqsave(host->host_lock, flags); |
1330 | SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2); | 1323 | SPRINTF("Host scsi%d: Western Digital WD-7000 (rev %d.%d)\n", host->host_no, adapter->rev1, adapter->rev2); |
1331 | SPRINTF(" IO base: 0x%x\n", adapter->iobase); | 1324 | SPRINTF(" IO base: 0x%x\n", adapter->iobase); |
@@ -1368,17 +1361,7 @@ static int wd7000_proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
1368 | 1361 | ||
1369 | spin_unlock_irqrestore(host->host_lock, flags); | 1362 | spin_unlock_irqrestore(host->host_lock, flags); |
1370 | 1363 | ||
1371 | /* | 1364 | return 0; |
1372 | * Calculate start of next buffer, and return value. | ||
1373 | */ | ||
1374 | *start = buffer + offset; | ||
1375 | |||
1376 | if ((pos - buffer) < offset) | ||
1377 | return (0); | ||
1378 | else if ((pos - buffer - offset) < length) | ||
1379 | return (pos - buffer - offset); | ||
1380 | else | ||
1381 | return (length); | ||
1382 | } | 1365 | } |
1383 | 1366 | ||
1384 | 1367 | ||
@@ -1413,7 +1396,8 @@ static __init int wd7000_detect(struct scsi_host_template *tpnt) | |||
1413 | for (i = 0; i < NUM_CONFIGS; biosptr[i++] = -1); | 1396 | for (i = 0; i < NUM_CONFIGS; biosptr[i++] = -1); |
1414 | 1397 | ||
1415 | tpnt->proc_name = "wd7000"; | 1398 | tpnt->proc_name = "wd7000"; |
1416 | tpnt->proc_info = &wd7000_proc_info; | 1399 | tpnt->show_info = &wd7000_show_info; |
1400 | tpnt->write_info = wd7000_set_info; | ||
1417 | 1401 | ||
1418 | /* | 1402 | /* |
1419 | * Set up SCB free list, which is shared by all adapters | 1403 | * Set up SCB free list, which is shared by all adapters |
@@ -1658,7 +1642,8 @@ MODULE_LICENSE("GPL"); | |||
1658 | 1642 | ||
1659 | static struct scsi_host_template driver_template = { | 1643 | static struct scsi_host_template driver_template = { |
1660 | .proc_name = "wd7000", | 1644 | .proc_name = "wd7000", |
1661 | .proc_info = wd7000_proc_info, | 1645 | .show_info = wd7000_show_info, |
1646 | .write_info = wd7000_set_info, | ||
1662 | .name = "Western Digital WD-7000", | 1647 | .name = "Western Digital WD-7000", |
1663 | .detect = wd7000_detect, | 1648 | .detect = wd7000_detect, |
1664 | .release = wd7000_release, | 1649 | .release = wd7000_release, |
diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index 362c214bcc0b..db790f9fc9db 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c | |||
@@ -31,17 +31,15 @@ | |||
31 | #include "comedidev.h" | 31 | #include "comedidev.h" |
32 | #include "comedi_internal.h" | 32 | #include "comedi_internal.h" |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/string.h> | 34 | #include <linux/seq_file.h> |
35 | 35 | ||
36 | static int comedi_read(char *buf, char **start, off_t offset, int len, | 36 | static int comedi_read(struct seq_file *m, void *v) |
37 | int *eof, void *data) | ||
38 | { | 37 | { |
39 | int i; | 38 | int i; |
40 | int devices_q = 0; | 39 | int devices_q = 0; |
41 | int l = 0; | ||
42 | struct comedi_driver *driv; | 40 | struct comedi_driver *driv; |
43 | 41 | ||
44 | l += sprintf(buf + l, | 42 | seq_printf(m, |
45 | "comedi version " COMEDI_RELEASE "\n" | 43 | "comedi version " COMEDI_RELEASE "\n" |
46 | "format string: %s\n", | 44 | "format string: %s\n", |
47 | "\"%2d: %-20s %-20s %4d\", i, " | 45 | "\"%2d: %-20s %-20s %4d\", i, " |
@@ -49,42 +47,51 @@ static int comedi_read(char *buf, char **start, off_t offset, int len, | |||
49 | 47 | ||
50 | for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { | 48 | for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { |
51 | struct comedi_device *dev = comedi_dev_from_minor(i); | 49 | struct comedi_device *dev = comedi_dev_from_minor(i); |
52 | |||
53 | if (!dev) | 50 | if (!dev) |
54 | continue; | 51 | continue; |
55 | 52 | ||
56 | if (dev->attached) { | 53 | if (dev->attached) { |
57 | devices_q = 1; | 54 | devices_q = 1; |
58 | l += sprintf(buf + l, "%2d: %-20s %-20s %4d\n", | 55 | seq_printf(m, "%2d: %-20s %-20s %4d\n", |
59 | i, | 56 | i, dev->driver->driver_name, |
60 | dev->driver->driver_name, | 57 | dev->board_name, dev->n_subdevices); |
61 | dev->board_name, dev->n_subdevices); | ||
62 | } | 58 | } |
63 | } | 59 | } |
64 | if (!devices_q) | 60 | if (!devices_q) |
65 | l += sprintf(buf + l, "no devices\n"); | 61 | seq_puts(m, "no devices\n"); |
66 | 62 | ||
67 | for (driv = comedi_drivers; driv; driv = driv->next) { | 63 | for (driv = comedi_drivers; driv; driv = driv->next) { |
68 | l += sprintf(buf + l, "%s:\n", driv->driver_name); | 64 | seq_printf(m, "%s:\n", driv->driver_name); |
69 | for (i = 0; i < driv->num_names; i++) { | 65 | for (i = 0; i < driv->num_names; i++) |
70 | l += sprintf(buf + l, " %s\n", | 66 | seq_printf(m, " %s\n", |
71 | *(char **)((char *)driv->board_name + | 67 | *(char **)((char *)driv->board_name + |
72 | i * driv->offset)); | 68 | i * driv->offset)); |
73 | } | 69 | |
74 | if (!driv->num_names) | 70 | if (!driv->num_names) |
75 | l += sprintf(buf + l, " %s\n", driv->driver_name); | 71 | seq_printf(m, " %s\n", driv->driver_name); |
76 | } | 72 | } |
77 | 73 | ||
78 | return l; | 74 | return 0; |
79 | } | 75 | } |
80 | 76 | ||
81 | void comedi_proc_init(void) | 77 | /* |
78 | * seq_file wrappers for procfile show routines. | ||
79 | */ | ||
80 | static int comedi_proc_open(struct inode *inode, struct file *file) | ||
82 | { | 81 | { |
83 | struct proc_dir_entry *comedi_proc; | 82 | return single_open(file, comedi_read, NULL); |
83 | } | ||
84 | |||
85 | static const struct file_operations comedi_proc_fops = { | ||
86 | .open = comedi_proc_open, | ||
87 | .read = seq_read, | ||
88 | .llseek = seq_lseek, | ||
89 | .release = seq_release, | ||
90 | }; | ||
84 | 91 | ||
85 | comedi_proc = create_proc_entry("comedi", S_IFREG | S_IRUGO, NULL); | 92 | void comedi_proc_init(void) |
86 | if (comedi_proc) | 93 | { |
87 | comedi_proc->read_proc = comedi_read; | 94 | proc_create("comedi", 0644, NULL, &comedi_proc_fops); |
88 | } | 95 | } |
89 | 96 | ||
90 | void comedi_proc_cleanup(void) | 97 | void comedi_proc_cleanup(void) |
diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c index a65b822db698..a6b006b0e983 100644 --- a/drivers/staging/csr/csr_wifi_hip_udi.c +++ b/drivers/staging/csr/csr_wifi_hip_udi.c | |||
@@ -24,10 +24,50 @@ | |||
24 | * | 24 | * |
25 | * --------------------------------------------------------------------------- | 25 | * --------------------------------------------------------------------------- |
26 | */ | 26 | */ |
27 | #include <linux/seq_file.h> | ||
27 | #include "csr_wifi_hip_unifi.h" | 28 | #include "csr_wifi_hip_unifi.h" |
28 | #include "csr_wifi_hip_card.h" | 29 | #include "csr_wifi_hip_card.h" |
29 | 30 | ||
30 | 31 | ||
32 | static void unifi_print_unsafe_sdio_status(card_t *card, struct seq_file *m) | ||
33 | { | ||
34 | #ifdef CSR_UNSAFE_SDIO_ACCESS | ||
35 | s32 iostate; | ||
36 | CsrResult r; | ||
37 | static const char *const states[] = { | ||
38 | "AWAKE", "DROWSY", "TORPID" | ||
39 | }; | ||
40 | #define SHARED_READ_RETRY_LIMIT 10 | ||
41 | u8 b; | ||
42 | |||
43 | seq_printf(m, "Host State: %s\n", states[card->host_state]); | ||
44 | |||
45 | r = unifi_check_io_status(card, &iostate); | ||
46 | if (iostate == 1) { | ||
47 | seq_puts(m, remaining, "I/O Check: F1 disabled\n"); | ||
48 | } else { | ||
49 | if (iostate == 1) { | ||
50 | seq_puts(m, "I/O Check: pending interrupt\n"); | ||
51 | |||
52 | seq_printf(m, "BH reason interrupt = %d\n", card->bh_reason_unifi); | ||
53 | seq_printf(m, "BH reason host = %d\n", card->bh_reason_host); | ||
54 | |||
55 | for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) { | ||
56 | r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b); | ||
57 | if (r == CSR_RESULT_SUCCESS && !(b & 0x80)) { | ||
58 | seq_printf(m, "fhsr: %u (driver thinks is %u)\n", | ||
59 | b, card->from_host_signals_r); | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); | ||
65 | seq_printf(m, "thsw: %u (driver thinks is %u)\n", | ||
66 | iostate, card->to_host_signals_w); | ||
67 | } | ||
68 | #endif | ||
69 | } | ||
70 | |||
31 | /* | 71 | /* |
32 | * --------------------------------------------------------------------------- | 72 | * --------------------------------------------------------------------------- |
33 | * unifi_print_status | 73 | * unifi_print_status |
@@ -41,228 +81,93 @@ | |||
41 | * None. | 81 | * None. |
42 | * --------------------------------------------------------------------------- | 82 | * --------------------------------------------------------------------------- |
43 | */ | 83 | */ |
44 | s32 unifi_print_status(card_t *card, char *str, s32 *remain) | 84 | s32 unifi_print_status(card_t *card, struct seq_file *m) |
45 | { | 85 | { |
46 | char *p = str; | 86 | sdio_config_data_t *cfg; |
47 | sdio_config_data_t *cfg; | 87 | u16 i, n; |
48 | u16 i, n; | 88 | |
49 | s32 remaining = *remain; | 89 | i = n = 0; |
50 | s32 written; | 90 | seq_printf(m, "Chip ID %u\n", card->chip_id); |
51 | #ifdef CSR_UNSAFE_SDIO_ACCESS | 91 | seq_printf(m, "Chip Version %04X\n", card->chip_version); |
52 | s32 iostate; | 92 | seq_printf(m, "HIP v%u.%u\n", |
53 | CsrResult r; | 93 | (card->config_data.version >> 8) & 0xFF, |
54 | static const char *const states[] = { | 94 | card->config_data.version & 0xFF); |
55 | "AWAKE", "DROWSY", "TORPID" | 95 | seq_printf(m, "Build %u: %s\n", card->build_id, card->build_id_string); |
56 | }; | 96 | |
57 | #define SHARED_READ_RETRY_LIMIT 10 | 97 | cfg = &card->config_data; |
58 | u8 b; | 98 | |
59 | #endif | 99 | seq_printf(m, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset); |
60 | 100 | seq_printf(m, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle); | |
61 | if (remaining <= 0) | 101 | seq_printf(m, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle); |
62 | { | 102 | seq_printf(m, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags); |
63 | return 0; | 103 | seq_printf(m, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags); |
64 | } | 104 | seq_printf(m, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots); |
65 | 105 | seq_printf(m, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots); | |
66 | i = n = 0; | 106 | seq_printf(m, "data_slot_size %u\n", cfg->data_slot_size); |
67 | written = scnprintf(p, remaining, "Chip ID %u\n", | 107 | |
68 | (u16)card->chip_id); | 108 | /* Added by protocol version 0x0001 */ |
69 | UNIFI_SNPRINTF_RET(p, remaining, written); | 109 | seq_printf(m, "overlay_size %u\n", cfg->overlay_size); |
70 | written = scnprintf(p, remaining, "Chip Version %04X\n", | 110 | |
71 | card->chip_version); | 111 | /* Added by protocol version 0x0300 */ |
72 | UNIFI_SNPRINTF_RET(p, remaining, written); | 112 | seq_printf(m, "data_slot_round %u\n", cfg->data_slot_round); |
73 | written = scnprintf(p, remaining, "HIP v%u.%u\n", | 113 | seq_printf(m, "sig_frag_size %u\n", cfg->sig_frag_size); |
74 | (card->config_data.version >> 8) & 0xFF, | 114 | |
75 | card->config_data.version & 0xFF); | 115 | /* Added by protocol version 0x0300 */ |
76 | UNIFI_SNPRINTF_RET(p, remaining, written); | 116 | seq_printf(m, "tohost_sig_pad %u\n", cfg->tohost_signal_padding); |
77 | written = scnprintf(p, remaining, "Build %u: %s\n", | 117 | |
78 | card->build_id, card->build_id_string); | 118 | seq_puts(m, "\nInternal state:\n"); |
79 | UNIFI_SNPRINTF_RET(p, remaining, written); | 119 | |
80 | 120 | seq_printf(m, "Last PHY PANIC: %04x:%04x\n", | |
81 | cfg = &card->config_data; | 121 | card->last_phy_panic_code, card->last_phy_panic_arg); |
82 | 122 | seq_printf(m, "Last MAC PANIC: %04x:%04x\n", | |
83 | written = scnprintf(p, remaining, "sdio ctrl offset %u\n", | 123 | card->last_mac_panic_code, card->last_mac_panic_arg); |
84 | cfg->sdio_ctrl_offset); | 124 | |
85 | UNIFI_SNPRINTF_RET(p, remaining, written); | 125 | seq_printf(m, "fhsr: %hu\n", (u16)card->from_host_signals_r); |
86 | written = scnprintf(p, remaining, "fromhost sigbuf handle %u\n", | 126 | seq_printf(m, "fhsw: %hu\n", (u16)card->from_host_signals_w); |
87 | cfg->fromhost_sigbuf_handle); | 127 | seq_printf(m, "thsr: %hu\n", (u16)card->to_host_signals_r); |
88 | UNIFI_SNPRINTF_RET(p, remaining, written); | 128 | seq_printf(m, "thsw: %hu\n", (u16)card->to_host_signals_w); |
89 | written = scnprintf(p, remaining, "tohost_sigbuf_handle %u\n", | 129 | seq_printf(m, "fh buffer contains: %d signals, %td bytes\n", |
90 | cfg->tohost_sigbuf_handle); | 130 | card->fh_buffer.count, |
91 | UNIFI_SNPRINTF_RET(p, remaining, written); | 131 | card->fh_buffer.ptr - card->fh_buffer.buf); |
92 | written = scnprintf(p, remaining, "num_fromhost_sig_frags %u\n", | 132 | |
93 | cfg->num_fromhost_sig_frags); | 133 | seq_puts(m, "paused: "); |
94 | UNIFI_SNPRINTF_RET(p, remaining, written); | 134 | for (i = 0; i < ARRAY_SIZE(card->tx_q_paused_flag); i++) |
95 | written = scnprintf(p, remaining, "num_tohost_sig_frags %u\n", | 135 | seq_printf(m, card->tx_q_paused_flag[i] ? "1" : "0"); |
96 | cfg->num_tohost_sig_frags); | 136 | seq_putc(m, '\n'); |
97 | UNIFI_SNPRINTF_RET(p, remaining, written); | 137 | |
98 | written = scnprintf(p, remaining, "num_fromhost_data_slots %u\n", | 138 | seq_printf(m, "fh command q: %u waiting, %u free of %u:\n", |
99 | cfg->num_fromhost_data_slots); | 139 | CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue), |
100 | UNIFI_SNPRINTF_RET(p, remaining, written); | 140 | CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue), |
101 | written = scnprintf(p, remaining, "num_tohost_data_slots %u\n", | 141 | UNIFI_SOFT_COMMAND_Q_LENGTH); |
102 | cfg->num_tohost_data_slots); | 142 | |
103 | UNIFI_SNPRINTF_RET(p, remaining, written); | 143 | for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) |
104 | written = scnprintf(p, remaining, "data_slot_size %u\n", | 144 | seq_printf(m, "fh traffic q[%u]: %u waiting, %u free of %u:\n", |
105 | cfg->data_slot_size); | 145 | i, |
106 | UNIFI_SNPRINTF_RET(p, remaining, written); | 146 | CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]), |
107 | 147 | CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]), | |
108 | /* Added by protocol version 0x0001 */ | 148 | UNIFI_SOFT_TRAFFIC_Q_LENGTH); |
109 | written = scnprintf(p, remaining, "overlay_size %u\n", | 149 | |
110 | (u16)cfg->overlay_size); | 150 | seq_printf(m, "fh data slots free: %u\n", |
111 | UNIFI_SNPRINTF_RET(p, remaining, written); | 151 | card->from_host_data ? CardGetFreeFromHostDataSlots(card) : 0); |
112 | 152 | ||
113 | /* Added by protocol version 0x0300 */ | 153 | seq_puts(m, "From host data slots:"); |
114 | written = scnprintf(p, remaining, "data_slot_round %u\n", | 154 | n = card->config_data.num_fromhost_data_slots; |
115 | cfg->data_slot_round); | 155 | for (i = 0; i < n && card->from_host_data; i++) |
116 | UNIFI_SNPRINTF_RET(p, remaining, written); | 156 | seq_printf(m, " %hu", (u16)card->from_host_data[i].bd.data_length); |
117 | written = scnprintf(p, remaining, "sig_frag_size %u\n", | 157 | seq_putc(m, '\n'); |
118 | cfg->sig_frag_size); | 158 | |
119 | UNIFI_SNPRINTF_RET(p, remaining, written); | 159 | seq_puts(m, "To host data slots:"); |
120 | 160 | n = card->config_data.num_tohost_data_slots; | |
121 | /* Added by protocol version 0x0300 */ | 161 | for (i = 0; i < n && card->to_host_data; i++) |
122 | written = scnprintf(p, remaining, "tohost_sig_pad %u\n", | 162 | seq_printf(m, " %hu", (u16)card->to_host_data[i].data_length); |
123 | cfg->tohost_signal_padding); | 163 | seq_putc(m, '\n'); |
124 | UNIFI_SNPRINTF_RET(p, remaining, written); | 164 | |
125 | 165 | unifi_print_unsafe_sdio_status(card, m); | |
126 | written = scnprintf(p, remaining, "\nInternal state:\n"); | 166 | |
127 | UNIFI_SNPRINTF_RET(p, remaining, written); | 167 | seq_puts(m, "\nStats:\n"); |
128 | 168 | seq_printf(m, "Total SDIO bytes: R=%u W=%u\n", | |
129 | written = scnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n", | 169 | card->sdio_bytes_read, card->sdio_bytes_written); |
130 | card->last_phy_panic_code, card->last_phy_panic_arg); | 170 | |
131 | UNIFI_SNPRINTF_RET(p, remaining, written); | 171 | seq_printf(m, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq); |
132 | written = scnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n", | 172 | return 0; |
133 | card->last_mac_panic_code, card->last_mac_panic_arg); | 173 | } |
134 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
135 | |||
136 | written = scnprintf(p, remaining, "fhsr: %u\n", | ||
137 | (u16)card->from_host_signals_r); | ||
138 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
139 | written = scnprintf(p, remaining, "fhsw: %u\n", | ||
140 | (u16)card->from_host_signals_w); | ||
141 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
142 | written = scnprintf(p, remaining, "thsr: %u\n", | ||
143 | (u16)card->to_host_signals_r); | ||
144 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
145 | written = scnprintf(p, remaining, "thsw: %u\n", | ||
146 | (u16)card->to_host_signals_w); | ||
147 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
148 | written = scnprintf(p, remaining, | ||
149 | "fh buffer contains: %d signals, %td bytes\n", | ||
150 | card->fh_buffer.count, | ||
151 | card->fh_buffer.ptr - card->fh_buffer.buf); | ||
152 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
153 | |||
154 | written = scnprintf(p, remaining, "paused: "); | ||
155 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
156 | for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++) | ||
157 | { | ||
158 | written = scnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0"); | ||
159 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
160 | } | ||
161 | written = scnprintf(p, remaining, "\n"); | ||
162 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
163 | |||
164 | written = scnprintf(p, remaining, | ||
165 | "fh command q: %u waiting, %u free of %u:\n", | ||
166 | CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue), | ||
167 | CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue), | ||
168 | UNIFI_SOFT_COMMAND_Q_LENGTH); | ||
169 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
170 | for (i = 0; i < UNIFI_NO_OF_TX_QS; i++) | ||
171 | { | ||
172 | written = scnprintf(p, remaining, | ||
173 | "fh traffic q[%u]: %u waiting, %u free of %u:\n", | ||
174 | i, | ||
175 | CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]), | ||
176 | CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]), | ||
177 | UNIFI_SOFT_TRAFFIC_Q_LENGTH); | ||
178 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
179 | } | ||
180 | |||
181 | written = scnprintf(p, remaining, "fh data slots free: %u\n", | ||
182 | card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0); | ||
183 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
184 | |||
185 | |||
186 | written = scnprintf(p, remaining, "From host data slots:"); | ||
187 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
188 | n = card->config_data.num_fromhost_data_slots; | ||
189 | for (i = 0; i < n && card->from_host_data; i++) | ||
190 | { | ||
191 | written = scnprintf(p, remaining, " %u", | ||
192 | (u16)card->from_host_data[i].bd.data_length); | ||
193 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
194 | } | ||
195 | written = scnprintf(p, remaining, "\n"); | ||
196 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
197 | |||
198 | written = scnprintf(p, remaining, "To host data slots:"); | ||
199 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
200 | n = card->config_data.num_tohost_data_slots; | ||
201 | for (i = 0; i < n && card->to_host_data; i++) | ||
202 | { | ||
203 | written = scnprintf(p, remaining, " %u", | ||
204 | (u16)card->to_host_data[i].data_length); | ||
205 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
206 | } | ||
207 | |||
208 | written = scnprintf(p, remaining, "\n"); | ||
209 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
210 | |||
211 | #ifdef CSR_UNSAFE_SDIO_ACCESS | ||
212 | written = scnprintf(p, remaining, "Host State: %s\n", states[card->host_state]); | ||
213 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
214 | |||
215 | r = unifi_check_io_status(card, &iostate); | ||
216 | if (iostate == 1) | ||
217 | { | ||
218 | written = scnprintf(p, remaining, "I/O Check: F1 disabled\n"); | ||
219 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
220 | } | ||
221 | else | ||
222 | { | ||
223 | if (iostate == 1) | ||
224 | { | ||
225 | written = scnprintf(p, remaining, "I/O Check: pending interrupt\n"); | ||
226 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
227 | } | ||
228 | |||
229 | written = scnprintf(p, remaining, "BH reason interrupt = %d\n", | ||
230 | card->bh_reason_unifi); | ||
231 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
232 | written = scnprintf(p, remaining, "BH reason host = %d\n", | ||
233 | card->bh_reason_host); | ||
234 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
235 | |||
236 | for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) | ||
237 | { | ||
238 | r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b); | ||
239 | if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80))) | ||
240 | { | ||
241 | written = scnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n", | ||
242 | b, card->from_host_signals_r); | ||
243 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
244 | break; | ||
245 | } | ||
246 | } | ||
247 | iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4); | ||
248 | written = scnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n", | ||
249 | iostate, card->to_host_signals_w); | ||
250 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
251 | } | ||
252 | #endif | ||
253 | |||
254 | written = scnprintf(p, remaining, "\nStats:\n"); | ||
255 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
256 | written = scnprintf(p, remaining, "Total SDIO bytes: R=%u W=%u\n", | ||
257 | card->sdio_bytes_read, card->sdio_bytes_written); | ||
258 | |||
259 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
260 | written = scnprintf(p, remaining, "Interrupts generated on card: %u\n", | ||
261 | card->unifi_interrupt_seq); | ||
262 | UNIFI_SNPRINTF_RET(p, remaining, written); | ||
263 | |||
264 | *remain = remaining; | ||
265 | return (p - str); | ||
266 | } /* unifi_print_status() */ | ||
267 | |||
268 | |||
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h index 9d85cfd57616..4126e85bfe9b 100644 --- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h +++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h | |||
@@ -47,21 +47,6 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); | |||
47 | * This is used in the linux /proc interface and might be useful | 47 | * This is used in the linux /proc interface and might be useful |
48 | * in other systems. | 48 | * in other systems. |
49 | */ | 49 | */ |
50 | s32 unifi_print_status(card_t *card, char *str, s32 *remain); | 50 | s32 unifi_print_status(card_t *card, struct seq_file *m); |
51 | |||
52 | #define UNIFI_SNPRINTF_RET(buf_p, remain, written) \ | ||
53 | do { \ | ||
54 | if (written >= remain) { \ | ||
55 | if (remain >= 2) { \ | ||
56 | buf_p[remain - 2] = '\n'; \ | ||
57 | buf_p[remain - 1] = 0; \ | ||
58 | } \ | ||
59 | buf_p += remain; \ | ||
60 | remain = 0; \ | ||
61 | } else if (written > 0) { \ | ||
62 | buf_p += written; \ | ||
63 | remain -= written; \ | ||
64 | } \ | ||
65 | } while (0) | ||
66 | 51 | ||
67 | #endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */ | 52 | #endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */ |
diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c index 5520d6539f77..bdc25236ab00 100644 --- a/drivers/staging/csr/drv.c +++ b/drivers/staging/csr/drv.c | |||
@@ -1941,7 +1941,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length) | |||
1941 | * | 1941 | * |
1942 | **************************************************************************** | 1942 | **************************************************************************** |
1943 | */ | 1943 | */ |
1944 | static struct file_operations unifi_fops = { | 1944 | static const struct file_operations unifi_fops = { |
1945 | .owner = THIS_MODULE, | 1945 | .owner = THIS_MODULE, |
1946 | .open = unifi_open, | 1946 | .open = unifi_open, |
1947 | .release = unifi_release, | 1947 | .release = unifi_release, |
@@ -2041,7 +2041,7 @@ void uf_destroy_device_nodes(unifi_priv_t *priv) | |||
2041 | * ---------------------------------------------------------------- | 2041 | * ---------------------------------------------------------------- |
2042 | */ | 2042 | */ |
2043 | static int | 2043 | static int |
2044 | uf_create_debug_device(struct file_operations *fops) | 2044 | uf_create_debug_device(const struct file_operations *fops) |
2045 | { | 2045 | { |
2046 | int ret; | 2046 | int ret; |
2047 | 2047 | ||
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index af9c28f073b9..f9b5c22c00b8 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * --------------------------------------------------------------------------- | 31 | * --------------------------------------------------------------------------- |
32 | */ | 32 | */ |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/seq_file.h> | ||
34 | 35 | ||
35 | #include "csr_wifi_hip_unifi.h" | 36 | #include "csr_wifi_hip_unifi.h" |
36 | #include "csr_wifi_hip_unifiversion.h" | 37 | #include "csr_wifi_hip_unifiversion.h" |
@@ -76,9 +77,28 @@ DEFINE_SEMAPHORE(Unifi_instance_mutex); | |||
76 | */ | 77 | */ |
77 | DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq); | 78 | DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq); |
78 | 79 | ||
80 | #ifdef CONFIG_PROC_FS | ||
81 | /* | ||
82 | * seq_file wrappers for procfile show routines. | ||
83 | */ | ||
84 | static int uf_proc_show(struct seq_file *m, void *v); | ||
85 | |||
86 | #define UNIFI_DEBUG_TXT_BUFFER (8 * 1024) | ||
87 | |||
88 | static int uf_proc_open(struct inode *inode, struct file *file) | ||
89 | { | ||
90 | return single_open_size(file, uf_proc_show, PDE_DATA(inode), | ||
91 | UNIFI_DEBUG_TXT_BUFFER); | ||
92 | } | ||
93 | |||
94 | static const struct file_operations uf_proc_fops = { | ||
95 | .open = uf_proc_open, | ||
96 | .read = seq_read, | ||
97 | .llseek = seq_lseek, | ||
98 | .release = seq_release, | ||
99 | }; | ||
79 | 100 | ||
80 | static int uf_read_proc(char *page, char **start, off_t offset, int count, | 101 | #endif /* CONFIG_PROC_FS */ |
81 | int *eof, void *data); | ||
82 | 102 | ||
83 | #ifdef CSR_WIFI_RX_PATH_SPLIT | 103 | #ifdef CSR_WIFI_RX_PATH_SPLIT |
84 | 104 | ||
@@ -327,8 +347,8 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) | |||
327 | * The following complex casting is in place in order to eliminate 64-bit compilation warning | 347 | * The following complex casting is in place in order to eliminate 64-bit compilation warning |
328 | * "cast to/from pointer from/to integer of different size" | 348 | * "cast to/from pointer from/to integer of different size" |
329 | */ | 349 | */ |
330 | if (!create_proc_read_entry(priv->proc_entry_name, 0, 0, | 350 | if (!proc_create_data(priv->proc_entry_name, 0, NULL, |
331 | uf_read_proc, (void *)(long)priv->instance)) | 351 | &uf_proc_fops, (void *)(long)priv->instance)) |
332 | { | 352 | { |
333 | unifi_error(priv, "unifi: can't create /proc/driver/unifi\n"); | 353 | unifi_error(priv, "unifi: can't create /proc/driver/unifi\n"); |
334 | } | 354 | } |
@@ -827,7 +847,7 @@ uf_put_instance(int inst) | |||
827 | 847 | ||
828 | /* | 848 | /* |
829 | * --------------------------------------------------------------------------- | 849 | * --------------------------------------------------------------------------- |
830 | * uf_read_proc | 850 | * uf_proc_show |
831 | * | 851 | * |
832 | * Read method for driver node in /proc/driver/unifi0 | 852 | * Read method for driver node in /proc/driver/unifi0 |
833 | * | 853 | * |
@@ -844,107 +864,54 @@ uf_put_instance(int inst) | |||
844 | * --------------------------------------------------------------------------- | 864 | * --------------------------------------------------------------------------- |
845 | */ | 865 | */ |
846 | #ifdef CONFIG_PROC_FS | 866 | #ifdef CONFIG_PROC_FS |
847 | static int | 867 | static int uf_proc_show(struct seq_file *m, void *v) |
848 | uf_read_proc(char *page, char **start, off_t offset, int count, | ||
849 | int *eof, void *data) | ||
850 | { | 868 | { |
851 | #define UNIFI_DEBUG_TXT_BUFFER 8*1024 | 869 | unifi_priv_t *priv; |
852 | unifi_priv_t *priv; | 870 | int i; |
853 | int actual_amount_to_copy; | 871 | |
854 | char *p, *orig_p; | 872 | /* |
855 | s32 remain = UNIFI_DEBUG_TXT_BUFFER; | 873 | * The following complex casting is in place in order to eliminate |
856 | s32 written; | 874 | * 64-bit compilation warning "cast to/from pointer from/to integer of |
857 | int i; | 875 | * different size" |
858 | 876 | */ | |
859 | /* | 877 | priv = uf_find_instance((long)m->private); |
860 | * The following complex casting is in place in order to eliminate 64-bit compilation warning | 878 | if (!priv) |
861 | * "cast to/from pointer from/to integer of different size" | 879 | return 0; |
862 | */ | 880 | |
863 | priv = uf_find_instance((int)(long)data); | 881 | seq_printf(m, "UniFi SDIO Driver: %s %s %s\n", |
864 | if (!priv) { | 882 | CSR_WIFI_VERSION, __DATE__, __TIME__); |
865 | return 0; | ||
866 | } | ||
867 | |||
868 | p = kmalloc( UNIFI_DEBUG_TXT_BUFFER, GFP_KERNEL ); | ||
869 | |||
870 | orig_p = p; | ||
871 | |||
872 | written = scnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n", | ||
873 | CSR_WIFI_VERSION, __DATE__, __TIME__); | ||
874 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
875 | #ifdef CSR_SME_USERSPACE | 883 | #ifdef CSR_SME_USERSPACE |
876 | written = scnprintf(p, remain, "SME: CSR userspace "); | 884 | seq_puts(m, "SME: CSR userspace "); |
877 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
878 | #ifdef CSR_SUPPORT_WEXT | 885 | #ifdef CSR_SUPPORT_WEXT |
879 | written = scnprintf(p, remain, "with WEXT support\n"); | 886 | seq_puts(m, "with WEXT support\n"); |
880 | #else | 887 | #else |
881 | written = scnprintf(p, remain, "\n"); | 888 | seq_putc(m, '\n'); |
882 | #endif /* CSR_SUPPORT_WEXT */ | 889 | #endif /* CSR_SUPPORT_WEXT */ |
883 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
884 | #endif /* CSR_SME_USERSPACE */ | 890 | #endif /* CSR_SME_USERSPACE */ |
885 | #ifdef CSR_NATIVE_LINUX | 891 | #ifdef CSR_NATIVE_LINUX |
886 | written = scnprintf(p, remain, "SME: native\n"); | 892 | seq_puts(m, "SME: native\n"); |
887 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
888 | #endif | 893 | #endif |
889 | 894 | ||
890 | #ifdef CSR_SUPPORT_SME | 895 | #ifdef CSR_SUPPORT_SME |
891 | written = scnprintf(p, remain, | 896 | seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n", |
892 | "Firmware (ROM) build:%u, Patch:%u\n", | 897 | priv->card_info.fw_build, |
893 | priv->card_info.fw_build, | 898 | priv->sme_versions.firmwarePatch); |
894 | priv->sme_versions.firmwarePatch); | ||
895 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
896 | #endif | 899 | #endif |
897 | p += unifi_print_status(priv->card, p, &remain); | ||
898 | |||
899 | written = scnprintf(p, remain, "Last dbg str: %s\n", | ||
900 | priv->last_debug_string); | ||
901 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
902 | |||
903 | written = scnprintf(p, remain, "Last dbg16:"); | ||
904 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
905 | for (i = 0; i < 8; i++) { | ||
906 | written = scnprintf(p, remain, " %04X", | ||
907 | priv->last_debug_word16[i]); | ||
908 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
909 | } | ||
910 | written = scnprintf(p, remain, "\n"); | ||
911 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
912 | written = scnprintf(p, remain, " "); | ||
913 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
914 | for (; i < 16; i++) { | ||
915 | written = scnprintf(p, remain, " %04X", | ||
916 | priv->last_debug_word16[i]); | ||
917 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
918 | } | ||
919 | written = scnprintf(p, remain, "\n"); | ||
920 | UNIFI_SNPRINTF_RET(p, remain, written); | ||
921 | *start = page; | ||
922 | |||
923 | written = UNIFI_DEBUG_TXT_BUFFER - remain; | ||
924 | |||
925 | if( offset >= written ) | ||
926 | { | ||
927 | *eof = 1; | ||
928 | kfree( orig_p ); | ||
929 | return(0); | ||
930 | } | ||
931 | |||
932 | if( offset + count > written ) | ||
933 | { | ||
934 | actual_amount_to_copy = written - offset; | ||
935 | *eof = 1; | ||
936 | } | ||
937 | else | ||
938 | { | ||
939 | actual_amount_to_copy = count; | ||
940 | } | ||
941 | 900 | ||
942 | memcpy( page, &(orig_p[offset]), actual_amount_to_copy ); | 901 | unifi_print_status(priv->card, m); |
943 | 902 | ||
944 | kfree( orig_p ); | 903 | seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string); |
945 | 904 | ||
946 | return( actual_amount_to_copy ); | 905 | seq_puts(m, "Last dbg16:"); |
947 | } /* uf_read_proc() */ | 906 | for (i = 0; i < 8; i++) |
907 | seq_printf(m, " %04X", priv->last_debug_word16[i]); | ||
908 | seq_putc(m, '\n'); | ||
909 | seq_puts(m, " "); | ||
910 | for (; i < 16; i++) | ||
911 | seq_printf(m, " %04X", priv->last_debug_word16[i]); | ||
912 | seq_putc(m, '\n'); | ||
913 | return 0; | ||
914 | } | ||
948 | #endif | 915 | #endif |
949 | 916 | ||
950 | 917 | ||
diff --git a/drivers/staging/cxt1e1/Makefile b/drivers/staging/cxt1e1/Makefile index e99b82311823..b9ccb7650251 100644 --- a/drivers/staging/cxt1e1/Makefile +++ b/drivers/staging/cxt1e1/Makefile | |||
@@ -12,8 +12,9 @@ cxt1e1-y := \ | |||
12 | linux.o \ | 12 | linux.o \ |
13 | functions.o \ | 13 | functions.o \ |
14 | hwprobe.o \ | 14 | hwprobe.o \ |
15 | sbeproc.o \ | ||
16 | pmc93x6_eeprom.o \ | 15 | pmc93x6_eeprom.o \ |
17 | sbecrc.o \ | 16 | sbecrc.o \ |
18 | comet_tables.o \ | 17 | comet_tables.o \ |
19 | sbeid.o | 18 | sbeid.o |
19 | |||
20 | cxt1e1-$(CONFIG_PROC_FS) += sbeproc.o | ||
diff --git a/drivers/staging/cxt1e1/sbeproc.c b/drivers/staging/cxt1e1/sbeproc.c index f42531c3d8da..49f10f0b7d29 100644 --- a/drivers/staging/cxt1e1/sbeproc.c +++ b/drivers/staging/cxt1e1/sbeproc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/seq_file.h> | ||
22 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | #include "pmcc4_sysdep.h" | 25 | #include "pmcc4_sysdep.h" |
@@ -26,332 +27,193 @@ | |||
26 | #include "pmcc4_private.h" | 27 | #include "pmcc4_private.h" |
27 | #include "sbeproc.h" | 28 | #include "sbeproc.h" |
28 | 29 | ||
29 | /* forwards */ | 30 | extern void sbecom_get_brdinfo(ci_t *, struct sbe_brd_info *, u_int8_t *); |
30 | void sbecom_get_brdinfo (ci_t *, struct sbe_brd_info *, u_int8_t *); | ||
31 | extern struct s_hdw_info hdw_info[MAX_BOARDS]; | 31 | extern struct s_hdw_info hdw_info[MAX_BOARDS]; |
32 | 32 | ||
33 | #ifdef CONFIG_PROC_FS | 33 | void sbecom_proc_brd_cleanup(ci_t *ci) |
34 | |||
35 | /********************************************************************/ | ||
36 | /* procfs stuff */ | ||
37 | /********************************************************************/ | ||
38 | |||
39 | |||
40 | void | ||
41 | sbecom_proc_brd_cleanup (ci_t * ci) | ||
42 | { | 34 | { |
43 | if (ci->dir_dev) | 35 | if (ci->dir_dev) { |
44 | { | 36 | char dir[7 + SBE_IFACETMPL_SIZE + 1]; |
45 | char dir[7 + SBE_IFACETMPL_SIZE + 1]; | 37 | snprintf(dir, sizeof(dir), "driver/%s", ci->devname); |
46 | snprintf(dir, sizeof(dir), "driver/%s", ci->devname); | 38 | remove_proc_entry("info", ci->dir_dev); |
47 | remove_proc_entry("info", ci->dir_dev); | 39 | remove_proc_entry(dir, NULL); |
48 | remove_proc_entry(dir, NULL); | 40 | ci->dir_dev = NULL; |
49 | ci->dir_dev = NULL; | 41 | } |
50 | } | ||
51 | } | 42 | } |
52 | 43 | ||
53 | 44 | static void sbecom_proc_get_brdinfo(ci_t *ci, struct sbe_brd_info *bip) | |
54 | static int | ||
55 | sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset, | ||
56 | int length, int *eof, void *priv) | ||
57 | { | 45 | { |
58 | ci_t *ci = (ci_t *) priv; | 46 | hdw_info_t *hi = &hdw_info[ci->brdno]; |
59 | int len = 0; | 47 | u_int8_t *bsn = 0; |
60 | char *spd; | 48 | |
61 | struct sbe_brd_info *bip; | 49 | switch (hi->promfmt) |
62 | 50 | { | |
63 | if (!(bip = OS_kmalloc (sizeof (struct sbe_brd_info)))) | 51 | case PROM_FORMAT_TYPE1: |
64 | { | 52 | bsn = (u_int8_t *) hi->mfg_info.pft1.Serial; |
65 | return -ENOMEM; | 53 | break; |
66 | } | 54 | case PROM_FORMAT_TYPE2: |
67 | #if 0 | 55 | bsn = (u_int8_t *) hi->mfg_info.pft2.Serial; |
68 | /** RLD DEBUG **/ | 56 | break; |
69 | pr_info(">> sbecom_proc_get_sbe_info: entered, offset %d. length %d.\n", | 57 | } |
70 | (int) offset, (int) length); | 58 | |
71 | #endif | 59 | sbecom_get_brdinfo (ci, bip, bsn); |
72 | 60 | ||
73 | { | 61 | pr_devel(">> sbecom_get_brdinfo: returned, first_if %p <%s> last_if %p <%s>\n", |
74 | hdw_info_t *hi = &hdw_info[ci->brdno]; | 62 | bip->first_iname, bip->first_iname, |
75 | 63 | bip->last_iname, bip->last_iname); | |
76 | u_int8_t *bsn = 0; | 64 | } |
77 | |||
78 | switch (hi->promfmt) | ||
79 | { | ||
80 | case PROM_FORMAT_TYPE1: | ||
81 | bsn = (u_int8_t *) hi->mfg_info.pft1.Serial; | ||
82 | break; | ||
83 | case PROM_FORMAT_TYPE2: | ||
84 | bsn = (u_int8_t *) hi->mfg_info.pft2.Serial; | ||
85 | break; | ||
86 | } | ||
87 | |||
88 | sbecom_get_brdinfo (ci, bip, bsn); | ||
89 | } | ||
90 | |||
91 | #if 0 | ||
92 | /** RLD DEBUG **/ | ||
93 | pr_info(">> sbecom_get_brdinfo: returned, first_if %p <%s> last_if %p <%s>\n", | ||
94 | (char *) &bip->first_iname, (char *) &bip->first_iname, | ||
95 | (char *) &bip->last_iname, (char *) &bip->last_iname); | ||
96 | #endif | ||
97 | len += sprintf (buffer + len, "Board Type: "); | ||
98 | switch (bip->brd_id) | ||
99 | { | ||
100 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3): | ||
101 | len += sprintf (buffer + len, "wanPMC-C1T3"); | ||
102 | break; | ||
103 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): | ||
104 | len += sprintf (buffer + len, "wanPTMC-256T3 <E1>"); | ||
105 | break; | ||
106 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): | ||
107 | len += sprintf (buffer + len, "wanPTMC-256T3 <T1>"); | ||
108 | break; | ||
109 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1): | ||
110 | len += sprintf (buffer + len, "wanPTMC-C24TE1"); | ||
111 | break; | ||
112 | |||
113 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): | ||
114 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): | ||
115 | len += sprintf (buffer + len, "wanPMC-C4T1E1"); | ||
116 | break; | ||
117 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): | ||
118 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): | ||
119 | len += sprintf (buffer + len, "wanPMC-C2T1E1"); | ||
120 | break; | ||
121 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): | ||
122 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): | ||
123 | len += sprintf (buffer + len, "wanPMC-C1T1E1"); | ||
124 | break; | ||
125 | |||
126 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): | ||
127 | len += sprintf (buffer + len, "wanPCI-C4T1E1"); | ||
128 | break; | ||
129 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): | ||
130 | len += sprintf (buffer + len, "wanPCI-C2T1E1"); | ||
131 | break; | ||
132 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): | ||
133 | len += sprintf (buffer + len, "wanPCI-C1T1E1"); | ||
134 | break; | ||
135 | |||
136 | default: | ||
137 | len += sprintf (buffer + len, "unknown"); | ||
138 | break; | ||
139 | } | ||
140 | len += sprintf (buffer + len, " [%08X]\n", bip->brd_id); | ||
141 | 65 | ||
142 | len += sprintf (buffer + len, "Board Number: %d\n", bip->brdno); | 66 | /* |
143 | len += sprintf (buffer + len, "Hardware ID: 0x%02X\n", ci->hdw_bid); | 67 | * Describe the driver state through /proc |
144 | len += sprintf (buffer + len, "Board SN: %06X\n", bip->brd_sn); | 68 | */ |
145 | len += sprintf(buffer + len, "Board MAC: %pMF\n", | 69 | static int sbecom_proc_get_sbe_info(struct seq_file *m, void *v) |
146 | bip->brd_mac_addr); | 70 | { |
147 | len += sprintf (buffer + len, "Ports: %d\n", ci->max_port); | 71 | ci_t *ci = m->private; |
148 | len += sprintf (buffer + len, "Channels: %d\n", bip->brd_chan_cnt); | 72 | char *spd; |
73 | struct sbe_brd_info *bip; | ||
74 | |||
75 | if (!(bip = OS_kmalloc(sizeof(struct sbe_brd_info)))) | ||
76 | return -ENOMEM; | ||
77 | |||
78 | pr_devel(">> sbecom_proc_get_sbe_info: entered\n"); | ||
79 | |||
80 | sbecom_proc_get_brdinfo(ci, bip); | ||
81 | |||
82 | seq_puts(m, "Board Type: "); | ||
83 | switch (bip->brd_id) { | ||
84 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3): | ||
85 | seq_puts(m, "wanPMC-C1T3"); | ||
86 | break; | ||
87 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): | ||
88 | seq_puts(m, "wanPTMC-256T3 <E1>"); | ||
89 | break; | ||
90 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): | ||
91 | seq_puts(m, "wanPTMC-256T3 <T1>"); | ||
92 | break; | ||
93 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1): | ||
94 | seq_puts(m, "wanPTMC-C24TE1"); | ||
95 | break; | ||
96 | |||
97 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): | ||
98 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): | ||
99 | seq_puts(m, "wanPMC-C4T1E1"); | ||
100 | break; | ||
101 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): | ||
102 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): | ||
103 | seq_puts(m, "wanPMC-C2T1E1"); | ||
104 | break; | ||
105 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): | ||
106 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): | ||
107 | seq_puts(m, "wanPMC-C1T1E1"); | ||
108 | break; | ||
109 | |||
110 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): | ||
111 | seq_puts(m, "wanPCI-C4T1E1"); | ||
112 | break; | ||
113 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): | ||
114 | seq_puts(m, "wanPCI-C2T1E1"); | ||
115 | break; | ||
116 | case SBE_BOARD_ID(PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): | ||
117 | seq_puts(m, "wanPCI-C1T1E1"); | ||
118 | break; | ||
119 | |||
120 | default: | ||
121 | seq_puts(m, "unknown"); | ||
122 | break; | ||
123 | } | ||
124 | |||
125 | seq_printf(m, " [%08X]\n", bip->brd_id); | ||
126 | |||
127 | seq_printf(m, "Board Number: %d\n", bip->brdno); | ||
128 | seq_printf(m, "Hardware ID: 0x%02X\n", ci->hdw_bid); | ||
129 | seq_printf(m, "Board SN: %06X\n", bip->brd_sn); | ||
130 | seq_printf(m, "Board MAC: %pMF\n", bip->brd_mac_addr); | ||
131 | seq_printf(m, "Ports: %d\n", ci->max_port); | ||
132 | seq_printf(m, "Channels: %d\n", bip->brd_chan_cnt); | ||
149 | #if 1 | 133 | #if 1 |
150 | len += sprintf (buffer + len, "Interface: %s -> %s\n", | 134 | seq_printf(m, "Interface: %s -> %s\n", |
151 | (char *) &bip->first_iname, (char *) &bip->last_iname); | 135 | bip->first_iname, bip->last_iname); |
152 | #else | 136 | #else |
153 | len += sprintf (buffer + len, "Interface: <not available> 1st %p lst %p\n", | 137 | seq_printf(m, "Interface: <not available> 1st %p lst %p\n", |
154 | (char *) &bip->first_iname, (char *) &bip->last_iname); | 138 | bip->first_iname, bip->last_iname); |
155 | #endif | 139 | #endif |
156 | 140 | ||
157 | switch (bip->brd_pci_speed) | 141 | switch (bip->brd_pci_speed) { |
158 | { | 142 | case BINFO_PCI_SPEED_33: |
159 | case BINFO_PCI_SPEED_33: | 143 | spd = "33Mhz"; |
160 | spd = "33Mhz"; | 144 | break; |
161 | break; | 145 | case BINFO_PCI_SPEED_66: |
162 | case BINFO_PCI_SPEED_66: | 146 | spd = "66Mhz"; |
163 | spd = "66Mhz"; | 147 | break; |
164 | break; | 148 | default: |
165 | default: | 149 | spd = "<not available>"; |
166 | spd = "<not available>"; | 150 | break; |
167 | break; | 151 | } |
168 | } | 152 | seq_printf(m, "PCI Bus Speed: %s\n", spd); |
169 | len += sprintf (buffer + len, "PCI Bus Speed: %s\n", spd); | 153 | seq_printf(m, "Release: %s\n", ci->release); |
170 | len += sprintf (buffer + len, "Release: %s\n", ci->release); | ||
171 | 154 | ||
172 | #ifdef SBE_PMCC4_ENABLE | 155 | #ifdef SBE_PMCC4_ENABLE |
173 | { | 156 | { |
174 | extern int cxt1e1_max_mru; | 157 | extern int cxt1e1_max_mru; |
175 | #if 0 | ||
176 | extern int max_chans_used; | ||
177 | extern int cxt1e1_max_mtu; | ||
178 | #endif | ||
179 | extern int max_rxdesc_used, max_txdesc_used; | ||
180 | |||
181 | len += sprintf (buffer + len, "\ncxt1e1_max_mru: %d\n", cxt1e1_max_mru); | ||
182 | #if 0 | 158 | #if 0 |
183 | len += sprintf (buffer + len, "\nmax_chans_used: %d\n", max_chans_used); | 159 | extern int max_chans_used; |
184 | len += sprintf (buffer + len, "cxt1e1_max_mtu: %d\n", cxt1e1_max_mtu); | 160 | extern int cxt1e1_max_mtu; |
185 | #endif | ||
186 | len += sprintf (buffer + len, "max_rxdesc_used: %d\n", max_rxdesc_used); | ||
187 | len += sprintf (buffer + len, "max_txdesc_used: %d\n", max_txdesc_used); | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | OS_kfree (bip); /* cleanup */ | ||
192 | |||
193 | /*** | ||
194 | * How to be a proc read function | ||
195 | * ------------------------------ | ||
196 | * Prototype: | ||
197 | * int f(char *buffer, char **start, off_t offset, | ||
198 | * int count, int *peof, void *dat) | ||
199 | * | ||
200 | * Assume that the buffer is "count" bytes in size. | ||
201 | * | ||
202 | * If you know you have supplied all the data you | ||
203 | * have, set *peof. | ||
204 | * | ||
205 | * You have three ways to return data: | ||
206 | * 0) Leave *start = NULL. (This is the default.) | ||
207 | * Put the data of the requested offset at that | ||
208 | * offset within the buffer. Return the number (n) | ||
209 | * of bytes there are from the beginning of the | ||
210 | * buffer up to the last byte of data. If the | ||
211 | * number of supplied bytes (= n - offset) is | ||
212 | * greater than zero and you didn't signal eof | ||
213 | * and the reader is prepared to take more data | ||
214 | * you will be called again with the requested | ||
215 | * offset advanced by the number of bytes | ||
216 | * absorbed. This interface is useful for files | ||
217 | * no larger than the buffer. | ||
218 | * 1) Set *start = an unsigned long value less than | ||
219 | * the buffer address but greater than zero. | ||
220 | * Put the data of the requested offset at the | ||
221 | * beginning of the buffer. Return the number of | ||
222 | * bytes of data placed there. If this number is | ||
223 | * greater than zero and you didn't signal eof | ||
224 | * and the reader is prepared to take more data | ||
225 | * you will be called again with the requested | ||
226 | * offset advanced by *start. This interface is | ||
227 | * useful when you have a large file consisting | ||
228 | * of a series of blocks which you want to count | ||
229 | * and return as wholes. | ||
230 | * (Hack by Paul.Russell@rustcorp.com.au) | ||
231 | * 2) Set *start = an address within the buffer. | ||
232 | * Put the data of the requested offset at *start. | ||
233 | * Return the number of bytes of data placed there. | ||
234 | * If this number is greater than zero and you | ||
235 | * didn't signal eof and the reader is prepared to | ||
236 | * take more data you will be called again with the | ||
237 | * requested offset advanced by the number of bytes | ||
238 | * absorbed. | ||
239 | */ | ||
240 | |||
241 | #if 1 | ||
242 | /* #4 - interpretation of above = set EOF, return len */ | ||
243 | *eof = 1; | ||
244 | #endif | 161 | #endif |
162 | extern int max_rxdesc_used, max_txdesc_used; | ||
245 | 163 | ||
164 | seq_printf(m, "\ncxt1e1_max_mru: %d\n", cxt1e1_max_mru); | ||
246 | #if 0 | 165 | #if 0 |
247 | /* | 166 | seq_printf(m, "\nmax_chans_used: %d\n", max_chans_used); |
248 | * #1 - from net/wireless/atmel.c RLD NOTE -there's something wrong with | 167 | seq_printf(m, "cxt1e1_max_mtu: %d\n", cxt1e1_max_mtu); |
249 | * this plagarized code which results in this routine being called TWICE. | ||
250 | * The second call returns ZERO, resulting in hidden failure, but at | ||
251 | * least only a single message set is being displayed. | ||
252 | */ | ||
253 | if (len <= offset + length) | ||
254 | *eof = 1; | ||
255 | *start = buffer + offset; | ||
256 | len -= offset; | ||
257 | if (len > length) | ||
258 | len = length; | ||
259 | if (len < 0) | ||
260 | len = 0; | ||
261 | #endif | ||
262 | |||
263 | #if 0 /* #2 from net/tokenring/olympic.c + | ||
264 | * lanstreamer.c */ | ||
265 | { | ||
266 | off_t begin = 0; | ||
267 | int size = 0; | ||
268 | off_t pos = 0; | ||
269 | |||
270 | size = len; | ||
271 | pos = begin + size; | ||
272 | if (pos < offset) | ||
273 | { | ||
274 | len = 0; | ||
275 | begin = pos; | ||
276 | } | ||
277 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
278 | len -= (offset - begin); /* Start slop */ | ||
279 | if (len > length) | ||
280 | len = length; /* Ending slop */ | ||
281 | } | ||
282 | #endif | 168 | #endif |
283 | 169 | seq_printf(m, "max_rxdesc_used: %d\n", max_rxdesc_used); | |
284 | #if 0 /* #3 from | 170 | seq_printf(m, "max_txdesc_used: %d\n", max_txdesc_used); |
285 | * char/ftape/lowlevel/ftape-proc.c */ | 171 | } |
286 | len = strlen (buffer); | ||
287 | *start = NULL; | ||
288 | if (offset + length >= len) | ||
289 | *eof = 1; | ||
290 | else | ||
291 | *eof = 0; | ||
292 | #endif | ||
293 | |||
294 | #if 0 | ||
295 | pr_info(">> proc_fs: returned len = %d., start %p\n", len, start); /* RLD DEBUG */ | ||
296 | #endif | 172 | #endif |
297 | 173 | ||
298 | /*** | 174 | kfree(bip); |
299 | using NONE: returns = 314.314.314. | ||
300 | using #1 : returns = 314, 0. | ||
301 | using #2 : returns = 314, 0, 0. | ||
302 | using #3 : returns = 314, 314. | ||
303 | using #4 : returns = 314, 314. | ||
304 | ***/ | ||
305 | 175 | ||
306 | return len; | 176 | pr_devel(">> proc_fs: finished\n"); |
177 | return 0; | ||
307 | } | 178 | } |
308 | 179 | ||
309 | /* initialize the /proc subsystem for the specific SBE driver */ | 180 | /* |
310 | 181 | * seq_file wrappers for procfile show routines. | |
311 | int __init | 182 | */ |
312 | sbecom_proc_brd_init (ci_t * ci) | 183 | static int sbecom_proc_open(struct inode *inode, struct file *file) |
313 | { | 184 | { |
314 | struct proc_dir_entry *e; | 185 | return single_open(file, sbecom_proc_get_sbe_info, PDE_DATA(inode)); |
315 | char dir[7 + SBE_IFACETMPL_SIZE + 1]; | ||
316 | |||
317 | /* create a directory in the root procfs */ | ||
318 | snprintf(dir, sizeof(dir), "driver/%s", ci->devname); | ||
319 | ci->dir_dev = proc_mkdir(dir, NULL); | ||
320 | if (!ci->dir_dev) | ||
321 | { | ||
322 | pr_err("Unable to create directory /proc/driver/%s\n", ci->devname); | ||
323 | goto fail; | ||
324 | } | ||
325 | e = create_proc_read_entry ("info", S_IFREG | S_IRUGO, | ||
326 | ci->dir_dev, sbecom_proc_get_sbe_info, ci); | ||
327 | if (!e) | ||
328 | { | ||
329 | pr_err("Unable to create entry /proc/driver/%s/info\n", ci->devname); | ||
330 | goto fail; | ||
331 | } | ||
332 | return 0; | ||
333 | |||
334 | fail: | ||
335 | sbecom_proc_brd_cleanup (ci); | ||
336 | return 1; | ||
337 | } | 186 | } |
338 | 187 | ||
339 | #else /*** ! CONFIG_PROC_FS ***/ | 188 | static const struct file_operations sbecom_proc_fops = { |
189 | .open = sbecom_proc_open, | ||
190 | .read = seq_read, | ||
191 | .llseek = seq_lseek, | ||
192 | .release = seq_release, | ||
193 | }; | ||
340 | 194 | ||
341 | /* stubbed off dummy routines */ | 195 | /* |
342 | 196 | * Initialize the /proc subsystem for the specific SBE driver | |
343 | void | 197 | */ |
344 | sbecom_proc_brd_cleanup (ci_t * ci) | 198 | int __init sbecom_proc_brd_init(ci_t *ci) |
345 | { | ||
346 | } | ||
347 | |||
348 | int __init | ||
349 | sbecom_proc_brd_init (ci_t * ci) | ||
350 | { | 199 | { |
351 | return 0; | 200 | char dir[7 + SBE_IFACETMPL_SIZE + 1]; |
352 | } | ||
353 | |||
354 | #endif /*** CONFIG_PROC_FS ***/ | ||
355 | 201 | ||
202 | snprintf(dir, sizeof(dir), "driver/%s", ci->devname); | ||
203 | ci->dir_dev = proc_mkdir(dir, NULL); | ||
204 | if (!ci->dir_dev) { | ||
205 | pr_err("Unable to create directory /proc/driver/%s\n", ci->devname); | ||
206 | goto fail; | ||
207 | } | ||
208 | |||
209 | if (!proc_create_data("info", S_IFREG | S_IRUGO, ci->dir_dev, | ||
210 | &sbecom_proc_fops, ci)) { | ||
211 | pr_err("Unable to create entry /proc/driver/%s/info\n", ci->devname); | ||
212 | goto fail; | ||
213 | } | ||
214 | return 0; | ||
356 | 215 | ||
357 | /*** End-of-File ***/ | 216 | fail: |
217 | sbecom_proc_brd_cleanup(ci); | ||
218 | return 1; | ||
219 | } | ||
diff --git a/drivers/staging/cxt1e1/sbeproc.h b/drivers/staging/cxt1e1/sbeproc.h index e82be6afd1e8..e5c072cf1952 100644 --- a/drivers/staging/cxt1e1/sbeproc.h +++ b/drivers/staging/cxt1e1/sbeproc.h | |||
@@ -23,10 +23,20 @@ | |||
23 | 23 | ||
24 | 24 | ||
25 | #ifdef CONFIG_PROC_FS | 25 | #ifdef CONFIG_PROC_FS |
26 | #ifdef __KERNEL__ | ||
27 | void sbecom_proc_brd_cleanup (ci_t *); | 26 | void sbecom_proc_brd_cleanup (ci_t *); |
28 | int __init sbecom_proc_brd_init (ci_t *); | 27 | int __init sbecom_proc_brd_init (ci_t *); |
29 | 28 | ||
30 | #endif /*** __KERNEL__ ***/ | 29 | #else |
30 | |||
31 | static inline void sbecom_proc_brd_cleanup(ci_t * ci) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | static inline int __init sbecom_proc_brd_init(ci_t * ci) | ||
36 | { | ||
37 | return 0; | ||
38 | } | ||
39 | |||
31 | #endif /*** CONFIG_PROC_FS ***/ | 40 | #endif /*** CONFIG_PROC_FS ***/ |
41 | |||
32 | #endif /*** _INC_SBEPROC_H_ ***/ | 42 | #endif /*** _INC_SBEPROC_H_ ***/ |
diff --git a/drivers/staging/dgrp/dgrp_common.c b/drivers/staging/dgrp/dgrp_common.c index 3553998b72bc..9a9b45624ba9 100644 --- a/drivers/staging/dgrp/dgrp_common.c +++ b/drivers/staging/dgrp/dgrp_common.c | |||
@@ -167,34 +167,3 @@ void dgrp_carrier(struct ch_struct *ch) | |||
167 | ch->ch_flag &= ~CH_PHYS_CD; | 167 | ch->ch_flag &= ~CH_PHYS_CD; |
168 | 168 | ||
169 | } | 169 | } |
170 | |||
171 | /** | ||
172 | * dgrp_chk_perm() -- check permissions for net device | ||
173 | * @inode: pointer to inode structure for the net communication device | ||
174 | * @op: operation to be tested | ||
175 | * | ||
176 | * The file permissions and ownerships are tested to determine whether | ||
177 | * the operation "op" is permitted on the file pointed to by the inode. | ||
178 | * Returns 0 if the operation is permitted, -EACCESS otherwise | ||
179 | */ | ||
180 | int dgrp_chk_perm(int mode, int op) | ||
181 | { | ||
182 | if (!uid_eq(GLOBAL_ROOT_UID, current_euid())) | ||
183 | mode >>= 6; | ||
184 | else if (in_egroup_p(GLOBAL_ROOT_GID)) | ||
185 | mode >>= 3; | ||
186 | |||
187 | if ((mode & op & 0007) == op) | ||
188 | return 0; | ||
189 | |||
190 | if (capable(CAP_SYS_ADMIN)) | ||
191 | return 0; | ||
192 | |||
193 | return -EACCES; | ||
194 | } | ||
195 | |||
196 | /* dgrp_chk_perm wrapper for permission call in struct inode_operations */ | ||
197 | int dgrp_inode_permission(struct inode *inode, int op) | ||
198 | { | ||
199 | return dgrp_chk_perm(inode->i_mode, op); | ||
200 | } | ||
diff --git a/drivers/staging/dgrp/dgrp_common.h b/drivers/staging/dgrp/dgrp_common.h index 2832b8e26c4b..23aba6c4d22c 100644 --- a/drivers/staging/dgrp/dgrp_common.h +++ b/drivers/staging/dgrp/dgrp_common.h | |||
@@ -49,20 +49,20 @@ extern struct dgrp_poll_data dgrp_poll_data; | |||
49 | extern void dgrp_poll_handler(unsigned long arg); | 49 | extern void dgrp_poll_handler(unsigned long arg); |
50 | 50 | ||
51 | /* from dgrp_mon_ops.c */ | 51 | /* from dgrp_mon_ops.c */ |
52 | extern void dgrp_register_mon_hook(struct proc_dir_entry *de); | 52 | extern const struct file_operations dgrp_mon_ops; |
53 | 53 | ||
54 | /* from dgrp_tty.c */ | 54 | /* from dgrp_tty.c */ |
55 | extern int dgrp_tty_init(struct nd_struct *nd); | 55 | extern int dgrp_tty_init(struct nd_struct *nd); |
56 | extern void dgrp_tty_uninit(struct nd_struct *nd); | 56 | extern void dgrp_tty_uninit(struct nd_struct *nd); |
57 | 57 | ||
58 | /* from dgrp_ports_ops.c */ | 58 | /* from dgrp_ports_ops.c */ |
59 | extern void dgrp_register_ports_hook(struct proc_dir_entry *de); | 59 | extern const struct file_operations dgrp_ports_ops; |
60 | 60 | ||
61 | /* from dgrp_net_ops.c */ | 61 | /* from dgrp_net_ops.c */ |
62 | extern void dgrp_register_net_hook(struct proc_dir_entry *de); | 62 | extern const struct file_operations dgrp_net_ops; |
63 | 63 | ||
64 | /* from dgrp_dpa_ops.c */ | 64 | /* from dgrp_dpa_ops.c */ |
65 | extern void dgrp_register_dpa_hook(struct proc_dir_entry *de); | 65 | extern const struct file_operations dgrp_dpa_ops; |
66 | extern void dgrp_dpa_data(struct nd_struct *, int, u8 *, int); | 66 | extern void dgrp_dpa_data(struct nd_struct *, int, u8 *, int); |
67 | 67 | ||
68 | /* from dgrp_sysfs.c */ | 68 | /* from dgrp_sysfs.c */ |
@@ -76,61 +76,6 @@ extern void dgrp_create_tty_sysfs(struct un_struct *un, struct device *c); | |||
76 | extern void dgrp_remove_tty_sysfs(struct device *c); | 76 | extern void dgrp_remove_tty_sysfs(struct device *c); |
77 | 77 | ||
78 | /* from dgrp_specproc.c */ | 78 | /* from dgrp_specproc.c */ |
79 | /* | ||
80 | * The list of DGRP entries with r/w capabilities. These | ||
81 | * magic numbers are used for identification purposes. | ||
82 | */ | ||
83 | enum { | ||
84 | DGRP_CONFIG = 1, /* Configure portservers */ | ||
85 | DGRP_NETDIR = 2, /* Directory for "net" devices */ | ||
86 | DGRP_MONDIR = 3, /* Directory for "mon" devices */ | ||
87 | DGRP_PORTSDIR = 4, /* Directory for "ports" devices */ | ||
88 | DGRP_INFO = 5, /* Get info. about the running module */ | ||
89 | DGRP_NODEINFO = 6, /* Get info. about the configured nodes */ | ||
90 | DGRP_DPADIR = 7, /* Directory for the "dpa" devices */ | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * Directions for proc handlers | ||
95 | */ | ||
96 | enum { | ||
97 | INBOUND = 1, /* Data being written to kernel */ | ||
98 | OUTBOUND = 2, /* Data being read from the kernel */ | ||
99 | }; | ||
100 | |||
101 | /** | ||
102 | * dgrp_proc_entry: structure for dgrp proc dirs | ||
103 | * @id: ID number associated with this particular entry. Should be | ||
104 | * unique across all of DGRP. | ||
105 | * @name: text name associated with the /proc entry | ||
106 | * @mode: file access permisssions for the /proc entry | ||
107 | * @child: pointer to table describing a subdirectory for this entry | ||
108 | * @de: pointer to directory entry for this object once registered. Used | ||
109 | * to grab the handle of the object for unregistration | ||
110 | * @excl_sem: semaphore to provide exclusive to struct | ||
111 | * @excl_cnt: counter of current accesses | ||
112 | * | ||
113 | * Each entry in a DGRP proc directory is described with a | ||
114 | * dgrp_proc_entry structure. A collection of these | ||
115 | * entries (in an array) represents the members associated | ||
116 | * with a particular /proc directory, and is referred to | ||
117 | * as a table. All tables are terminated by an entry with | ||
118 | * zeros for every member. | ||
119 | */ | ||
120 | struct dgrp_proc_entry { | ||
121 | int id; /* Integer identifier */ | ||
122 | const char *name; /* ASCII identifier */ | ||
123 | mode_t mode; /* File access permissions */ | ||
124 | struct dgrp_proc_entry *child; /* Child pointer */ | ||
125 | |||
126 | /* file ops to use, pass NULL to use default */ | ||
127 | struct file_operations *proc_file_ops; | ||
128 | |||
129 | struct proc_dir_entry *de; /* proc entry pointer */ | ||
130 | struct semaphore excl_sem; /* Protects exclusive access var */ | ||
131 | int excl_cnt; /* Counts number of curr accesses */ | ||
132 | }; | ||
133 | |||
134 | extern void dgrp_unregister_proc(void); | 79 | extern void dgrp_unregister_proc(void); |
135 | extern void dgrp_register_proc(void); | 80 | extern void dgrp_register_proc(void); |
136 | 81 | ||
@@ -144,8 +89,6 @@ extern void dgrp_register_proc(void); | |||
144 | *-----------------------------------------------------------------------*/ | 89 | *-----------------------------------------------------------------------*/ |
145 | 90 | ||
146 | void dgrp_carrier(struct ch_struct *ch); | 91 | void dgrp_carrier(struct ch_struct *ch); |
147 | extern int dgrp_inode_permission(struct inode *inode, int op); | ||
148 | extern int dgrp_chk_perm(int mode, int op); | ||
149 | 92 | ||
150 | 93 | ||
151 | /* | 94 | /* |
diff --git a/drivers/staging/dgrp/dgrp_dpa_ops.c b/drivers/staging/dgrp/dgrp_dpa_ops.c index ca10a3362e29..114799cddd85 100644 --- a/drivers/staging/dgrp/dgrp_dpa_ops.c +++ b/drivers/staging/dgrp/dgrp_dpa_ops.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/cred.h> | 40 | #include <linux/cred.h> |
41 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
42 | #include <linux/ratelimit.h> | 42 | #include <linux/ratelimit.h> |
43 | #include <linux/slab.h> | ||
43 | #include <asm/unaligned.h> | 44 | #include <asm/unaligned.h> |
44 | 45 | ||
45 | #include "dgrp_common.h" | 46 | #include "dgrp_common.h" |
@@ -52,7 +53,7 @@ static long dgrp_dpa_ioctl(struct file *file, unsigned int cmd, | |||
52 | unsigned long arg); | 53 | unsigned long arg); |
53 | static unsigned int dgrp_dpa_select(struct file *, struct poll_table_struct *); | 54 | static unsigned int dgrp_dpa_select(struct file *, struct poll_table_struct *); |
54 | 55 | ||
55 | static const struct file_operations dpa_ops = { | 56 | const struct file_operations dgrp_dpa_ops = { |
56 | .owner = THIS_MODULE, | 57 | .owner = THIS_MODULE, |
57 | .read = dgrp_dpa_read, | 58 | .read = dgrp_dpa_read, |
58 | .poll = dgrp_dpa_select, | 59 | .poll = dgrp_dpa_select, |
@@ -61,12 +62,6 @@ static const struct file_operations dpa_ops = { | |||
61 | .release = dgrp_dpa_release, | 62 | .release = dgrp_dpa_release, |
62 | }; | 63 | }; |
63 | 64 | ||
64 | static struct inode_operations dpa_inode_ops = { | ||
65 | .permission = dgrp_inode_permission | ||
66 | }; | ||
67 | |||
68 | |||
69 | |||
70 | struct digi_node { | 65 | struct digi_node { |
71 | uint nd_state; /* Node state: 1 = up, 0 = down. */ | 66 | uint nd_state; /* Node state: 1 = up, 0 = down. */ |
72 | uint nd_chan_count; /* Number of channels found */ | 67 | uint nd_chan_count; /* Number of channels found */ |
@@ -111,17 +106,6 @@ struct digi_debug { | |||
111 | #define DIGI_SETDEBUG (('d'<<8) | 247) /* set debug info */ | 106 | #define DIGI_SETDEBUG (('d'<<8) | 247) /* set debug info */ |
112 | 107 | ||
113 | 108 | ||
114 | void dgrp_register_dpa_hook(struct proc_dir_entry *de) | ||
115 | { | ||
116 | struct nd_struct *node = de->data; | ||
117 | |||
118 | de->proc_iops = &dpa_inode_ops; | ||
119 | rcu_assign_pointer(de->proc_fops, &dpa_ops); | ||
120 | |||
121 | node->nd_dpa_de = de; | ||
122 | spin_lock_init(&node->nd_dpa_lock); | ||
123 | } | ||
124 | |||
125 | /* | 109 | /* |
126 | * dgrp_dpa_open -- open the DPA device for a particular PortServer | 110 | * dgrp_dpa_open -- open the DPA device for a particular PortServer |
127 | */ | 111 | */ |
@@ -130,8 +114,6 @@ static int dgrp_dpa_open(struct inode *inode, struct file *file) | |||
130 | struct nd_struct *nd; | 114 | struct nd_struct *nd; |
131 | int rtn = 0; | 115 | int rtn = 0; |
132 | 116 | ||
133 | struct proc_dir_entry *de; | ||
134 | |||
135 | rtn = try_module_get(THIS_MODULE); | 117 | rtn = try_module_get(THIS_MODULE); |
136 | if (!rtn) | 118 | if (!rtn) |
137 | return -ENXIO; | 119 | return -ENXIO; |
@@ -154,12 +136,7 @@ static int dgrp_dpa_open(struct inode *inode, struct file *file) | |||
154 | /* | 136 | /* |
155 | * Get the node pointer, and fail if it doesn't exist. | 137 | * Get the node pointer, and fail if it doesn't exist. |
156 | */ | 138 | */ |
157 | de = PDE(inode); | 139 | nd = PDE_DATA(inode); |
158 | if (!de) { | ||
159 | rtn = -ENXIO; | ||
160 | goto done; | ||
161 | } | ||
162 | nd = (struct nd_struct *)de->data; | ||
163 | if (!nd) { | 140 | if (!nd) { |
164 | rtn = -ENXIO; | 141 | rtn = -ENXIO; |
165 | goto done; | 142 | goto done; |
diff --git a/drivers/staging/dgrp/dgrp_mon_ops.c b/drivers/staging/dgrp/dgrp_mon_ops.c index b484fccb494e..d18be4180e3b 100644 --- a/drivers/staging/dgrp/dgrp_mon_ops.c +++ b/drivers/staging/dgrp/dgrp_mon_ops.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/tty.h> | 37 | #include <linux/tty.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
40 | #include <linux/slab.h> | ||
40 | #include <linux/proc_fs.h> | 41 | #include <linux/proc_fs.h> |
41 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
42 | 43 | ||
@@ -49,7 +50,7 @@ static ssize_t dgrp_mon_read(struct file *, char __user *, size_t, loff_t *); | |||
49 | static long dgrp_mon_ioctl(struct file *file, unsigned int cmd, | 50 | static long dgrp_mon_ioctl(struct file *file, unsigned int cmd, |
50 | unsigned long arg); | 51 | unsigned long arg); |
51 | 52 | ||
52 | static const struct file_operations mon_ops = { | 53 | const struct file_operations dgrp_mon_ops = { |
53 | .owner = THIS_MODULE, | 54 | .owner = THIS_MODULE, |
54 | .read = dgrp_mon_read, | 55 | .read = dgrp_mon_read, |
55 | .unlocked_ioctl = dgrp_mon_ioctl, | 56 | .unlocked_ioctl = dgrp_mon_ioctl, |
@@ -57,20 +58,6 @@ static const struct file_operations mon_ops = { | |||
57 | .release = dgrp_mon_release, | 58 | .release = dgrp_mon_release, |
58 | }; | 59 | }; |
59 | 60 | ||
60 | static struct inode_operations mon_inode_ops = { | ||
61 | .permission = dgrp_inode_permission | ||
62 | }; | ||
63 | |||
64 | void dgrp_register_mon_hook(struct proc_dir_entry *de) | ||
65 | { | ||
66 | struct nd_struct *node = de->data; | ||
67 | |||
68 | de->proc_iops = &mon_inode_ops; | ||
69 | rcu_assign_pointer(de->proc_fops, &mon_ops); | ||
70 | node->nd_mon_de = de; | ||
71 | sema_init(&node->nd_mon_semaphore, 1); | ||
72 | } | ||
73 | |||
74 | /** | 61 | /** |
75 | * dgrp_mon_open() -- open /proc/dgrp/ports device for a PortServer | 62 | * dgrp_mon_open() -- open /proc/dgrp/ports device for a PortServer |
76 | * @inode: struct inode * | 63 | * @inode: struct inode * |
@@ -81,7 +68,6 @@ void dgrp_register_mon_hook(struct proc_dir_entry *de) | |||
81 | static int dgrp_mon_open(struct inode *inode, struct file *file) | 68 | static int dgrp_mon_open(struct inode *inode, struct file *file) |
82 | { | 69 | { |
83 | struct nd_struct *nd; | 70 | struct nd_struct *nd; |
84 | struct proc_dir_entry *de; | ||
85 | struct timeval tv; | 71 | struct timeval tv; |
86 | uint32_t time; | 72 | uint32_t time; |
87 | u8 *buf; | 73 | u8 *buf; |
@@ -109,13 +95,7 @@ static int dgrp_mon_open(struct inode *inode, struct file *file) | |||
109 | /* | 95 | /* |
110 | * Get the node pointer, and fail if it doesn't exist. | 96 | * Get the node pointer, and fail if it doesn't exist. |
111 | */ | 97 | */ |
112 | de = PDE(inode); | 98 | nd = PDE_DATA(inode); |
113 | if (!de) { | ||
114 | rtn = -ENXIO; | ||
115 | goto done; | ||
116 | } | ||
117 | |||
118 | nd = (struct nd_struct *)de->data; | ||
119 | if (!nd) { | 99 | if (!nd) { |
120 | rtn = -ENXIO; | 100 | rtn = -ENXIO; |
121 | goto done; | 101 | goto done; |
diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c index 64f48ffb9d4e..5b7833f593ff 100644 --- a/drivers/staging/dgrp/dgrp_net_ops.c +++ b/drivers/staging/dgrp/dgrp_net_ops.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/proc_fs.h> | 37 | #include <linux/proc_fs.h> |
38 | #include <linux/types.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/string.h> | 39 | #include <linux/string.h> |
40 | #include <linux/device.h> | 40 | #include <linux/device.h> |
41 | #include <linux/tty.h> | 41 | #include <linux/tty.h> |
@@ -72,7 +72,7 @@ static long dgrp_net_ioctl(struct file *file, unsigned int cmd, | |||
72 | static unsigned int dgrp_net_select(struct file *file, | 72 | static unsigned int dgrp_net_select(struct file *file, |
73 | struct poll_table_struct *table); | 73 | struct poll_table_struct *table); |
74 | 74 | ||
75 | static const struct file_operations net_ops = { | 75 | const struct file_operations dgrp_net_ops = { |
76 | .owner = THIS_MODULE, | 76 | .owner = THIS_MODULE, |
77 | .read = dgrp_net_read, | 77 | .read = dgrp_net_read, |
78 | .write = dgrp_net_write, | 78 | .write = dgrp_net_write, |
@@ -82,23 +82,6 @@ static const struct file_operations net_ops = { | |||
82 | .release = dgrp_net_release, | 82 | .release = dgrp_net_release, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct inode_operations net_inode_ops = { | ||
86 | .permission = dgrp_inode_permission | ||
87 | }; | ||
88 | |||
89 | void dgrp_register_net_hook(struct proc_dir_entry *de) | ||
90 | { | ||
91 | struct nd_struct *node = de->data; | ||
92 | |||
93 | de->proc_iops = &net_inode_ops; | ||
94 | rcu_assign_pointer(de->proc_fops, &net_ops); | ||
95 | node->nd_net_de = de; | ||
96 | sema_init(&node->nd_net_semaphore, 1); | ||
97 | node->nd_state = NS_CLOSED; | ||
98 | dgrp_create_node_class_sysfs_files(node); | ||
99 | } | ||
100 | |||
101 | |||
102 | /** | 85 | /** |
103 | * dgrp_dump() -- prints memory for debugging purposes. | 86 | * dgrp_dump() -- prints memory for debugging purposes. |
104 | * @mem: Memory location which should be printed to the console | 87 | * @mem: Memory location which should be printed to the console |
@@ -801,7 +784,6 @@ out_err: | |||
801 | static int dgrp_net_open(struct inode *inode, struct file *file) | 784 | static int dgrp_net_open(struct inode *inode, struct file *file) |
802 | { | 785 | { |
803 | struct nd_struct *nd; | 786 | struct nd_struct *nd; |
804 | struct proc_dir_entry *de; | ||
805 | ulong lock_flags; | 787 | ulong lock_flags; |
806 | int rtn; | 788 | int rtn; |
807 | 789 | ||
@@ -825,13 +807,7 @@ static int dgrp_net_open(struct inode *inode, struct file *file) | |||
825 | /* | 807 | /* |
826 | * Get the node pointer, and fail if it doesn't exist. | 808 | * Get the node pointer, and fail if it doesn't exist. |
827 | */ | 809 | */ |
828 | de = PDE(inode); | 810 | nd = PDE_DATA(inode); |
829 | if (!de) { | ||
830 | rtn = -ENXIO; | ||
831 | goto done; | ||
832 | } | ||
833 | |||
834 | nd = (struct nd_struct *) de->data; | ||
835 | if (!nd) { | 811 | if (!nd) { |
836 | rtn = -ENXIO; | 812 | rtn = -ENXIO; |
837 | goto done; | 813 | goto done; |
diff --git a/drivers/staging/dgrp/dgrp_ports_ops.c b/drivers/staging/dgrp/dgrp_ports_ops.c index f93dc1f262f5..4ce030815f27 100644 --- a/drivers/staging/dgrp/dgrp_ports_ops.c +++ b/drivers/staging/dgrp/dgrp_ports_ops.c | |||
@@ -47,7 +47,7 @@ | |||
47 | /* File operation declarations */ | 47 | /* File operation declarations */ |
48 | static int dgrp_ports_open(struct inode *, struct file *); | 48 | static int dgrp_ports_open(struct inode *, struct file *); |
49 | 49 | ||
50 | static const struct file_operations ports_ops = { | 50 | const struct file_operations dgrp_ports_ops = { |
51 | .owner = THIS_MODULE, | 51 | .owner = THIS_MODULE, |
52 | .open = dgrp_ports_open, | 52 | .open = dgrp_ports_open, |
53 | .read = seq_read, | 53 | .read = seq_read, |
@@ -55,20 +55,6 @@ static const struct file_operations ports_ops = { | |||
55 | .release = seq_release | 55 | .release = seq_release |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static struct inode_operations ports_inode_ops = { | ||
59 | .permission = dgrp_inode_permission | ||
60 | }; | ||
61 | |||
62 | |||
63 | void dgrp_register_ports_hook(struct proc_dir_entry *de) | ||
64 | { | ||
65 | struct nd_struct *node = de->data; | ||
66 | |||
67 | de->proc_iops = &ports_inode_ops; | ||
68 | rcu_assign_pointer(de->proc_fops, &ports_ops); | ||
69 | node->nd_ports_de = de; | ||
70 | } | ||
71 | |||
72 | static void *dgrp_ports_seq_start(struct seq_file *seq, loff_t *pos) | 58 | static void *dgrp_ports_seq_start(struct seq_file *seq, loff_t *pos) |
73 | { | 59 | { |
74 | if (*pos == 0) | 60 | if (*pos == 0) |
@@ -163,7 +149,7 @@ static int dgrp_ports_open(struct inode *inode, struct file *file) | |||
163 | rtn = seq_open(file, &ports_seq_ops); | 149 | rtn = seq_open(file, &ports_seq_ops); |
164 | if (!rtn) { | 150 | if (!rtn) { |
165 | seq = file->private_data; | 151 | seq = file->private_data; |
166 | seq->private = PDE(inode)->data; | 152 | seq->private = PDE_DATA(inode); |
167 | } | 153 | } |
168 | 154 | ||
169 | return rtn; | 155 | return rtn; |
diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c index d66712c8aa94..205d80ef4455 100644 --- a/drivers/staging/dgrp/dgrp_specproc.c +++ b/drivers/staging/dgrp/dgrp_specproc.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/cred.h> | 38 | #include <linux/cred.h> |
39 | #include <linux/proc_fs.h> | 39 | #include <linux/proc_fs.h> |
40 | #include <linux/slab.h> | ||
40 | #include <linux/ctype.h> | 41 | #include <linux/ctype.h> |
41 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
42 | #include <linux/uaccess.h> | 43 | #include <linux/uaccess.h> |
@@ -44,43 +45,17 @@ | |||
44 | 45 | ||
45 | #include "dgrp_common.h" | 46 | #include "dgrp_common.h" |
46 | 47 | ||
47 | static struct dgrp_proc_entry dgrp_table[]; | ||
48 | static struct proc_dir_entry *dgrp_proc_dir_entry; | 48 | static struct proc_dir_entry *dgrp_proc_dir_entry; |
49 | 49 | ||
50 | static int dgrp_add_id(long id); | 50 | static int dgrp_add_id(long id); |
51 | static int dgrp_remove_nd(struct nd_struct *nd); | 51 | static int dgrp_remove_nd(struct nd_struct *nd); |
52 | static void unregister_dgrp_device(struct proc_dir_entry *de); | 52 | static struct proc_dir_entry *add_proc_file(struct nd_struct *node, |
53 | static void register_dgrp_device(struct nd_struct *node, | ||
54 | struct proc_dir_entry *root, | 53 | struct proc_dir_entry *root, |
55 | void (*register_hook)(struct proc_dir_entry *de)); | 54 | const struct file_operations *fops); |
56 | 55 | ||
57 | /* File operation declarations */ | 56 | /* File operation declarations */ |
58 | static int dgrp_gen_proc_open(struct inode *, struct file *); | ||
59 | static int dgrp_gen_proc_close(struct inode *, struct file *); | ||
60 | static int parse_write_config(char *); | 57 | static int parse_write_config(char *); |
61 | 58 | ||
62 | |||
63 | static const struct file_operations dgrp_proc_file_ops = { | ||
64 | .owner = THIS_MODULE, | ||
65 | .open = dgrp_gen_proc_open, | ||
66 | .release = dgrp_gen_proc_close, | ||
67 | }; | ||
68 | |||
69 | static struct inode_operations proc_inode_ops = { | ||
70 | .permission = dgrp_inode_permission | ||
71 | }; | ||
72 | |||
73 | |||
74 | static void register_proc_table(struct dgrp_proc_entry *, | ||
75 | struct proc_dir_entry *); | ||
76 | static void unregister_proc_table(struct dgrp_proc_entry *, | ||
77 | struct proc_dir_entry *); | ||
78 | |||
79 | static struct dgrp_proc_entry dgrp_net_table[]; | ||
80 | static struct dgrp_proc_entry dgrp_mon_table[]; | ||
81 | static struct dgrp_proc_entry dgrp_ports_table[]; | ||
82 | static struct dgrp_proc_entry dgrp_dpa_table[]; | ||
83 | |||
84 | static ssize_t dgrp_config_proc_write(struct file *file, | 59 | static ssize_t dgrp_config_proc_write(struct file *file, |
85 | const char __user *buffer, | 60 | const char __user *buffer, |
86 | size_t count, loff_t *pos); | 61 | size_t count, loff_t *pos); |
@@ -89,7 +64,7 @@ static int dgrp_nodeinfo_proc_open(struct inode *inode, struct file *file); | |||
89 | static int dgrp_info_proc_open(struct inode *inode, struct file *file); | 64 | static int dgrp_info_proc_open(struct inode *inode, struct file *file); |
90 | static int dgrp_config_proc_open(struct inode *inode, struct file *file); | 65 | static int dgrp_config_proc_open(struct inode *inode, struct file *file); |
91 | 66 | ||
92 | static struct file_operations config_proc_file_ops = { | 67 | static const struct file_operations config_proc_file_ops = { |
93 | .owner = THIS_MODULE, | 68 | .owner = THIS_MODULE, |
94 | .open = dgrp_config_proc_open, | 69 | .open = dgrp_config_proc_open, |
95 | .read = seq_read, | 70 | .read = seq_read, |
@@ -98,7 +73,7 @@ static struct file_operations config_proc_file_ops = { | |||
98 | .write = dgrp_config_proc_write, | 73 | .write = dgrp_config_proc_write, |
99 | }; | 74 | }; |
100 | 75 | ||
101 | static struct file_operations info_proc_file_ops = { | 76 | static const struct file_operations info_proc_file_ops = { |
102 | .owner = THIS_MODULE, | 77 | .owner = THIS_MODULE, |
103 | .open = dgrp_info_proc_open, | 78 | .open = dgrp_info_proc_open, |
104 | .read = seq_read, | 79 | .read = seq_read, |
@@ -106,7 +81,7 @@ static struct file_operations info_proc_file_ops = { | |||
106 | .release = single_release, | 81 | .release = single_release, |
107 | }; | 82 | }; |
108 | 83 | ||
109 | static struct file_operations nodeinfo_proc_file_ops = { | 84 | static const struct file_operations nodeinfo_proc_file_ops = { |
110 | .owner = THIS_MODULE, | 85 | .owner = THIS_MODULE, |
111 | .open = dgrp_nodeinfo_proc_open, | 86 | .open = dgrp_nodeinfo_proc_open, |
112 | .read = seq_read, | 87 | .read = seq_read, |
@@ -114,71 +89,25 @@ static struct file_operations nodeinfo_proc_file_ops = { | |||
114 | .release = seq_release, | 89 | .release = seq_release, |
115 | }; | 90 | }; |
116 | 91 | ||
117 | static struct dgrp_proc_entry dgrp_table[] = { | ||
118 | { | ||
119 | .id = DGRP_CONFIG, | ||
120 | .name = "config", | ||
121 | .mode = 0644, | ||
122 | .proc_file_ops = &config_proc_file_ops, | ||
123 | }, | ||
124 | { | ||
125 | .id = DGRP_INFO, | ||
126 | .name = "info", | ||
127 | .mode = 0644, | ||
128 | .proc_file_ops = &info_proc_file_ops, | ||
129 | }, | ||
130 | { | ||
131 | .id = DGRP_NODEINFO, | ||
132 | .name = "nodeinfo", | ||
133 | .mode = 0644, | ||
134 | .proc_file_ops = &nodeinfo_proc_file_ops, | ||
135 | }, | ||
136 | { | ||
137 | .id = DGRP_NETDIR, | ||
138 | .name = "net", | ||
139 | .mode = 0500, | ||
140 | .child = dgrp_net_table | ||
141 | }, | ||
142 | { | ||
143 | .id = DGRP_MONDIR, | ||
144 | .name = "mon", | ||
145 | .mode = 0500, | ||
146 | .child = dgrp_mon_table | ||
147 | }, | ||
148 | { | ||
149 | .id = DGRP_PORTSDIR, | ||
150 | .name = "ports", | ||
151 | .mode = 0500, | ||
152 | .child = dgrp_ports_table | ||
153 | }, | ||
154 | { | ||
155 | .id = DGRP_DPADIR, | ||
156 | .name = "dpa", | ||
157 | .mode = 0500, | ||
158 | .child = dgrp_dpa_table | ||
159 | } | ||
160 | }; | ||
161 | |||
162 | static struct proc_dir_entry *net_entry_pointer; | 92 | static struct proc_dir_entry *net_entry_pointer; |
163 | static struct proc_dir_entry *mon_entry_pointer; | 93 | static struct proc_dir_entry *mon_entry_pointer; |
164 | static struct proc_dir_entry *dpa_entry_pointer; | 94 | static struct proc_dir_entry *dpa_entry_pointer; |
165 | static struct proc_dir_entry *ports_entry_pointer; | 95 | static struct proc_dir_entry *ports_entry_pointer; |
166 | 96 | ||
167 | static struct dgrp_proc_entry dgrp_net_table[] = { | 97 | static void remove_files(struct nd_struct *nd) |
168 | {0} | 98 | { |
169 | }; | 99 | char buf[3]; |
170 | 100 | ID_TO_CHAR(nd->nd_ID, buf); | |
171 | static struct dgrp_proc_entry dgrp_mon_table[] = { | 101 | dgrp_remove_node_class_sysfs_files(nd); |
172 | {0} | 102 | if (nd->nd_net_de) |
173 | }; | 103 | remove_proc_entry(buf, net_entry_pointer); |
174 | 104 | if (nd->nd_mon_de) | |
175 | static struct dgrp_proc_entry dgrp_ports_table[] = { | 105 | remove_proc_entry(buf, mon_entry_pointer); |
176 | {0} | 106 | if (nd->nd_dpa_de) |
177 | }; | 107 | remove_proc_entry(buf, dpa_entry_pointer); |
178 | 108 | if (nd->nd_ports_de) | |
179 | static struct dgrp_proc_entry dgrp_dpa_table[] = { | 109 | remove_proc_entry(buf, ports_entry_pointer); |
180 | {0} | 110 | } |
181 | }; | ||
182 | 111 | ||
183 | void dgrp_unregister_proc(void) | 112 | void dgrp_unregister_proc(void) |
184 | { | 113 | { |
@@ -188,12 +117,19 @@ void dgrp_unregister_proc(void) | |||
188 | ports_entry_pointer = NULL; | 117 | ports_entry_pointer = NULL; |
189 | 118 | ||
190 | if (dgrp_proc_dir_entry) { | 119 | if (dgrp_proc_dir_entry) { |
191 | unregister_proc_table(dgrp_table, dgrp_proc_dir_entry); | 120 | struct nd_struct *nd; |
192 | remove_proc_entry(dgrp_proc_dir_entry->name, | 121 | list_for_each_entry(nd, &nd_struct_list, list) |
193 | dgrp_proc_dir_entry->parent); | 122 | remove_files(nd); |
123 | remove_proc_entry("dgrp/config", NULL); | ||
124 | remove_proc_entry("dgrp/info", NULL); | ||
125 | remove_proc_entry("dgrp/nodeinfo", NULL); | ||
126 | remove_proc_entry("dgrp/net", NULL); | ||
127 | remove_proc_entry("dgrp/mon", NULL); | ||
128 | remove_proc_entry("dgrp/dpa", NULL); | ||
129 | remove_proc_entry("dgrp/ports", NULL); | ||
130 | remove_proc_entry("dgrp", NULL); | ||
194 | dgrp_proc_dir_entry = NULL; | 131 | dgrp_proc_dir_entry = NULL; |
195 | } | 132 | } |
196 | |||
197 | } | 133 | } |
198 | 134 | ||
199 | void dgrp_register_proc(void) | 135 | void dgrp_register_proc(void) |
@@ -201,211 +137,16 @@ void dgrp_register_proc(void) | |||
201 | /* | 137 | /* |
202 | * Register /proc/dgrp | 138 | * Register /proc/dgrp |
203 | */ | 139 | */ |
204 | dgrp_proc_dir_entry = proc_create("dgrp", S_IFDIR, NULL, | 140 | dgrp_proc_dir_entry = proc_mkdir("dgrp", NULL); |
205 | &dgrp_proc_file_ops); | 141 | if (!dgrp_proc_dir_entry) |
206 | register_proc_table(dgrp_table, dgrp_proc_dir_entry); | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * /proc/sys support | ||
211 | */ | ||
212 | static int dgrp_proc_match(int len, const char *name, struct proc_dir_entry *de) | ||
213 | { | ||
214 | if (!de || !de->low_ino) | ||
215 | return 0; | ||
216 | if (de->namelen != len) | ||
217 | return 0; | ||
218 | return !memcmp(name, de->name, len); | ||
219 | } | ||
220 | |||
221 | |||
222 | /* | ||
223 | * Scan the entries in table and add them all to /proc at the position | ||
224 | * referred to by "root" | ||
225 | */ | ||
226 | static void register_proc_table(struct dgrp_proc_entry *table, | ||
227 | struct proc_dir_entry *root) | ||
228 | { | ||
229 | struct proc_dir_entry *de; | ||
230 | int len; | ||
231 | mode_t mode; | ||
232 | |||
233 | if (table == NULL) | ||
234 | return; | 142 | return; |
235 | if (root == NULL) | 143 | proc_create("dgrp/config", 0644, NULL, &config_proc_file_ops); |
236 | return; | 144 | proc_create("dgrp/info", 0644, NULL, &info_proc_file_ops); |
237 | 145 | proc_create("dgrp/nodeinfo", 0644, NULL, &nodeinfo_proc_file_ops); | |
238 | for (; table->id; table++) { | 146 | net_entry_pointer = proc_mkdir_mode("dgrp/net", 0500, NULL); |
239 | /* Can't do anything without a proc name. */ | 147 | mon_entry_pointer = proc_mkdir_mode("dgrp/mon", 0500, NULL); |
240 | if (!table->name) | 148 | dpa_entry_pointer = proc_mkdir_mode("dgrp/dpa", 0500, NULL); |
241 | continue; | 149 | ports_entry_pointer = proc_mkdir_mode("dgrp/ports", 0500, NULL); |
242 | |||
243 | /* Maybe we can't do anything with it... */ | ||
244 | if (!table->proc_file_ops && | ||
245 | !table->child) { | ||
246 | pr_warn("dgrp: Can't register %s\n", | ||
247 | table->name); | ||
248 | continue; | ||
249 | } | ||
250 | |||
251 | len = strlen(table->name); | ||
252 | mode = table->mode; | ||
253 | |||
254 | de = NULL; | ||
255 | if (!table->child) | ||
256 | mode |= S_IFREG; | ||
257 | else { | ||
258 | mode |= S_IFDIR; | ||
259 | for (de = root->subdir; de; de = de->next) { | ||
260 | if (dgrp_proc_match(len, table->name, de)) | ||
261 | break; | ||
262 | } | ||
263 | /* If the subdir exists already, de is non-NULL */ | ||
264 | } | ||
265 | |||
266 | if (!de) { | ||
267 | de = create_proc_entry(table->name, mode, root); | ||
268 | if (!de) | ||
269 | continue; | ||
270 | de->data = (void *) table; | ||
271 | if (!table->child) { | ||
272 | de->proc_iops = &proc_inode_ops; | ||
273 | if (table->proc_file_ops) | ||
274 | rcu_assign_pointer(de->proc_fops, | ||
275 | table->proc_file_ops); | ||
276 | else | ||
277 | rcu_assign_pointer(de->proc_fops, | ||
278 | &dgrp_proc_file_ops); | ||
279 | } | ||
280 | } | ||
281 | table->de = de; | ||
282 | if (de->mode & S_IFDIR) | ||
283 | register_proc_table(table->child, de); | ||
284 | |||
285 | if (table->id == DGRP_NETDIR) | ||
286 | net_entry_pointer = de; | ||
287 | |||
288 | if (table->id == DGRP_MONDIR) | ||
289 | mon_entry_pointer = de; | ||
290 | |||
291 | if (table->id == DGRP_DPADIR) | ||
292 | dpa_entry_pointer = de; | ||
293 | |||
294 | if (table->id == DGRP_PORTSDIR) | ||
295 | ports_entry_pointer = de; | ||
296 | } | ||
297 | } | ||
298 | |||
299 | /* | ||
300 | * Unregister a /proc sysctl table and any subdirectories. | ||
301 | */ | ||
302 | static void unregister_proc_table(struct dgrp_proc_entry *table, | ||
303 | struct proc_dir_entry *root) | ||
304 | { | ||
305 | struct proc_dir_entry *de; | ||
306 | struct nd_struct *tmp; | ||
307 | |||
308 | if (table == NULL) | ||
309 | return; | ||
310 | |||
311 | list_for_each_entry(tmp, &nd_struct_list, list) { | ||
312 | if ((table == dgrp_net_table) && (tmp->nd_net_de)) { | ||
313 | unregister_dgrp_device(tmp->nd_net_de); | ||
314 | dgrp_remove_node_class_sysfs_files(tmp); | ||
315 | } | ||
316 | |||
317 | if ((table == dgrp_mon_table) && (tmp->nd_mon_de)) | ||
318 | unregister_dgrp_device(tmp->nd_mon_de); | ||
319 | |||
320 | if ((table == dgrp_dpa_table) && (tmp->nd_dpa_de)) | ||
321 | unregister_dgrp_device(tmp->nd_dpa_de); | ||
322 | |||
323 | if ((table == dgrp_ports_table) && (tmp->nd_ports_de)) | ||
324 | unregister_dgrp_device(tmp->nd_ports_de); | ||
325 | } | ||
326 | |||
327 | for (; table->id; table++) { | ||
328 | de = table->de; | ||
329 | |||
330 | if (!de) | ||
331 | continue; | ||
332 | if (de->mode & S_IFDIR) { | ||
333 | if (!table->child) { | ||
334 | pr_alert("dgrp: malformed sysctl tree on free\n"); | ||
335 | continue; | ||
336 | } | ||
337 | unregister_proc_table(table->child, de); | ||
338 | |||
339 | /* Don't unregister directories which still have entries */ | ||
340 | if (de->subdir) | ||
341 | continue; | ||
342 | } | ||
343 | |||
344 | /* Don't unregister proc entries that are still being used.. */ | ||
345 | if ((atomic_read(&de->count)) != 1) { | ||
346 | pr_alert("proc entry %s in use, not removing\n", | ||
347 | de->name); | ||
348 | continue; | ||
349 | } | ||
350 | |||
351 | remove_proc_entry(de->name, de->parent); | ||
352 | table->de = NULL; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | static int dgrp_gen_proc_open(struct inode *inode, struct file *file) | ||
357 | { | ||
358 | struct proc_dir_entry *de; | ||
359 | struct dgrp_proc_entry *entry; | ||
360 | int ret = 0; | ||
361 | |||
362 | de = (struct proc_dir_entry *) PDE(file_inode(file)); | ||
363 | if (!de || !de->data) { | ||
364 | ret = -ENXIO; | ||
365 | goto done; | ||
366 | } | ||
367 | |||
368 | entry = (struct dgrp_proc_entry *) de->data; | ||
369 | if (!entry) { | ||
370 | ret = -ENXIO; | ||
371 | goto done; | ||
372 | } | ||
373 | |||
374 | down(&entry->excl_sem); | ||
375 | |||
376 | if (entry->excl_cnt) | ||
377 | ret = -EBUSY; | ||
378 | else | ||
379 | entry->excl_cnt++; | ||
380 | |||
381 | up(&entry->excl_sem); | ||
382 | |||
383 | done: | ||
384 | return ret; | ||
385 | } | ||
386 | |||
387 | static int dgrp_gen_proc_close(struct inode *inode, struct file *file) | ||
388 | { | ||
389 | struct proc_dir_entry *de; | ||
390 | struct dgrp_proc_entry *entry; | ||
391 | |||
392 | de = (struct proc_dir_entry *) PDE(file_inode(file)); | ||
393 | if (!de || !de->data) | ||
394 | goto done; | ||
395 | |||
396 | entry = (struct dgrp_proc_entry *) de->data; | ||
397 | if (!entry) | ||
398 | goto done; | ||
399 | |||
400 | down(&entry->excl_sem); | ||
401 | |||
402 | if (entry->excl_cnt) | ||
403 | entry->excl_cnt = 0; | ||
404 | |||
405 | up(&entry->excl_sem); | ||
406 | |||
407 | done: | ||
408 | return 0; | ||
409 | } | 150 | } |
410 | 151 | ||
411 | static void *dgrp_config_proc_start(struct seq_file *m, loff_t *pos) | 152 | static void *dgrp_config_proc_start(struct seq_file *m, loff_t *pos) |
@@ -736,6 +477,10 @@ static int dgrp_add_id(long id) | |||
736 | init_waitqueue_head(&nd->nd_tx_waitq); | 477 | init_waitqueue_head(&nd->nd_tx_waitq); |
737 | init_waitqueue_head(&nd->nd_mon_wqueue); | 478 | init_waitqueue_head(&nd->nd_mon_wqueue); |
738 | init_waitqueue_head(&nd->nd_dpa_wqueue); | 479 | init_waitqueue_head(&nd->nd_dpa_wqueue); |
480 | sema_init(&nd->nd_mon_semaphore, 1); | ||
481 | sema_init(&nd->nd_net_semaphore, 1); | ||
482 | spin_lock_init(&nd->nd_dpa_lock); | ||
483 | nd->nd_state = NS_CLOSED; | ||
739 | for (i = 0; i < SEQ_MAX; i++) | 484 | for (i = 0; i < SEQ_MAX; i++) |
740 | init_waitqueue_head(&nd->nd_seq_wque[i]); | 485 | init_waitqueue_head(&nd->nd_seq_wque[i]); |
741 | 486 | ||
@@ -750,12 +495,12 @@ static int dgrp_add_id(long id) | |||
750 | if (ret) | 495 | if (ret) |
751 | goto error_out; | 496 | goto error_out; |
752 | 497 | ||
753 | register_dgrp_device(nd, net_entry_pointer, dgrp_register_net_hook); | 498 | dgrp_create_node_class_sysfs_files(nd); |
754 | register_dgrp_device(nd, mon_entry_pointer, dgrp_register_mon_hook); | 499 | nd->nd_net_de = add_proc_file(nd, net_entry_pointer, &dgrp_net_ops); |
755 | register_dgrp_device(nd, dpa_entry_pointer, dgrp_register_dpa_hook); | 500 | nd->nd_mon_de = add_proc_file(nd, mon_entry_pointer, &dgrp_mon_ops); |
756 | register_dgrp_device(nd, ports_entry_pointer, | 501 | nd->nd_dpa_de = add_proc_file(nd, dpa_entry_pointer, &dgrp_dpa_ops); |
757 | dgrp_register_ports_hook); | 502 | nd->nd_ports_de = add_proc_file(nd, ports_entry_pointer, |
758 | 503 | &dgrp_ports_ops); | |
759 | return 0; | 504 | return 0; |
760 | 505 | ||
761 | /* FIXME this guy should free the tty driver stored in nd and destroy | 506 | /* FIXME this guy should free the tty driver stored in nd and destroy |
@@ -774,16 +519,7 @@ static int dgrp_remove_nd(struct nd_struct *nd) | |||
774 | if (nd->nd_tty_ref_cnt) | 519 | if (nd->nd_tty_ref_cnt) |
775 | return -EBUSY; | 520 | return -EBUSY; |
776 | 521 | ||
777 | if (nd->nd_net_de) { | 522 | remove_files(nd); |
778 | unregister_dgrp_device(nd->nd_net_de); | ||
779 | dgrp_remove_node_class_sysfs_files(nd); | ||
780 | } | ||
781 | |||
782 | unregister_dgrp_device(nd->nd_mon_de); | ||
783 | |||
784 | unregister_dgrp_device(nd->nd_ports_de); | ||
785 | |||
786 | unregister_dgrp_device(nd->nd_dpa_de); | ||
787 | 523 | ||
788 | dgrp_tty_uninit(nd); | 524 | dgrp_tty_uninit(nd); |
789 | 525 | ||
@@ -795,38 +531,11 @@ static int dgrp_remove_nd(struct nd_struct *nd) | |||
795 | return 0; | 531 | return 0; |
796 | } | 532 | } |
797 | 533 | ||
798 | static void register_dgrp_device(struct nd_struct *node, | 534 | static struct proc_dir_entry *add_proc_file(struct nd_struct *node, |
799 | struct proc_dir_entry *root, | 535 | struct proc_dir_entry *root, |
800 | void (*register_hook)(struct proc_dir_entry *de)) | 536 | const struct file_operations *fops) |
801 | { | 537 | { |
802 | char buf[3]; | 538 | char buf[3]; |
803 | struct proc_dir_entry *de; | ||
804 | |||
805 | ID_TO_CHAR(node->nd_ID, buf); | 539 | ID_TO_CHAR(node->nd_ID, buf); |
806 | 540 | return proc_create_data(buf, 0600, root, fops, node); | |
807 | de = create_proc_entry(buf, 0600 | S_IFREG, root); | ||
808 | if (!de) | ||
809 | return; | ||
810 | |||
811 | de->data = (void *) node; | ||
812 | |||
813 | if (register_hook) | ||
814 | register_hook(de); | ||
815 | |||
816 | } | ||
817 | |||
818 | static void unregister_dgrp_device(struct proc_dir_entry *de) | ||
819 | { | ||
820 | if (!de) | ||
821 | return; | ||
822 | |||
823 | /* Don't unregister proc entries that are still being used.. */ | ||
824 | if ((atomic_read(&de->count)) != 1) { | ||
825 | pr_alert("%s - proc entry %s in use. Not removing.\n", | ||
826 | __func__, de->name); | ||
827 | return; | ||
828 | } | ||
829 | |||
830 | remove_proc_entry(de->name, de->parent); | ||
831 | de = NULL; | ||
832 | } | 541 | } |
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 5337b415d450..21b369e0150f 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/seq_file.h> | ||
22 | #include <linux/string.h> | 23 | #include <linux/string.h> |
23 | #include <linux/vmalloc.h> | 24 | #include <linux/vmalloc.h> |
24 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
@@ -29,70 +30,55 @@ | |||
29 | #define FT1000_PROC "ft1000" | 30 | #define FT1000_PROC "ft1000" |
30 | #define MAX_FILE_LEN 255 | 31 | #define MAX_FILE_LEN 255 |
31 | 32 | ||
32 | #define PUTM_TO_PAGE(len, page, args...) \ | 33 | #define seq_putx(m, message, size, var) \ |
33 | len += snprintf(page+len, PAGE_SIZE - len, args) | 34 | seq_printf(m, message); \ |
34 | |||
35 | #define PUTX_TO_PAGE(len, page, message, size, var) \ | ||
36 | len += snprintf(page+len, PAGE_SIZE - len, message); \ | ||
37 | for(i = 0; i < (size - 1); i++) { \ | 35 | for(i = 0; i < (size - 1); i++) { \ |
38 | len += snprintf(page+len, PAGE_SIZE - len, "%02x:", var[i]); \ | 36 | seq_printf(m, "%02x:", var[i]); \ |
39 | } \ | 37 | } \ |
40 | len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i]) | 38 | seq_printf(m, "%02x\n", var[i]) |
41 | 39 | ||
42 | #define PUTD_TO_PAGE(len, page, message, size, var) \ | 40 | #define seq_putd(m, message, size, var) \ |
43 | len += snprintf(page+len, PAGE_SIZE - len, message); \ | 41 | seq_printf(m, message); \ |
44 | for(i = 0; i < (size - 1); i++) { \ | 42 | for(i = 0; i < (size - 1); i++) { \ |
45 | len += snprintf(page+len, PAGE_SIZE - len, "%d.", var[i]); \ | 43 | seq_printf(m, "%d.", var[i]); \ |
46 | } \ | 44 | } \ |
47 | len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i]) | 45 | seq_printf(m, "%d\n", var[i]) |
48 | 46 | ||
49 | static int ft1000ReadProc(char *page, char **start, off_t off, | 47 | static int ft1000ReadProc(struct seq_file *m, void *v) |
50 | int count, int *eof, void *data) | ||
51 | { | 48 | { |
52 | struct net_device *dev; | 49 | static const char *status[] = { |
53 | int len; | ||
54 | int i; | ||
55 | struct ft1000_info *info; | ||
56 | char *status[] = { | ||
57 | "Idle (Disconnect)", "Searching", "Active (Connected)", | 50 | "Idle (Disconnect)", "Searching", "Active (Connected)", |
58 | "Waiting for L2", "Sleep", "No Coverage", "", "" | 51 | "Waiting for L2", "Sleep", "No Coverage", "", "" |
59 | }; | 52 | }; |
60 | char *signal[] = { "", "*", "**", "***", "****" }; | 53 | static const char *signal[] = { "", "*", "**", "***", "****" }; |
54 | |||
55 | struct net_device *dev = m->private; | ||
56 | struct ft1000_info *info = netdev_priv(dev); | ||
57 | int i; | ||
61 | int strength; | 58 | int strength; |
62 | int quality; | 59 | int quality; |
63 | struct timeval tv; | 60 | struct timeval tv; |
64 | time_t delta; | 61 | time_t delta; |
65 | 62 | ||
66 | dev = (struct net_device *)data; | ||
67 | info = netdev_priv(dev); | ||
68 | |||
69 | if (off > 0) { | ||
70 | *eof = 1; | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | /* Wrap-around */ | ||
75 | |||
76 | if (info->AsicID == ELECTRABUZZ_ID) { | 63 | if (info->AsicID == ELECTRABUZZ_ID) { |
77 | if (info->ProgConStat != 0xFF) { | 64 | if (info->ProgConStat != 0xFF) { |
78 | info->LedStat = | 65 | info->LedStat = |
79 | ft1000_read_dpram(dev, FT1000_DSP_LED); | 66 | ft1000_read_dpram(dev, FT1000_DSP_LED); |
80 | info->ConStat = | 67 | info->ConStat = |
81 | ft1000_read_dpram(dev, | 68 | ft1000_read_dpram(dev, FT1000_DSP_CON_STATE); |
82 | FT1000_DSP_CON_STATE); | ||
83 | } else { | 69 | } else { |
84 | info->ConStat = 0xf; | 70 | info->ConStat = 0xf; |
85 | } | 71 | } |
86 | } else { | 72 | } else { |
87 | if (info->ProgConStat != 0xFF) { | 73 | if (info->ProgConStat != 0xFF) { |
88 | info->LedStat = | 74 | info->LedStat = |
89 | ntohs(ft1000_read_dpram_mag_16 | 75 | ntohs(ft1000_read_dpram_mag_16( |
90 | (dev, FT1000_MAG_DSP_LED, | 76 | dev, FT1000_MAG_DSP_LED, |
91 | FT1000_MAG_DSP_LED_INDX)); | 77 | FT1000_MAG_DSP_LED_INDX)); |
92 | info->ConStat = | 78 | info->ConStat = |
93 | ntohs(ft1000_read_dpram_mag_16 | 79 | ntohs(ft1000_read_dpram_mag_16( |
94 | (dev, FT1000_MAG_DSP_CON_STATE, | 80 | dev, FT1000_MAG_DSP_CON_STATE, |
95 | FT1000_MAG_DSP_CON_STATE_INDX)); | 81 | FT1000_MAG_DSP_CON_STATE_INDX)); |
96 | } else { | 82 | } else { |
97 | info->ConStat = 0xf; | 83 | info->ConStat = 0xf; |
98 | } | 84 | } |
@@ -135,36 +121,46 @@ static int ft1000ReadProc(char *page, char **start, off_t off, | |||
135 | } | 121 | } |
136 | 122 | ||
137 | do_gettimeofday(&tv); | 123 | do_gettimeofday(&tv); |
138 | delta = (tv.tv_sec - info->ConTm); | 124 | delta = tv.tv_sec - info->ConTm; |
139 | len = 0; | 125 | seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n", |
140 | PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n", | ||
141 | ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); | 126 | ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); |
142 | PUTM_TO_PAGE(len, page, "Connection Time[s]: %ld\n", delta); | 127 | seq_printf(m, "Connection Time[s]: %ld\n", delta); |
143 | PUTM_TO_PAGE(len, page, "Asic ID: %s\n", | 128 | seq_printf(m, "Asic ID: %s\n", |
144 | (info->AsicID) == | 129 | info->AsicID == |
145 | ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); | 130 | ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); |
146 | PUTX_TO_PAGE(len, page, "SKU: ", SKUSZ, info->Sku); | 131 | seq_putx(m, "SKU: ", SKUSZ, info->Sku); |
147 | PUTX_TO_PAGE(len, page, "EUI64: ", EUISZ, info->eui64); | 132 | seq_putx(m, "EUI64: ", EUISZ, info->eui64); |
148 | PUTD_TO_PAGE(len, page, "DSP version number: ", DSPVERSZ, info->DspVer); | 133 | seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer); |
149 | PUTX_TO_PAGE(len, page, "Hardware Serial Number: ", HWSERNUMSZ, | 134 | seq_putx(m, "Hardware Serial Number: ", HWSERNUMSZ, info->HwSerNum); |
150 | info->HwSerNum); | 135 | seq_putx(m, "Caliberation Version: ", CALVERSZ, info->RfCalVer); |
151 | PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ, | 136 | seq_putd(m, "Caliberation Date: ", CALDATESZ, info->RfCalDate); |
152 | info->RfCalVer); | 137 | seq_printf(m, "Media State: %s\n", |
153 | PUTD_TO_PAGE(len, page, "Caliberation Date: ", CALDATESZ, | ||
154 | info->RfCalDate); | ||
155 | PUTM_TO_PAGE(len, page, "Media State: %s\n", | ||
156 | (info->mediastate) ? "link" : "no link"); | 138 | (info->mediastate) ? "link" : "no link"); |
157 | PUTM_TO_PAGE(len, page, "Connection Status: %s\n", | 139 | seq_printf(m, "Connection Status: %s\n", status[info->ConStat & 0x7]); |
158 | status[((info->ConStat) & 0x7)]); | 140 | seq_printf(m, "RX packets: %ld\n", info->stats.rx_packets); |
159 | PUTM_TO_PAGE(len, page, "RX packets: %ld\n", info->stats.rx_packets); | 141 | seq_printf(m, "TX packets: %ld\n", info->stats.tx_packets); |
160 | PUTM_TO_PAGE(len, page, "TX packets: %ld\n", info->stats.tx_packets); | 142 | seq_printf(m, "RX bytes: %ld\n", info->stats.rx_bytes); |
161 | PUTM_TO_PAGE(len, page, "RX bytes: %ld\n", info->stats.rx_bytes); | 143 | seq_printf(m, "TX bytes: %ld\n", info->stats.tx_bytes); |
162 | PUTM_TO_PAGE(len, page, "TX bytes: %ld\n", info->stats.tx_bytes); | 144 | seq_printf(m, "Signal Strength: %s\n", signal[strength]); |
163 | PUTM_TO_PAGE(len, page, "Signal Strength: %s\n", signal[strength]); | 145 | seq_printf(m, "Signal Quality: %s\n", signal[quality]); |
164 | PUTM_TO_PAGE(len, page, "Signal Quality: %s\n", signal[quality]); | 146 | return 0; |
165 | return len; | 147 | } |
148 | |||
149 | /* | ||
150 | * seq_file wrappers for procfile show routines. | ||
151 | */ | ||
152 | static int ft1000_proc_open(struct inode *inode, struct file *file) | ||
153 | { | ||
154 | return single_open(file, ft1000ReadProc, PDE_DATA(inode)); | ||
166 | } | 155 | } |
167 | 156 | ||
157 | static const struct file_operations ft1000_proc_fops = { | ||
158 | .open = ft1000_proc_open, | ||
159 | .read = seq_read, | ||
160 | .llseek = seq_lseek, | ||
161 | .release = seq_release, | ||
162 | }; | ||
163 | |||
168 | static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, | 164 | static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, |
169 | void *ptr) | 165 | void *ptr) |
170 | { | 166 | { |
@@ -176,8 +172,8 @@ static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, | |||
176 | switch (event) { | 172 | switch (event) { |
177 | case NETDEV_CHANGENAME: | 173 | case NETDEV_CHANGENAME: |
178 | remove_proc_entry(info->netdevname, info->ft1000_proc_dir); | 174 | remove_proc_entry(info->netdevname, info->ft1000_proc_dir); |
179 | create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir, | 175 | proc_create_data(dev->name, 0644, info->ft1000_proc_dir, |
180 | ft1000ReadProc, dev); | 176 | &ft1000_proc_fops, dev); |
181 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); | 177 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); |
182 | break; | 178 | break; |
183 | } | 179 | } |
@@ -195,8 +191,10 @@ void ft1000InitProc(struct net_device *dev) | |||
195 | info = netdev_priv(dev); | 191 | info = netdev_priv(dev); |
196 | 192 | ||
197 | info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net); | 193 | info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net); |
198 | create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir, | 194 | |
199 | ft1000ReadProc, dev); | 195 | proc_create_data(dev->name, 0644, info->ft1000_proc_dir, |
196 | &ft1000_proc_fops, dev); | ||
197 | |||
200 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); | 198 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); |
201 | register_netdevice_notifier(&ft1000_netdev_notifier); | 199 | register_netdevice_notifier(&ft1000_netdev_notifier); |
202 | } | 200 | } |
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c index 297389e8c608..3251d2e073b5 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | |||
@@ -55,7 +55,7 @@ int numofmsgbuf = 0; | |||
55 | // | 55 | // |
56 | // Table of entry-point routines for char device | 56 | // Table of entry-point routines for char device |
57 | // | 57 | // |
58 | static struct file_operations ft1000fops = | 58 | static const struct file_operations ft1000fops = |
59 | { | 59 | { |
60 | .unlocked_ioctl = ft1000_ioctl, | 60 | .unlocked_ioctl = ft1000_ioctl, |
61 | .poll = ft1000_poll_dev, | 61 | .poll = ft1000_poll_dev, |
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index b99640637fe0..d8294d6c9560 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_fs.h> |
25 | #include <linux/seq_file.h> | ||
25 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
26 | 27 | ||
27 | 28 | ||
@@ -30,22 +31,17 @@ | |||
30 | #define FT1000_PROC_DIR "ft1000" | 31 | #define FT1000_PROC_DIR "ft1000" |
31 | 32 | ||
32 | 33 | ||
33 | #define PUTM_TO_PAGE(len,page,args...) \ | 34 | #define seq_putx(m, message, size, var) \ |
34 | len += snprintf(page+len, PAGE_SIZE - len, args) | 35 | seq_printf(m, message); \ |
36 | for(i = 0; i < (size - 1); i++) \ | ||
37 | seq_printf(m, "%02x:", var[i]); \ | ||
38 | seq_printf(m, "%02x\n", var[i]) | ||
35 | 39 | ||
36 | #define PUTX_TO_PAGE(len,page,message,size,var) \ | 40 | #define seq_putd(m, message, size, var) \ |
37 | len += snprintf(page+len, PAGE_SIZE - len, message); \ | 41 | seq_printf(m, message); \ |
38 | for (i = 0; i < (size - 1); i++) {\ | 42 | for(i = 0; i < (size - 1); i++) \ |
39 | len += snprintf(page+len, PAGE_SIZE - len, "%02x:", var[i]); \ | 43 | seq_printf(m, "%d.", var[i]); \ |
40 | } \ | 44 | seq_printf(m, "%d\n", var[i]) |
41 | len += snprintf(page+len, PAGE_SIZE - len, "%02x\n", var[i]) | ||
42 | |||
43 | #define PUTD_TO_PAGE(len,page,message,size,var) \ | ||
44 | len += snprintf(page+len, PAGE_SIZE - len, message); \ | ||
45 | for (i = 0; i < (size - 1); i++) {\ | ||
46 | len += snprintf(page+len, PAGE_SIZE - len, "%d.", var[i]); \ | ||
47 | } \ | ||
48 | len += snprintf(page+len, PAGE_SIZE - len, "%d\n", var[i]) | ||
49 | 45 | ||
50 | 46 | ||
51 | #define FTNET_PROC init_net.proc_net | 47 | #define FTNET_PROC init_net.proc_net |
@@ -55,19 +51,9 @@ int ft1000_read_dpram16 (struct ft1000_usb *ft1000dev, u16 indx, | |||
55 | u8 *buffer, u8 highlow); | 51 | u8 *buffer, u8 highlow); |
56 | 52 | ||
57 | 53 | ||
58 | static int | 54 | static int ft1000ReadProc(struct seq_file *m, void *v) |
59 | ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, | ||
60 | void *data) | ||
61 | { | 55 | { |
62 | struct net_device *dev; | 56 | static const char *status[] = { |
63 | int len; | ||
64 | int i; | ||
65 | unsigned short ledStat; | ||
66 | unsigned short conStat; | ||
67 | |||
68 | struct ft1000_info *info; | ||
69 | |||
70 | char *status[] = { | ||
71 | "Idle (Disconnect)", | 57 | "Idle (Disconnect)", |
72 | "Searching", | 58 | "Searching", |
73 | "Active (Connected)", | 59 | "Active (Connected)", |
@@ -77,22 +63,18 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, | |||
77 | "", | 63 | "", |
78 | "", | 64 | "", |
79 | }; | 65 | }; |
66 | static const char *signal[] = { "", "*", "**", "***", "****" }; | ||
80 | 67 | ||
81 | char *signal[] = { "", "*", "**", "***", "****" }; | 68 | struct net_device *dev = m->private; |
69 | struct ft1000_info *info = netdev_priv(dev); | ||
70 | int i; | ||
71 | unsigned short ledStat; | ||
72 | unsigned short conStat; | ||
82 | int strength; | 73 | int strength; |
83 | int quality; | 74 | int quality; |
84 | struct timeval tv; | 75 | struct timeval tv; |
85 | time_t delta; | 76 | time_t delta; |
86 | 77 | ||
87 | dev = (struct net_device *) data; | ||
88 | info = netdev_priv(dev); | ||
89 | |||
90 | if (off > 0) { | ||
91 | *eof = 1; | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | |||
96 | if (info->ProgConStat != 0xFF) { | 78 | if (info->ProgConStat != 0xFF) { |
97 | ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED, | 79 | ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED, |
98 | (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); | 80 | (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX); |
@@ -144,36 +126,43 @@ ft1000ReadProc(char *page, char **start, off_t off, int count, int *eof, | |||
144 | quality = 0; | 126 | quality = 0; |
145 | } | 127 | } |
146 | 128 | ||
147 | len = 0; | 129 | seq_printf(m, "Connection Time: %02ld:%02ld:%02ld\n", |
148 | PUTM_TO_PAGE(len, page, "Connection Time: %02ld:%02ld:%02ld\n", | ||
149 | ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); | 130 | ((delta / 3600) % 24), ((delta / 60) % 60), (delta % 60)); |
150 | PUTM_TO_PAGE(len, page, "Connection Time[s]: %ld\n", delta); | 131 | seq_printf(m, "Connection Time[s]: %ld\n", delta); |
151 | PUTM_TO_PAGE(len, page, "Asic ID: %s\n", | 132 | seq_printf(m, "Asic ID: %s\n", |
152 | (info->AsicID) == | 133 | (info->AsicID) == ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); |
153 | ELECTRABUZZ_ID ? "ELECTRABUZZ ASIC" : "MAGNEMITE ASIC"); | 134 | seq_putx(m, "SKU: ", SKUSZ, info->Sku); |
154 | PUTX_TO_PAGE(len, page, "SKU: ", SKUSZ, info->Sku); | 135 | seq_putx(m, "EUI64: ", EUISZ, info->eui64); |
155 | PUTX_TO_PAGE(len, page, "EUI64: ", EUISZ, info->eui64); | 136 | seq_putd(m, "DSP version number: ", DSPVERSZ, info->DspVer); |
156 | PUTD_TO_PAGE(len, page, "DSP version number: ", DSPVERSZ, info->DspVer); | 137 | seq_putx(m, "Hardware Serial Number: ", HWSERNUMSZ, info->HwSerNum); |
157 | PUTX_TO_PAGE(len, page, "Hardware Serial Number: ", HWSERNUMSZ, | 138 | seq_putx(m, "Caliberation Version: ", CALVERSZ, info->RfCalVer); |
158 | info->HwSerNum); | 139 | seq_putd(m, "Caliberation Date: ", CALDATESZ, info->RfCalDate); |
159 | PUTX_TO_PAGE(len, page, "Caliberation Version: ", CALVERSZ, | 140 | seq_printf(m, "Media State: %s\n", (info->mediastate) ? "link" : "no link"); |
160 | info->RfCalVer); | 141 | seq_printf(m, "Connection Status: %s\n", status[info->ConStat & 0x7]); |
161 | PUTD_TO_PAGE(len, page, "Caliberation Date: ", CALDATESZ, | 142 | seq_printf(m, "RX packets: %ld\n", info->stats.rx_packets); |
162 | info->RfCalDate); | 143 | seq_printf(m, "TX packets: %ld\n", info->stats.tx_packets); |
163 | PUTM_TO_PAGE(len, page, "Media State: %s\n", | 144 | seq_printf(m, "RX bytes: %ld\n", info->stats.rx_bytes); |
164 | (info->mediastate) ? "link" : "no link"); | 145 | seq_printf(m, "TX bytes: %ld\n", info->stats.tx_bytes); |
165 | PUTM_TO_PAGE(len, page, "Connection Status: %s\n", | 146 | seq_printf(m, "Signal Strength: %s\n", signal[strength]); |
166 | status[((info->ConStat) & 0x7)]); | 147 | seq_printf(m, "Signal Quality: %s\n", signal[quality]); |
167 | PUTM_TO_PAGE(len, page, "RX packets: %ld\n", info->stats.rx_packets); | 148 | return 0; |
168 | PUTM_TO_PAGE(len, page, "TX packets: %ld\n", info->stats.tx_packets); | 149 | } |
169 | PUTM_TO_PAGE(len, page, "RX bytes: %ld\n", info->stats.rx_bytes); | 150 | |
170 | PUTM_TO_PAGE(len, page, "TX bytes: %ld\n", info->stats.tx_bytes); | 151 | /* |
171 | PUTM_TO_PAGE(len, page, "Signal Strength: %s\n", signal[strength]); | 152 | * seq_file wrappers for procfile show routines. |
172 | PUTM_TO_PAGE(len, page, "Signal Quality: %s\n", signal[quality]); | 153 | */ |
173 | 154 | static int ft1000_proc_open(struct inode *inode, struct file *file) | |
174 | return len; | 155 | { |
156 | return single_open(file, ft1000ReadProc, PDE_DATA(inode)); | ||
175 | } | 157 | } |
176 | 158 | ||
159 | static const struct file_operations ft1000_proc_fops = { | ||
160 | .open = ft1000_proc_open, | ||
161 | .read = seq_read, | ||
162 | .llseek = seq_lseek, | ||
163 | .release = seq_release, | ||
164 | }; | ||
165 | |||
177 | static int | 166 | static int |
178 | ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) | 167 | ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) |
179 | { | 168 | { |
@@ -186,9 +175,9 @@ ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) | |||
186 | switch (event) { | 175 | switch (event) { |
187 | case NETDEV_CHANGENAME: | 176 | case NETDEV_CHANGENAME: |
188 | remove_proc_entry(info->netdevname, info->ft1000_proc_dir); | 177 | remove_proc_entry(info->netdevname, info->ft1000_proc_dir); |
189 | ft1000_proc_file = create_proc_read_entry(dev->name, 0644, | 178 | ft1000_proc_file = |
190 | info->ft1000_proc_dir, | 179 | proc_create_data(dev->name, 0644, info->ft1000_proc_dir, |
191 | ft1000ReadProc, dev); | 180 | &ft1000_proc_fops, dev); |
192 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); | 181 | snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name); |
193 | break; | 182 | break; |
194 | } | 183 | } |
@@ -217,10 +206,10 @@ int ft1000_init_proc(struct net_device *dev) | |||
217 | } | 206 | } |
218 | 207 | ||
219 | ft1000_proc_file = | 208 | ft1000_proc_file = |
220 | create_proc_read_entry(dev->name, 0644, | 209 | proc_create_data(dev->name, 0644, info->ft1000_proc_dir, |
221 | info->ft1000_proc_dir, ft1000ReadProc, dev); | 210 | &ft1000_proc_fops, dev); |
222 | 211 | ||
223 | if (ft1000_proc_file == NULL) { | 212 | if (!ft1000_proc_file) { |
224 | printk(KERN_WARNING "Unable to create /proc entry.\n"); | 213 | printk(KERN_WARNING "Unable to create /proc entry.\n"); |
225 | goto fail_entry; | 214 | goto fail_entry; |
226 | } | 215 | } |
diff --git a/drivers/staging/keucr/scsiglue.c b/drivers/staging/keucr/scsiglue.c index 083b20e6253e..48e1005349da 100644 --- a/drivers/staging/keucr/scsiglue.c +++ b/drivers/staging/keucr/scsiglue.c | |||
@@ -229,26 +229,18 @@ void usb_stor_report_bus_reset(struct us_data *us) | |||
229 | 229 | ||
230 | /* we use this macro to help us write into the buffer */ | 230 | /* we use this macro to help us write into the buffer */ |
231 | #undef SPRINTF | 231 | #undef SPRINTF |
232 | #define SPRINTF(args...) \ | 232 | #define SPRINTF(args...) seq_printf(m, ##args) |
233 | do { \ | ||
234 | if (pos < buffer+length) \ | ||
235 | pos += sprintf(pos, ## args); \ | ||
236 | } while (0) | ||
237 | 233 | ||
238 | /* | 234 | static int write_info(struct Scsi_Host *host, char *buffer, int length) |
239 | * proc_info() | 235 | { |
240 | */ | 236 | return length; |
241 | static int proc_info(struct Scsi_Host *host, char *buffer, char **start, | 237 | } |
242 | off_t offset, int length, int inout) | 238 | |
239 | static int show_info(struct seq_file *m, struct Scsi_Host *host) | ||
243 | { | 240 | { |
244 | struct us_data *us = host_to_us(host); | 241 | struct us_data *us = host_to_us(host); |
245 | char *pos = buffer; | ||
246 | const char *string; | 242 | const char *string; |
247 | 243 | ||
248 | /* pr_info("scsiglue --- proc_info\n"); */ | ||
249 | if (inout) | ||
250 | return length; | ||
251 | |||
252 | /* print the controller name */ | 244 | /* print the controller name */ |
253 | SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); | 245 | SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); |
254 | 246 | ||
@@ -278,29 +270,17 @@ static int proc_info(struct Scsi_Host *host, char *buffer, char **start, | |||
278 | SPRINTF(" Transport: %s\n", us->transport_name); | 270 | SPRINTF(" Transport: %s\n", us->transport_name); |
279 | 271 | ||
280 | /* show the device flags */ | 272 | /* show the device flags */ |
281 | if (pos < buffer + length) { | 273 | SPRINTF(" Quirks:"); |
282 | pos += sprintf(pos, " Quirks:"); | ||
283 | 274 | ||
284 | #define US_FLAG(name, value) \ | 275 | #define US_FLAG(name, value) \ |
285 | do { \ | 276 | do { \ |
286 | if (us->fflags & value) \ | 277 | if (us->fflags & value) \ |
287 | pos += sprintf(pos, " " #name); \ | 278 | SPRINTF(" " #name); \ |
288 | } while (0); | 279 | } while (0); |
289 | US_DO_ALL_FLAGS | 280 | US_DO_ALL_FLAGS |
290 | #undef US_FLAG | 281 | #undef US_FLAG |
291 | 282 | seq_putc(m, '\n'); | |
292 | *(pos++) = '\n'; | 283 | return 0; |
293 | } | ||
294 | |||
295 | /* Calculate start of next buffer, and return value. */ | ||
296 | *start = buffer + offset; | ||
297 | |||
298 | if ((pos - buffer) < offset) | ||
299 | return 0; | ||
300 | else if ((pos - buffer - offset) < length) | ||
301 | return pos - buffer - offset; | ||
302 | else | ||
303 | return length; | ||
304 | } | 284 | } |
305 | 285 | ||
306 | /*********************************************************************** | 286 | /*********************************************************************** |
@@ -351,7 +331,8 @@ struct scsi_host_template usb_stor_host_template = { | |||
351 | /* basic userland interface stuff */ | 331 | /* basic userland interface stuff */ |
352 | .name = "eucr-storage", | 332 | .name = "eucr-storage", |
353 | .proc_name = "eucr-storage", | 333 | .proc_name = "eucr-storage", |
354 | .proc_info = proc_info, | 334 | .write_info = write_info, |
335 | .show_info = show_info, | ||
355 | .info = host_info, | 336 | .info = host_info, |
356 | 337 | ||
357 | /* command interface -- queued only */ | 338 | /* command interface -- queued only */ |
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h index 70ea4145b4c8..edacc8001640 100644 --- a/drivers/staging/rtl8187se/r8180.h +++ b/drivers/staging/rtl8187se/r8180.h | |||
@@ -372,7 +372,6 @@ typedef struct r8180_priv | |||
372 | struct Stats stats; | 372 | struct Stats stats; |
373 | struct _link_detect_t link_detect; //YJ,add,080828 | 373 | struct _link_detect_t link_detect; //YJ,add,080828 |
374 | struct iw_statistics wstats; | 374 | struct iw_statistics wstats; |
375 | struct proc_dir_entry *dir_dev; | ||
376 | 375 | ||
377 | /*RX stuff*/ | 376 | /*RX stuff*/ |
378 | u32 *rxring; | 377 | u32 *rxring; |
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c index d10d75e8a33f..f7c1d9905ec6 100644 --- a/drivers/staging/rtl8187se/r8180_core.c +++ b/drivers/staging/rtl8187se/r8180_core.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <linux/syscalls.h> | 36 | #include <linux/syscalls.h> |
37 | #include <linux/eeprom_93cx6.h> | 37 | #include <linux/eeprom_93cx6.h> |
38 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
39 | #include <linux/proc_fs.h> | ||
40 | #include <linux/seq_file.h> | ||
39 | 41 | ||
40 | #include "r8180_hw.h" | 42 | #include "r8180_hw.h" |
41 | #include "r8180.h" | 43 | #include "r8180.h" |
@@ -204,51 +206,35 @@ void rtl8180_start_tx_beacon(struct net_device *dev); | |||
204 | 206 | ||
205 | static struct proc_dir_entry *rtl8180_proc; | 207 | static struct proc_dir_entry *rtl8180_proc; |
206 | 208 | ||
207 | static int proc_get_registers(char *page, char **start, | 209 | static int proc_get_registers(struct seq_file *m, void *v) |
208 | off_t offset, int count, | ||
209 | int *eof, void *data) | ||
210 | { | 210 | { |
211 | struct net_device *dev = data; | 211 | struct net_device *dev = m->private; |
212 | int len = 0; | 212 | int i, n, max = 0xff; |
213 | int i, n; | ||
214 | int max = 0xff; | ||
215 | 213 | ||
216 | /* This dump the current register page */ | 214 | /* This dump the current register page */ |
217 | for (n = 0; n <= max;) { | 215 | for (n = 0; n <= max;) { |
218 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | 216 | seq_printf(m, "\nD: %2x > ", n); |
219 | 217 | ||
220 | for (i = 0; i < 16 && n <= max; i++, n++) | 218 | for (i = 0; i < 16 && n <= max; i++, n++) |
221 | len += snprintf(page + len, count - len, "%2x ", | 219 | seq_printf(m, "%2x ", read_nic_byte(dev, n)); |
222 | read_nic_byte(dev, n)); | ||
223 | } | 220 | } |
224 | len += snprintf(page + len, count - len, "\n"); | 221 | seq_putc(m, '\n'); |
225 | 222 | return 0; | |
226 | *eof = 1; | ||
227 | return len; | ||
228 | } | 223 | } |
229 | 224 | ||
230 | int get_curr_tx_free_desc(struct net_device *dev, int priority); | 225 | int get_curr_tx_free_desc(struct net_device *dev, int priority); |
231 | 226 | ||
232 | static int proc_get_stats_hw(char *page, char **start, | 227 | static int proc_get_stats_hw(struct seq_file *m, void *v) |
233 | off_t offset, int count, | ||
234 | int *eof, void *data) | ||
235 | { | 228 | { |
236 | int len = 0; | 229 | return 0; |
237 | |||
238 | *eof = 1; | ||
239 | return len; | ||
240 | } | 230 | } |
241 | 231 | ||
242 | static int proc_get_stats_rx(char *page, char **start, | 232 | static int proc_get_stats_rx(struct seq_file *m, void *v) |
243 | off_t offset, int count, | ||
244 | int *eof, void *data) | ||
245 | { | 233 | { |
246 | struct net_device *dev = data; | 234 | struct net_device *dev = m->private; |
247 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | 235 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); |
248 | 236 | ||
249 | int len = 0; | 237 | seq_printf(m, |
250 | |||
251 | len += snprintf(page + len, count - len, | ||
252 | "RX OK: %lu\n" | 238 | "RX OK: %lu\n" |
253 | "RX Retry: %lu\n" | 239 | "RX Retry: %lu\n" |
254 | "RX CRC Error(0-500): %lu\n" | 240 | "RX CRC Error(0-500): %lu\n" |
@@ -263,22 +249,17 @@ static int proc_get_stats_rx(char *page, char **start, | |||
263 | priv->stats.rxicverr | 249 | priv->stats.rxicverr |
264 | ); | 250 | ); |
265 | 251 | ||
266 | *eof = 1; | 252 | return 0; |
267 | return len; | ||
268 | } | 253 | } |
269 | 254 | ||
270 | static int proc_get_stats_tx(char *page, char **start, | 255 | static int proc_get_stats_tx(struct seq_file *m, void *v) |
271 | off_t offset, int count, | ||
272 | int *eof, void *data) | ||
273 | { | 256 | { |
274 | struct net_device *dev = data; | 257 | struct net_device *dev = m->private; |
275 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | 258 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); |
276 | |||
277 | int len = 0; | ||
278 | unsigned long totalOK; | 259 | unsigned long totalOK; |
279 | 260 | ||
280 | totalOK = priv->stats.txnpokint+priv->stats.txhpokint+priv->stats.txlpokint; | 261 | totalOK = priv->stats.txnpokint+priv->stats.txhpokint+priv->stats.txlpokint; |
281 | len += snprintf(page + len, count - len, | 262 | seq_printf(m, |
282 | "TX OK: %lu\n" | 263 | "TX OK: %lu\n" |
283 | "TX Error: %lu\n" | 264 | "TX Error: %lu\n" |
284 | "TX Retry: %lu\n" | 265 | "TX Retry: %lu\n" |
@@ -291,8 +272,7 @@ static int proc_get_stats_tx(char *page, char **start, | |||
291 | priv->stats.txbeaconerr | 272 | priv->stats.txbeaconerr |
292 | ); | 273 | ); |
293 | 274 | ||
294 | *eof = 1; | 275 | return 0; |
295 | return len; | ||
296 | } | 276 | } |
297 | 277 | ||
298 | void rtl8180_proc_module_init(void) | 278 | void rtl8180_proc_module_init(void) |
@@ -308,59 +288,61 @@ void rtl8180_proc_module_remove(void) | |||
308 | 288 | ||
309 | void rtl8180_proc_remove_one(struct net_device *dev) | 289 | void rtl8180_proc_remove_one(struct net_device *dev) |
310 | { | 290 | { |
311 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | 291 | remove_proc_subtree(dev->name, rtl8180_proc); |
312 | if (priv->dir_dev) { | ||
313 | remove_proc_entry("stats-hw", priv->dir_dev); | ||
314 | remove_proc_entry("stats-tx", priv->dir_dev); | ||
315 | remove_proc_entry("stats-rx", priv->dir_dev); | ||
316 | remove_proc_entry("registers", priv->dir_dev); | ||
317 | priv->dir_dev = NULL; | ||
318 | } | ||
319 | } | 292 | } |
320 | 293 | ||
321 | void rtl8180_proc_init_one(struct net_device *dev) | 294 | /* |
295 | * seq_file wrappers for procfile show routines. | ||
296 | */ | ||
297 | static int rtl8180_proc_open(struct inode *inode, struct file *file) | ||
322 | { | 298 | { |
323 | struct proc_dir_entry *e; | 299 | struct net_device *dev = proc_get_parent_data(inode); |
324 | struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); | 300 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); |
325 | 301 | ||
326 | priv->dir_dev = rtl8180_proc; | 302 | return single_open(file, show, dev); |
327 | if (!priv->dir_dev) { | 303 | } |
328 | DMESGE("Unable to initialize /proc/net/r8180/%s\n", | ||
329 | dev->name); | ||
330 | return; | ||
331 | } | ||
332 | 304 | ||
333 | e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, | 305 | static const struct file_operations rtl8180_proc_fops = { |
334 | priv->dir_dev, proc_get_stats_hw, dev); | 306 | .open = rtl8180_proc_open, |
335 | if (!e) { | 307 | .read = seq_read, |
336 | DMESGE("Unable to initialize " | 308 | .llseek = seq_lseek, |
337 | "/proc/net/r8180/%s/stats-hw\n", | 309 | .release = seq_release, |
338 | dev->name); | 310 | }; |
339 | } | ||
340 | 311 | ||
341 | e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, | 312 | /* |
342 | priv->dir_dev, proc_get_stats_rx, dev); | 313 | * Table of proc files we need to create. |
343 | if (!e) { | 314 | */ |
344 | DMESGE("Unable to initialize " | 315 | struct rtl8180_proc_file { |
345 | "/proc/net/r8180/%s/stats-rx\n", | 316 | char name[12]; |
346 | dev->name); | 317 | int (*show)(struct seq_file *, void *); |
347 | } | 318 | }; |
348 | 319 | ||
320 | static const struct rtl8180_proc_file rtl8180_proc_files[] = { | ||
321 | { "stats-hw", &proc_get_stats_hw }, | ||
322 | { "stats-rx", &proc_get_stats_rx }, | ||
323 | { "stats-tx", &proc_get_stats_tx }, | ||
324 | { "registers", &proc_get_registers }, | ||
325 | { "" } | ||
326 | }; | ||
327 | |||
328 | void rtl8180_proc_init_one(struct net_device *dev) | ||
329 | { | ||
330 | const struct rtl8180_proc_file *f; | ||
331 | struct proc_dir_entry *dir; | ||
349 | 332 | ||
350 | e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, | 333 | dir = proc_mkdir_data(dev->name, 0, rtl8180_proc, dev); |
351 | priv->dir_dev, proc_get_stats_tx, dev); | 334 | if (!dir) { |
352 | if (!e) { | 335 | DMESGE("Unable to initialize /proc/net/r8180/%s\n", dev->name); |
353 | DMESGE("Unable to initialize " | 336 | return; |
354 | "/proc/net/r8180/%s/stats-tx\n", | ||
355 | dev->name); | ||
356 | } | 337 | } |
357 | 338 | ||
358 | e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, | 339 | for (f = rtl8180_proc_files; f->name[0]; f++) { |
359 | priv->dir_dev, proc_get_registers, dev); | 340 | if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, |
360 | if (!e) { | 341 | &rtl8180_proc_fops, f->show)) { |
361 | DMESGE("Unable to initialize " | 342 | DMESGE("Unable to initialize /proc/net/r8180/%s/%s\n", |
362 | "/proc/net/r8180/%s/registers\n", | 343 | dev->name, f->name); |
363 | dev->name); | 344 | return; |
345 | } | ||
364 | } | 346 | } |
365 | } | 347 | } |
366 | 348 | ||
diff --git a/drivers/staging/rtl8192e/rtl8192e/Makefile b/drivers/staging/rtl8192e/rtl8192e/Makefile index 313a92ec6833..a2c4fb4ba1af 100644 --- a/drivers/staging/rtl8192e/rtl8192e/Makefile +++ b/drivers/staging/rtl8192e/rtl8192e/Makefile | |||
@@ -7,7 +7,6 @@ r8192e_pci-objs := \ | |||
7 | r8190P_rtl8256.o \ | 7 | r8190P_rtl8256.o \ |
8 | rtl_cam.o \ | 8 | rtl_cam.o \ |
9 | rtl_core.o \ | 9 | rtl_core.o \ |
10 | rtl_debug.o \ | ||
11 | rtl_dm.o \ | 10 | rtl_dm.o \ |
12 | rtl_eeprom.o \ | 11 | rtl_eeprom.o \ |
13 | rtl_ethtool.o \ | 12 | rtl_ethtool.o \ |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4ebf99b30975..2b6c61c5d3d8 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c | |||
@@ -2966,8 +2966,6 @@ static int rtl8192_pci_probe(struct pci_dev *pdev, | |||
2966 | goto err_free_irq; | 2966 | goto err_free_irq; |
2967 | RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name); | 2967 | RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name); |
2968 | 2968 | ||
2969 | rtl8192_proc_init_one(dev); | ||
2970 | |||
2971 | if (priv->polling_timer_on == 0) | 2969 | if (priv->polling_timer_on == 0) |
2972 | check_rfctrl_gpio_timer((unsigned long)dev); | 2970 | check_rfctrl_gpio_timer((unsigned long)dev); |
2973 | 2971 | ||
@@ -3003,7 +3001,6 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev) | |||
3003 | del_timer_sync(&priv->gpio_polling_timer); | 3001 | del_timer_sync(&priv->gpio_polling_timer); |
3004 | cancel_delayed_work(&priv->gpio_change_rf_wq); | 3002 | cancel_delayed_work(&priv->gpio_change_rf_wq); |
3005 | priv->polling_timer_on = 0; | 3003 | priv->polling_timer_on = 0; |
3006 | rtl8192_proc_remove_one(dev); | ||
3007 | rtl8192_down(dev, true); | 3004 | rtl8192_down(dev, true); |
3008 | deinit_hal_dm(dev); | 3005 | deinit_hal_dm(dev); |
3009 | if (priv->pFirmware) { | 3006 | if (priv->pFirmware) { |
@@ -3093,7 +3090,6 @@ static int __init rtl8192_pci_module_init(void) | |||
3093 | printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n"); | 3090 | printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n"); |
3094 | printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n"); | 3091 | printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n"); |
3095 | 3092 | ||
3096 | rtl8192_proc_module_init(); | ||
3097 | if (0 != pci_register_driver(&rtl8192_pci_driver)) { | 3093 | if (0 != pci_register_driver(&rtl8192_pci_driver)) { |
3098 | DMESG("No device found"); | 3094 | DMESG("No device found"); |
3099 | /*pci_unregister_driver (&rtl8192_pci_driver);*/ | 3095 | /*pci_unregister_driver (&rtl8192_pci_driver);*/ |
@@ -3107,7 +3103,6 @@ static void __exit rtl8192_pci_module_exit(void) | |||
3107 | pci_unregister_driver(&rtl8192_pci_driver); | 3103 | pci_unregister_driver(&rtl8192_pci_driver); |
3108 | 3104 | ||
3109 | RT_TRACE(COMP_DOWN, "Exiting"); | 3105 | RT_TRACE(COMP_DOWN, "Exiting"); |
3110 | rtl8192_proc_module_remove(); | ||
3111 | } | 3106 | } |
3112 | 3107 | ||
3113 | void check_rfctrl_gpio_timer(unsigned long data) | 3108 | void check_rfctrl_gpio_timer(unsigned long data) |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index 320d5fc026b4..87d4d349c890 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h | |||
@@ -1085,10 +1085,4 @@ void ActUpdateChannelAccessSetting(struct net_device *dev, | |||
1085 | enum wireless_mode WirelessMode, | 1085 | enum wireless_mode WirelessMode, |
1086 | struct channel_access_setting *ChnlAccessSetting); | 1086 | struct channel_access_setting *ChnlAccessSetting); |
1087 | 1087 | ||
1088 | /* proc stuff from rtl_debug.c */ | ||
1089 | void rtl8192_proc_init_one(struct net_device *dev); | ||
1090 | void rtl8192_proc_remove_one(struct net_device *dev); | ||
1091 | void rtl8192_proc_module_init(void); | ||
1092 | void rtl8192_proc_module_remove(void); | ||
1093 | |||
1094 | #endif | 1088 | #endif |
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_debug.c b/drivers/staging/rtl8192e/rtl8192e/rtl_debug.c deleted file mode 100644 index c19b14cd6f77..000000000000 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_debug.c +++ /dev/null | |||
@@ -1,1029 +0,0 @@ | |||
1 | /****************************************************************************** | ||
2 | * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. | ||
3 | * | ||
4 | * Based on the r8180 driver, which is: | ||
5 | * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of version 2 of the GNU General Public License as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License along with | ||
16 | * this program; if not, write to the Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | ||
18 | * | ||
19 | * The full GNU General Public License is included in this distribution in the | ||
20 | * file called LICENSE. | ||
21 | * | ||
22 | * Contact Information: | ||
23 | * wlanfae <wlanfae@realtek.com> | ||
24 | ******************************************************************************/ | ||
25 | #include "rtl_core.h" | ||
26 | #include "r8192E_phy.h" | ||
27 | #include "r8192E_phyreg.h" | ||
28 | #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */ | ||
29 | #include "r8192E_cmdpkt.h" | ||
30 | |||
31 | /**************************************************************************** | ||
32 | -----------------------------PROCFS STUFF------------------------- | ||
33 | *****************************************************************************/ | ||
34 | /*This part is related to PROC, which will record some statistics. */ | ||
35 | static struct proc_dir_entry *rtl8192_proc; | ||
36 | |||
37 | static int proc_get_stats_ap(char *page, char **start, | ||
38 | off_t offset, int count, | ||
39 | int *eof, void *data) | ||
40 | { | ||
41 | struct net_device *dev = data; | ||
42 | struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); | ||
43 | struct rtllib_device *ieee = priv->rtllib; | ||
44 | struct rtllib_network *target; | ||
45 | int len = 0; | ||
46 | |||
47 | list_for_each_entry(target, &ieee->network_list, list) { | ||
48 | |||
49 | len += snprintf(page + len, count - len, | ||
50 | "%s ", target->ssid); | ||
51 | |||
52 | if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) | ||
53 | len += snprintf(page + len, count - len, | ||
54 | "WPA\n"); | ||
55 | else | ||
56 | len += snprintf(page + len, count - len, | ||
57 | "non_WPA\n"); | ||
58 | |||
59 | } | ||
60 | |||
61 | *eof = 1; | ||
62 | return len; | ||
63 | } | ||
64 | |||
65 | static int proc_get_registers_0(char *page, char **start, | ||
66 | off_t offset, int count, | ||
67 | int *eof, void *data) | ||
68 | { | ||
69 | struct net_device *dev = data; | ||
70 | |||
71 | int len = 0; | ||
72 | int i, n, page0; | ||
73 | |||
74 | int max = 0xff; | ||
75 | page0 = 0x000; | ||
76 | |||
77 | len += snprintf(page + len, count - len, | ||
78 | "\n####################page %x##################\n ", | ||
79 | (page0>>8)); | ||
80 | len += snprintf(page + len, count - len, | ||
81 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
82 | "0C 0D 0E 0F"); | ||
83 | for (n = 0; n <= max;) { | ||
84 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
85 | for (i = 0; i < 16 && n <= max; n++, i++) | ||
86 | len += snprintf(page + len, count - len, | ||
87 | "%2.2x ", read_nic_byte(dev, | ||
88 | (page0 | n))); | ||
89 | } | ||
90 | len += snprintf(page + len, count - len, "\n"); | ||
91 | *eof = 1; | ||
92 | return len; | ||
93 | |||
94 | } | ||
95 | static int proc_get_registers_1(char *page, char **start, | ||
96 | off_t offset, int count, | ||
97 | int *eof, void *data) | ||
98 | { | ||
99 | struct net_device *dev = data; | ||
100 | |||
101 | int len = 0; | ||
102 | int i, n, page0; | ||
103 | |||
104 | int max = 0xff; | ||
105 | page0 = 0x100; | ||
106 | |||
107 | /* This dump the current register page */ | ||
108 | len += snprintf(page + len, count - len, | ||
109 | "\n####################page %x##################\n ", | ||
110 | (page0>>8)); | ||
111 | len += snprintf(page + len, count - len, | ||
112 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
113 | "0C 0D 0E 0F"); | ||
114 | for (n = 0; n <= max;) { | ||
115 | len += snprintf(page + len, count - len, | ||
116 | "\nD: %2x > ", n); | ||
117 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
118 | len += snprintf(page + len, count - len, | ||
119 | "%2.2x ", read_nic_byte(dev, | ||
120 | (page0 | n))); | ||
121 | } | ||
122 | len += snprintf(page + len, count - len, "\n"); | ||
123 | *eof = 1; | ||
124 | return len; | ||
125 | |||
126 | } | ||
127 | static int proc_get_registers_2(char *page, char **start, | ||
128 | off_t offset, int count, | ||
129 | int *eof, void *data) | ||
130 | { | ||
131 | struct net_device *dev = data; | ||
132 | |||
133 | int len = 0; | ||
134 | int i, n, page0; | ||
135 | |||
136 | int max = 0xff; | ||
137 | page0 = 0x200; | ||
138 | |||
139 | /* This dump the current register page */ | ||
140 | len += snprintf(page + len, count - len, | ||
141 | "\n####################page %x##################\n ", | ||
142 | (page0 >> 8)); | ||
143 | len += snprintf(page + len, count - len, | ||
144 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C " | ||
145 | "0D 0E 0F"); | ||
146 | for (n = 0; n <= max;) { | ||
147 | len += snprintf(page + len, count - len, | ||
148 | "\nD: %2x > ", n); | ||
149 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
150 | len += snprintf(page + len, count - len, | ||
151 | "%2.2x ", read_nic_byte(dev, | ||
152 | (page0 | n))); | ||
153 | } | ||
154 | len += snprintf(page + len, count - len, "\n"); | ||
155 | *eof = 1; | ||
156 | return len; | ||
157 | |||
158 | } | ||
159 | static int proc_get_registers_3(char *page, char **start, | ||
160 | off_t offset, int count, | ||
161 | int *eof, void *data) | ||
162 | { | ||
163 | struct net_device *dev = data; | ||
164 | |||
165 | int len = 0; | ||
166 | int i, n, page0; | ||
167 | |||
168 | int max = 0xff; | ||
169 | page0 = 0x300; | ||
170 | |||
171 | /* This dump the current register page */ | ||
172 | len += snprintf(page + len, count - len, | ||
173 | "\n####################page %x##################\n ", | ||
174 | (page0>>8)); | ||
175 | len += snprintf(page + len, count - len, | ||
176 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
177 | "0C 0D 0E 0F"); | ||
178 | for (n = 0; n <= max;) { | ||
179 | len += snprintf(page + len, count - len, | ||
180 | "\nD: %2x > ", n); | ||
181 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
182 | len += snprintf(page + len, count - len, | ||
183 | "%2.2x ", read_nic_byte(dev, | ||
184 | (page0 | n))); | ||
185 | } | ||
186 | len += snprintf(page + len, count - len, "\n"); | ||
187 | *eof = 1; | ||
188 | return len; | ||
189 | |||
190 | } | ||
191 | static int proc_get_registers_4(char *page, char **start, | ||
192 | off_t offset, int count, | ||
193 | int *eof, void *data) | ||
194 | { | ||
195 | struct net_device *dev = data; | ||
196 | |||
197 | int len = 0; | ||
198 | int i, n, page0; | ||
199 | |||
200 | int max = 0xff; | ||
201 | page0 = 0x400; | ||
202 | |||
203 | /* This dump the current register page */ | ||
204 | len += snprintf(page + len, count - len, | ||
205 | "\n####################page %x##################\n ", | ||
206 | (page0>>8)); | ||
207 | len += snprintf(page + len, count - len, | ||
208 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
209 | "0C 0D 0E 0F"); | ||
210 | for (n = 0; n <= max;) { | ||
211 | len += snprintf(page + len, count - len, | ||
212 | "\nD: %2x > ", n); | ||
213 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
214 | len += snprintf(page + len, count - len, | ||
215 | "%2.2x ", read_nic_byte(dev, | ||
216 | (page0 | n))); | ||
217 | } | ||
218 | len += snprintf(page + len, count - len, "\n"); | ||
219 | *eof = 1; | ||
220 | return len; | ||
221 | |||
222 | } | ||
223 | static int proc_get_registers_5(char *page, char **start, | ||
224 | off_t offset, int count, | ||
225 | int *eof, void *data) | ||
226 | { | ||
227 | struct net_device *dev = data; | ||
228 | |||
229 | int len = 0; | ||
230 | int i, n, page0; | ||
231 | |||
232 | int max = 0xff; | ||
233 | page0 = 0x500; | ||
234 | |||
235 | /* This dump the current register page */ | ||
236 | len += snprintf(page + len, count - len, | ||
237 | "\n####################page %x##################\n ", | ||
238 | (page0 >> 8)); | ||
239 | len += snprintf(page + len, count - len, | ||
240 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
241 | "0C 0D 0E 0F"); | ||
242 | for (n = 0; n <= max;) { | ||
243 | len += snprintf(page + len, count - len, | ||
244 | "\nD: %2x > ", n); | ||
245 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
246 | len += snprintf(page + len, count - len, | ||
247 | "%2.2x ", read_nic_byte(dev, | ||
248 | (page0 | n))); | ||
249 | } | ||
250 | len += snprintf(page + len, count - len, "\n"); | ||
251 | *eof = 1; | ||
252 | return len; | ||
253 | |||
254 | } | ||
255 | static int proc_get_registers_6(char *page, char **start, | ||
256 | off_t offset, int count, | ||
257 | int *eof, void *data) | ||
258 | { | ||
259 | struct net_device *dev = data; | ||
260 | |||
261 | int len = 0; | ||
262 | int i, n, page0; | ||
263 | |||
264 | int max = 0xff; | ||
265 | page0 = 0x600; | ||
266 | |||
267 | /* This dump the current register page */ | ||
268 | len += snprintf(page + len, count - len, | ||
269 | "\n####################page %x##################\n ", | ||
270 | (page0>>8)); | ||
271 | len += snprintf(page + len, count - len, | ||
272 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B " | ||
273 | "0C 0D 0E 0F"); | ||
274 | for (n = 0; n <= max;) { | ||
275 | len += snprintf(page + len, count - len, | ||
276 | "\nD: %2x > ", n); | ||
277 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
278 | len += snprintf(page + len, count - len, | ||
279 | "%2.2x ", read_nic_byte(dev, | ||
280 | (page0 | n))); | ||
281 | } | ||
282 | len += snprintf(page + len, count - len, "\n"); | ||
283 | *eof = 1; | ||
284 | return len; | ||
285 | |||
286 | } | ||
287 | static int proc_get_registers_7(char *page, char **start, | ||
288 | off_t offset, int count, | ||
289 | int *eof, void *data) | ||
290 | { | ||
291 | struct net_device *dev = data; | ||
292 | |||
293 | int len = 0; | ||
294 | int i, n, page0; | ||
295 | |||
296 | int max = 0xff; | ||
297 | page0 = 0x700; | ||
298 | |||
299 | /* This dump the current register page */ | ||
300 | len += snprintf(page + len, count - len, | ||
301 | "\n####################page %x##################\n ", | ||
302 | (page0 >> 8)); | ||
303 | len += snprintf(page + len, count - len, | ||
304 | "\nD: OF > 00 01 02 03 04 05 06 07 08 09 0A 0B 0C " | ||
305 | "0D 0E 0F"); | ||
306 | for (n = 0; n <= max;) { | ||
307 | len += snprintf(page + len, count - len, | ||
308 | "\nD: %2x > ", n); | ||
309 | for (i = 0; i < 16 && n <= max; i++, n++) | ||
310 | len += snprintf(page + len, count - len, | ||
311 | "%2.2x ", read_nic_byte(dev, | ||
312 | (page0 | n))); | ||
313 | } | ||
314 | len += snprintf(page + len, count - len, "\n"); | ||
315 | *eof = 1; | ||
316 | return len; | ||
317 | |||
318 | } | ||
319 | static int proc_get_registers_8(char *page, char **start, | ||
320 | off_t offset, int count, | ||
321 | int *eof, void *data) | ||
322 | { | ||
323 | struct net_device *dev = data; | ||
324 | |||
325 | int len = 0; | ||
326 | int i, n, page0; | ||
327 | |||
328 | int max = 0xff; | ||
329 | page0 = 0x800; | ||
330 | |||
331 | /* This dump the current register page */ | ||
332 | len += snprintf(page + len, count - len, | ||
333 | "\n####################page %x##################\n", | ||
334 | (page0 >> 8)); | ||
335 | for (n = 0; n <= max;) { | ||
336 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
337 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
338 | len += snprintf(page + len, count - len, | ||
339 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
340 | (page0 | n), bMaskDWord)); | ||
341 | } | ||
342 | len += snprintf(page + len, count - len, "\n"); | ||
343 | *eof = 1; | ||
344 | return len; | ||
345 | |||
346 | } | ||
347 | static int proc_get_registers_9(char *page, char **start, | ||
348 | off_t offset, int count, | ||
349 | int *eof, void *data) | ||
350 | { | ||
351 | struct net_device *dev = data; | ||
352 | |||
353 | int len = 0; | ||
354 | int i, n, page0; | ||
355 | |||
356 | int max = 0xff; | ||
357 | page0 = 0x900; | ||
358 | |||
359 | /* This dump the current register page */ | ||
360 | len += snprintf(page + len, count - len, | ||
361 | "\n####################page %x##################\n", | ||
362 | (page0>>8)); | ||
363 | for (n = 0; n <= max;) { | ||
364 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
365 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
366 | len += snprintf(page + len, count - len, | ||
367 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
368 | (page0 | n), bMaskDWord)); | ||
369 | } | ||
370 | len += snprintf(page + len, count - len, "\n"); | ||
371 | *eof = 1; | ||
372 | return len; | ||
373 | } | ||
374 | static int proc_get_registers_a(char *page, char **start, | ||
375 | off_t offset, int count, | ||
376 | int *eof, void *data) | ||
377 | { | ||
378 | struct net_device *dev = data; | ||
379 | |||
380 | int len = 0; | ||
381 | int i, n, page0; | ||
382 | |||
383 | int max = 0xff; | ||
384 | page0 = 0xa00; | ||
385 | |||
386 | /* This dump the current register page */ | ||
387 | len += snprintf(page + len, count - len, | ||
388 | "\n####################page %x##################\n", | ||
389 | (page0>>8)); | ||
390 | for (n = 0; n <= max;) { | ||
391 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
392 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
393 | len += snprintf(page + len, count - len, | ||
394 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
395 | (page0 | n), bMaskDWord)); | ||
396 | } | ||
397 | len += snprintf(page + len, count - len, "\n"); | ||
398 | *eof = 1; | ||
399 | return len; | ||
400 | } | ||
401 | static int proc_get_registers_b(char *page, char **start, | ||
402 | off_t offset, int count, | ||
403 | int *eof, void *data) | ||
404 | { | ||
405 | struct net_device *dev = data; | ||
406 | |||
407 | int len = 0; | ||
408 | int i, n, page0; | ||
409 | |||
410 | int max = 0xff; | ||
411 | page0 = 0xb00; | ||
412 | |||
413 | /* This dump the current register page */ | ||
414 | len += snprintf(page + len, count - len, | ||
415 | "\n####################page %x##################\n", | ||
416 | (page0 >> 8)); | ||
417 | for (n = 0; n <= max;) { | ||
418 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
419 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
420 | len += snprintf(page + len, count - len, | ||
421 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
422 | (page0 | n), bMaskDWord)); | ||
423 | } | ||
424 | len += snprintf(page + len, count - len, "\n"); | ||
425 | *eof = 1; | ||
426 | return len; | ||
427 | } | ||
428 | static int proc_get_registers_c(char *page, char **start, | ||
429 | off_t offset, int count, | ||
430 | int *eof, void *data) | ||
431 | { | ||
432 | struct net_device *dev = data; | ||
433 | |||
434 | int len = 0; | ||
435 | int i, n, page0; | ||
436 | |||
437 | int max = 0xff; | ||
438 | page0 = 0xc00; | ||
439 | |||
440 | /* This dump the current register page */ | ||
441 | len += snprintf(page + len, count - len, | ||
442 | "\n####################page %x##################\n", | ||
443 | (page0>>8)); | ||
444 | for (n = 0; n <= max;) { | ||
445 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
446 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
447 | len += snprintf(page + len, count - len, | ||
448 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
449 | (page0 | n), bMaskDWord)); | ||
450 | } | ||
451 | len += snprintf(page + len, count - len, "\n"); | ||
452 | *eof = 1; | ||
453 | return len; | ||
454 | } | ||
455 | static int proc_get_registers_d(char *page, char **start, | ||
456 | off_t offset, int count, | ||
457 | int *eof, void *data) | ||
458 | { | ||
459 | struct net_device *dev = data; | ||
460 | |||
461 | int len = 0; | ||
462 | int i, n, page0; | ||
463 | |||
464 | int max = 0xff; | ||
465 | page0 = 0xd00; | ||
466 | |||
467 | /* This dump the current register page */ | ||
468 | len += snprintf(page + len, count - len, | ||
469 | "\n####################page %x##################\n", | ||
470 | (page0>>8)); | ||
471 | for (n = 0; n <= max;) { | ||
472 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
473 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
474 | len += snprintf(page + len, count - len, | ||
475 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
476 | (page0 | n), bMaskDWord)); | ||
477 | } | ||
478 | len += snprintf(page + len, count - len, "\n"); | ||
479 | *eof = 1; | ||
480 | return len; | ||
481 | } | ||
482 | static int proc_get_registers_e(char *page, char **start, | ||
483 | off_t offset, int count, | ||
484 | int *eof, void *data) | ||
485 | { | ||
486 | struct net_device *dev = data; | ||
487 | |||
488 | int len = 0; | ||
489 | int i, n, page0; | ||
490 | |||
491 | int max = 0xff; | ||
492 | page0 = 0xe00; | ||
493 | |||
494 | /* This dump the current register page */ | ||
495 | len += snprintf(page + len, count - len, | ||
496 | "\n####################page %x##################\n", | ||
497 | (page0>>8)); | ||
498 | for (n = 0; n <= max;) { | ||
499 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
500 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
501 | len += snprintf(page + len, count - len, | ||
502 | "%8.8x ", rtl8192_QueryBBReg(dev, | ||
503 | (page0 | n), bMaskDWord)); | ||
504 | } | ||
505 | len += snprintf(page + len, count - len, "\n"); | ||
506 | *eof = 1; | ||
507 | return len; | ||
508 | } | ||
509 | |||
510 | static int proc_get_reg_rf_a(char *page, char **start, | ||
511 | off_t offset, int count, | ||
512 | int *eof, void *data) | ||
513 | { | ||
514 | struct net_device *dev = data; | ||
515 | |||
516 | int len = 0; | ||
517 | int i, n; | ||
518 | |||
519 | int max = 0xff; | ||
520 | |||
521 | /* This dump the current register page */ | ||
522 | len += snprintf(page + len, count - len, | ||
523 | "\n#################### RF-A ##################\n "); | ||
524 | for (n = 0; n <= max;) { | ||
525 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
526 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
527 | len += snprintf(page + len, count - len, | ||
528 | "%8.8x ", rtl8192_phy_QueryRFReg(dev, | ||
529 | (enum rf90_radio_path)RF90_PATH_A, n, | ||
530 | bMaskDWord)); | ||
531 | } | ||
532 | len += snprintf(page + len, count - len, "\n"); | ||
533 | *eof = 1; | ||
534 | return len; | ||
535 | } | ||
536 | |||
537 | static int proc_get_reg_rf_b(char *page, char **start, | ||
538 | off_t offset, int count, | ||
539 | int *eof, void *data) | ||
540 | { | ||
541 | struct net_device *dev = data; | ||
542 | |||
543 | int len = 0; | ||
544 | int i, n; | ||
545 | |||
546 | int max = 0xff; | ||
547 | |||
548 | /* This dump the current register page */ | ||
549 | len += snprintf(page + len, count - len, | ||
550 | "\n#################### RF-B ##################\n "); | ||
551 | for (n = 0; n <= max;) { | ||
552 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
553 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
554 | len += snprintf(page + len, count - len, | ||
555 | "%8.8x ", rtl8192_phy_QueryRFReg(dev, | ||
556 | (enum rf90_radio_path)RF90_PATH_B, n, | ||
557 | bMaskDWord)); | ||
558 | } | ||
559 | len += snprintf(page + len, count - len, "\n"); | ||
560 | *eof = 1; | ||
561 | return len; | ||
562 | } | ||
563 | |||
564 | static int proc_get_reg_rf_c(char *page, char **start, | ||
565 | off_t offset, int count, | ||
566 | int *eof, void *data) | ||
567 | { | ||
568 | struct net_device *dev = data; | ||
569 | |||
570 | int len = 0; | ||
571 | int i, n; | ||
572 | |||
573 | int max = 0xff; | ||
574 | |||
575 | /* This dump the current register page */ | ||
576 | len += snprintf(page + len, count - len, | ||
577 | "\n#################### RF-C ##################\n"); | ||
578 | for (n = 0; n <= max;) { | ||
579 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
580 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
581 | len += snprintf(page + len, count - len, | ||
582 | "%8.8x ", rtl8192_phy_QueryRFReg(dev, | ||
583 | (enum rf90_radio_path)RF90_PATH_C, n, | ||
584 | bMaskDWord)); | ||
585 | } | ||
586 | len += snprintf(page + len, count - len, "\n"); | ||
587 | *eof = 1; | ||
588 | return len; | ||
589 | } | ||
590 | |||
591 | static int proc_get_reg_rf_d(char *page, char **start, | ||
592 | off_t offset, int count, | ||
593 | int *eof, void *data) | ||
594 | { | ||
595 | struct net_device *dev = data; | ||
596 | |||
597 | int len = 0; | ||
598 | int i, n; | ||
599 | |||
600 | int max = 0xff; | ||
601 | |||
602 | /* This dump the current register page */ | ||
603 | len += snprintf(page + len, count - len, | ||
604 | "\n#################### RF-D ##################\n "); | ||
605 | for (n = 0; n <= max;) { | ||
606 | len += snprintf(page + len, count - len, "\nD: %2x > ", n); | ||
607 | for (i = 0; i < 4 && n <= max; n += 4, i++) | ||
608 | len += snprintf(page + len, count - len, | ||
609 | "%8.8x ", rtl8192_phy_QueryRFReg(dev, | ||
610 | (enum rf90_radio_path)RF90_PATH_D, n, | ||
611 | bMaskDWord)); | ||
612 | } | ||
613 | len += snprintf(page + len, count - len, "\n"); | ||
614 | *eof = 1; | ||
615 | return len; | ||
616 | } | ||
617 | |||
618 | static int proc_get_cam_register_1(char *page, char **start, | ||
619 | off_t offset, int count, | ||
620 | int *eof, void *data) | ||
621 | { | ||
622 | struct net_device *dev = data; | ||
623 | u32 target_command = 0; | ||
624 | u32 target_content = 0; | ||
625 | u8 entry_i = 0; | ||
626 | u32 ulStatus; | ||
627 | int len = 0; | ||
628 | int i = 100, j = 0; | ||
629 | |||
630 | /* This dump the current register page */ | ||
631 | len += snprintf(page + len, count - len, | ||
632 | "\n#################### SECURITY CAM (0-10) ######" | ||
633 | "############\n "); | ||
634 | for (j = 0; j < 11; j++) { | ||
635 | len += snprintf(page + len, count - len, "\nD: %2x > ", j); | ||
636 | for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { | ||
637 | target_command = entry_i+CAM_CONTENT_COUNT*j; | ||
638 | target_command = target_command | BIT31; | ||
639 | |||
640 | while ((i--) >= 0) { | ||
641 | ulStatus = read_nic_dword(dev, RWCAM); | ||
642 | if (ulStatus & BIT31) | ||
643 | continue; | ||
644 | else | ||
645 | break; | ||
646 | } | ||
647 | write_nic_dword(dev, RWCAM, target_command); | ||
648 | target_content = read_nic_dword(dev, RCAMO); | ||
649 | len += snprintf(page + len, count - len, "%8.8x ", | ||
650 | target_content); | ||
651 | } | ||
652 | } | ||
653 | |||
654 | len += snprintf(page + len, count - len, "\n"); | ||
655 | *eof = 1; | ||
656 | return len; | ||
657 | } | ||
658 | |||
659 | static int proc_get_cam_register_2(char *page, char **start, | ||
660 | off_t offset, int count, | ||
661 | int *eof, void *data) | ||
662 | { | ||
663 | struct net_device *dev = data; | ||
664 | u32 target_command = 0; | ||
665 | u32 target_content = 0; | ||
666 | u8 entry_i = 0; | ||
667 | u32 ulStatus; | ||
668 | int len = 0; | ||
669 | int i = 100, j = 0; | ||
670 | |||
671 | /* This dump the current register page */ | ||
672 | len += snprintf(page + len, count - len, | ||
673 | "\n#################### SECURITY CAM (11-21) " | ||
674 | "##################\n "); | ||
675 | for (j = 11; j < 22; j++) { | ||
676 | len += snprintf(page + len, count - len, "\nD: %2x > ", j); | ||
677 | for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { | ||
678 | target_command = entry_i + CAM_CONTENT_COUNT * j; | ||
679 | target_command = target_command | BIT31; | ||
680 | |||
681 | while ((i--) >= 0) { | ||
682 | ulStatus = read_nic_dword(dev, RWCAM); | ||
683 | if (ulStatus & BIT31) | ||
684 | continue; | ||
685 | else | ||
686 | break; | ||
687 | } | ||
688 | write_nic_dword(dev, RWCAM, target_command); | ||
689 | target_content = read_nic_dword(dev, RCAMO); | ||
690 | len += snprintf(page + len, count - len, "%8.8x ", | ||
691 | target_content); | ||
692 | } | ||
693 | } | ||
694 | |||
695 | len += snprintf(page + len, count - len, "\n"); | ||
696 | *eof = 1; | ||
697 | return len; | ||
698 | } | ||
699 | |||
700 | static int proc_get_cam_register_3(char *page, char **start, | ||
701 | off_t offset, int count, | ||
702 | int *eof, void *data) | ||
703 | { | ||
704 | struct net_device *dev = data; | ||
705 | u32 target_command = 0; | ||
706 | u32 target_content = 0; | ||
707 | u8 entry_i = 0; | ||
708 | u32 ulStatus; | ||
709 | int len = 0; | ||
710 | int i = 100, j = 0; | ||
711 | |||
712 | /* This dump the current register page */ | ||
713 | len += snprintf(page + len, count - len, | ||
714 | "\n#################### SECURITY CAM (22-31) ######" | ||
715 | "############\n "); | ||
716 | for (j = 22; j < TOTAL_CAM_ENTRY; j++) { | ||
717 | len += snprintf(page + len, count - len, "\nD: %2x > ", j); | ||
718 | for (entry_i = 0; entry_i < CAM_CONTENT_COUNT; entry_i++) { | ||
719 | target_command = entry_i + CAM_CONTENT_COUNT * j; | ||
720 | target_command = target_command | BIT31; | ||
721 | |||
722 | while ((i--) >= 0) { | ||
723 | ulStatus = read_nic_dword(dev, RWCAM); | ||
724 | if (ulStatus & BIT31) | ||
725 | continue; | ||
726 | else | ||
727 | break; | ||
728 | } | ||
729 | write_nic_dword(dev, RWCAM, target_command); | ||
730 | target_content = read_nic_dword(dev, RCAMO); | ||
731 | len += snprintf(page + len, count - len, "%8.8x ", | ||
732 | target_content); | ||
733 | } | ||
734 | } | ||
735 | |||
736 | len += snprintf(page + len, count - len, "\n"); | ||
737 | *eof = 1; | ||
738 | return len; | ||
739 | } | ||
740 | static int proc_get_stats_tx(char *page, char **start, | ||
741 | off_t offset, int count, | ||
742 | int *eof, void *data) | ||
743 | { | ||
744 | struct net_device *dev = data; | ||
745 | struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); | ||
746 | |||
747 | int len = 0; | ||
748 | |||
749 | len += snprintf(page + len, count - len, | ||
750 | "TX VI priority ok int: %lu\n" | ||
751 | "TX VO priority ok int: %lu\n" | ||
752 | "TX BE priority ok int: %lu\n" | ||
753 | "TX BK priority ok int: %lu\n" | ||
754 | "TX MANAGE priority ok int: %lu\n" | ||
755 | "TX BEACON priority ok int: %lu\n" | ||
756 | "TX BEACON priority error int: %lu\n" | ||
757 | "TX CMDPKT priority ok int: %lu\n" | ||
758 | "TX queue stopped?: %d\n" | ||
759 | "TX fifo overflow: %lu\n" | ||
760 | "TX total data packets %lu\n" | ||
761 | "TX total data bytes :%lu\n", | ||
762 | priv->stats.txviokint, | ||
763 | priv->stats.txvookint, | ||
764 | priv->stats.txbeokint, | ||
765 | priv->stats.txbkokint, | ||
766 | priv->stats.txmanageokint, | ||
767 | priv->stats.txbeaconokint, | ||
768 | priv->stats.txbeaconerr, | ||
769 | priv->stats.txcmdpktokint, | ||
770 | netif_queue_stopped(dev), | ||
771 | priv->stats.txoverflow, | ||
772 | priv->rtllib->stats.tx_packets, | ||
773 | priv->rtllib->stats.tx_bytes | ||
774 | |||
775 | |||
776 | ); | ||
777 | |||
778 | *eof = 1; | ||
779 | return len; | ||
780 | } | ||
781 | |||
782 | |||
783 | |||
784 | static int proc_get_stats_rx(char *page, char **start, | ||
785 | off_t offset, int count, | ||
786 | int *eof, void *data) | ||
787 | { | ||
788 | struct net_device *dev = data; | ||
789 | struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); | ||
790 | |||
791 | int len = 0; | ||
792 | |||
793 | len += snprintf(page + len, count - len, | ||
794 | "RX packets: %lu\n" | ||
795 | "RX data crc err: %lu\n" | ||
796 | "RX mgmt crc err: %lu\n" | ||
797 | "RX desc err: %lu\n" | ||
798 | "RX rx overflow error: %lu\n", | ||
799 | priv->stats.rxint, | ||
800 | priv->stats.rxdatacrcerr, | ||
801 | priv->stats.rxmgmtcrcerr, | ||
802 | priv->stats.rxrdu, | ||
803 | priv->stats.rxoverflow); | ||
804 | |||
805 | *eof = 1; | ||
806 | return len; | ||
807 | } | ||
808 | |||
809 | void rtl8192_proc_module_init(void) | ||
810 | { | ||
811 | RT_TRACE(COMP_INIT, "Initializing proc filesystem"); | ||
812 | rtl8192_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); | ||
813 | } | ||
814 | |||
815 | |||
816 | void rtl8192_proc_module_remove(void) | ||
817 | { | ||
818 | remove_proc_entry(DRV_NAME, init_net.proc_net); | ||
819 | } | ||
820 | |||
821 | |||
822 | void rtl8192_proc_remove_one(struct net_device *dev) | ||
823 | { | ||
824 | struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); | ||
825 | |||
826 | printk(KERN_INFO "dev name %s\n", dev->name); | ||
827 | |||
828 | if (priv->dir_dev) { | ||
829 | remove_proc_entry("stats-tx", priv->dir_dev); | ||
830 | remove_proc_entry("stats-rx", priv->dir_dev); | ||
831 | remove_proc_entry("stats-ap", priv->dir_dev); | ||
832 | remove_proc_entry("registers-0", priv->dir_dev); | ||
833 | remove_proc_entry("registers-1", priv->dir_dev); | ||
834 | remove_proc_entry("registers-2", priv->dir_dev); | ||
835 | remove_proc_entry("registers-3", priv->dir_dev); | ||
836 | remove_proc_entry("registers-4", priv->dir_dev); | ||
837 | remove_proc_entry("registers-5", priv->dir_dev); | ||
838 | remove_proc_entry("registers-6", priv->dir_dev); | ||
839 | remove_proc_entry("registers-7", priv->dir_dev); | ||
840 | remove_proc_entry("registers-8", priv->dir_dev); | ||
841 | remove_proc_entry("registers-9", priv->dir_dev); | ||
842 | remove_proc_entry("registers-a", priv->dir_dev); | ||
843 | remove_proc_entry("registers-b", priv->dir_dev); | ||
844 | remove_proc_entry("registers-c", priv->dir_dev); | ||
845 | remove_proc_entry("registers-d", priv->dir_dev); | ||
846 | remove_proc_entry("registers-e", priv->dir_dev); | ||
847 | remove_proc_entry("RF-A", priv->dir_dev); | ||
848 | remove_proc_entry("RF-B", priv->dir_dev); | ||
849 | remove_proc_entry("RF-C", priv->dir_dev); | ||
850 | remove_proc_entry("RF-D", priv->dir_dev); | ||
851 | remove_proc_entry("SEC-CAM-1", priv->dir_dev); | ||
852 | remove_proc_entry("SEC-CAM-2", priv->dir_dev); | ||
853 | remove_proc_entry("SEC-CAM-3", priv->dir_dev); | ||
854 | remove_proc_entry("wlan0", rtl8192_proc); | ||
855 | priv->dir_dev = NULL; | ||
856 | } | ||
857 | } | ||
858 | |||
859 | |||
860 | void rtl8192_proc_init_one(struct net_device *dev) | ||
861 | { | ||
862 | struct proc_dir_entry *e; | ||
863 | struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); | ||
864 | |||
865 | priv->dir_dev = create_proc_entry(dev->name, | ||
866 | S_IFDIR | S_IRUGO | S_IXUGO, | ||
867 | rtl8192_proc); | ||
868 | if (!priv->dir_dev) { | ||
869 | RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192" | ||
870 | "/%s\n", dev->name); | ||
871 | return; | ||
872 | } | ||
873 | e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, | ||
874 | priv->dir_dev, proc_get_stats_rx, dev); | ||
875 | |||
876 | if (!e) | ||
877 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
878 | "/proc/net/rtl8192/%s/stats-rx\n", | ||
879 | dev->name); | ||
880 | |||
881 | e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, | ||
882 | priv->dir_dev, proc_get_stats_tx, dev); | ||
883 | |||
884 | if (!e) | ||
885 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
886 | "/proc/net/rtl8192/%s/stats-tx\n", | ||
887 | dev->name); | ||
888 | |||
889 | e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, | ||
890 | priv->dir_dev, proc_get_stats_ap, dev); | ||
891 | |||
892 | if (!e) | ||
893 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
894 | "/proc/net/rtl8192/%s/stats-ap\n", | ||
895 | dev->name); | ||
896 | |||
897 | e = create_proc_read_entry("registers-0", S_IFREG | S_IRUGO, | ||
898 | priv->dir_dev, proc_get_registers_0, dev); | ||
899 | if (!e) | ||
900 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
901 | "/proc/net/rtl8192/%s/registers-0\n", | ||
902 | dev->name); | ||
903 | e = create_proc_read_entry("registers-1", S_IFREG | S_IRUGO, | ||
904 | priv->dir_dev, proc_get_registers_1, dev); | ||
905 | if (!e) | ||
906 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
907 | "/proc/net/rtl8192/%s/registers-1\n", | ||
908 | dev->name); | ||
909 | e = create_proc_read_entry("registers-2", S_IFREG | S_IRUGO, | ||
910 | priv->dir_dev, proc_get_registers_2, dev); | ||
911 | if (!e) | ||
912 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
913 | "/proc/net/rtl8192/%s/registers-2\n", | ||
914 | dev->name); | ||
915 | e = create_proc_read_entry("registers-3", S_IFREG | S_IRUGO, | ||
916 | priv->dir_dev, proc_get_registers_3, dev); | ||
917 | if (!e) | ||
918 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
919 | "/proc/net/rtl8192/%s/registers-3\n", | ||
920 | dev->name); | ||
921 | e = create_proc_read_entry("registers-4", S_IFREG | S_IRUGO, | ||
922 | priv->dir_dev, proc_get_registers_4, dev); | ||
923 | if (!e) | ||
924 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
925 | "/proc/net/rtl8192/%s/registers-4\n", | ||
926 | dev->name); | ||
927 | e = create_proc_read_entry("registers-5", S_IFREG | S_IRUGO, | ||
928 | priv->dir_dev, proc_get_registers_5, dev); | ||
929 | if (!e) | ||
930 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
931 | "/proc/net/rtl8192/%s/registers-5\n", | ||
932 | dev->name); | ||
933 | e = create_proc_read_entry("registers-6", S_IFREG | S_IRUGO, | ||
934 | priv->dir_dev, proc_get_registers_6, dev); | ||
935 | if (!e) | ||
936 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
937 | "/proc/net/rtl8192/%s/registers-6\n", | ||
938 | dev->name); | ||
939 | e = create_proc_read_entry("registers-7", S_IFREG | S_IRUGO, | ||
940 | priv->dir_dev, proc_get_registers_7, dev); | ||
941 | if (!e) | ||
942 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
943 | "/proc/net/rtl8192/%s/registers-7\n", | ||
944 | dev->name); | ||
945 | e = create_proc_read_entry("registers-8", S_IFREG | S_IRUGO, | ||
946 | priv->dir_dev, proc_get_registers_8, dev); | ||
947 | if (!e) | ||
948 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
949 | "/proc/net/rtl8192/%s/registers-8\n", | ||
950 | dev->name); | ||
951 | e = create_proc_read_entry("registers-9", S_IFREG | S_IRUGO, | ||
952 | priv->dir_dev, proc_get_registers_9, dev); | ||
953 | if (!e) | ||
954 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
955 | "/proc/net/rtl8192/%s/registers-9\n", | ||
956 | dev->name); | ||
957 | e = create_proc_read_entry("registers-a", S_IFREG | S_IRUGO, | ||
958 | priv->dir_dev, proc_get_registers_a, dev); | ||
959 | if (!e) | ||
960 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
961 | "/proc/net/rtl8192/%s/registers-a\n", | ||
962 | dev->name); | ||
963 | e = create_proc_read_entry("registers-b", S_IFREG | S_IRUGO, | ||
964 | priv->dir_dev, proc_get_registers_b, dev); | ||
965 | if (!e) | ||
966 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
967 | "/proc/net/rtl8192/%s/registers-b\n", | ||
968 | dev->name); | ||
969 | e = create_proc_read_entry("registers-c", S_IFREG | S_IRUGO, | ||
970 | priv->dir_dev, proc_get_registers_c, dev); | ||
971 | if (!e) | ||
972 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
973 | "/proc/net/rtl8192/%s/registers-c\n", | ||
974 | dev->name); | ||
975 | e = create_proc_read_entry("registers-d", S_IFREG | S_IRUGO, | ||
976 | priv->dir_dev, proc_get_registers_d, dev); | ||
977 | if (!e) | ||
978 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
979 | "/proc/net/rtl8192/%s/registers-d\n", | ||
980 | dev->name); | ||
981 | e = create_proc_read_entry("registers-e", S_IFREG | S_IRUGO, | ||
982 | priv->dir_dev, proc_get_registers_e, dev); | ||
983 | if (!e) | ||
984 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
985 | "/proc/net/rtl8192/%s/registers-e\n", | ||
986 | dev->name); | ||
987 | e = create_proc_read_entry("RF-A", S_IFREG | S_IRUGO, | ||
988 | priv->dir_dev, proc_get_reg_rf_a, dev); | ||
989 | if (!e) | ||
990 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
991 | "/proc/net/rtl8192/%s/RF-A\n", | ||
992 | dev->name); | ||
993 | e = create_proc_read_entry("RF-B", S_IFREG | S_IRUGO, | ||
994 | priv->dir_dev, proc_get_reg_rf_b, dev); | ||
995 | if (!e) | ||
996 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
997 | "/proc/net/rtl8192/%s/RF-B\n", | ||
998 | dev->name); | ||
999 | e = create_proc_read_entry("RF-C", S_IFREG | S_IRUGO, | ||
1000 | priv->dir_dev, proc_get_reg_rf_c, dev); | ||
1001 | if (!e) | ||
1002 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
1003 | "/proc/net/rtl8192/%s/RF-C\n", | ||
1004 | dev->name); | ||
1005 | e = create_proc_read_entry("RF-D", S_IFREG | S_IRUGO, | ||
1006 | priv->dir_dev, proc_get_reg_rf_d, dev); | ||
1007 | if (!e) | ||
1008 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
1009 | "/proc/net/rtl8192/%s/RF-D\n", | ||
1010 | dev->name); | ||
1011 | e = create_proc_read_entry("SEC-CAM-1", S_IFREG | S_IRUGO, | ||
1012 | priv->dir_dev, proc_get_cam_register_1, dev); | ||
1013 | if (!e) | ||
1014 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
1015 | "/proc/net/rtl8192/%s/SEC-CAM-1\n", | ||
1016 | dev->name); | ||
1017 | e = create_proc_read_entry("SEC-CAM-2", S_IFREG | S_IRUGO, | ||
1018 | priv->dir_dev, proc_get_cam_register_2, dev); | ||
1019 | if (!e) | ||
1020 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
1021 | "/proc/net/rtl8192/%s/SEC-CAM-2\n", | ||
1022 | dev->name); | ||
1023 | e = create_proc_read_entry("SEC-CAM-3", S_IFREG | S_IRUGO, | ||
1024 | priv->dir_dev, proc_get_cam_register_3, dev); | ||
1025 | if (!e) | ||
1026 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
1027 | "/proc/net/rtl8192/%s/SEC-CAM-3\n", | ||
1028 | dev->name); | ||
1029 | } | ||
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 4217b88e6fc3..e51cb49ce10e 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | |||
@@ -412,19 +412,18 @@ static int rtllib_ccmp_get_key(void *key, int len, u8 *seq, void *priv) | |||
412 | } | 412 | } |
413 | 413 | ||
414 | 414 | ||
415 | static char *rtllib_ccmp_print_stats(char *p, void *priv) | 415 | static void rtllib_ccmp_print_stats(struct seq_file *m, void *priv) |
416 | { | 416 | { |
417 | struct rtllib_ccmp_data *ccmp = priv; | 417 | struct rtllib_ccmp_data *ccmp = priv; |
418 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " | 418 | seq_printf(m, |
419 | "tx_pn=%pM rx_pn=%pM " | 419 | "key[%d] alg=CCMP key_set=%d " |
420 | "format_errors=%d replays=%d decrypt_errors=%d\n", | 420 | "tx_pn=%pM rx_pn=%pM " |
421 | ccmp->key_idx, ccmp->key_set, | 421 | "format_errors=%d replays=%d decrypt_errors=%d\n", |
422 | ccmp->tx_pn, ccmp->rx_pn, | 422 | ccmp->key_idx, ccmp->key_set, |
423 | ccmp->dot11RSNAStatsCCMPFormatErrors, | 423 | ccmp->tx_pn, ccmp->rx_pn, |
424 | ccmp->dot11RSNAStatsCCMPReplays, | 424 | ccmp->dot11RSNAStatsCCMPFormatErrors, |
425 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | 425 | ccmp->dot11RSNAStatsCCMPReplays, |
426 | 426 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | |
427 | return p; | ||
428 | } | 427 | } |
429 | 428 | ||
430 | static struct lib80211_crypto_ops rtllib_crypt_ccmp = { | 429 | static struct lib80211_crypto_ops rtllib_crypt_ccmp = { |
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 800925053fb0..5cfd73baf1cc 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c | |||
@@ -708,30 +708,30 @@ static int rtllib_tkip_get_key(void *key, int len, u8 *seq, void *priv) | |||
708 | } | 708 | } |
709 | 709 | ||
710 | 710 | ||
711 | static char *rtllib_tkip_print_stats(char *p, void *priv) | 711 | static void rtllib_tkip_print_stats(struct seq_file *m, void *priv) |
712 | { | 712 | { |
713 | struct rtllib_tkip_data *tkip = priv; | 713 | struct rtllib_tkip_data *tkip = priv; |
714 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " | 714 | seq_printf(m, |
715 | "tx_pn=%02x%02x%02x%02x%02x%02x " | 715 | "key[%d] alg=TKIP key_set=%d " |
716 | "rx_pn=%02x%02x%02x%02x%02x%02x " | 716 | "tx_pn=%02x%02x%02x%02x%02x%02x " |
717 | "replays=%d icv_errors=%d local_mic_failures=%d\n", | 717 | "rx_pn=%02x%02x%02x%02x%02x%02x " |
718 | tkip->key_idx, tkip->key_set, | 718 | "replays=%d icv_errors=%d local_mic_failures=%d\n", |
719 | (tkip->tx_iv32 >> 24) & 0xff, | 719 | tkip->key_idx, tkip->key_set, |
720 | (tkip->tx_iv32 >> 16) & 0xff, | 720 | (tkip->tx_iv32 >> 24) & 0xff, |
721 | (tkip->tx_iv32 >> 8) & 0xff, | 721 | (tkip->tx_iv32 >> 16) & 0xff, |
722 | tkip->tx_iv32 & 0xff, | 722 | (tkip->tx_iv32 >> 8) & 0xff, |
723 | (tkip->tx_iv16 >> 8) & 0xff, | 723 | tkip->tx_iv32 & 0xff, |
724 | tkip->tx_iv16 & 0xff, | 724 | (tkip->tx_iv16 >> 8) & 0xff, |
725 | (tkip->rx_iv32 >> 24) & 0xff, | 725 | tkip->tx_iv16 & 0xff, |
726 | (tkip->rx_iv32 >> 16) & 0xff, | 726 | (tkip->rx_iv32 >> 24) & 0xff, |
727 | (tkip->rx_iv32 >> 8) & 0xff, | 727 | (tkip->rx_iv32 >> 16) & 0xff, |
728 | tkip->rx_iv32 & 0xff, | 728 | (tkip->rx_iv32 >> 8) & 0xff, |
729 | (tkip->rx_iv16 >> 8) & 0xff, | 729 | tkip->rx_iv32 & 0xff, |
730 | tkip->rx_iv16 & 0xff, | 730 | (tkip->rx_iv16 >> 8) & 0xff, |
731 | tkip->dot11RSNAStatsTKIPReplays, | 731 | tkip->rx_iv16 & 0xff, |
732 | tkip->dot11RSNAStatsTKIPICVErrors, | 732 | tkip->dot11RSNAStatsTKIPReplays, |
733 | tkip->dot11RSNAStatsTKIPLocalMICFailures); | 733 | tkip->dot11RSNAStatsTKIPICVErrors, |
734 | return p; | 734 | tkip->dot11RSNAStatsTKIPLocalMICFailures); |
735 | } | 735 | } |
736 | 736 | ||
737 | static struct lib80211_crypto_ops rtllib_crypt_tkip = { | 737 | static struct lib80211_crypto_ops rtllib_crypt_tkip = { |
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 8cdf38913a33..c4df6e01ef74 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c | |||
@@ -247,12 +247,10 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | |||
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | static char *prism2_wep_print_stats(char *p, void *priv) | 250 | static void prism2_wep_print_stats(struct seq_file *m, void *priv) |
251 | { | 251 | { |
252 | struct prism2_wep_data *wep = priv; | 252 | struct prism2_wep_data *wep = priv; |
253 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", | 253 | seq_printf(m, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); |
254 | wep->key_idx, wep->key_len); | ||
255 | return p; | ||
256 | } | 254 | } |
257 | 255 | ||
258 | static struct lib80211_crypto_ops rtllib_crypt_wep = { | 256 | static struct lib80211_crypto_ops rtllib_crypt_wep = { |
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index f9dae958a5d4..84ea721d5d8e 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c | |||
@@ -208,61 +208,51 @@ static int debug = \ | |||
208 | ; | 208 | ; |
209 | static struct proc_dir_entry *rtllib_proc; | 209 | static struct proc_dir_entry *rtllib_proc; |
210 | 210 | ||
211 | static int show_debug_level(char *page, char **start, off_t offset, | 211 | static int show_debug_level(struct seq_file *m, void *v) |
212 | int count, int *eof, void *data) | ||
213 | { | 212 | { |
214 | return snprintf(page, count, "0x%08X\n", rtllib_debug_level); | 213 | return seq_printf(m, "0x%08X\n", rtllib_debug_level); |
215 | } | 214 | } |
216 | 215 | ||
217 | static int store_debug_level(struct file *file, const char __user *buffer, | 216 | static ssize_t write_debug_level(struct file *file, const char __user *buffer, |
218 | unsigned long count, void *data) | 217 | size_t count, loff_t *ppos) |
219 | { | 218 | { |
220 | char buf[] = "0x00000000"; | ||
221 | unsigned long len = min((unsigned long)sizeof(buf) - 1, count); | ||
222 | char *p = (char *)buf; | ||
223 | unsigned long val; | 219 | unsigned long val; |
220 | int err = kstrtoul_from_user(buffer, count, 0, &val); | ||
221 | if (err) | ||
222 | return err; | ||
223 | rtllib_debug_level = val; | ||
224 | return count; | ||
225 | } | ||
224 | 226 | ||
225 | if (copy_from_user(buf, buffer, len)) | 227 | static int open_debug_level(struct inode *inode, struct file *file) |
226 | return count; | 228 | { |
227 | buf[len] = 0; | 229 | return single_open(file, show_debug_level, NULL); |
228 | if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { | ||
229 | p++; | ||
230 | if (p[0] == 'x' || p[0] == 'X') | ||
231 | p++; | ||
232 | val = simple_strtoul(p, &p, 16); | ||
233 | } else | ||
234 | val = simple_strtoul(p, &p, 10); | ||
235 | if (p == buf) | ||
236 | printk(KERN_INFO DRV_NAME | ||
237 | ": %s is not in hex or decimal form.\n", buf); | ||
238 | else | ||
239 | rtllib_debug_level = val; | ||
240 | |||
241 | return strnlen(buf, count); | ||
242 | } | 230 | } |
243 | 231 | ||
232 | static const struct file_operations fops = { | ||
233 | .open = open_debug_level, | ||
234 | .read = seq_read, | ||
235 | .llseek = seq_lseek, | ||
236 | .write = write_debug_level | ||
237 | }; | ||
238 | |||
244 | int __init rtllib_init(void) | 239 | int __init rtllib_init(void) |
245 | { | 240 | { |
246 | struct proc_dir_entry *e; | 241 | struct proc_dir_entry *e; |
247 | 242 | ||
248 | rtllib_debug_level = debug; | 243 | rtllib_debug_level = debug; |
249 | rtllib_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); | 244 | rtllib_proc = proc_mkdir(DRV_NAME, init_net.proc_net); |
250 | if (rtllib_proc == NULL) { | 245 | if (rtllib_proc == NULL) { |
251 | RTLLIB_ERROR("Unable to create " DRV_NAME | 246 | RTLLIB_ERROR("Unable to create " DRV_NAME |
252 | " proc directory\n"); | 247 | " proc directory\n"); |
253 | return -EIO; | 248 | return -EIO; |
254 | } | 249 | } |
255 | e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, | 250 | e = proc_create("debug_level", S_IRUGO | S_IWUSR, rtllib_proc, &fops); |
256 | rtllib_proc); | ||
257 | if (!e) { | 251 | if (!e) { |
258 | remove_proc_entry(DRV_NAME, init_net.proc_net); | 252 | remove_proc_entry(DRV_NAME, init_net.proc_net); |
259 | rtllib_proc = NULL; | 253 | rtllib_proc = NULL; |
260 | return -EIO; | 254 | return -EIO; |
261 | } | 255 | } |
262 | e->read_proc = show_debug_level; | ||
263 | e->write_proc = store_debug_level; | ||
264 | e->data = NULL; | ||
265 | |||
266 | return 0; | 256 | return 0; |
267 | } | 257 | } |
268 | 258 | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 76c56e5aed79..e0870c05a5e0 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | |||
@@ -243,39 +243,34 @@ static int debug = \ | |||
243 | ; | 243 | ; |
244 | struct proc_dir_entry *ieee80211_proc; | 244 | struct proc_dir_entry *ieee80211_proc; |
245 | 245 | ||
246 | static int show_debug_level(char *page, char **start, off_t offset, | 246 | static int show_debug_level(struct seq_file *m, void *v) |
247 | int count, int *eof, void *data) | ||
248 | { | 247 | { |
249 | return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); | 248 | return seq_printf(m, "0x%08X\n", ieee80211_debug_level); |
250 | } | 249 | } |
251 | 250 | ||
252 | static int store_debug_level(struct file *file, const char *buffer, | 251 | static ssize_t write_debug_level(struct file *file, const char __user *buffer, |
253 | unsigned long count, void *data) | 252 | size_t count, loff_t *ppos) |
254 | { | 253 | { |
255 | char buf[] = "0x00000000"; | ||
256 | unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count); | ||
257 | char *p = (char *)buf; | ||
258 | unsigned long val; | 254 | unsigned long val; |
255 | int err = kstrtoul_from_user(buffer, count, 0, &val); | ||
256 | if (err) | ||
257 | return err; | ||
258 | ieee80211_debug_level = val; | ||
259 | return count; | ||
260 | } | ||
259 | 261 | ||
260 | if (copy_from_user(buf, buffer, len)) | 262 | static int open_debug_level(struct inode *inode, struct file *file) |
261 | return count; | 263 | { |
262 | buf[len] = 0; | 264 | return single_open(file, show_debug_level, NULL); |
263 | if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { | ||
264 | p++; | ||
265 | if (p[0] == 'x' || p[0] == 'X') | ||
266 | p++; | ||
267 | val = simple_strtoul(p, &p, 16); | ||
268 | } else | ||
269 | val = simple_strtoul(p, &p, 10); | ||
270 | if (p == buf) | ||
271 | printk(KERN_INFO DRV_NAME | ||
272 | ": %s is not in hex or decimal form.\n", buf); | ||
273 | else | ||
274 | ieee80211_debug_level = val; | ||
275 | |||
276 | return strnlen(buf, count); | ||
277 | } | 265 | } |
278 | 266 | ||
267 | static const struct file_operations fops = { | ||
268 | .open = open_debug_level, | ||
269 | .read = seq_read, | ||
270 | .llseek = seq_lseek, | ||
271 | .write = write_debug_level | ||
272 | }; | ||
273 | |||
279 | int __init ieee80211_debug_init(void) | 274 | int __init ieee80211_debug_init(void) |
280 | { | 275 | { |
281 | struct proc_dir_entry *e; | 276 | struct proc_dir_entry *e; |
@@ -288,17 +283,13 @@ int __init ieee80211_debug_init(void) | |||
288 | " proc directory\n"); | 283 | " proc directory\n"); |
289 | return -EIO; | 284 | return -EIO; |
290 | } | 285 | } |
291 | e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, | 286 | e = proc_create("debug_level", S_IRUGO | S_IWUSR, |
292 | ieee80211_proc); | 287 | ieee80211_proc, &fops); |
293 | if (!e) { | 288 | if (!e) { |
294 | remove_proc_entry(DRV_NAME, init_net.proc_net); | 289 | remove_proc_entry(DRV_NAME, init_net.proc_net); |
295 | ieee80211_proc = NULL; | 290 | ieee80211_proc = NULL; |
296 | return -EIO; | 291 | return -EIO; |
297 | } | 292 | } |
298 | e->read_proc = show_debug_level; | ||
299 | e->write_proc = store_debug_level; | ||
300 | e->data = NULL; | ||
301 | |||
302 | return 0; | 293 | return 0; |
303 | } | 294 | } |
304 | 295 | ||
diff --git a/drivers/staging/rtl8192u/ieee80211/proc.c b/drivers/staging/rtl8192u/ieee80211/proc.c index 6eda928e4090..c426dfdd9fdd 100644 --- a/drivers/staging/rtl8192u/ieee80211/proc.c +++ b/drivers/staging/rtl8192u/ieee80211/proc.c | |||
@@ -99,7 +99,7 @@ static int crypto_info_open(struct inode *inode, struct file *file) | |||
99 | return seq_open(file, &crypto_seq_ops); | 99 | return seq_open(file, &crypto_seq_ops); |
100 | } | 100 | } |
101 | 101 | ||
102 | static struct file_operations proc_crypto_ops = { | 102 | static const struct file_operations proc_crypto_ops = { |
103 | .open = crypto_info_open, | 103 | .open = crypto_info_open, |
104 | .read = seq_read, | 104 | .read = seq_read, |
105 | .llseek = seq_lseek, | 105 | .llseek = seq_lseek, |
@@ -108,9 +108,5 @@ static struct file_operations proc_crypto_ops = { | |||
108 | 108 | ||
109 | void __init crypto_init_proc(void) | 109 | void __init crypto_init_proc(void) |
110 | { | 110 | { |
111 | struct proc_dir_entry *proc; | 111 | proc_create("crypto", 0, NULL, &proc_crypto_ops); |
112 | |||
113 | proc = create_proc_entry("crypto", 0, NULL); | ||
114 | if (proc) | ||
115 | proc->proc_fops = &proc_crypto_ops; | ||
116 | } | 112 | } |
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index e538e026b512..bedeb330ad4f 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h | |||
@@ -946,7 +946,6 @@ typedef struct r8192_priv { | |||
946 | /*stats*/ | 946 | /*stats*/ |
947 | struct Stats stats; | 947 | struct Stats stats; |
948 | struct iw_statistics wstats; | 948 | struct iw_statistics wstats; |
949 | struct proc_dir_entry *dir_dev; | ||
950 | 949 | ||
951 | /*RX stuff*/ | 950 | /*RX stuff*/ |
952 | // u32 *rxring; | 951 | // u32 *rxring; |
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f7de2f6d49a5..145923397556 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c | |||
@@ -71,6 +71,8 @@ double __extendsfdf2(float a) {return a;} | |||
71 | //#include "r8192xU_phyreg.h" | 71 | //#include "r8192xU_phyreg.h" |
72 | #include <linux/usb.h> | 72 | #include <linux/usb.h> |
73 | #include <linux/slab.h> | 73 | #include <linux/slab.h> |
74 | #include <linux/proc_fs.h> | ||
75 | #include <linux/seq_file.h> | ||
74 | // FIXME: check if 2.6.7 is ok | 76 | // FIXME: check if 2.6.7 is ok |
75 | 77 | ||
76 | #ifdef CONFIG_RTL8192_PM | 78 | #ifdef CONFIG_RTL8192_PM |
@@ -472,103 +474,73 @@ void watch_dog_timer_callback(unsigned long data); | |||
472 | 474 | ||
473 | static struct proc_dir_entry *rtl8192_proc; | 475 | static struct proc_dir_entry *rtl8192_proc; |
474 | 476 | ||
475 | static int proc_get_stats_ap(char *page, char **start, off_t offset, int count, | 477 | static int proc_get_stats_ap(struct seq_file *m, void *v) |
476 | int *eof, void *data) | ||
477 | { | 478 | { |
478 | struct net_device *dev = data; | 479 | struct net_device *dev = m->private; |
479 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 480 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); |
480 | struct ieee80211_device *ieee = priv->ieee80211; | 481 | struct ieee80211_device *ieee = priv->ieee80211; |
481 | struct ieee80211_network *target; | 482 | struct ieee80211_network *target; |
482 | 483 | ||
483 | int len = 0; | ||
484 | |||
485 | list_for_each_entry(target, &ieee->network_list, list) { | 484 | list_for_each_entry(target, &ieee->network_list, list) { |
486 | 485 | const char *wpa = "non_WPA"; | |
487 | len += snprintf(page + len, count - len, "%s ", target->ssid); | ||
488 | |||
489 | if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) | 486 | if (target->wpa_ie_len > 0 || target->rsn_ie_len > 0) |
490 | len += snprintf(page + len, count - len, "WPA\n"); | 487 | wpa = "WPA"; |
491 | else | 488 | |
492 | len += snprintf(page + len, count - len, "non_WPA\n"); | 489 | seq_printf(m, "%s %s\n", target->ssid, wpa); |
493 | } | 490 | } |
494 | 491 | ||
495 | *eof = 1; | 492 | return 0; |
496 | return len; | ||
497 | } | 493 | } |
498 | 494 | ||
499 | static int proc_get_registers(char *page, char **start, | 495 | static int proc_get_registers(struct seq_file *m, void *v) |
500 | off_t offset, int count, | ||
501 | int *eof, void *data) | ||
502 | { | 496 | { |
503 | struct net_device *dev = data; | 497 | struct net_device *dev = m->private; |
504 | // struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 498 | int i,n, max = 0xff; |
505 | 499 | ||
506 | int len = 0; | 500 | seq_puts(m, "\n####################page 0##################\n "); |
507 | int i,n; | ||
508 | |||
509 | int max=0xff; | ||
510 | |||
511 | /* This dump the current register page */ | ||
512 | len += snprintf(page + len, count - len, | ||
513 | "\n####################page 0##################\n "); | ||
514 | 501 | ||
515 | for (n=0;n<=max;) { | 502 | for (n=0;n<=max;) { |
516 | //printk( "\nD: %2x> ", n); | 503 | //printk( "\nD: %2x> ", n); |
517 | len += snprintf(page + len, count - len, | 504 | seq_printf(m, "\nD: %2x > ",n); |
518 | "\nD: %2x > ",n); | ||
519 | 505 | ||
520 | for (i=0;i<16 && n<=max;i++,n++) | 506 | for (i=0;i<16 && n<=max;i++,n++) |
521 | len += snprintf(page + len, count - len, | 507 | seq_printf(m, "%2x ",read_nic_byte(dev,0x000|n)); |
522 | "%2x ",read_nic_byte(dev,0x000|n)); | ||
523 | 508 | ||
524 | // printk("%2x ",read_nic_byte(dev,n)); | 509 | // printk("%2x ",read_nic_byte(dev,n)); |
525 | } | 510 | } |
526 | len += snprintf(page + len, count - len, | 511 | |
527 | "\n####################page 1##################\n "); | 512 | seq_puts(m, "\n####################page 1##################\n "); |
528 | for (n=0;n<=max;) { | 513 | for (n=0;n<=max;) { |
529 | //printk( "\nD: %2x> ", n); | 514 | //printk( "\nD: %2x> ", n); |
530 | len += snprintf(page + len, count - len, | 515 | seq_printf(m, "\nD: %2x > ",n); |
531 | "\nD: %2x > ",n); | ||
532 | 516 | ||
533 | for (i=0;i<16 && n<=max;i++,n++) | 517 | for (i=0;i<16 && n<=max;i++,n++) |
534 | len += snprintf(page + len, count - len, | 518 | seq_printf(m, "%2x ",read_nic_byte(dev,0x100|n)); |
535 | "%2x ",read_nic_byte(dev,0x100|n)); | ||
536 | 519 | ||
537 | // printk("%2x ",read_nic_byte(dev,n)); | 520 | // printk("%2x ",read_nic_byte(dev,n)); |
538 | } | 521 | } |
539 | len += snprintf(page + len, count - len, | 522 | |
540 | "\n####################page 3##################\n "); | 523 | seq_puts(m, "\n####################page 3##################\n "); |
541 | for (n=0;n<=max;) { | 524 | for (n=0;n<=max;) { |
542 | //printk( "\nD: %2x> ", n); | 525 | //printk( "\nD: %2x> ", n); |
543 | len += snprintf(page + len, count - len, | 526 | seq_printf(m, "\nD: %2x > ",n); |
544 | "\nD: %2x > ",n); | ||
545 | 527 | ||
546 | for(i=0;i<16 && n<=max;i++,n++) | 528 | for(i=0;i<16 && n<=max;i++,n++) |
547 | len += snprintf(page + len, count - len, | 529 | seq_printf(m, "%2x ",read_nic_byte(dev,0x300|n)); |
548 | "%2x ",read_nic_byte(dev,0x300|n)); | ||
549 | 530 | ||
550 | // printk("%2x ",read_nic_byte(dev,n)); | 531 | // printk("%2x ",read_nic_byte(dev,n)); |
551 | } | 532 | } |
552 | 533 | ||
553 | len += snprintf(page + len, count - len,"\n"); | 534 | seq_putc(m, '\n'); |
554 | *eof = 1; | 535 | return 0; |
555 | return len; | ||
556 | } | 536 | } |
557 | 537 | ||
558 | 538 | static int proc_get_stats_tx(struct seq_file *m, void *v) | |
559 | |||
560 | |||
561 | |||
562 | static int proc_get_stats_tx(char *page, char **start, | ||
563 | off_t offset, int count, | ||
564 | int *eof, void *data) | ||
565 | { | 539 | { |
566 | struct net_device *dev = data; | 540 | struct net_device *dev = m->private; |
567 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 541 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); |
568 | 542 | ||
569 | int len = 0; | 543 | seq_printf(m, |
570 | |||
571 | len += snprintf(page + len, count - len, | ||
572 | "TX VI priority ok int: %lu\n" | 544 | "TX VI priority ok int: %lu\n" |
573 | "TX VI priority error int: %lu\n" | 545 | "TX VI priority error int: %lu\n" |
574 | "TX VO priority ok int: %lu\n" | 546 | "TX VO priority ok int: %lu\n" |
@@ -629,22 +601,15 @@ static int proc_get_stats_tx(char *page, char **start, | |||
629 | // priv->stats.txbeaconerr | 601 | // priv->stats.txbeaconerr |
630 | ); | 602 | ); |
631 | 603 | ||
632 | *eof = 1; | 604 | return 0; |
633 | return len; | ||
634 | } | 605 | } |
635 | 606 | ||
636 | 607 | static int proc_get_stats_rx(struct seq_file *m, void *v) | |
637 | |||
638 | static int proc_get_stats_rx(char *page, char **start, | ||
639 | off_t offset, int count, | ||
640 | int *eof, void *data) | ||
641 | { | 608 | { |
642 | struct net_device *dev = data; | 609 | struct net_device *dev = m->private; |
643 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 610 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); |
644 | 611 | ||
645 | int len = 0; | 612 | seq_printf(m, |
646 | |||
647 | len += snprintf(page + len, count - len, | ||
648 | "RX packets: %lu\n" | 613 | "RX packets: %lu\n" |
649 | "RX urb status error: %lu\n" | 614 | "RX urb status error: %lu\n" |
650 | "RX invalid urb error: %lu\n", | 615 | "RX invalid urb error: %lu\n", |
@@ -652,9 +617,9 @@ static int proc_get_stats_rx(char *page, char **start, | |||
652 | priv->stats.rxstaterr, | 617 | priv->stats.rxstaterr, |
653 | priv->stats.rxurberr); | 618 | priv->stats.rxurberr); |
654 | 619 | ||
655 | *eof = 1; | 620 | return 0; |
656 | return len; | ||
657 | } | 621 | } |
622 | |||
658 | void rtl8192_proc_module_init(void) | 623 | void rtl8192_proc_module_init(void) |
659 | { | 624 | { |
660 | RT_TRACE(COMP_INIT, "Initializing proc filesystem"); | 625 | RT_TRACE(COMP_INIT, "Initializing proc filesystem"); |
@@ -667,74 +632,70 @@ void rtl8192_proc_module_remove(void) | |||
667 | remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); | 632 | remove_proc_entry(RTL819xU_MODULE_NAME, init_net.proc_net); |
668 | } | 633 | } |
669 | 634 | ||
670 | 635 | /* | |
671 | void rtl8192_proc_remove_one(struct net_device *dev) | 636 | * seq_file wrappers for procfile show routines. |
637 | */ | ||
638 | static int rtl8192_proc_open(struct inode *inode, struct file *file) | ||
672 | { | 639 | { |
673 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 640 | struct net_device *dev = proc_get_parent_data(inode); |
641 | int (*show)(struct seq_file *, void *) = PDE_DATA(inode); | ||
674 | 642 | ||
675 | 643 | return single_open(file, show, dev); | |
676 | if (priv->dir_dev) { | ||
677 | // remove_proc_entry("stats-hw", priv->dir_dev); | ||
678 | remove_proc_entry("stats-tx", priv->dir_dev); | ||
679 | remove_proc_entry("stats-rx", priv->dir_dev); | ||
680 | // remove_proc_entry("stats-ieee", priv->dir_dev); | ||
681 | remove_proc_entry("stats-ap", priv->dir_dev); | ||
682 | remove_proc_entry("registers", priv->dir_dev); | ||
683 | // remove_proc_entry("cck-registers",priv->dir_dev); | ||
684 | // remove_proc_entry("ofdm-registers",priv->dir_dev); | ||
685 | //remove_proc_entry(dev->name, rtl8192_proc); | ||
686 | remove_proc_entry("wlan0", rtl8192_proc); | ||
687 | priv->dir_dev = NULL; | ||
688 | } | ||
689 | } | 644 | } |
690 | 645 | ||
646 | static const struct file_operations rtl8192_proc_fops = { | ||
647 | .open = rtl8192_proc_open, | ||
648 | .read = seq_read, | ||
649 | .llseek = seq_lseek, | ||
650 | .release = seq_release, | ||
651 | }; | ||
691 | 652 | ||
692 | void rtl8192_proc_init_one(struct net_device *dev) | 653 | /* |
693 | { | 654 | * Table of proc files we need to create. |
694 | struct proc_dir_entry *e; | 655 | */ |
695 | struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); | 656 | struct rtl8192_proc_file { |
696 | priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc); | 657 | char name[12]; |
697 | if (!priv->dir_dev) { | 658 | int (*show)(struct seq_file *, void *); |
698 | RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", | 659 | }; |
699 | dev->name); | ||
700 | return; | ||
701 | } | ||
702 | e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, | ||
703 | priv->dir_dev, proc_get_stats_rx, dev); | ||
704 | |||
705 | if (!e) { | ||
706 | RT_TRACE(COMP_ERR,"Unable to initialize " | ||
707 | "/proc/net/rtl8192/%s/stats-rx\n", | ||
708 | dev->name); | ||
709 | } | ||
710 | |||
711 | 660 | ||
712 | e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, | 661 | static const struct rtl8192_proc_file rtl8192_proc_files[] = { |
713 | priv->dir_dev, proc_get_stats_tx, dev); | 662 | { "stats-rx", &proc_get_stats_rx }, |
663 | { "stats-tx", &proc_get_stats_tx }, | ||
664 | { "stats-ap", &proc_get_stats_ap }, | ||
665 | { "registers", &proc_get_registers }, | ||
666 | { "" } | ||
667 | }; | ||
714 | 668 | ||
715 | if (!e) { | 669 | void rtl8192_proc_init_one(struct net_device *dev) |
716 | RT_TRACE(COMP_ERR, "Unable to initialize " | 670 | { |
717 | "/proc/net/rtl8192/%s/stats-tx\n", | 671 | const struct rtl8192_proc_file *f; |
718 | dev->name); | 672 | struct proc_dir_entry *dir; |
719 | } | ||
720 | 673 | ||
721 | e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, | 674 | if (rtl8192_proc) { |
722 | priv->dir_dev, proc_get_stats_ap, dev); | 675 | dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev); |
676 | if (!dir) { | ||
677 | RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", | ||
678 | dev->name); | ||
679 | return; | ||
680 | } | ||
723 | 681 | ||
724 | if (!e) { | 682 | for (f = rtl8192_proc_files; f->name[0]; f++) { |
725 | RT_TRACE(COMP_ERR, "Unable to initialize " | 683 | if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, |
726 | "/proc/net/rtl8192/%s/stats-ap\n", | 684 | &rtl8192_proc_fops, f->show)) { |
727 | dev->name); | 685 | RT_TRACE(COMP_ERR, "Unable to initialize " |
686 | "/proc/net/rtl8192/%s/%s\n", | ||
687 | dev->name, f->name); | ||
688 | return; | ||
689 | } | ||
690 | } | ||
728 | } | 691 | } |
692 | } | ||
729 | 693 | ||
730 | e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, | 694 | void rtl8192_proc_remove_one(struct net_device *dev) |
731 | priv->dir_dev, proc_get_registers, dev); | 695 | { |
732 | if (!e) { | 696 | remove_proc_subtree(dev->name, rtl8192_proc); |
733 | RT_TRACE(COMP_ERR, "Unable to initialize " | ||
734 | "/proc/net/rtl8192/%s/registers\n", | ||
735 | dev->name); | ||
736 | } | ||
737 | } | 697 | } |
698 | |||
738 | /**************************************************************************** | 699 | /**************************************************************************** |
739 | -----------------------------MISC STUFF------------------------- | 700 | -----------------------------MISC STUFF------------------------- |
740 | *****************************************************************************/ | 701 | *****************************************************************************/ |
diff --git a/drivers/staging/rts5139/rts51x_scsi.c b/drivers/staging/rts5139/rts51x_scsi.c index b58f1dfe006d..610870546406 100644 --- a/drivers/staging/rts5139/rts51x_scsi.c +++ b/drivers/staging/rts5139/rts51x_scsi.c | |||
@@ -1968,18 +1968,16 @@ int slave_configure(struct scsi_device *sdev) | |||
1968 | 1968 | ||
1969 | /* we use this macro to help us write into the buffer */ | 1969 | /* we use this macro to help us write into the buffer */ |
1970 | #undef SPRINTF | 1970 | #undef SPRINTF |
1971 | #define SPRINTF(args...) \ | 1971 | #define SPRINTF(args...) seq_printf(m, ##args) |
1972 | do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0) | ||
1973 | 1972 | ||
1974 | int proc_info(struct Scsi_Host *host, char *buffer, | 1973 | static int write_info(struct Scsi_Host *host, char *buffer, int length) |
1975 | char **start, off_t offset, int length, int inout) | ||
1976 | { | 1974 | { |
1977 | char *pos = buffer; | ||
1978 | |||
1979 | /* if someone is sending us data, just throw it away */ | 1975 | /* if someone is sending us data, just throw it away */ |
1980 | if (inout) | 1976 | return length; |
1981 | return length; | 1977 | } |
1982 | 1978 | ||
1979 | static int show_info(struct seq_file *m, struct Scsi_Host *host) | ||
1980 | { | ||
1983 | /* print the controller name */ | 1981 | /* print the controller name */ |
1984 | SPRINTF(" Host scsi%d: %s\n", host->host_no, RTS51X_NAME); | 1982 | SPRINTF(" Host scsi%d: %s\n", host->host_no, RTS51X_NAME); |
1985 | 1983 | ||
@@ -1988,18 +1986,7 @@ int proc_info(struct Scsi_Host *host, char *buffer, | |||
1988 | SPRINTF(" Product: RTS51xx USB Card Reader\n"); | 1986 | SPRINTF(" Product: RTS51xx USB Card Reader\n"); |
1989 | SPRINTF(" Version: %s\n", DRIVER_VERSION); | 1987 | SPRINTF(" Version: %s\n", DRIVER_VERSION); |
1990 | SPRINTF(" Build: %s\n", __TIME__); | 1988 | SPRINTF(" Build: %s\n", __TIME__); |
1991 | 1989 | return 0; | |
1992 | /* | ||
1993 | * Calculate start of next buffer, and return value. | ||
1994 | */ | ||
1995 | *start = buffer + offset; | ||
1996 | |||
1997 | if ((pos - buffer) < offset) | ||
1998 | return 0; | ||
1999 | else if ((pos - buffer - offset) < length) | ||
2000 | return pos - buffer - offset; | ||
2001 | else | ||
2002 | return length; | ||
2003 | } | 1990 | } |
2004 | 1991 | ||
2005 | /* queue a command */ | 1992 | /* queue a command */ |
@@ -2100,7 +2087,8 @@ struct scsi_host_template rts51x_host_template = { | |||
2100 | /* basic userland interface stuff */ | 2087 | /* basic userland interface stuff */ |
2101 | .name = RTS51X_NAME, | 2088 | .name = RTS51X_NAME, |
2102 | .proc_name = RTS51X_NAME, | 2089 | .proc_name = RTS51X_NAME, |
2103 | .proc_info = proc_info, | 2090 | .show_info = show_info, |
2091 | .write_info = write_info, | ||
2104 | .info = rts5139_info, | 2092 | .info = rts5139_info, |
2105 | 2093 | ||
2106 | /* command interface -- queued only */ | 2094 | /* command interface -- queued only */ |
diff --git a/drivers/staging/rts5139/rts51x_scsi.h b/drivers/staging/rts5139/rts51x_scsi.h index 3a5213611d21..1a0d70566186 100644 --- a/drivers/staging/rts5139/rts51x_scsi.h +++ b/drivers/staging/rts5139/rts51x_scsi.h | |||
@@ -147,8 +147,6 @@ struct scsi_cmnd; | |||
147 | 147 | ||
148 | int slave_alloc(struct scsi_device *sdev); | 148 | int slave_alloc(struct scsi_device *sdev); |
149 | int slave_configure(struct scsi_device *sdev); | 149 | int slave_configure(struct scsi_device *sdev); |
150 | int proc_info(struct Scsi_Host *host, char *buffer, | ||
151 | char **start, off_t offset, int length, int inout); | ||
152 | int queuecommand(struct Scsi_Host *, struct scsi_cmnd *); | 150 | int queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
153 | int command_abort(struct scsi_cmnd *srb); | 151 | int command_abort(struct scsi_cmnd *srb); |
154 | int bus_reset(struct scsi_cmnd *srb); | 152 | int bus_reset(struct scsi_cmnd *srb); |
diff --git a/drivers/staging/silicom/Makefile b/drivers/staging/silicom/Makefile index 80e6d12d156b..ca8359481c48 100644 --- a/drivers/staging/silicom/Makefile +++ b/drivers/staging/silicom/Makefile | |||
@@ -4,6 +4,3 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_BPCTL) += bpctl_mod.o | 5 | obj-$(CONFIG_BPCTL) += bpctl_mod.o |
6 | obj-$(CONFIG_SBYPASS) += bypasslib/ | 6 | obj-$(CONFIG_SBYPASS) += bypasslib/ |
7 | |||
8 | |||
9 | bpctl_mod-objs := bp_mod.o bp_proc.o | ||
diff --git a/drivers/staging/silicom/bp_proc.c b/drivers/staging/silicom/bp_proc.c deleted file mode 100644 index a01ca97b7665..000000000000 --- a/drivers/staging/silicom/bp_proc.c +++ /dev/null | |||
@@ -1,1327 +0,0 @@ | |||
1 | /******************************************************************************/ | ||
2 | /* */ | ||
3 | /* Copyright (c) 2004-2006 Silicom, Ltd */ | ||
4 | /* All rights reserved. */ | ||
5 | /* */ | ||
6 | /* This program is free software; you can redistribute it and/or modify */ | ||
7 | /* it under the terms of the GNU General Public License as published by */ | ||
8 | /* the Free Software Foundation, located in the file LICENSE. */ | ||
9 | /* */ | ||
10 | /* */ | ||
11 | /******************************************************************************/ | ||
12 | |||
13 | #if defined(CONFIG_SMP) && !defined(__SMP__) | ||
14 | #define __SMP__ | ||
15 | #endif | ||
16 | |||
17 | #include <linux/proc_fs.h> | ||
18 | #include <linux/netdevice.h> | ||
19 | #include <asm/uaccess.h> | ||
20 | /* #include <linux/smp_lock.h> */ | ||
21 | #include "bp_mod.h" | ||
22 | |||
23 | #define BP_PROC_DIR "bypass" | ||
24 | /* #define BYPASS_SUPPORT "bypass" */ | ||
25 | |||
26 | #ifdef BYPASS_SUPPORT | ||
27 | |||
28 | #define GPIO6_SET_ENTRY_SD "gpio6_set" | ||
29 | #define GPIO6_CLEAR_ENTRY_SD "gpio6_clear" | ||
30 | |||
31 | #define GPIO7_SET_ENTRY_SD "gpio7_set" | ||
32 | #define GPIO7_CLEAR_ENTRY_SD "gpio7_clear" | ||
33 | |||
34 | #define PULSE_SET_ENTRY_SD "pulse_set" | ||
35 | #define ZERO_SET_ENTRY_SD "zero_set" | ||
36 | #define PULSE_GET1_ENTRY_SD "pulse_get1" | ||
37 | #define PULSE_GET2_ENTRY_SD "pulse_get2" | ||
38 | |||
39 | #define CMND_ON_ENTRY_SD "cmnd_on" | ||
40 | #define CMND_OFF_ENTRY_SD "cmnd_off" | ||
41 | #define RESET_CONT_ENTRY_SD "reset_cont" | ||
42 | |||
43 | /*COMMANDS*/ | ||
44 | #define BYPASS_INFO_ENTRY_SD "bypass_info" | ||
45 | #define BYPASS_SLAVE_ENTRY_SD "bypass_slave" | ||
46 | #define BYPASS_CAPS_ENTRY_SD "bypass_caps" | ||
47 | #define WD_SET_CAPS_ENTRY_SD "wd_set_caps" | ||
48 | #define BYPASS_ENTRY_SD "bypass" | ||
49 | #define BYPASS_CHANGE_ENTRY_SD "bypass_change" | ||
50 | #define BYPASS_WD_ENTRY_SD "bypass_wd" | ||
51 | #define WD_EXPIRE_TIME_ENTRY_SD "wd_expire_time" | ||
52 | #define RESET_BYPASS_WD_ENTRY_SD "reset_bypass_wd" | ||
53 | #define DIS_BYPASS_ENTRY_SD "dis_bypass" | ||
54 | #define BYPASS_PWUP_ENTRY_SD "bypass_pwup" | ||
55 | #define BYPASS_PWOFF_ENTRY_SD "bypass_pwoff" | ||
56 | #define STD_NIC_ENTRY_SD "std_nic" | ||
57 | #define STD_NIC_ENTRY_SD "std_nic" | ||
58 | #define TAP_ENTRY_SD "tap" | ||
59 | #define TAP_CHANGE_ENTRY_SD "tap_change" | ||
60 | #define DIS_TAP_ENTRY_SD "dis_tap" | ||
61 | #define TAP_PWUP_ENTRY_SD "tap_pwup" | ||
62 | #define TWO_PORT_LINK_ENTRY_SD "two_port_link" | ||
63 | #define WD_EXP_MODE_ENTRY_SD "wd_exp_mode" | ||
64 | #define WD_AUTORESET_ENTRY_SD "wd_autoreset" | ||
65 | #define TPL_ENTRY_SD "tpl" | ||
66 | #define WAIT_AT_PWUP_ENTRY_SD "wait_at_pwup" | ||
67 | #define HW_RESET_ENTRY_SD "hw_reset" | ||
68 | #define DISC_ENTRY_SD "disc" | ||
69 | #define DISC_CHANGE_ENTRY_SD "disc_change" | ||
70 | #define DIS_DISC_ENTRY_SD "dis_disc" | ||
71 | #define DISC_PWUP_ENTRY_SD "disc_pwup" | ||
72 | |||
73 | static struct proc_dir_entry *bp_procfs_dir; | ||
74 | |||
75 | static struct proc_dir_entry *proc_getdir(char *name, | ||
76 | struct proc_dir_entry *proc_dir) | ||
77 | { | ||
78 | struct proc_dir_entry *pde = proc_dir; | ||
79 | for (pde = pde->subdir; pde; pde = pde->next) { | ||
80 | if (pde->namelen && (strcmp(name, pde->name) == 0)) { | ||
81 | /* directory exists */ | ||
82 | break; | ||
83 | } | ||
84 | } | ||
85 | if (pde == (struct proc_dir_entry *)0) { | ||
86 | /* create the directory */ | ||
87 | pde = create_proc_entry(name, S_IFDIR, proc_dir); | ||
88 | if (pde == (struct proc_dir_entry *)0) | ||
89 | return pde; | ||
90 | } | ||
91 | return pde; | ||
92 | } | ||
93 | |||
94 | int | ||
95 | bypass_proc_create_entry_sd(struct pfs_unit *pfs_unit_curr, | ||
96 | char *proc_name, | ||
97 | write_proc_t *write_proc, | ||
98 | read_proc_t *read_proc, | ||
99 | struct proc_dir_entry *parent_pfs, void *data) | ||
100 | { | ||
101 | strcpy(pfs_unit_curr->proc_name, proc_name); | ||
102 | pfs_unit_curr->proc_entry = create_proc_entry(pfs_unit_curr->proc_name, | ||
103 | S_IFREG | S_IRUSR | | ||
104 | S_IWUSR | S_IRGRP | | ||
105 | S_IROTH, parent_pfs); | ||
106 | if (pfs_unit_curr->proc_entry == 0) | ||
107 | return -1; | ||
108 | |||
109 | pfs_unit_curr->proc_entry->read_proc = read_proc; | ||
110 | pfs_unit_curr->proc_entry->write_proc = write_proc; | ||
111 | pfs_unit_curr->proc_entry->data = data; | ||
112 | |||
113 | return 0; | ||
114 | |||
115 | } | ||
116 | |||
117 | int | ||
118 | get_bypass_info_pfs(char *page, char **start, off_t off, int count, | ||
119 | int *eof, void *data) | ||
120 | { | ||
121 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
122 | int len = 0; | ||
123 | |||
124 | len += sprintf(page, "Name\t\t\t%s\n", pbp_device_block->bp_name); | ||
125 | len += | ||
126 | sprintf(page + len, "Firmware version\t0x%x\n", | ||
127 | pbp_device_block->bp_fw_ver); | ||
128 | |||
129 | *eof = 1; | ||
130 | return len; | ||
131 | } | ||
132 | |||
133 | int | ||
134 | get_bypass_slave_pfs(char *page, char **start, off_t off, int count, | ||
135 | int *eof, void *data) | ||
136 | { | ||
137 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
138 | |||
139 | struct pci_dev *pci_slave_dev = pbp_device_block->bp_slave; | ||
140 | struct net_device *net_slave_dev; | ||
141 | int len = 0; | ||
142 | |||
143 | if (is_bypass_fn(pbp_device_block)) { | ||
144 | net_slave_dev = pci_get_drvdata(pci_slave_dev); | ||
145 | if (net_slave_dev) | ||
146 | len = sprintf(page, "%s\n", net_slave_dev->name); | ||
147 | else | ||
148 | len = sprintf(page, "fail\n"); | ||
149 | } else | ||
150 | len = sprintf(page, "fail\n"); | ||
151 | |||
152 | *eof = 1; | ||
153 | return len; | ||
154 | } | ||
155 | |||
156 | int | ||
157 | get_bypass_caps_pfs(char *page, char **start, off_t off, int count, | ||
158 | int *eof, void *data) | ||
159 | { | ||
160 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
161 | |||
162 | int len = 0, ret = 0; | ||
163 | |||
164 | ret = get_bypass_caps_fn(pbp_device_block); | ||
165 | if (ret == BP_NOT_CAP) | ||
166 | len = sprintf(page, "-1\n"); | ||
167 | else | ||
168 | len = sprintf(page, "0x%x\n", ret); | ||
169 | *eof = 1; | ||
170 | return len; | ||
171 | |||
172 | } | ||
173 | |||
174 | int | ||
175 | get_wd_set_caps_pfs(char *page, char **start, off_t off, int count, | ||
176 | int *eof, void *data) | ||
177 | { | ||
178 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
179 | |||
180 | int len = 0, ret = 0; | ||
181 | |||
182 | ret = get_wd_set_caps_fn(pbp_device_block); | ||
183 | if (ret == BP_NOT_CAP) | ||
184 | len = sprintf(page, "-1\n"); | ||
185 | else | ||
186 | len = sprintf(page, "0x%x\n", ret); | ||
187 | *eof = 1; | ||
188 | return len; | ||
189 | } | ||
190 | |||
191 | int | ||
192 | set_bypass_pfs(struct file *file, const char *buffer, | ||
193 | unsigned long count, void *data) | ||
194 | { | ||
195 | |||
196 | char kbuf[256]; | ||
197 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
198 | |||
199 | int bypass_param = 0, length = 0; | ||
200 | |||
201 | if (count > (sizeof(kbuf) - 1)) | ||
202 | return -1; | ||
203 | |||
204 | if (copy_from_user(&kbuf, buffer, count)) | ||
205 | return -1; | ||
206 | |||
207 | kbuf[count] = '\0'; | ||
208 | length = strlen(kbuf); | ||
209 | if (kbuf[length - 1] == '\n') | ||
210 | kbuf[--length] = '\0'; | ||
211 | |||
212 | if (strcmp(kbuf, "on") == 0) | ||
213 | bypass_param = 1; | ||
214 | else if (strcmp(kbuf, "off") == 0) | ||
215 | bypass_param = 0; | ||
216 | |||
217 | set_bypass_fn(pbp_device_block, bypass_param); | ||
218 | |||
219 | return count; | ||
220 | } | ||
221 | |||
222 | int | ||
223 | set_tap_pfs(struct file *file, const char *buffer, | ||
224 | unsigned long count, void *data) | ||
225 | { | ||
226 | |||
227 | char kbuf[256]; | ||
228 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
229 | |||
230 | int tap_param = 0, length = 0; | ||
231 | |||
232 | if (count > (sizeof(kbuf) - 1)) | ||
233 | return -1; | ||
234 | |||
235 | if (copy_from_user(&kbuf, buffer, count)) | ||
236 | return -1; | ||
237 | |||
238 | kbuf[count] = '\0'; | ||
239 | length = strlen(kbuf); | ||
240 | if (kbuf[length - 1] == '\n') | ||
241 | kbuf[--length] = '\0'; | ||
242 | |||
243 | if (strcmp(kbuf, "on") == 0) | ||
244 | tap_param = 1; | ||
245 | else if (strcmp(kbuf, "off") == 0) | ||
246 | tap_param = 0; | ||
247 | |||
248 | set_tap_fn(pbp_device_block, tap_param); | ||
249 | |||
250 | return count; | ||
251 | } | ||
252 | |||
253 | int | ||
254 | set_disc_pfs(struct file *file, const char *buffer, | ||
255 | unsigned long count, void *data) | ||
256 | { | ||
257 | |||
258 | char kbuf[256]; | ||
259 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
260 | |||
261 | int tap_param = 0, length = 0; | ||
262 | |||
263 | if (count > (sizeof(kbuf) - 1)) | ||
264 | return -1; | ||
265 | |||
266 | if (copy_from_user(&kbuf, buffer, count)) | ||
267 | return -1; | ||
268 | |||
269 | kbuf[count] = '\0'; | ||
270 | length = strlen(kbuf); | ||
271 | if (kbuf[length - 1] == '\n') | ||
272 | kbuf[--length] = '\0'; | ||
273 | |||
274 | if (strcmp(kbuf, "on") == 0) | ||
275 | tap_param = 1; | ||
276 | else if (strcmp(kbuf, "off") == 0) | ||
277 | tap_param = 0; | ||
278 | |||
279 | set_disc_fn(pbp_device_block, tap_param); | ||
280 | |||
281 | return count; | ||
282 | } | ||
283 | |||
284 | int | ||
285 | get_bypass_pfs(char *page, char **start, off_t off, int count, | ||
286 | int *eof, void *data) | ||
287 | { | ||
288 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
289 | |||
290 | int len = 0, ret = 0; | ||
291 | |||
292 | ret = get_bypass_fn(pbp_device_block); | ||
293 | if (ret == BP_NOT_CAP) | ||
294 | len = sprintf(page, "fail\n"); | ||
295 | else if (ret == 1) | ||
296 | len = sprintf(page, "on\n"); | ||
297 | else if (ret == 0) | ||
298 | len = sprintf(page, "off\n"); | ||
299 | |||
300 | *eof = 1; | ||
301 | return len; | ||
302 | } | ||
303 | |||
304 | int | ||
305 | get_tap_pfs(char *page, char **start, off_t off, int count, | ||
306 | int *eof, void *data) | ||
307 | { | ||
308 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
309 | |||
310 | int len = 0, ret = 0; | ||
311 | |||
312 | ret = get_tap_fn(pbp_device_block); | ||
313 | if (ret == BP_NOT_CAP) | ||
314 | len = sprintf(page, "fail\n"); | ||
315 | else if (ret == 1) | ||
316 | len = sprintf(page, "on\n"); | ||
317 | else if (ret == 0) | ||
318 | len = sprintf(page, "off\n"); | ||
319 | |||
320 | *eof = 1; | ||
321 | return len; | ||
322 | } | ||
323 | |||
324 | int | ||
325 | get_disc_pfs(char *page, char **start, off_t off, int count, | ||
326 | int *eof, void *data) | ||
327 | { | ||
328 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
329 | |||
330 | int len = 0, ret = 0; | ||
331 | |||
332 | ret = get_disc_fn(pbp_device_block); | ||
333 | if (ret == BP_NOT_CAP) | ||
334 | len = sprintf(page, "fail\n"); | ||
335 | else if (ret == 1) | ||
336 | len = sprintf(page, "on\n"); | ||
337 | else if (ret == 0) | ||
338 | len = sprintf(page, "off\n"); | ||
339 | |||
340 | *eof = 1; | ||
341 | return len; | ||
342 | } | ||
343 | |||
344 | int | ||
345 | get_bypass_change_pfs(char *page, char **start, off_t off, int count, | ||
346 | int *eof, void *data) | ||
347 | { | ||
348 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
349 | |||
350 | int len = 0, ret = 0; | ||
351 | |||
352 | ret = get_bypass_change_fn(pbp_device_block); | ||
353 | if (ret == 1) | ||
354 | len = sprintf(page, "on\n"); | ||
355 | else if (ret == 0) | ||
356 | len = sprintf(page, "off\n"); | ||
357 | else | ||
358 | len = sprintf(page, "fail\n"); | ||
359 | |||
360 | *eof = 1; | ||
361 | return len; | ||
362 | } | ||
363 | |||
364 | int | ||
365 | get_tap_change_pfs(char *page, char **start, off_t off, int count, | ||
366 | int *eof, void *data) | ||
367 | { | ||
368 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
369 | |||
370 | int len = 0, ret = 0; | ||
371 | |||
372 | ret = get_tap_change_fn(pbp_device_block); | ||
373 | if (ret == 1) | ||
374 | len = sprintf(page, "on\n"); | ||
375 | else if (ret == 0) | ||
376 | len = sprintf(page, "off\n"); | ||
377 | else | ||
378 | len = sprintf(page, "fail\n"); | ||
379 | |||
380 | *eof = 1; | ||
381 | return len; | ||
382 | } | ||
383 | |||
384 | int | ||
385 | get_disc_change_pfs(char *page, char **start, off_t off, int count, | ||
386 | int *eof, void *data) | ||
387 | { | ||
388 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
389 | |||
390 | int len = 0, ret = 0; | ||
391 | |||
392 | ret = get_disc_change_fn(pbp_device_block); | ||
393 | if (ret == 1) | ||
394 | len = sprintf(page, "on\n"); | ||
395 | else if (ret == 0) | ||
396 | len = sprintf(page, "off\n"); | ||
397 | else | ||
398 | len = sprintf(page, "fail\n"); | ||
399 | |||
400 | *eof = 1; | ||
401 | return len; | ||
402 | } | ||
403 | |||
404 | int | ||
405 | set_bypass_wd_pfs(struct file *file, const char *buffer, | ||
406 | unsigned long count, void *data) | ||
407 | { | ||
408 | |||
409 | char kbuf[256]; | ||
410 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
411 | |||
412 | unsigned int timeout = 0; | ||
413 | char *timeout_ptr = kbuf; | ||
414 | |||
415 | if (copy_from_user(&kbuf, buffer, count)) | ||
416 | return -1; | ||
417 | |||
418 | timeout_ptr = kbuf; | ||
419 | timeout = atoi(&timeout_ptr); | ||
420 | |||
421 | set_bypass_wd_fn(pbp_device_block, timeout); | ||
422 | |||
423 | return count; | ||
424 | } | ||
425 | |||
426 | int | ||
427 | get_bypass_wd_pfs(char *page, char **start, off_t off, int count, | ||
428 | int *eof, void *data) | ||
429 | { | ||
430 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
431 | |||
432 | int len = 0, ret = 0, timeout = 0; | ||
433 | |||
434 | ret = get_bypass_wd_fn(pbp_device_block, &timeout); | ||
435 | if (ret == BP_NOT_CAP) | ||
436 | len = sprintf(page, "fail\n"); | ||
437 | else if (timeout == -1) | ||
438 | len = sprintf(page, "unknown\n"); | ||
439 | else if (timeout == 0) | ||
440 | len = sprintf(page, "disable\n"); | ||
441 | else | ||
442 | len = sprintf(page, "%d\n", timeout); | ||
443 | |||
444 | *eof = 1; | ||
445 | return len; | ||
446 | } | ||
447 | |||
448 | int | ||
449 | get_wd_expire_time_pfs(char *page, char **start, off_t off, int count, | ||
450 | int *eof, void *data) | ||
451 | { | ||
452 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
453 | |||
454 | int len = 0, ret = 0, timeout = 0; | ||
455 | |||
456 | ret = get_wd_expire_time_fn(pbp_device_block, &timeout); | ||
457 | if (ret == BP_NOT_CAP) | ||
458 | len = sprintf(page, "fail\n"); | ||
459 | else if (timeout == -1) | ||
460 | len = sprintf(page, "expire\n"); | ||
461 | else if (timeout == 0) | ||
462 | len = sprintf(page, "disable\n"); | ||
463 | |||
464 | else | ||
465 | len = sprintf(page, "%d\n", timeout); | ||
466 | *eof = 1; | ||
467 | return len; | ||
468 | } | ||
469 | |||
470 | int | ||
471 | get_tpl_pfs(char *page, char **start, off_t off, int count, | ||
472 | int *eof, void *data) | ||
473 | { | ||
474 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
475 | |||
476 | int len = 0, ret = 0; | ||
477 | |||
478 | ret = get_tpl_fn(pbp_device_block); | ||
479 | if (ret == BP_NOT_CAP) | ||
480 | len = sprintf(page, "fail\n"); | ||
481 | else if (ret == 1) | ||
482 | len = sprintf(page, "on\n"); | ||
483 | else if (ret == 0) | ||
484 | len = sprintf(page, "off\n"); | ||
485 | |||
486 | *eof = 1; | ||
487 | return len; | ||
488 | } | ||
489 | |||
490 | #ifdef PMC_FIX_FLAG | ||
491 | int | ||
492 | get_wait_at_pwup_pfs(char *page, char **start, off_t off, int count, | ||
493 | int *eof, void *data) | ||
494 | { | ||
495 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
496 | |||
497 | int len = 0, ret = 0; | ||
498 | |||
499 | ret = get_bp_wait_at_pwup_fn(pbp_device_block); | ||
500 | if (ret == BP_NOT_CAP) | ||
501 | len = sprintf(page, "fail\n"); | ||
502 | else if (ret == 1) | ||
503 | len = sprintf(page, "on\n"); | ||
504 | else if (ret == 0) | ||
505 | len = sprintf(page, "off\n"); | ||
506 | |||
507 | *eof = 1; | ||
508 | return len; | ||
509 | } | ||
510 | |||
511 | int | ||
512 | get_hw_reset_pfs(char *page, char **start, off_t off, int count, | ||
513 | int *eof, void *data) | ||
514 | { | ||
515 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
516 | |||
517 | int len = 0, ret = 0; | ||
518 | |||
519 | ret = get_bp_hw_reset_fn(pbp_device_block); | ||
520 | if (ret == BP_NOT_CAP) | ||
521 | len = sprintf(page, "fail\n"); | ||
522 | else if (ret == 1) | ||
523 | len = sprintf(page, "on\n"); | ||
524 | else if (ret == 0) | ||
525 | len = sprintf(page, "off\n"); | ||
526 | |||
527 | *eof = 1; | ||
528 | return len; | ||
529 | } | ||
530 | |||
531 | #endif /*PMC_WAIT_FLAG */ | ||
532 | |||
533 | int | ||
534 | reset_bypass_wd_pfs(char *page, char **start, off_t off, int count, | ||
535 | int *eof, void *data) | ||
536 | { | ||
537 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
538 | |||
539 | int len = 0, ret = 0; | ||
540 | |||
541 | ret = reset_bypass_wd_timer_fn(pbp_device_block); | ||
542 | if (ret == BP_NOT_CAP) | ||
543 | len = sprintf(page, "fail\n"); | ||
544 | else if (ret == 0) | ||
545 | len = sprintf(page, "disable\n"); | ||
546 | else if (ret == 1) | ||
547 | len = sprintf(page, "success\n"); | ||
548 | |||
549 | *eof = 1; | ||
550 | return len; | ||
551 | } | ||
552 | |||
553 | int | ||
554 | set_dis_bypass_pfs(struct file *file, const char *buffer, | ||
555 | unsigned long count, void *data) | ||
556 | { | ||
557 | |||
558 | char kbuf[256]; | ||
559 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
560 | |||
561 | int bypass_param = 0, length = 0; | ||
562 | |||
563 | if (copy_from_user(&kbuf, buffer, count)) | ||
564 | return -1; | ||
565 | |||
566 | kbuf[count] = '\0'; | ||
567 | length = strlen(kbuf); | ||
568 | if (kbuf[length - 1] == '\n') | ||
569 | kbuf[--length] = '\0'; | ||
570 | |||
571 | if (strcmp(kbuf, "on") == 0) | ||
572 | bypass_param = 1; | ||
573 | else if (strcmp(kbuf, "off") == 0) | ||
574 | bypass_param = 0; | ||
575 | |||
576 | set_dis_bypass_fn(pbp_device_block, bypass_param); | ||
577 | |||
578 | return count; | ||
579 | } | ||
580 | |||
581 | int | ||
582 | set_dis_tap_pfs(struct file *file, const char *buffer, | ||
583 | unsigned long count, void *data) | ||
584 | { | ||
585 | |||
586 | char kbuf[256]; | ||
587 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
588 | |||
589 | int tap_param = 0, length = 0; | ||
590 | |||
591 | if (copy_from_user(&kbuf, buffer, count)) | ||
592 | return -1; | ||
593 | |||
594 | kbuf[count] = '\0'; | ||
595 | length = strlen(kbuf); | ||
596 | if (kbuf[length - 1] == '\n') | ||
597 | kbuf[--length] = '\0'; | ||
598 | |||
599 | if (strcmp(kbuf, "on") == 0) | ||
600 | tap_param = 1; | ||
601 | else if (strcmp(kbuf, "off") == 0) | ||
602 | tap_param = 0; | ||
603 | |||
604 | set_dis_tap_fn(pbp_device_block, tap_param); | ||
605 | |||
606 | return count; | ||
607 | } | ||
608 | |||
609 | int | ||
610 | set_dis_disc_pfs(struct file *file, const char *buffer, | ||
611 | unsigned long count, void *data) | ||
612 | { | ||
613 | |||
614 | char kbuf[256]; | ||
615 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
616 | |||
617 | int tap_param = 0, length = 0; | ||
618 | |||
619 | if (copy_from_user(&kbuf, buffer, count)) | ||
620 | return -1; | ||
621 | |||
622 | kbuf[count] = '\0'; | ||
623 | length = strlen(kbuf); | ||
624 | if (kbuf[length - 1] == '\n') | ||
625 | kbuf[--length] = '\0'; | ||
626 | |||
627 | if (strcmp(kbuf, "on") == 0) | ||
628 | tap_param = 1; | ||
629 | else if (strcmp(kbuf, "off") == 0) | ||
630 | tap_param = 0; | ||
631 | |||
632 | set_dis_disc_fn(pbp_device_block, tap_param); | ||
633 | |||
634 | return count; | ||
635 | } | ||
636 | |||
637 | int | ||
638 | get_dis_bypass_pfs(char *page, char **start, off_t off, int count, | ||
639 | int *eof, void *data) | ||
640 | { | ||
641 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
642 | |||
643 | int len = 0, ret = 0; | ||
644 | |||
645 | ret = get_dis_bypass_fn(pbp_device_block); | ||
646 | if (ret == BP_NOT_CAP) | ||
647 | len = sprintf(page, "fail\n"); | ||
648 | else if (ret == 0) | ||
649 | len = sprintf(page, "off\n"); | ||
650 | else | ||
651 | len = sprintf(page, "on\n"); | ||
652 | |||
653 | *eof = 1; | ||
654 | return len; | ||
655 | } | ||
656 | |||
657 | int | ||
658 | get_dis_tap_pfs(char *page, char **start, off_t off, int count, | ||
659 | int *eof, void *data) | ||
660 | { | ||
661 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
662 | |||
663 | int len = 0, ret = 0; | ||
664 | |||
665 | ret = get_dis_tap_fn(pbp_device_block); | ||
666 | if (ret == BP_NOT_CAP) | ||
667 | len = sprintf(page, "fail\n"); | ||
668 | else if (ret == 0) | ||
669 | len = sprintf(page, "off\n"); | ||
670 | else | ||
671 | len = sprintf(page, "on\n"); | ||
672 | |||
673 | *eof = 1; | ||
674 | return len; | ||
675 | } | ||
676 | |||
677 | int | ||
678 | get_dis_disc_pfs(char *page, char **start, off_t off, int count, | ||
679 | int *eof, void *data) | ||
680 | { | ||
681 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
682 | |||
683 | int len = 0, ret = 0; | ||
684 | |||
685 | ret = get_dis_disc_fn(pbp_device_block); | ||
686 | if (ret == BP_NOT_CAP) | ||
687 | len = sprintf(page, "fail\n"); | ||
688 | else if (ret == 0) | ||
689 | len = sprintf(page, "off\n"); | ||
690 | else | ||
691 | len = sprintf(page, "on\n"); | ||
692 | |||
693 | *eof = 1; | ||
694 | return len; | ||
695 | } | ||
696 | |||
697 | int | ||
698 | set_bypass_pwup_pfs(struct file *file, const char *buffer, | ||
699 | unsigned long count, void *data) | ||
700 | { | ||
701 | |||
702 | char kbuf[256]; | ||
703 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
704 | |||
705 | int bypass_param = 0, length = 0; | ||
706 | |||
707 | if (copy_from_user(&kbuf, buffer, count)) | ||
708 | return -1; | ||
709 | |||
710 | kbuf[count] = '\0'; | ||
711 | length = strlen(kbuf); | ||
712 | if (kbuf[length - 1] == '\n') | ||
713 | kbuf[--length] = '\0'; | ||
714 | |||
715 | if (strcmp(kbuf, "on") == 0) | ||
716 | bypass_param = 1; | ||
717 | else if (strcmp(kbuf, "off") == 0) | ||
718 | bypass_param = 0; | ||
719 | |||
720 | set_bypass_pwup_fn(pbp_device_block, bypass_param); | ||
721 | |||
722 | return count; | ||
723 | } | ||
724 | |||
725 | int | ||
726 | set_bypass_pwoff_pfs(struct file *file, const char *buffer, | ||
727 | unsigned long count, void *data) | ||
728 | { | ||
729 | |||
730 | char kbuf[256]; | ||
731 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
732 | |||
733 | int bypass_param = 0, length = 0; | ||
734 | |||
735 | if (copy_from_user(&kbuf, buffer, count)) | ||
736 | return -1; | ||
737 | |||
738 | kbuf[count] = '\0'; | ||
739 | length = strlen(kbuf); | ||
740 | if (kbuf[length - 1] == '\n') | ||
741 | kbuf[--length] = '\0'; | ||
742 | |||
743 | if (strcmp(kbuf, "on") == 0) | ||
744 | bypass_param = 1; | ||
745 | else if (strcmp(kbuf, "off") == 0) | ||
746 | bypass_param = 0; | ||
747 | |||
748 | set_bypass_pwoff_fn(pbp_device_block, bypass_param); | ||
749 | |||
750 | return count; | ||
751 | } | ||
752 | |||
753 | int | ||
754 | set_tap_pwup_pfs(struct file *file, const char *buffer, | ||
755 | unsigned long count, void *data) | ||
756 | { | ||
757 | |||
758 | char kbuf[256]; | ||
759 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
760 | |||
761 | int tap_param = 0, length = 0; | ||
762 | |||
763 | if (copy_from_user(&kbuf, buffer, count)) | ||
764 | return -1; | ||
765 | |||
766 | kbuf[count] = '\0'; | ||
767 | length = strlen(kbuf); | ||
768 | if (kbuf[length - 1] == '\n') | ||
769 | kbuf[--length] = '\0'; | ||
770 | |||
771 | if (strcmp(kbuf, "on") == 0) | ||
772 | tap_param = 1; | ||
773 | else if (strcmp(kbuf, "off") == 0) | ||
774 | tap_param = 0; | ||
775 | |||
776 | set_tap_pwup_fn(pbp_device_block, tap_param); | ||
777 | |||
778 | return count; | ||
779 | } | ||
780 | |||
781 | int | ||
782 | set_disc_pwup_pfs(struct file *file, const char *buffer, | ||
783 | unsigned long count, void *data) | ||
784 | { | ||
785 | |||
786 | char kbuf[256]; | ||
787 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
788 | |||
789 | int tap_param = 0, length = 0; | ||
790 | |||
791 | if (copy_from_user(&kbuf, buffer, count)) | ||
792 | return -1; | ||
793 | |||
794 | kbuf[count] = '\0'; | ||
795 | length = strlen(kbuf); | ||
796 | if (kbuf[length - 1] == '\n') | ||
797 | kbuf[--length] = '\0'; | ||
798 | |||
799 | if (strcmp(kbuf, "on") == 0) | ||
800 | tap_param = 1; | ||
801 | else if (strcmp(kbuf, "off") == 0) | ||
802 | tap_param = 0; | ||
803 | |||
804 | set_disc_pwup_fn(pbp_device_block, tap_param); | ||
805 | |||
806 | return count; | ||
807 | } | ||
808 | |||
809 | int | ||
810 | get_bypass_pwup_pfs(char *page, char **start, off_t off, int count, | ||
811 | int *eof, void *data) | ||
812 | { | ||
813 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
814 | |||
815 | int len = 0, ret = 0; | ||
816 | |||
817 | ret = get_bypass_pwup_fn(pbp_device_block); | ||
818 | if (ret == BP_NOT_CAP) | ||
819 | len = sprintf(page, "fail\n"); | ||
820 | else if (ret == 0) | ||
821 | len = sprintf(page, "off\n"); | ||
822 | else | ||
823 | len = sprintf(page, "on\n"); | ||
824 | |||
825 | *eof = 1; | ||
826 | return len; | ||
827 | } | ||
828 | |||
829 | int | ||
830 | get_bypass_pwoff_pfs(char *page, char **start, off_t off, int count, | ||
831 | int *eof, void *data) | ||
832 | { | ||
833 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
834 | |||
835 | int len = 0, ret = 0; | ||
836 | |||
837 | ret = get_bypass_pwoff_fn(pbp_device_block); | ||
838 | if (ret == BP_NOT_CAP) | ||
839 | len = sprintf(page, "fail\n"); | ||
840 | else if (ret == 0) | ||
841 | len = sprintf(page, "off\n"); | ||
842 | else | ||
843 | len = sprintf(page, "on\n"); | ||
844 | |||
845 | *eof = 1; | ||
846 | return len; | ||
847 | } | ||
848 | |||
849 | int | ||
850 | get_tap_pwup_pfs(char *page, char **start, off_t off, int count, | ||
851 | int *eof, void *data) | ||
852 | { | ||
853 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
854 | |||
855 | int len = 0, ret = 0; | ||
856 | |||
857 | ret = get_tap_pwup_fn(pbp_device_block); | ||
858 | if (ret == BP_NOT_CAP) | ||
859 | len = sprintf(page, "fail\n"); | ||
860 | else if (ret == 0) | ||
861 | len = sprintf(page, "off\n"); | ||
862 | else | ||
863 | len = sprintf(page, "on\n"); | ||
864 | |||
865 | *eof = 1; | ||
866 | return len; | ||
867 | } | ||
868 | |||
869 | int | ||
870 | get_disc_pwup_pfs(char *page, char **start, off_t off, int count, | ||
871 | int *eof, void *data) | ||
872 | { | ||
873 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
874 | |||
875 | int len = 0, ret = 0; | ||
876 | |||
877 | ret = get_disc_pwup_fn(pbp_device_block); | ||
878 | if (ret == BP_NOT_CAP) | ||
879 | len = sprintf(page, "fail\n"); | ||
880 | else if (ret == 0) | ||
881 | len = sprintf(page, "off\n"); | ||
882 | else | ||
883 | len = sprintf(page, "on\n"); | ||
884 | |||
885 | *eof = 1; | ||
886 | return len; | ||
887 | } | ||
888 | |||
889 | int | ||
890 | set_std_nic_pfs(struct file *file, const char *buffer, | ||
891 | unsigned long count, void *data) | ||
892 | { | ||
893 | |||
894 | char kbuf[256]; | ||
895 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
896 | |||
897 | int bypass_param = 0, length = 0; | ||
898 | |||
899 | if (copy_from_user(&kbuf, buffer, count)) | ||
900 | return -1; | ||
901 | |||
902 | kbuf[count] = '\0'; | ||
903 | length = strlen(kbuf); | ||
904 | if (kbuf[length - 1] == '\n') | ||
905 | kbuf[--length] = '\0'; | ||
906 | |||
907 | if (strcmp(kbuf, "on") == 0) | ||
908 | bypass_param = 1; | ||
909 | else if (strcmp(kbuf, "off") == 0) | ||
910 | bypass_param = 0; | ||
911 | |||
912 | set_std_nic_fn(pbp_device_block, bypass_param); | ||
913 | |||
914 | return count; | ||
915 | } | ||
916 | |||
917 | int | ||
918 | get_std_nic_pfs(char *page, char **start, off_t off, int count, | ||
919 | int *eof, void *data) | ||
920 | { | ||
921 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
922 | |||
923 | int len = 0, ret = 0; | ||
924 | |||
925 | ret = get_std_nic_fn(pbp_device_block); | ||
926 | if (ret == BP_NOT_CAP) | ||
927 | len = sprintf(page, "fail\n"); | ||
928 | else if (ret == 0) | ||
929 | len = sprintf(page, "off\n"); | ||
930 | else | ||
931 | len = sprintf(page, "on\n"); | ||
932 | |||
933 | *eof = 1; | ||
934 | return len; | ||
935 | } | ||
936 | |||
937 | int | ||
938 | get_wd_exp_mode_pfs(char *page, char **start, off_t off, int count, | ||
939 | int *eof, void *data) | ||
940 | { | ||
941 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
942 | |||
943 | int len = 0, ret = 0; | ||
944 | |||
945 | ret = get_wd_exp_mode_fn(pbp_device_block); | ||
946 | if (ret == 1) | ||
947 | len = sprintf(page, "tap\n"); | ||
948 | else if (ret == 0) | ||
949 | len = sprintf(page, "bypass\n"); | ||
950 | else if (ret == 2) | ||
951 | len = sprintf(page, "disc\n"); | ||
952 | |||
953 | else | ||
954 | len = sprintf(page, "fail\n"); | ||
955 | |||
956 | *eof = 1; | ||
957 | return len; | ||
958 | } | ||
959 | |||
960 | int | ||
961 | set_wd_exp_mode_pfs(struct file *file, const char *buffer, | ||
962 | unsigned long count, void *data) | ||
963 | { | ||
964 | |||
965 | char kbuf[256]; | ||
966 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
967 | |||
968 | int bypass_param = 0, length = 0; | ||
969 | |||
970 | if (count > (sizeof(kbuf) - 1)) | ||
971 | return -1; | ||
972 | |||
973 | if (copy_from_user(&kbuf, buffer, count)) | ||
974 | return -1; | ||
975 | |||
976 | kbuf[count] = '\0'; | ||
977 | length = strlen(kbuf); | ||
978 | if (kbuf[length - 1] == '\n') | ||
979 | kbuf[--length] = '\0'; | ||
980 | |||
981 | if (strcmp(kbuf, "tap") == 0) | ||
982 | bypass_param = 1; | ||
983 | else if (strcmp(kbuf, "bypass") == 0) | ||
984 | bypass_param = 0; | ||
985 | else if (strcmp(kbuf, "disc") == 0) | ||
986 | bypass_param = 2; | ||
987 | |||
988 | set_wd_exp_mode_fn(pbp_device_block, bypass_param); | ||
989 | |||
990 | return count; | ||
991 | } | ||
992 | |||
993 | int | ||
994 | get_wd_autoreset_pfs(char *page, char **start, off_t off, int count, | ||
995 | int *eof, void *data) | ||
996 | { | ||
997 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
998 | |||
999 | int len = 0, ret = 0; | ||
1000 | |||
1001 | ret = get_wd_autoreset_fn(pbp_device_block); | ||
1002 | if (ret >= 0) | ||
1003 | len = sprintf(page, "%d\n", ret); | ||
1004 | else | ||
1005 | len = sprintf(page, "fail\n"); | ||
1006 | |||
1007 | *eof = 1; | ||
1008 | return len; | ||
1009 | } | ||
1010 | |||
1011 | int | ||
1012 | set_wd_autoreset_pfs(struct file *file, const char *buffer, | ||
1013 | unsigned long count, void *data) | ||
1014 | { | ||
1015 | char kbuf[256]; | ||
1016 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
1017 | u32 timeout = 0; | ||
1018 | char *timeout_ptr = kbuf; | ||
1019 | |||
1020 | if (copy_from_user(&kbuf, buffer, count)) | ||
1021 | return -1; | ||
1022 | |||
1023 | timeout_ptr = kbuf; | ||
1024 | timeout = atoi(&timeout_ptr); | ||
1025 | |||
1026 | set_wd_autoreset_fn(pbp_device_block, timeout); | ||
1027 | |||
1028 | return count; | ||
1029 | } | ||
1030 | |||
1031 | int | ||
1032 | set_tpl_pfs(struct file *file, const char *buffer, | ||
1033 | unsigned long count, void *data) | ||
1034 | { | ||
1035 | |||
1036 | char kbuf[256]; | ||
1037 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
1038 | |||
1039 | int tpl_param = 0, length = 0; | ||
1040 | |||
1041 | if (count > (sizeof(kbuf) - 1)) | ||
1042 | return -1; | ||
1043 | |||
1044 | if (copy_from_user(&kbuf, buffer, count)) | ||
1045 | return -1; | ||
1046 | |||
1047 | kbuf[count] = '\0'; | ||
1048 | length = strlen(kbuf); | ||
1049 | if (kbuf[length - 1] == '\n') | ||
1050 | kbuf[--length] = '\0'; | ||
1051 | |||
1052 | if (strcmp(kbuf, "on") == 0) | ||
1053 | tpl_param = 1; | ||
1054 | else if (strcmp(kbuf, "off") == 0) | ||
1055 | tpl_param = 0; | ||
1056 | |||
1057 | set_tpl_fn(pbp_device_block, tpl_param); | ||
1058 | |||
1059 | return count; | ||
1060 | } | ||
1061 | |||
1062 | #ifdef PMC_FIX_FLAG | ||
1063 | int | ||
1064 | set_wait_at_pwup_pfs(struct file *file, const char *buffer, | ||
1065 | unsigned long count, void *data) | ||
1066 | { | ||
1067 | |||
1068 | char kbuf[256]; | ||
1069 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
1070 | |||
1071 | int tpl_param = 0, length = 0; | ||
1072 | |||
1073 | if (count > (sizeof(kbuf) - 1)) | ||
1074 | return -1; | ||
1075 | |||
1076 | if (copy_from_user(&kbuf, buffer, count)) | ||
1077 | return -1; | ||
1078 | |||
1079 | kbuf[count] = '\0'; | ||
1080 | length = strlen(kbuf); | ||
1081 | if (kbuf[length - 1] == '\n') | ||
1082 | kbuf[--length] = '\0'; | ||
1083 | |||
1084 | if (strcmp(kbuf, "on") == 0) | ||
1085 | tpl_param = 1; | ||
1086 | else if (strcmp(kbuf, "off") == 0) | ||
1087 | tpl_param = 0; | ||
1088 | |||
1089 | set_bp_wait_at_pwup_fn(pbp_device_block, tpl_param); | ||
1090 | |||
1091 | return count; | ||
1092 | } | ||
1093 | |||
1094 | int | ||
1095 | set_hw_reset_pfs(struct file *file, const char *buffer, | ||
1096 | unsigned long count, void *data) | ||
1097 | { | ||
1098 | |||
1099 | char kbuf[256]; | ||
1100 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
1101 | |||
1102 | int tpl_param = 0, length = 0; | ||
1103 | |||
1104 | if (count > (sizeof(kbuf) - 1)) | ||
1105 | return -1; | ||
1106 | |||
1107 | if (copy_from_user(&kbuf, buffer, count)) | ||
1108 | return -1; | ||
1109 | |||
1110 | kbuf[count] = '\0'; | ||
1111 | length = strlen(kbuf); | ||
1112 | if (kbuf[length - 1] == '\n') | ||
1113 | kbuf[--length] = '\0'; | ||
1114 | |||
1115 | if (strcmp(kbuf, "on") == 0) | ||
1116 | tpl_param = 1; | ||
1117 | else if (strcmp(kbuf, "off") == 0) | ||
1118 | tpl_param = 0; | ||
1119 | |||
1120 | set_bp_hw_reset_fn(pbp_device_block, tpl_param); | ||
1121 | |||
1122 | return count; | ||
1123 | } | ||
1124 | |||
1125 | #endif /*PMC_FIX_FLAG */ | ||
1126 | |||
1127 | int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block) | ||
1128 | { | ||
1129 | struct bypass_pfs_sd *current_pfs = &(pbp_device_block->bypass_pfs_set); | ||
1130 | static struct proc_dir_entry *procfs_dir; | ||
1131 | int ret = 0; | ||
1132 | |||
1133 | sprintf(current_pfs->dir_name, "bypass_%s", dev->name); | ||
1134 | |||
1135 | if (!bp_procfs_dir) | ||
1136 | return -1; | ||
1137 | |||
1138 | /* create device proc dir */ | ||
1139 | procfs_dir = proc_getdir(current_pfs->dir_name, bp_procfs_dir); | ||
1140 | if (procfs_dir == 0) { | ||
1141 | printk(KERN_DEBUG "Could not create procfs directory %s\n", | ||
1142 | current_pfs->dir_name); | ||
1143 | return -1; | ||
1144 | } | ||
1145 | current_pfs->bypass_entry = procfs_dir; | ||
1146 | |||
1147 | if (bypass_proc_create_entry(&(current_pfs->bypass_info), BYPASS_INFO_ENTRY_SD, NULL, /* write */ | ||
1148 | get_bypass_info_pfs, /* read */ | ||
1149 | procfs_dir, pbp_device_block)) | ||
1150 | ret = -1; | ||
1151 | |||
1152 | if (pbp_device_block->bp_caps & SW_CTL_CAP) { | ||
1153 | |||
1154 | /* Create set param proc's */ | ||
1155 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_slave), BYPASS_SLAVE_ENTRY_SD, NULL, /* write */ | ||
1156 | get_bypass_slave_pfs, /* read */ | ||
1157 | procfs_dir, pbp_device_block)) | ||
1158 | ret = -1; | ||
1159 | |||
1160 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_caps), BYPASS_CAPS_ENTRY_SD, NULL, /* write */ | ||
1161 | get_bypass_caps_pfs, /* read */ | ||
1162 | procfs_dir, pbp_device_block)) | ||
1163 | ret = -1; | ||
1164 | |||
1165 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_set_caps), WD_SET_CAPS_ENTRY_SD, NULL, /* write */ | ||
1166 | get_wd_set_caps_pfs, /* read */ | ||
1167 | procfs_dir, pbp_device_block)) | ||
1168 | ret = -1; | ||
1169 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_wd), BYPASS_WD_ENTRY_SD, set_bypass_wd_pfs, /* write */ | ||
1170 | get_bypass_wd_pfs, /* read */ | ||
1171 | procfs_dir, pbp_device_block)) | ||
1172 | ret = -1; | ||
1173 | |||
1174 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_expire_time), WD_EXPIRE_TIME_ENTRY_SD, NULL, /* write */ | ||
1175 | get_wd_expire_time_pfs, /* read */ | ||
1176 | procfs_dir, pbp_device_block)) | ||
1177 | ret = -1; | ||
1178 | |||
1179 | if (bypass_proc_create_entry_sd(&(current_pfs->reset_bypass_wd), RESET_BYPASS_WD_ENTRY_SD, NULL, /* write */ | ||
1180 | reset_bypass_wd_pfs, /* read */ | ||
1181 | procfs_dir, pbp_device_block)) | ||
1182 | ret = -1; | ||
1183 | |||
1184 | if (bypass_proc_create_entry_sd(&(current_pfs->std_nic), STD_NIC_ENTRY_SD, set_std_nic_pfs, /* write */ | ||
1185 | get_std_nic_pfs, /* read */ | ||
1186 | procfs_dir, pbp_device_block)) | ||
1187 | ret = -1; | ||
1188 | |||
1189 | if (pbp_device_block->bp_caps & BP_CAP) { | ||
1190 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass), BYPASS_ENTRY_SD, set_bypass_pfs, /* write */ | ||
1191 | get_bypass_pfs, /* read */ | ||
1192 | procfs_dir, | ||
1193 | pbp_device_block)) | ||
1194 | ret = -1; | ||
1195 | |||
1196 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_bypass), DIS_BYPASS_ENTRY_SD, set_dis_bypass_pfs, /* write */ | ||
1197 | get_dis_bypass_pfs, /* read */ | ||
1198 | procfs_dir, | ||
1199 | pbp_device_block)) | ||
1200 | ret = -1; | ||
1201 | |||
1202 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwup), BYPASS_PWUP_ENTRY_SD, set_bypass_pwup_pfs, /* write */ | ||
1203 | get_bypass_pwup_pfs, /* read */ | ||
1204 | procfs_dir, | ||
1205 | pbp_device_block)) | ||
1206 | ret = -1; | ||
1207 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwoff), BYPASS_PWOFF_ENTRY_SD, set_bypass_pwoff_pfs, /* write */ | ||
1208 | get_bypass_pwoff_pfs, /* read */ | ||
1209 | procfs_dir, | ||
1210 | pbp_device_block)) | ||
1211 | ret = -1; | ||
1212 | |||
1213 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_change), BYPASS_CHANGE_ENTRY_SD, NULL, /* write */ | ||
1214 | get_bypass_change_pfs, /* read */ | ||
1215 | procfs_dir, | ||
1216 | pbp_device_block)) | ||
1217 | ret = -1; | ||
1218 | } | ||
1219 | |||
1220 | if (pbp_device_block->bp_caps & TAP_CAP) { | ||
1221 | |||
1222 | if (bypass_proc_create_entry_sd(&(current_pfs->tap), TAP_ENTRY_SD, set_tap_pfs, /* write */ | ||
1223 | get_tap_pfs, /* read */ | ||
1224 | procfs_dir, | ||
1225 | pbp_device_block)) | ||
1226 | ret = -1; | ||
1227 | |||
1228 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), DIS_TAP_ENTRY_SD, set_dis_tap_pfs, /* write */ | ||
1229 | get_dis_tap_pfs, /* read */ | ||
1230 | procfs_dir, | ||
1231 | pbp_device_block)) | ||
1232 | ret = -1; | ||
1233 | |||
1234 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), TAP_PWUP_ENTRY_SD, set_tap_pwup_pfs, /* write */ | ||
1235 | get_tap_pwup_pfs, /* read */ | ||
1236 | procfs_dir, | ||
1237 | pbp_device_block)) | ||
1238 | ret = -1; | ||
1239 | |||
1240 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), TAP_CHANGE_ENTRY_SD, NULL, /* write */ | ||
1241 | get_tap_change_pfs, /* read */ | ||
1242 | procfs_dir, | ||
1243 | pbp_device_block)) | ||
1244 | ret = -1; | ||
1245 | } | ||
1246 | if (pbp_device_block->bp_caps & DISC_CAP) { | ||
1247 | |||
1248 | if (bypass_proc_create_entry_sd(&(current_pfs->tap), DISC_ENTRY_SD, set_disc_pfs, /* write */ | ||
1249 | get_disc_pfs, /* read */ | ||
1250 | procfs_dir, | ||
1251 | pbp_device_block)) | ||
1252 | ret = -1; | ||
1253 | #if 1 | ||
1254 | |||
1255 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), DIS_DISC_ENTRY_SD, set_dis_disc_pfs, /* write */ | ||
1256 | get_dis_disc_pfs, /* read */ | ||
1257 | procfs_dir, | ||
1258 | pbp_device_block)) | ||
1259 | ret = -1; | ||
1260 | #endif | ||
1261 | |||
1262 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), DISC_PWUP_ENTRY_SD, set_disc_pwup_pfs, /* write */ | ||
1263 | get_disc_pwup_pfs, /* read */ | ||
1264 | procfs_dir, | ||
1265 | pbp_device_block)) | ||
1266 | ret = -1; | ||
1267 | |||
1268 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), DISC_CHANGE_ENTRY_SD, NULL, /* write */ | ||
1269 | get_disc_change_pfs, /* read */ | ||
1270 | procfs_dir, | ||
1271 | pbp_device_block)) | ||
1272 | ret = -1; | ||
1273 | } | ||
1274 | |||
1275 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_exp_mode), WD_EXP_MODE_ENTRY_SD, set_wd_exp_mode_pfs, /* write */ | ||
1276 | get_wd_exp_mode_pfs, /* read */ | ||
1277 | procfs_dir, pbp_device_block)) | ||
1278 | ret = -1; | ||
1279 | |||
1280 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_autoreset), WD_AUTORESET_ENTRY_SD, set_wd_autoreset_pfs, /* write */ | ||
1281 | get_wd_autoreset_pfs, /* read */ | ||
1282 | procfs_dir, pbp_device_block)) | ||
1283 | ret = -1; | ||
1284 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), TPL_ENTRY_SD, set_tpl_pfs, /* write */ | ||
1285 | get_tpl_pfs, /* read */ | ||
1286 | procfs_dir, pbp_device_block)) | ||
1287 | ret = -1; | ||
1288 | #ifdef PMC_FIX_FLAG | ||
1289 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), WAIT_AT_PWUP_ENTRY_SD, set_wait_at_pwup_pfs, /* write */ | ||
1290 | get_wait_at_pwup_pfs, /* read */ | ||
1291 | procfs_dir, pbp_device_block)) | ||
1292 | ret = -1; | ||
1293 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), HW_RESET_ENTRY_SD, set_hw_reset_pfs, /* write */ | ||
1294 | get_hw_reset_pfs, /* read */ | ||
1295 | procfs_dir, pbp_device_block)) | ||
1296 | ret = -1; | ||
1297 | |||
1298 | #endif | ||
1299 | |||
1300 | } | ||
1301 | if (ret < 0) | ||
1302 | printk(KERN_DEBUG "Create proc entry failed\n"); | ||
1303 | |||
1304 | return ret; | ||
1305 | } | ||
1306 | |||
1307 | int bypass_proc_remove_dev_sd(bpctl_dev_t *pbp_device_block) | ||
1308 | { | ||
1309 | |||
1310 | struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; | ||
1311 | struct proc_dir_entry *pde = current_pfs->bypass_entry, *pde_curr = | ||
1312 | NULL; | ||
1313 | char name[256]; | ||
1314 | |||
1315 | for (pde = pde->subdir; pde;) { | ||
1316 | strcpy(name, pde->name); | ||
1317 | pde_curr = pde; | ||
1318 | pde = pde->next; | ||
1319 | remove_proc_entry(name, current_pfs->bypass_entry); | ||
1320 | } | ||
1321 | if (!pde) | ||
1322 | remove_proc_entry(current_pfs->dir_name, bp_procfs_dir); | ||
1323 | |||
1324 | return 0; | ||
1325 | } | ||
1326 | |||
1327 | #endif /* BYPASS_SUPPORT */ | ||
diff --git a/drivers/staging/silicom/bp_mod.c b/drivers/staging/silicom/bpctl_mod.c index 45a222723207..b7e570ccb759 100644 --- a/drivers/staging/silicom/bp_mod.c +++ b/drivers/staging/silicom/bpctl_mod.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #define BP_MOD_DESCR "Silicom Bypass-SD Control driver" | 35 | #define BP_MOD_DESCR "Silicom Bypass-SD Control driver" |
36 | #define BP_SYNC_FLAG 1 | 36 | #define BP_SYNC_FLAG 1 |
37 | 37 | ||
38 | static int Device_Open = 0; | ||
39 | static int major_num = 0; | 38 | static int major_num = 0; |
40 | 39 | ||
41 | MODULE_AUTHOR("Anna Lukin, annal@silicom.co.il"); | 40 | MODULE_AUTHOR("Anna Lukin, annal@silicom.co.il"); |
@@ -60,35 +59,9 @@ typedef enum { | |||
60 | bp_none, | 59 | bp_none, |
61 | } bp_media_type; | 60 | } bp_media_type; |
62 | 61 | ||
63 | struct pfs_unit_sd { | ||
64 | struct proc_dir_entry *proc_entry; | ||
65 | char proc_name[32]; | ||
66 | }; | ||
67 | |||
68 | struct bypass_pfs_sd { | 62 | struct bypass_pfs_sd { |
69 | char dir_name[32]; | 63 | char dir_name[32]; |
70 | struct proc_dir_entry *bypass_entry; | 64 | struct proc_dir_entry *bypass_entry; |
71 | struct pfs_unit_sd bypass_info; | ||
72 | struct pfs_unit_sd bypass_slave; | ||
73 | struct pfs_unit_sd bypass_caps; | ||
74 | struct pfs_unit_sd wd_set_caps; | ||
75 | struct pfs_unit_sd bypass; | ||
76 | struct pfs_unit_sd bypass_change; | ||
77 | struct pfs_unit_sd bypass_wd; | ||
78 | struct pfs_unit_sd wd_expire_time; | ||
79 | struct pfs_unit_sd reset_bypass_wd; | ||
80 | struct pfs_unit_sd dis_bypass; | ||
81 | struct pfs_unit_sd bypass_pwup; | ||
82 | struct pfs_unit_sd bypass_pwoff; | ||
83 | struct pfs_unit_sd std_nic; | ||
84 | struct pfs_unit_sd tap; | ||
85 | struct pfs_unit_sd dis_tap; | ||
86 | struct pfs_unit_sd tap_pwup; | ||
87 | struct pfs_unit_sd tap_change; | ||
88 | struct pfs_unit_sd wd_exp_mode; | ||
89 | struct pfs_unit_sd wd_autoreset; | ||
90 | struct pfs_unit_sd tpl; | ||
91 | |||
92 | }; | 65 | }; |
93 | 66 | ||
94 | typedef struct _bpctl_dev { | 67 | typedef struct _bpctl_dev { |
@@ -315,27 +288,6 @@ static struct notifier_block bp_notifier_block = { | |||
315 | .notifier_call = bp_device_event, | 288 | .notifier_call = bp_device_event, |
316 | }; | 289 | }; |
317 | 290 | ||
318 | static int device_open(struct inode *inode, struct file *file) | ||
319 | { | ||
320 | #ifdef DEBUG | ||
321 | printk("device_open(%p)\n", file); | ||
322 | #endif | ||
323 | Device_Open++; | ||
324 | /* | ||
325 | * Initialize the message | ||
326 | */ | ||
327 | return SUCCESS; | ||
328 | } | ||
329 | |||
330 | static int device_release(struct inode *inode, struct file *file) | ||
331 | { | ||
332 | #ifdef DEBUG | ||
333 | printk("device_release(%p,%p)\n", inode, file); | ||
334 | #endif | ||
335 | Device_Open--; | ||
336 | return SUCCESS; | ||
337 | } | ||
338 | |||
339 | int is_bypass_fn(bpctl_dev_t *pbpctl_dev); | 291 | int is_bypass_fn(bpctl_dev_t *pbpctl_dev); |
340 | int wdt_time_left(bpctl_dev_t *pbpctl_dev); | 292 | int wdt_time_left(bpctl_dev_t *pbpctl_dev); |
341 | 293 | ||
@@ -1728,62 +1680,33 @@ int gpio6_clear_fn(bpctl_dev_t *pbpctl_dev) | |||
1728 | } | 1680 | } |
1729 | #endif /*BYPASS_DEBUG */ | 1681 | #endif /*BYPASS_DEBUG */ |
1730 | 1682 | ||
1731 | static bpctl_dev_t *get_status_port_fn(bpctl_dev_t *pbpctl_dev) | 1683 | static bpctl_dev_t *lookup_port(bpctl_dev_t *dev) |
1732 | { | 1684 | { |
1733 | int idx_dev = 0; | 1685 | bpctl_dev_t *p; |
1734 | 1686 | int n; | |
1735 | if (pbpctl_dev == NULL) | 1687 | for (n = 0, p = bpctl_dev_arr; n < device_num && p->pdev; n++) { |
1736 | return NULL; | 1688 | if (p->bus == dev->bus |
1737 | 1689 | && p->slot == dev->slot | |
1738 | if ((pbpctl_dev->func == 0) || (pbpctl_dev->func == 2)) { | 1690 | && p->func == (dev->func ^ 1)) |
1739 | for (idx_dev = 0; | 1691 | return p; |
1740 | ((bpctl_dev_arr[idx_dev].pdev != NULL) | 1692 | } |
1741 | && (idx_dev < device_num)); idx_dev++) { | 1693 | return NULL; |
1742 | if ((bpctl_dev_arr[idx_dev].bus == pbpctl_dev->bus) | 1694 | } |
1743 | && (bpctl_dev_arr[idx_dev].slot == pbpctl_dev->slot) | ||
1744 | && ((bpctl_dev_arr[idx_dev].func == 1) | ||
1745 | && (pbpctl_dev->func == 0))) { | ||
1746 | |||
1747 | return &(bpctl_dev_arr[idx_dev]); | ||
1748 | } | ||
1749 | if ((bpctl_dev_arr[idx_dev].bus == pbpctl_dev->bus) && | ||
1750 | (bpctl_dev_arr[idx_dev].slot == pbpctl_dev->slot) && | ||
1751 | ((bpctl_dev_arr[idx_dev].func == 3) | ||
1752 | && (pbpctl_dev->func == 2))) { | ||
1753 | 1695 | ||
1754 | return &(bpctl_dev_arr[idx_dev]); | 1696 | static bpctl_dev_t *get_status_port_fn(bpctl_dev_t *pbpctl_dev) |
1755 | } | 1697 | { |
1756 | } | 1698 | if (pbpctl_dev) { |
1699 | if (pbpctl_dev->func == 0 || pbpctl_dev->func == 2) | ||
1700 | return lookup_port(pbpctl_dev); | ||
1757 | } | 1701 | } |
1758 | return NULL; | 1702 | return NULL; |
1759 | } | 1703 | } |
1760 | 1704 | ||
1761 | static bpctl_dev_t *get_master_port_fn(bpctl_dev_t *pbpctl_dev) | 1705 | static bpctl_dev_t *get_master_port_fn(bpctl_dev_t *pbpctl_dev) |
1762 | { | 1706 | { |
1763 | int idx_dev = 0; | 1707 | if (pbpctl_dev) { |
1764 | 1708 | if (pbpctl_dev->func == 1 || pbpctl_dev->func == 3) | |
1765 | if (pbpctl_dev == NULL) | 1709 | return lookup_port(pbpctl_dev); |
1766 | return NULL; | ||
1767 | |||
1768 | if ((pbpctl_dev->func == 1) || (pbpctl_dev->func == 3)) { | ||
1769 | for (idx_dev = 0; | ||
1770 | ((bpctl_dev_arr[idx_dev].pdev != NULL) | ||
1771 | && (idx_dev < device_num)); idx_dev++) { | ||
1772 | if ((bpctl_dev_arr[idx_dev].bus == pbpctl_dev->bus) | ||
1773 | && (bpctl_dev_arr[idx_dev].slot == pbpctl_dev->slot) | ||
1774 | && ((bpctl_dev_arr[idx_dev].func == 0) | ||
1775 | && (pbpctl_dev->func == 1))) { | ||
1776 | |||
1777 | return &(bpctl_dev_arr[idx_dev]); | ||
1778 | } | ||
1779 | if ((bpctl_dev_arr[idx_dev].bus == pbpctl_dev->bus) && | ||
1780 | (bpctl_dev_arr[idx_dev].slot == pbpctl_dev->slot) && | ||
1781 | ((bpctl_dev_arr[idx_dev].func == 2) | ||
1782 | && (pbpctl_dev->func == 3))) { | ||
1783 | |||
1784 | return &(bpctl_dev_arr[idx_dev]); | ||
1785 | } | ||
1786 | } | ||
1787 | } | 1710 | } |
1788 | return NULL; | 1711 | return NULL; |
1789 | } | 1712 | } |
@@ -5858,11 +5781,9 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */ | |||
5858 | return ret; | 5781 | return ret; |
5859 | } | 5782 | } |
5860 | 5783 | ||
5861 | struct file_operations Fops = { | 5784 | static const struct file_operations Fops = { |
5862 | .owner = THIS_MODULE, | 5785 | .owner = THIS_MODULE, |
5863 | .unlocked_ioctl = device_ioctl, | 5786 | .unlocked_ioctl = device_ioctl, |
5864 | .open = device_open, | ||
5865 | .release = device_release, /* a.k.a. close */ | ||
5866 | }; | 5787 | }; |
5867 | 5788 | ||
5868 | #ifndef PCI_DEVICE | 5789 | #ifndef PCI_DEVICE |
@@ -6686,6 +6607,118 @@ static bpmod_info_t tx_ctl_pci_tbl[] = { | |||
6686 | {0,} | 6607 | {0,} |
6687 | }; | 6608 | }; |
6688 | 6609 | ||
6610 | static void find_fw(bpctl_dev_t *dev) | ||
6611 | { | ||
6612 | unsigned long mmio_start, mmio_len; | ||
6613 | struct pci_dev *pdev1 = dev->pdev; | ||
6614 | |||
6615 | if ((OLD_IF_SERIES(dev->subdevice)) || | ||
6616 | (INTEL_IF_SERIES(dev->subdevice))) | ||
6617 | dev->bp_fw_ver = 0xff; | ||
6618 | else | ||
6619 | dev->bp_fw_ver = bypass_fw_ver(dev); | ||
6620 | |||
6621 | if (dev->bp_10gb == 1 && dev->bp_fw_ver == 0xff) { | ||
6622 | int cnt = 100; | ||
6623 | while (cnt--) { | ||
6624 | iounmap((void *)dev->mem_map); | ||
6625 | mmio_start = pci_resource_start(pdev1, 0); | ||
6626 | mmio_len = pci_resource_len(pdev1, 0); | ||
6627 | |||
6628 | dev->mem_map = (unsigned long) | ||
6629 | ioremap(mmio_start, mmio_len); | ||
6630 | |||
6631 | dev->bp_fw_ver = bypass_fw_ver(dev); | ||
6632 | if (dev-> bp_fw_ver == 0xa8) | ||
6633 | break; | ||
6634 | } | ||
6635 | } | ||
6636 | /* dev->bp_fw_ver=0xa8; */ | ||
6637 | printk("firmware version: 0x%x\n", dev->bp_fw_ver); | ||
6638 | } | ||
6639 | |||
6640 | static int init_one(bpctl_dev_t *dev, bpmod_info_t *info, struct pci_dev *pdev1) | ||
6641 | { | ||
6642 | unsigned long mmio_start, mmio_len; | ||
6643 | |||
6644 | dev->pdev = pdev1; | ||
6645 | mmio_start = pci_resource_start(pdev1, 0); | ||
6646 | mmio_len = pci_resource_len(pdev1, 0); | ||
6647 | |||
6648 | dev->desc = dev_desc[info->index].name; | ||
6649 | dev->name = info->bp_name; | ||
6650 | dev->device = info->device; | ||
6651 | dev->vendor = info->vendor; | ||
6652 | dev->subdevice = info->subdevice; | ||
6653 | dev->subvendor = info->subvendor; | ||
6654 | dev->func = PCI_FUNC(pdev1->devfn); | ||
6655 | dev->slot = PCI_SLOT(pdev1->devfn); | ||
6656 | dev->bus = pdev1->bus->number; | ||
6657 | dev->mem_map = (unsigned long)ioremap(mmio_start, mmio_len); | ||
6658 | #ifdef BP_SYNC_FLAG | ||
6659 | spin_lock_init(&dev->bypass_wr_lock); | ||
6660 | #endif | ||
6661 | if (BP10G9_IF_SERIES(dev->subdevice)) | ||
6662 | dev->bp_10g9 = 1; | ||
6663 | if (BP10G_IF_SERIES(dev->subdevice)) | ||
6664 | dev->bp_10g = 1; | ||
6665 | if (PEG540_IF_SERIES(dev->subdevice)) | ||
6666 | dev->bp_540 = 1; | ||
6667 | if (PEGF5_IF_SERIES(dev->subdevice)) | ||
6668 | dev->bp_fiber5 = 1; | ||
6669 | if (PEG80_IF_SERIES(dev->subdevice)) | ||
6670 | dev->bp_i80 = 1; | ||
6671 | if (PEGF80_IF_SERIES(dev->subdevice)) | ||
6672 | dev->bp_i80 = 1; | ||
6673 | if ((dev->subdevice & 0xa00) == 0xa00) | ||
6674 | dev->bp_i80 = 1; | ||
6675 | if (BP10GB_IF_SERIES(dev->subdevice)) { | ||
6676 | if (dev->ifindex == 0) { | ||
6677 | unregister_chrdev(major_num, DEVICE_NAME); | ||
6678 | printk("Please load network driver for %s adapter!\n", | ||
6679 | dev->name); | ||
6680 | return -1; | ||
6681 | } | ||
6682 | |||
6683 | if (dev->ndev && !(dev->ndev->flags & IFF_UP)) { | ||
6684 | unregister_chrdev(major_num, DEVICE_NAME); | ||
6685 | printk("Please bring up network interfaces for %s adapter!\n", | ||
6686 | dev->name); | ||
6687 | return -1; | ||
6688 | } | ||
6689 | dev->bp_10gb = 1; | ||
6690 | } | ||
6691 | |||
6692 | if (!dev->bp_10g9) { | ||
6693 | if (is_bypass_fn(dev)) { | ||
6694 | printk(KERN_INFO "%s found, ", | ||
6695 | dev->name); | ||
6696 | find_fw(dev); | ||
6697 | } | ||
6698 | dev->wdt_status = WDT_STATUS_UNKNOWN; | ||
6699 | dev->reset_time = 0; | ||
6700 | atomic_set(&dev->wdt_busy, 0); | ||
6701 | dev->bp_status_un = 1; | ||
6702 | |||
6703 | bypass_caps_init(dev); | ||
6704 | |||
6705 | init_bypass_wd_auto(dev); | ||
6706 | init_bypass_tpl_auto(dev); | ||
6707 | if (NOKIA_SERIES(dev->subdevice)) | ||
6708 | reset_cont(dev); | ||
6709 | } | ||
6710 | #ifdef BP_SELF_TEST | ||
6711 | if ((dev->bp_tx_data = kzalloc(BPTEST_DATA_LEN, GFP_KERNEL))) { | ||
6712 | memset(dev->bp_tx_data, 0xff, 6); | ||
6713 | memset(dev->bp_tx_data + 6, 0x0, 1); | ||
6714 | memset(dev->bp_tx_data + 7, 0xaa, 5); | ||
6715 | *(__be16 *)(dev->bp_tx_data + 12) = htons(ETH_P_BPTEST); | ||
6716 | } else | ||
6717 | printk("bp_ctl: Memory allocation error!\n"); | ||
6718 | #endif | ||
6719 | return 0; | ||
6720 | } | ||
6721 | |||
6689 | /* | 6722 | /* |
6690 | * Initialize the module - Register the character device | 6723 | * Initialize the module - Register the character device |
6691 | */ | 6724 | */ |
@@ -6694,7 +6727,7 @@ static int __init bypass_init_module(void) | |||
6694 | { | 6727 | { |
6695 | int ret_val, idx, idx_dev = 0; | 6728 | int ret_val, idx, idx_dev = 0; |
6696 | struct pci_dev *pdev1 = NULL; | 6729 | struct pci_dev *pdev1 = NULL; |
6697 | unsigned long mmio_start, mmio_len; | 6730 | bpctl_dev_t *dev; |
6698 | 6731 | ||
6699 | printk(BP_MOD_DESCR " v" BP_MOD_VER "\n"); | 6732 | printk(BP_MOD_DESCR " v" BP_MOD_VER "\n"); |
6700 | ret_val = register_chrdev(major_num, DEVICE_NAME, &Fops); | 6733 | ret_val = register_chrdev(major_num, DEVICE_NAME, &Fops); |
@@ -6729,181 +6762,16 @@ static int __init bypass_init_module(void) | |||
6729 | memset(bpctl_dev_arr, 0, ((device_num) * sizeof(bpctl_dev_t))); | 6762 | memset(bpctl_dev_arr, 0, ((device_num) * sizeof(bpctl_dev_t))); |
6730 | 6763 | ||
6731 | pdev1 = NULL; | 6764 | pdev1 = NULL; |
6765 | dev = bpctl_dev_arr; | ||
6732 | for (idx = 0; tx_ctl_pci_tbl[idx].vendor; idx++) { | 6766 | for (idx = 0; tx_ctl_pci_tbl[idx].vendor; idx++) { |
6733 | while ((pdev1 = pci_get_subsys(tx_ctl_pci_tbl[idx].vendor, | 6767 | while ((pdev1 = pci_get_subsys(tx_ctl_pci_tbl[idx].vendor, |
6734 | tx_ctl_pci_tbl[idx].device, | 6768 | tx_ctl_pci_tbl[idx].device, |
6735 | tx_ctl_pci_tbl[idx].subvendor, | 6769 | tx_ctl_pci_tbl[idx].subvendor, |
6736 | tx_ctl_pci_tbl[idx].subdevice, | 6770 | tx_ctl_pci_tbl[idx].subdevice, |
6737 | pdev1))) { | 6771 | pdev1))) { |
6738 | bpctl_dev_arr[idx_dev].pdev = pdev1; | 6772 | if (init_one(dev, &tx_ctl_pci_tbl[idx], pdev1) < 0) |
6739 | 6773 | return -1; | |
6740 | mmio_start = pci_resource_start(pdev1, 0); | 6774 | dev++; |
6741 | mmio_len = pci_resource_len(pdev1, 0); | ||
6742 | |||
6743 | bpctl_dev_arr[idx_dev].desc = | ||
6744 | dev_desc[tx_ctl_pci_tbl[idx].index].name; | ||
6745 | bpctl_dev_arr[idx_dev].name = | ||
6746 | tx_ctl_pci_tbl[idx].bp_name; | ||
6747 | bpctl_dev_arr[idx_dev].device = | ||
6748 | tx_ctl_pci_tbl[idx].device; | ||
6749 | bpctl_dev_arr[idx_dev].vendor = | ||
6750 | tx_ctl_pci_tbl[idx].vendor; | ||
6751 | bpctl_dev_arr[idx_dev].subdevice = | ||
6752 | tx_ctl_pci_tbl[idx].subdevice; | ||
6753 | bpctl_dev_arr[idx_dev].subvendor = | ||
6754 | tx_ctl_pci_tbl[idx].subvendor; | ||
6755 | /* bpctl_dev_arr[idx_dev].pdev=pdev1; */ | ||
6756 | bpctl_dev_arr[idx_dev].func = PCI_FUNC(pdev1->devfn); | ||
6757 | bpctl_dev_arr[idx_dev].slot = PCI_SLOT(pdev1->devfn); | ||
6758 | bpctl_dev_arr[idx_dev].bus = pdev1->bus->number; | ||
6759 | bpctl_dev_arr[idx_dev].mem_map = | ||
6760 | (unsigned long)ioremap(mmio_start, mmio_len); | ||
6761 | #ifdef BP_SYNC_FLAG | ||
6762 | spin_lock_init(&bpctl_dev_arr[idx_dev].bypass_wr_lock); | ||
6763 | #endif | ||
6764 | if (BP10G9_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) | ||
6765 | bpctl_dev_arr[idx_dev].bp_10g9 = 1; | ||
6766 | if (BP10G_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) | ||
6767 | bpctl_dev_arr[idx_dev].bp_10g = 1; | ||
6768 | if (PEG540_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) { | ||
6769 | |||
6770 | bpctl_dev_arr[idx_dev].bp_540 = 1; | ||
6771 | } | ||
6772 | if (PEGF5_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) | ||
6773 | bpctl_dev_arr[idx_dev].bp_fiber5 = 1; | ||
6774 | if (PEG80_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) | ||
6775 | bpctl_dev_arr[idx_dev].bp_i80 = 1; | ||
6776 | if (PEGF80_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) | ||
6777 | bpctl_dev_arr[idx_dev].bp_i80 = 1; | ||
6778 | if ((bpctl_dev_arr[idx_dev].subdevice & 0xa00) == 0xa00) | ||
6779 | bpctl_dev_arr[idx_dev].bp_i80 = 1; | ||
6780 | if (BP10GB_IF_SERIES(bpctl_dev_arr[idx_dev].subdevice)) { | ||
6781 | if (bpctl_dev_arr[idx_dev].ifindex == 0) { | ||
6782 | unregister_chrdev(major_num, | ||
6783 | DEVICE_NAME); | ||
6784 | printk | ||
6785 | ("Please load network driver for %s adapter!\n", | ||
6786 | bpctl_dev_arr[idx_dev].name); | ||
6787 | return -1; | ||
6788 | } | ||
6789 | |||
6790 | if (bpctl_dev_arr[idx_dev].ndev) { | ||
6791 | if (! | ||
6792 | (bpctl_dev_arr[idx_dev].ndev-> | ||
6793 | flags & IFF_UP)) { | ||
6794 | if (! | ||
6795 | (bpctl_dev_arr[idx_dev]. | ||
6796 | ndev->flags & IFF_UP)) { | ||
6797 | unregister_chrdev | ||
6798 | (major_num, | ||
6799 | DEVICE_NAME); | ||
6800 | printk | ||
6801 | ("Please bring up network interfaces for %s adapter!\n", | ||
6802 | bpctl_dev_arr | ||
6803 | [idx_dev].name); | ||
6804 | return -1; | ||
6805 | } | ||
6806 | |||
6807 | } | ||
6808 | } | ||
6809 | bpctl_dev_arr[idx_dev].bp_10gb = 1; | ||
6810 | } | ||
6811 | |||
6812 | if (!bpctl_dev_arr[idx_dev].bp_10g9) { | ||
6813 | |||
6814 | if (is_bypass_fn(&bpctl_dev_arr[idx_dev])) { | ||
6815 | printk(KERN_INFO "%s found, ", | ||
6816 | bpctl_dev_arr[idx_dev].name); | ||
6817 | if ((OLD_IF_SERIES | ||
6818 | (bpctl_dev_arr[idx_dev].subdevice)) | ||
6819 | || | ||
6820 | (INTEL_IF_SERIES | ||
6821 | (bpctl_dev_arr[idx_dev]. | ||
6822 | subdevice))) | ||
6823 | bpctl_dev_arr[idx_dev]. | ||
6824 | bp_fw_ver = 0xff; | ||
6825 | else | ||
6826 | bpctl_dev_arr[idx_dev]. | ||
6827 | bp_fw_ver = | ||
6828 | bypass_fw_ver(&bpctl_dev_arr | ||
6829 | [idx_dev]); | ||
6830 | if ((bpctl_dev_arr[idx_dev].bp_10gb == | ||
6831 | 1) | ||
6832 | && (bpctl_dev_arr[idx_dev]. | ||
6833 | bp_fw_ver == 0xff)) { | ||
6834 | int cnt = 100; | ||
6835 | while (cnt--) { | ||
6836 | iounmap((void | ||
6837 | *) | ||
6838 | (bpctl_dev_arr | ||
6839 | [idx_dev]. | ||
6840 | mem_map)); | ||
6841 | mmio_start = | ||
6842 | pci_resource_start | ||
6843 | (pdev1, 0); | ||
6844 | mmio_len = | ||
6845 | pci_resource_len | ||
6846 | (pdev1, 0); | ||
6847 | |||
6848 | bpctl_dev_arr[idx_dev]. | ||
6849 | mem_map = | ||
6850 | (unsigned long) | ||
6851 | ioremap(mmio_start, | ||
6852 | mmio_len); | ||
6853 | |||
6854 | bpctl_dev_arr[idx_dev]. | ||
6855 | bp_fw_ver = | ||
6856 | bypass_fw_ver | ||
6857 | (&bpctl_dev_arr | ||
6858 | [idx_dev]); | ||
6859 | if (bpctl_dev_arr | ||
6860 | [idx_dev]. | ||
6861 | bp_fw_ver == 0xa8) | ||
6862 | break; | ||
6863 | |||
6864 | } | ||
6865 | } | ||
6866 | /* bpctl_dev_arr[idx_dev].bp_fw_ver=0xa8; */ | ||
6867 | printk("firmware version: 0x%x\n", | ||
6868 | bpctl_dev_arr[idx_dev]. | ||
6869 | bp_fw_ver); | ||
6870 | } | ||
6871 | bpctl_dev_arr[idx_dev].wdt_status = | ||
6872 | WDT_STATUS_UNKNOWN; | ||
6873 | bpctl_dev_arr[idx_dev].reset_time = 0; | ||
6874 | atomic_set(&bpctl_dev_arr[idx_dev].wdt_busy, 0); | ||
6875 | bpctl_dev_arr[idx_dev].bp_status_un = 1; | ||
6876 | |||
6877 | bypass_caps_init(&bpctl_dev_arr[idx_dev]); | ||
6878 | |||
6879 | init_bypass_wd_auto(&bpctl_dev_arr[idx_dev]); | ||
6880 | init_bypass_tpl_auto(&bpctl_dev_arr[idx_dev]); | ||
6881 | if (NOKIA_SERIES | ||
6882 | (bpctl_dev_arr[idx_dev].subdevice)) | ||
6883 | reset_cont(&bpctl_dev_arr[idx_dev]); | ||
6884 | } | ||
6885 | #ifdef BP_SELF_TEST | ||
6886 | if ((bpctl_dev_arr[idx_dev].bp_tx_data = | ||
6887 | kmalloc(BPTEST_DATA_LEN, GFP_KERNEL))) { | ||
6888 | |||
6889 | memset(bpctl_dev_arr[idx_dev].bp_tx_data, 0x0, | ||
6890 | BPTEST_DATA_LEN); | ||
6891 | |||
6892 | memset(bpctl_dev_arr[idx_dev].bp_tx_data, 0xff, | ||
6893 | 6); | ||
6894 | memset(bpctl_dev_arr[idx_dev].bp_tx_data + 6, | ||
6895 | 0x0, 1); | ||
6896 | memset(bpctl_dev_arr[idx_dev].bp_tx_data + 7, | ||
6897 | 0xaa, 5); | ||
6898 | |||
6899 | *(__be16 *) (bpctl_dev_arr[idx_dev].bp_tx_data + | ||
6900 | 12) = htons(ETH_P_BPTEST); | ||
6901 | |||
6902 | } else | ||
6903 | printk("bp_ctl: Memory allocation error!\n"); | ||
6904 | #endif | ||
6905 | idx_dev++; | ||
6906 | |||
6907 | } | 6775 | } |
6908 | } | 6776 | } |
6909 | if_scan_init(); | 6777 | if_scan_init(); |
@@ -6913,33 +6781,27 @@ static int __init bypass_init_module(void) | |||
6913 | { | 6781 | { |
6914 | 6782 | ||
6915 | bpctl_dev_t *pbpctl_dev_c = NULL; | 6783 | bpctl_dev_t *pbpctl_dev_c = NULL; |
6916 | for (idx_dev = 0; | 6784 | for (idx_dev = 0, dev = bpctl_dev_arr; |
6917 | ((bpctl_dev_arr[idx_dev].pdev != NULL) | 6785 | idx_dev < device_num && dev->pdev; |
6918 | && (idx_dev < device_num)); idx_dev++) { | 6786 | idx_dev++, dev++) { |
6919 | if (bpctl_dev_arr[idx_dev].bp_10g9) { | 6787 | if (dev->bp_10g9) { |
6920 | pbpctl_dev_c = | 6788 | pbpctl_dev_c = get_status_port_fn(dev); |
6921 | get_status_port_fn(&bpctl_dev_arr[idx_dev]); | 6789 | if (is_bypass_fn(dev)) { |
6922 | if (is_bypass_fn(&bpctl_dev_arr[idx_dev])) { | ||
6923 | printk(KERN_INFO "%s found, ", | 6790 | printk(KERN_INFO "%s found, ", |
6924 | bpctl_dev_arr[idx_dev].name); | 6791 | dev->name); |
6925 | bpctl_dev_arr[idx_dev].bp_fw_ver = | 6792 | dev->bp_fw_ver = bypass_fw_ver(dev); |
6926 | bypass_fw_ver(&bpctl_dev_arr | ||
6927 | [idx_dev]); | ||
6928 | printk("firmware version: 0x%x\n", | 6793 | printk("firmware version: 0x%x\n", |
6929 | bpctl_dev_arr[idx_dev]. | 6794 | dev->bp_fw_ver); |
6930 | bp_fw_ver); | ||
6931 | |||
6932 | } | 6795 | } |
6933 | bpctl_dev_arr[idx_dev].wdt_status = | 6796 | dev->wdt_status = WDT_STATUS_UNKNOWN; |
6934 | WDT_STATUS_UNKNOWN; | 6797 | dev->reset_time = 0; |
6935 | bpctl_dev_arr[idx_dev].reset_time = 0; | 6798 | atomic_set(&dev->wdt_busy, 0); |
6936 | atomic_set(&bpctl_dev_arr[idx_dev].wdt_busy, 0); | 6799 | dev->bp_status_un = 1; |
6937 | bpctl_dev_arr[idx_dev].bp_status_un = 1; | ||
6938 | 6800 | ||
6939 | bypass_caps_init(&bpctl_dev_arr[idx_dev]); | 6801 | bypass_caps_init(dev); |
6940 | 6802 | ||
6941 | init_bypass_wd_auto(&bpctl_dev_arr[idx_dev]); | 6803 | init_bypass_wd_auto(dev); |
6942 | init_bypass_tpl_auto(&bpctl_dev_arr[idx_dev]); | 6804 | init_bypass_tpl_auto(dev); |
6943 | 6805 | ||
6944 | } | 6806 | } |
6945 | 6807 | ||
@@ -7336,78 +7198,11 @@ EXPORT_SYMBOL_NOVERS(bp_if_scan_sd); | |||
7336 | 7198 | ||
7337 | #define BP_PROC_DIR "bypass" | 7199 | #define BP_PROC_DIR "bypass" |
7338 | 7200 | ||
7339 | #define GPIO6_SET_ENTRY_SD "gpio6_set" | ||
7340 | #define GPIO6_CLEAR_ENTRY_SD "gpio6_clear" | ||
7341 | |||
7342 | #define GPIO7_SET_ENTRY_SD "gpio7_set" | ||
7343 | #define GPIO7_CLEAR_ENTRY_SD "gpio7_clear" | ||
7344 | |||
7345 | #define PULSE_SET_ENTRY_SD "pulse_set" | ||
7346 | #define ZERO_SET_ENTRY_SD "zero_set" | ||
7347 | #define PULSE_GET1_ENTRY_SD "pulse_get1" | ||
7348 | #define PULSE_GET2_ENTRY_SD "pulse_get2" | ||
7349 | |||
7350 | #define CMND_ON_ENTRY_SD "cmnd_on" | ||
7351 | #define CMND_OFF_ENTRY_SD "cmnd_off" | ||
7352 | #define RESET_CONT_ENTRY_SD "reset_cont" | ||
7353 | |||
7354 | /*COMMANDS*/ | ||
7355 | #define BYPASS_INFO_ENTRY_SD "bypass_info" | ||
7356 | #define BYPASS_SLAVE_ENTRY_SD "bypass_slave" | ||
7357 | #define BYPASS_CAPS_ENTRY_SD "bypass_caps" | ||
7358 | #define WD_SET_CAPS_ENTRY_SD "wd_set_caps" | ||
7359 | #define BYPASS_ENTRY_SD "bypass" | ||
7360 | #define BYPASS_CHANGE_ENTRY_SD "bypass_change" | ||
7361 | #define BYPASS_WD_ENTRY_SD "bypass_wd" | ||
7362 | #define WD_EXPIRE_TIME_ENTRY_SD "wd_expire_time" | ||
7363 | #define RESET_BYPASS_WD_ENTRY_SD "reset_bypass_wd" | ||
7364 | #define DIS_BYPASS_ENTRY_SD "dis_bypass" | ||
7365 | #define BYPASS_PWUP_ENTRY_SD "bypass_pwup" | ||
7366 | #define BYPASS_PWOFF_ENTRY_SD "bypass_pwoff" | ||
7367 | #define STD_NIC_ENTRY_SD "std_nic" | ||
7368 | #define STD_NIC_ENTRY_SD "std_nic" | ||
7369 | #define TAP_ENTRY_SD "tap" | ||
7370 | #define TAP_CHANGE_ENTRY_SD "tap_change" | ||
7371 | #define DIS_TAP_ENTRY_SD "dis_tap" | ||
7372 | #define TAP_PWUP_ENTRY_SD "tap_pwup" | ||
7373 | #define TWO_PORT_LINK_ENTRY_SD "two_port_link" | ||
7374 | #define WD_EXP_MODE_ENTRY_SD "wd_exp_mode" | ||
7375 | #define WD_AUTORESET_ENTRY_SD "wd_autoreset" | ||
7376 | #define TPL_ENTRY_SD "tpl" | ||
7377 | #define WAIT_AT_PWUP_ENTRY_SD "wait_at_pwup" | ||
7378 | #define HW_RESET_ENTRY_SD "hw_reset" | ||
7379 | #define DISC_ENTRY_SD "disc" | ||
7380 | #define DISC_CHANGE_ENTRY_SD "disc_change" | ||
7381 | #define DIS_DISC_ENTRY_SD "dis_disc" | ||
7382 | #define DISC_PWUP_ENTRY_SD "disc_pwup" | ||
7383 | static struct proc_dir_entry *bp_procfs_dir; | 7201 | static struct proc_dir_entry *bp_procfs_dir; |
7384 | 7202 | ||
7385 | static struct proc_dir_entry *proc_getdir(char *name, | ||
7386 | struct proc_dir_entry *proc_dir) | ||
7387 | { | ||
7388 | struct proc_dir_entry *pde = proc_dir; | ||
7389 | |||
7390 | for (pde = pde->subdir; pde; pde = pde->next) { | ||
7391 | if (pde->namelen && (strcmp(name, pde->name) == 0)) { | ||
7392 | /* directory exists */ | ||
7393 | break; | ||
7394 | } | ||
7395 | } | ||
7396 | if (pde == (struct proc_dir_entry *)0) { | ||
7397 | /* create the directory */ | ||
7398 | pde = proc_mkdir(name, proc_dir); | ||
7399 | if (pde == (struct proc_dir_entry *)0) { | ||
7400 | |||
7401 | return pde; | ||
7402 | } | ||
7403 | } | ||
7404 | |||
7405 | return pde; | ||
7406 | } | ||
7407 | |||
7408 | int bp_proc_create(void) | 7203 | int bp_proc_create(void) |
7409 | { | 7204 | { |
7410 | bp_procfs_dir = proc_getdir(BP_PROC_DIR, init_net.proc_net); | 7205 | bp_procfs_dir = proc_mkdir(BP_PROC_DIR, init_net.proc_net); |
7411 | if (bp_procfs_dir == (struct proc_dir_entry *)0) { | 7206 | if (bp_procfs_dir == (struct proc_dir_entry *)0) { |
7412 | printk(KERN_DEBUG | 7207 | printk(KERN_DEBUG |
7413 | "Could not create procfs nicinfo directory %s\n", | 7208 | "Could not create procfs nicinfo directory %s\n", |
@@ -7417,144 +7212,99 @@ int bp_proc_create(void) | |||
7417 | return 0; | 7212 | return 0; |
7418 | } | 7213 | } |
7419 | 7214 | ||
7420 | int | 7215 | static int procfs_add(char *proc_name, const struct file_operations *fops, |
7421 | bypass_proc_create_entry_sd(struct pfs_unit_sd *pfs_unit_curr, | 7216 | bpctl_dev_t *dev) |
7422 | char *proc_name, | ||
7423 | write_proc_t *write_proc, | ||
7424 | read_proc_t *read_proc, | ||
7425 | struct proc_dir_entry *parent_pfs, void *data) | ||
7426 | { | 7217 | { |
7427 | strcpy(pfs_unit_curr->proc_name, proc_name); | 7218 | struct bypass_pfs_sd *pfs = &dev->bypass_pfs_set; |
7428 | pfs_unit_curr->proc_entry = create_proc_entry(pfs_unit_curr->proc_name, | 7219 | if (!proc_create_data(proc_name, 0644, pfs->bypass_entry, fops, dev)) |
7429 | S_IFREG | S_IRUSR | | ||
7430 | S_IWUSR | S_IRGRP | | ||
7431 | S_IROTH, parent_pfs); | ||
7432 | if (pfs_unit_curr->proc_entry == NULL) | ||
7433 | return -1; | 7220 | return -1; |
7434 | |||
7435 | pfs_unit_curr->proc_entry->read_proc = read_proc; | ||
7436 | pfs_unit_curr->proc_entry->write_proc = write_proc; | ||
7437 | pfs_unit_curr->proc_entry->data = data; | ||
7438 | |||
7439 | return 0; | 7221 | return 0; |
7440 | |||
7441 | } | 7222 | } |
7442 | 7223 | ||
7443 | int | 7224 | #define RO_FOPS(name) \ |
7444 | get_bypass_info_pfs(char *page, char **start, off_t off, int count, | 7225 | static int name##_open(struct inode *inode, struct file *file) \ |
7445 | int *eof, void *data) | 7226 | { \ |
7446 | { | 7227 | return single_open(file, show_##name, PDE_DATA(inode));\ |
7447 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7228 | } \ |
7448 | int len = 0; | 7229 | static const struct file_operations name##_ops = { \ |
7449 | 7230 | .open = name##_open, \ | |
7450 | len += sprintf(page, "Name\t\t\t%s\n", pbp_device_block->name); | 7231 | .read = seq_read, \ |
7451 | len += | 7232 | .llseek = seq_lseek, \ |
7452 | sprintf(page + len, "Firmware version\t0x%x\n", | 7233 | .release = single_release, \ |
7453 | pbp_device_block->bp_fw_ver); | 7234 | }; |
7454 | 7235 | ||
7455 | *eof = 1; | 7236 | #define RW_FOPS(name) \ |
7456 | return len; | 7237 | static int name##_open(struct inode *inode, struct file *file) \ |
7457 | } | 7238 | { \ |
7239 | return single_open(file, show_##name, PDE_DATA(inode));\ | ||
7240 | } \ | ||
7241 | static const struct file_operations name##_ops = { \ | ||
7242 | .open = name##_open, \ | ||
7243 | .read = seq_read, \ | ||
7244 | .write = name##_write, \ | ||
7245 | .llseek = seq_lseek, \ | ||
7246 | .release = single_release, \ | ||
7247 | }; | ||
7458 | 7248 | ||
7459 | int | 7249 | static int show_bypass_info(struct seq_file *m, void *v) |
7460 | get_bypass_slave_pfs(char *page, char **start, off_t off, int count, | ||
7461 | int *eof, void *data) | ||
7462 | { | 7250 | { |
7463 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7251 | bpctl_dev_t *dev = m->private; |
7464 | 7252 | ||
7465 | int len = 0; | 7253 | seq_printf(m, "Name\t\t\t%s\n", dev->name); |
7466 | bpctl_dev_t *pbp_device_block_slave = NULL; | 7254 | seq_printf(m, "Firmware version\t0x%x\n", dev->bp_fw_ver); |
7467 | int idx_dev = 0; | 7255 | return 0; |
7468 | struct net_device *net_slave_dev = NULL; | ||
7469 | |||
7470 | if ((pbp_device_block->func == 0) || (pbp_device_block->func == 2)) { | ||
7471 | for (idx_dev = 0; | ||
7472 | ((bpctl_dev_arr[idx_dev].pdev != NULL) | ||
7473 | && (idx_dev < device_num)); idx_dev++) { | ||
7474 | if ((bpctl_dev_arr[idx_dev].bus == | ||
7475 | pbp_device_block->bus) | ||
7476 | && (bpctl_dev_arr[idx_dev].slot == | ||
7477 | pbp_device_block->slot)) { | ||
7478 | if ((pbp_device_block->func == 0) | ||
7479 | && (bpctl_dev_arr[idx_dev].func == 1)) { | ||
7480 | pbp_device_block_slave = | ||
7481 | &bpctl_dev_arr[idx_dev]; | ||
7482 | break; | ||
7483 | } | ||
7484 | if ((pbp_device_block->func == 2) && | ||
7485 | (bpctl_dev_arr[idx_dev].func == 3)) { | ||
7486 | pbp_device_block_slave = | ||
7487 | &bpctl_dev_arr[idx_dev]; | ||
7488 | break; | ||
7489 | } | ||
7490 | } | ||
7491 | } | ||
7492 | } else | ||
7493 | pbp_device_block_slave = pbp_device_block; | ||
7494 | if (!pbp_device_block_slave) { | ||
7495 | len = sprintf(page, "fail\n"); | ||
7496 | *eof = 1; | ||
7497 | return len; | ||
7498 | } | ||
7499 | net_slave_dev = pbp_device_block_slave->ndev; | ||
7500 | if (net_slave_dev) | ||
7501 | len = sprintf(page, "%s\n", net_slave_dev->name); | ||
7502 | |||
7503 | *eof = 1; | ||
7504 | return len; | ||
7505 | } | 7256 | } |
7257 | RO_FOPS(bypass_info) | ||
7506 | 7258 | ||
7507 | int | 7259 | static int show_bypass_slave(struct seq_file *m, void *v) |
7508 | get_bypass_caps_pfs(char *page, char **start, off_t off, int count, | ||
7509 | int *eof, void *data) | ||
7510 | { | 7260 | { |
7511 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7261 | bpctl_dev_t *dev = m->private; |
7512 | 7262 | bpctl_dev_t *slave = get_status_port_fn(dev); | |
7513 | int len = 0, ret = 0; | 7263 | if (!slave) |
7264 | slave = dev; | ||
7265 | if (!slave) | ||
7266 | seq_printf(m, "fail\n"); | ||
7267 | else if (slave->ndev) | ||
7268 | seq_printf(m, "%s\n", slave->ndev->name); | ||
7269 | return 0; | ||
7270 | } | ||
7271 | RO_FOPS(bypass_slave) | ||
7514 | 7272 | ||
7515 | ret = get_bypass_caps_fn(pbp_device_block); | 7273 | static int show_bypass_caps(struct seq_file *m, void *v) |
7274 | { | ||
7275 | bpctl_dev_t *dev = m->private; | ||
7276 | int ret = get_bypass_caps_fn(dev); | ||
7516 | if (ret == BP_NOT_CAP) | 7277 | if (ret == BP_NOT_CAP) |
7517 | len = sprintf(page, "-1\n"); | 7278 | seq_printf(m, "-1\n"); |
7518 | else | 7279 | else |
7519 | len = sprintf(page, "0x%x\n", ret); | 7280 | seq_printf(m, "0x%x\n", ret); |
7520 | *eof = 1; | 7281 | return 0; |
7521 | return len; | ||
7522 | |||
7523 | } | 7282 | } |
7283 | RO_FOPS(bypass_caps) | ||
7524 | 7284 | ||
7525 | int | 7285 | static int show_wd_set_caps(struct seq_file *m, void *v) |
7526 | get_wd_set_caps_pfs(char *page, char **start, off_t off, int count, | ||
7527 | int *eof, void *data) | ||
7528 | { | 7286 | { |
7529 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7287 | bpctl_dev_t *dev = m->private; |
7530 | 7288 | int ret = get_wd_set_caps_fn(dev); | |
7531 | int len = 0, ret = 0; | ||
7532 | |||
7533 | ret = get_wd_set_caps_fn(pbp_device_block); | ||
7534 | if (ret == BP_NOT_CAP) | 7289 | if (ret == BP_NOT_CAP) |
7535 | len = sprintf(page, "-1\n"); | 7290 | seq_printf(m, "-1\n"); |
7536 | else | 7291 | else |
7537 | len = sprintf(page, "0x%x\n", ret); | 7292 | seq_printf(m, "0x%x\n", ret); |
7538 | *eof = 1; | 7293 | return 0; |
7539 | return len; | ||
7540 | } | 7294 | } |
7295 | RO_FOPS(wd_set_caps) | ||
7541 | 7296 | ||
7542 | int | 7297 | static int user_on_off(const void __user *buffer, size_t count) |
7543 | set_bypass_pfs(struct file *file, const char *buffer, | ||
7544 | unsigned long count, void *data) | ||
7545 | { | 7298 | { |
7546 | 7299 | ||
7547 | char kbuf[256]; | 7300 | char kbuf[256]; |
7548 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7301 | int length = 0; |
7549 | |||
7550 | int bypass_param = 0, length = 0; | ||
7551 | 7302 | ||
7552 | if (count > (sizeof(kbuf) - 1)) | 7303 | if (count > (sizeof(kbuf) - 1)) |
7553 | return -1; | 7304 | return -1; |
7554 | 7305 | ||
7555 | if (copy_from_user(&kbuf, buffer, count)) { | 7306 | if (copy_from_user(&kbuf, buffer, count)) |
7556 | return -1; | 7307 | return -1; |
7557 | } | ||
7558 | 7308 | ||
7559 | kbuf[count] = '\0'; | 7309 | kbuf[count] = '\0'; |
7560 | length = strlen(kbuf); | 7310 | length = strlen(kbuf); |
@@ -7562,806 +7312,467 @@ set_bypass_pfs(struct file *file, const char *buffer, | |||
7562 | kbuf[--length] = '\0'; | 7312 | kbuf[--length] = '\0'; |
7563 | 7313 | ||
7564 | if (strcmp(kbuf, "on") == 0) | 7314 | if (strcmp(kbuf, "on") == 0) |
7565 | bypass_param = 1; | 7315 | return 1; |
7566 | else if (strcmp(kbuf, "off") == 0) | 7316 | if (strcmp(kbuf, "off") == 0) |
7567 | bypass_param = 0; | 7317 | return 0; |
7568 | 7318 | return 0; | |
7569 | set_bypass_fn(pbp_device_block, bypass_param); | ||
7570 | |||
7571 | return count; | ||
7572 | } | 7319 | } |
7573 | 7320 | ||
7574 | int | 7321 | static ssize_t bypass_write(struct file *file, const char __user *buffer, |
7575 | set_tap_pfs(struct file *file, const char *buffer, | 7322 | size_t count, loff_t *pos) |
7576 | unsigned long count, void *data) | ||
7577 | { | 7323 | { |
7578 | 7324 | int bypass_param = user_on_off(buffer, count); | |
7579 | char kbuf[256]; | 7325 | if (bypass_param < 0) |
7580 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
7581 | |||
7582 | int tap_param = 0, length = 0; | ||
7583 | |||
7584 | if (count > (sizeof(kbuf) - 1)) | ||
7585 | return -1; | 7326 | return -1; |
7586 | 7327 | ||
7587 | if (copy_from_user(&kbuf, buffer, count)) { | 7328 | set_bypass_fn(PDE_DATA(file_inode(file)), bypass_param); |
7588 | return -1; | ||
7589 | } | ||
7590 | |||
7591 | kbuf[count] = '\0'; | ||
7592 | length = strlen(kbuf); | ||
7593 | if (kbuf[length - 1] == '\n') | ||
7594 | kbuf[--length] = '\0'; | ||
7595 | |||
7596 | if (strcmp(kbuf, "on") == 0) | ||
7597 | tap_param = 1; | ||
7598 | else if (strcmp(kbuf, "off") == 0) | ||
7599 | tap_param = 0; | ||
7600 | |||
7601 | set_tap_fn(pbp_device_block, tap_param); | ||
7602 | |||
7603 | return count; | 7329 | return count; |
7604 | } | 7330 | } |
7605 | 7331 | static int show_bypass(struct seq_file *m, void *v) | |
7606 | int | ||
7607 | set_disc_pfs(struct file *file, const char *buffer, | ||
7608 | unsigned long count, void *data) | ||
7609 | { | 7332 | { |
7333 | bpctl_dev_t *dev = m->private; | ||
7334 | int ret = get_bypass_fn(dev); | ||
7335 | if (ret == BP_NOT_CAP) | ||
7336 | seq_printf(m, "fail\n"); | ||
7337 | else if (ret == 1) | ||
7338 | seq_printf(m, "on\n"); | ||
7339 | else if (ret == 0) | ||
7340 | seq_printf(m, "off\n"); | ||
7341 | return 0; | ||
7342 | } | ||
7343 | RW_FOPS(bypass) | ||
7610 | 7344 | ||
7611 | char kbuf[256]; | 7345 | static ssize_t tap_write(struct file *file, const char __user *buffer, |
7612 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7346 | size_t count, loff_t *pos) |
7613 | 7347 | { | |
7614 | int tap_param = 0, length = 0; | 7348 | int tap_param = user_on_off(buffer, count); |
7615 | 7349 | if (tap_param < 0) | |
7616 | if (count > (sizeof(kbuf) - 1)) | ||
7617 | return -1; | ||
7618 | |||
7619 | if (copy_from_user(&kbuf, buffer, count)) { | ||
7620 | return -1; | 7350 | return -1; |
7621 | } | ||
7622 | |||
7623 | kbuf[count] = '\0'; | ||
7624 | length = strlen(kbuf); | ||
7625 | if (kbuf[length - 1] == '\n') | ||
7626 | kbuf[--length] = '\0'; | ||
7627 | |||
7628 | if (strcmp(kbuf, "on") == 0) | ||
7629 | tap_param = 1; | ||
7630 | else if (strcmp(kbuf, "off") == 0) | ||
7631 | tap_param = 0; | ||
7632 | |||
7633 | set_disc_fn(pbp_device_block, tap_param); | ||
7634 | 7351 | ||
7352 | set_tap_fn(PDE_DATA(file_inode(file)), tap_param); | ||
7635 | return count; | 7353 | return count; |
7636 | } | 7354 | } |
7637 | 7355 | static int show_tap(struct seq_file *m, void *v) | |
7638 | int | ||
7639 | get_bypass_pfs(char *page, char **start, off_t off, int count, | ||
7640 | int *eof, void *data) | ||
7641 | { | 7356 | { |
7642 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7357 | bpctl_dev_t *dev = m->private; |
7643 | 7358 | int ret = get_tap_fn(dev); | |
7644 | int len = 0, ret = 0; | ||
7645 | |||
7646 | ret = get_bypass_fn(pbp_device_block); | ||
7647 | if (ret == BP_NOT_CAP) | 7359 | if (ret == BP_NOT_CAP) |
7648 | len = sprintf(page, "fail\n"); | 7360 | seq_printf(m, "fail\n"); |
7649 | else if (ret == 1) | 7361 | else if (ret == 1) |
7650 | len = sprintf(page, "on\n"); | 7362 | seq_printf(m, "on\n"); |
7651 | else if (ret == 0) | 7363 | else if (ret == 0) |
7652 | len = sprintf(page, "off\n"); | 7364 | seq_printf(m, "off\n"); |
7653 | 7365 | return 0; | |
7654 | *eof = 1; | ||
7655 | return len; | ||
7656 | } | 7366 | } |
7367 | RW_FOPS(tap) | ||
7657 | 7368 | ||
7658 | int | 7369 | static ssize_t disc_write(struct file *file, const char __user *buffer, |
7659 | get_tap_pfs(char *page, char **start, off_t off, int count, | 7370 | size_t count, loff_t *pos) |
7660 | int *eof, void *data) | ||
7661 | { | 7371 | { |
7662 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7372 | int tap_param = user_on_off(buffer, count); |
7663 | 7373 | if (tap_param < 0) | |
7664 | int len = 0, ret = 0; | 7374 | return -1; |
7665 | |||
7666 | ret = get_tap_fn(pbp_device_block); | ||
7667 | if (ret == BP_NOT_CAP) | ||
7668 | len = sprintf(page, "fail\n"); | ||
7669 | else if (ret == 1) | ||
7670 | len = sprintf(page, "on\n"); | ||
7671 | else if (ret == 0) | ||
7672 | len = sprintf(page, "off\n"); | ||
7673 | 7375 | ||
7674 | *eof = 1; | 7376 | set_disc_fn(PDE_DATA(file_inode(file)), tap_param); |
7675 | return len; | 7377 | return count; |
7676 | } | 7378 | } |
7677 | 7379 | static int show_disc(struct seq_file *m, void *v) | |
7678 | int | ||
7679 | get_disc_pfs(char *page, char **start, off_t off, int count, | ||
7680 | int *eof, void *data) | ||
7681 | { | 7380 | { |
7682 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7381 | bpctl_dev_t *dev = m->private; |
7683 | 7382 | int ret = get_disc_fn(dev); | |
7684 | int len = 0, ret = 0; | ||
7685 | |||
7686 | ret = get_disc_fn(pbp_device_block); | ||
7687 | if (ret == BP_NOT_CAP) | 7383 | if (ret == BP_NOT_CAP) |
7688 | len = sprintf(page, "fail\n"); | 7384 | seq_printf(m, "fail\n"); |
7689 | else if (ret == 1) | 7385 | else if (ret == 1) |
7690 | len = sprintf(page, "on\n"); | 7386 | seq_printf(m, "on\n"); |
7691 | else if (ret == 0) | 7387 | else if (ret == 0) |
7692 | len = sprintf(page, "off\n"); | 7388 | seq_printf(m, "off\n"); |
7693 | 7389 | return 0; | |
7694 | *eof = 1; | ||
7695 | return len; | ||
7696 | } | 7390 | } |
7391 | RW_FOPS(disc) | ||
7697 | 7392 | ||
7698 | int | 7393 | static int show_bypass_change(struct seq_file *m, void *v) |
7699 | get_bypass_change_pfs(char *page, char **start, off_t off, int count, | ||
7700 | int *eof, void *data) | ||
7701 | { | 7394 | { |
7702 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7395 | bpctl_dev_t *dev = m->private; |
7703 | 7396 | int ret = get_bypass_change_fn(dev); | |
7704 | int len = 0, ret = 0; | ||
7705 | |||
7706 | ret = get_bypass_change_fn(pbp_device_block); | ||
7707 | if (ret == 1) | 7397 | if (ret == 1) |
7708 | len = sprintf(page, "on\n"); | 7398 | seq_printf(m, "on\n"); |
7709 | else if (ret == 0) | 7399 | else if (ret == 0) |
7710 | len = sprintf(page, "off\n"); | 7400 | seq_printf(m, "off\n"); |
7711 | else | 7401 | else |
7712 | len = sprintf(page, "fail\n"); | 7402 | seq_printf(m, "fail\n"); |
7713 | 7403 | return 0; | |
7714 | *eof = 1; | ||
7715 | return len; | ||
7716 | } | 7404 | } |
7405 | RO_FOPS(bypass_change) | ||
7717 | 7406 | ||
7718 | int | 7407 | static int show_tap_change(struct seq_file *m, void *v) |
7719 | get_tap_change_pfs(char *page, char **start, off_t off, int count, | ||
7720 | int *eof, void *data) | ||
7721 | { | 7408 | { |
7722 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7409 | bpctl_dev_t *dev = m->private; |
7723 | 7410 | int ret = get_tap_change_fn(dev); | |
7724 | int len = 0, ret = 0; | ||
7725 | |||
7726 | ret = get_tap_change_fn(pbp_device_block); | ||
7727 | if (ret == 1) | 7411 | if (ret == 1) |
7728 | len = sprintf(page, "on\n"); | 7412 | seq_printf(m, "on\n"); |
7729 | else if (ret == 0) | 7413 | else if (ret == 0) |
7730 | len = sprintf(page, "off\n"); | 7414 | seq_printf(m, "off\n"); |
7731 | else | 7415 | else |
7732 | len = sprintf(page, "fail\n"); | 7416 | seq_printf(m, "fail\n"); |
7733 | 7417 | return 0; | |
7734 | *eof = 1; | ||
7735 | return len; | ||
7736 | } | 7418 | } |
7419 | RO_FOPS(tap_change) | ||
7737 | 7420 | ||
7738 | int | 7421 | static int show_disc_change(struct seq_file *m, void *v) |
7739 | get_disc_change_pfs(char *page, char **start, off_t off, int count, | ||
7740 | int *eof, void *data) | ||
7741 | { | 7422 | { |
7742 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7423 | bpctl_dev_t *dev = m->private; |
7743 | 7424 | int ret = get_disc_change_fn(dev); | |
7744 | int len = 0, ret = 0; | ||
7745 | |||
7746 | ret = get_disc_change_fn(pbp_device_block); | ||
7747 | if (ret == 1) | 7425 | if (ret == 1) |
7748 | len = sprintf(page, "on\n"); | 7426 | seq_printf(m, "on\n"); |
7749 | else if (ret == 0) | 7427 | else if (ret == 0) |
7750 | len = sprintf(page, "off\n"); | 7428 | seq_printf(m, "off\n"); |
7751 | else | 7429 | else |
7752 | len = sprintf(page, "fail\n"); | 7430 | seq_printf(m, "fail\n"); |
7753 | 7431 | return 0; | |
7754 | *eof = 1; | ||
7755 | return len; | ||
7756 | } | ||
7757 | |||
7758 | #define isdigit(c) (c >= '0' && c <= '9') | ||
7759 | __inline static int atoi(char **s) | ||
7760 | { | ||
7761 | int i = 0; | ||
7762 | while (isdigit(**s)) | ||
7763 | i = i * 10 + *((*s)++) - '0'; | ||
7764 | return i; | ||
7765 | } | 7432 | } |
7433 | RO_FOPS(disc_change) | ||
7766 | 7434 | ||
7767 | int | 7435 | static ssize_t bypass_wd_write(struct file *file, const char __user *buffer, |
7768 | set_bypass_wd_pfs(struct file *file, const char *buffer, | 7436 | size_t count, loff_t *pos) |
7769 | unsigned long count, void *data) | ||
7770 | { | 7437 | { |
7771 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7438 | bpctl_dev_t *dev = PDE_DATA(file_inode(file)); |
7772 | int timeout; | 7439 | int timeout; |
7773 | int ret; | 7440 | int ret = kstrtoint_from_user(buffer, count, 10, &timeout); |
7774 | |||
7775 | ret = kstrtoint_from_user(buffer, count, 10, &timeout); | ||
7776 | if (ret) | 7441 | if (ret) |
7777 | return ret; | 7442 | return ret; |
7778 | set_bypass_wd_fn(pbp_device_block, timeout); | 7443 | set_bypass_wd_fn(dev, timeout); |
7779 | |||
7780 | return count; | 7444 | return count; |
7781 | } | 7445 | } |
7782 | 7446 | static int show_bypass_wd(struct seq_file *m, void *v) | |
7783 | int | ||
7784 | get_bypass_wd_pfs(char *page, char **start, off_t off, int count, | ||
7785 | int *eof, void *data) | ||
7786 | { | 7447 | { |
7787 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7448 | bpctl_dev_t *dev = m->private; |
7449 | int ret = 0, timeout = 0; | ||
7788 | 7450 | ||
7789 | int len = 0, ret = 0, timeout = 0; | 7451 | ret = get_bypass_wd_fn(dev, &timeout); |
7790 | |||
7791 | ret = get_bypass_wd_fn(pbp_device_block, &timeout); | ||
7792 | if (ret == BP_NOT_CAP) | 7452 | if (ret == BP_NOT_CAP) |
7793 | len = sprintf(page, "fail\n"); | 7453 | seq_printf(m, "fail\n"); |
7794 | else if (timeout == -1) | 7454 | else if (timeout == -1) |
7795 | len = sprintf(page, "unknown\n"); | 7455 | seq_printf(m, "unknown\n"); |
7796 | else if (timeout == 0) | 7456 | else if (timeout == 0) |
7797 | len = sprintf(page, "disable\n"); | 7457 | seq_printf(m, "disable\n"); |
7798 | else | 7458 | else |
7799 | len = sprintf(page, "%d\n", timeout); | 7459 | seq_printf(m, "%d\n", timeout); |
7800 | 7460 | return 0; | |
7801 | *eof = 1; | ||
7802 | return len; | ||
7803 | } | 7461 | } |
7462 | RW_FOPS(bypass_wd) | ||
7804 | 7463 | ||
7805 | int | 7464 | static int show_wd_expire_time(struct seq_file *m, void *v) |
7806 | get_wd_expire_time_pfs(char *page, char **start, off_t off, int count, | ||
7807 | int *eof, void *data) | ||
7808 | { | 7465 | { |
7809 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7466 | bpctl_dev_t *dev = m->private; |
7810 | 7467 | int ret = 0, timeout = 0; | |
7811 | int len = 0, ret = 0, timeout = 0; | 7468 | ret = get_wd_expire_time_fn(dev, &timeout); |
7812 | |||
7813 | ret = get_wd_expire_time_fn(pbp_device_block, &timeout); | ||
7814 | if (ret == BP_NOT_CAP) | 7469 | if (ret == BP_NOT_CAP) |
7815 | len = sprintf(page, "fail\n"); | 7470 | seq_printf(m, "fail\n"); |
7816 | else if (timeout == -1) | 7471 | else if (timeout == -1) |
7817 | len = sprintf(page, "expire\n"); | 7472 | seq_printf(m, "expire\n"); |
7818 | else if (timeout == 0) | 7473 | else if (timeout == 0) |
7819 | len = sprintf(page, "disable\n"); | 7474 | seq_printf(m, "disable\n"); |
7820 | |||
7821 | else | 7475 | else |
7822 | len = sprintf(page, "%d\n", timeout); | 7476 | seq_printf(m, "%d\n", timeout); |
7823 | *eof = 1; | 7477 | return 0; |
7824 | return len; | ||
7825 | } | 7478 | } |
7479 | RO_FOPS(wd_expire_time) | ||
7826 | 7480 | ||
7827 | int | 7481 | static ssize_t tpl_write(struct file *file, const char __user *buffer, |
7828 | get_tpl_pfs(char *page, char **start, off_t off, int count, | 7482 | size_t count, loff_t *pos) |
7829 | int *eof, void *data) | ||
7830 | { | 7483 | { |
7831 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7484 | bpctl_dev_t *dev = PDE_DATA(file_inode(file)); |
7832 | 7485 | int tpl_param = user_on_off(buffer, count); | |
7833 | int len = 0, ret = 0; | 7486 | if (tpl_param < 0) |
7487 | return -1; | ||
7834 | 7488 | ||
7835 | ret = get_tpl_fn(pbp_device_block); | 7489 | set_tpl_fn(dev, tpl_param); |
7490 | return count; | ||
7491 | } | ||
7492 | static int show_tpl(struct seq_file *m, void *v) | ||
7493 | { | ||
7494 | bpctl_dev_t *dev = m->private; | ||
7495 | int ret = get_tpl_fn(dev); | ||
7836 | if (ret == BP_NOT_CAP) | 7496 | if (ret == BP_NOT_CAP) |
7837 | len = sprintf(page, "fail\n"); | 7497 | seq_printf(m, "fail\n"); |
7838 | else if (ret == 1) | 7498 | else if (ret == 1) |
7839 | len = sprintf(page, "on\n"); | 7499 | seq_printf(m, "on\n"); |
7840 | else if (ret == 0) | 7500 | else if (ret == 0) |
7841 | len = sprintf(page, "off\n"); | 7501 | seq_printf(m, "off\n"); |
7842 | 7502 | return 0; | |
7843 | *eof = 1; | ||
7844 | return len; | ||
7845 | } | 7503 | } |
7504 | RW_FOPS(tpl) | ||
7846 | 7505 | ||
7847 | #ifdef PMC_FIX_FLAG | 7506 | #ifdef PMC_FIX_FLAG |
7848 | int | 7507 | static ssize_t wait_at_pwup_write(struct file *file, const char __user *buffer, |
7849 | get_wait_at_pwup_pfs(char *page, char **start, off_t off, int count, | 7508 | size_t count, loff_t *pos) |
7850 | int *eof, void *data) | ||
7851 | { | 7509 | { |
7852 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7510 | bpctl_dev_t *dev = PDE_DATA(file_inode(file)); |
7853 | 7511 | int tpl_param = user_on_off(buffer, count); | |
7854 | int len = 0, ret = 0; | 7512 | if (tpl_param < 0) |
7513 | return -1; | ||
7855 | 7514 | ||
7856 | ret = get_bp_wait_at_pwup_fn(pbp_device_block); | 7515 | set_bp_wait_at_pwup_fn(dev, tpl_param); |
7516 | return count; | ||
7517 | } | ||
7518 | static int show_wait_at_pwup(struct seq_file *m, void *v) | ||
7519 | { | ||
7520 | bpctl_dev_t *dev = m->private; | ||
7521 | int ret = get_bp_wait_at_pwup_fn(dev); | ||
7857 | if (ret == BP_NOT_CAP) | 7522 | if (ret == BP_NOT_CAP) |
7858 | len = sprintf(page, "fail\n"); | 7523 | seq_printf(m, "fail\n"); |
7859 | else if (ret == 1) | 7524 | else if (ret == 1) |
7860 | len = sprintf(page, "on\n"); | 7525 | seq_printf(m, "on\n"); |
7861 | else if (ret == 0) | 7526 | else if (ret == 0) |
7862 | len = sprintf(page, "off\n"); | 7527 | seq_printf(m, "off\n"); |
7863 | 7528 | return 0; | |
7864 | *eof = 1; | ||
7865 | return len; | ||
7866 | } | 7529 | } |
7530 | RW_FOPS(wait_at_pwup) | ||
7867 | 7531 | ||
7868 | int | 7532 | static ssize_t hw_reset_write(struct file *file, const char __user *buffer, |
7869 | get_hw_reset_pfs(char *page, char **start, off_t off, int count, | 7533 | size_t count, loff_t *pos) |
7870 | int *eof, void *data) | ||
7871 | { | 7534 | { |
7872 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7535 | bpctl_dev_t *dev = PDE_DATA(file_inode(file)); |
7873 | 7536 | int tpl_param = user_on_off(buffer, count); | |
7874 | int len = 0, ret = 0; | 7537 | if (tpl_param < 0) |
7538 | return -1; | ||
7875 | 7539 | ||
7876 | ret = get_bp_hw_reset_fn(pbp_device_block); | 7540 | set_bp_hw_reset_fn(dev, tpl_param); |
7541 | return count; | ||
7542 | } | ||
7543 | static int show_hw_reset(struct seq_file *m, void *v) | ||
7544 | { | ||
7545 | bpctl_dev_t *dev = m->private; | ||
7546 | int ret = get_bp_hw_reset_fn(dev); | ||
7877 | if (ret == BP_NOT_CAP) | 7547 | if (ret == BP_NOT_CAP) |
7878 | len = sprintf(page, "fail\n"); | 7548 | seq_printf(m, "fail\n"); |
7879 | else if (ret == 1) | 7549 | else if (ret == 1) |
7880 | len = sprintf(page, "on\n"); | 7550 | seq_printf(m, "on\n"); |
7881 | else if (ret == 0) | 7551 | else if (ret == 0) |
7882 | len = sprintf(page, "off\n"); | 7552 | seq_printf(m, "off\n"); |
7883 | 7553 | return 0; | |
7884 | *eof = 1; | ||
7885 | return len; | ||
7886 | } | 7554 | } |
7555 | RW_FOPS(hw_reset) | ||
7887 | 7556 | ||
7888 | #endif /*PMC_WAIT_FLAG */ | 7557 | #endif /*PMC_WAIT_FLAG */ |
7889 | 7558 | ||
7890 | int | 7559 | static int show_reset_bypass_wd(struct seq_file *m, void *v) |
7891 | reset_bypass_wd_pfs(char *page, char **start, off_t off, int count, | ||
7892 | int *eof, void *data) | ||
7893 | { | 7560 | { |
7894 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7561 | bpctl_dev_t *dev = m->private; |
7895 | 7562 | int ret = reset_bypass_wd_timer_fn(dev); | |
7896 | int len = 0, ret = 0; | ||
7897 | |||
7898 | ret = reset_bypass_wd_timer_fn(pbp_device_block); | ||
7899 | if (ret == BP_NOT_CAP) | 7563 | if (ret == BP_NOT_CAP) |
7900 | len = sprintf(page, "fail\n"); | 7564 | seq_printf(m, "fail\n"); |
7901 | else if (ret == 0) | 7565 | else if (ret == 0) |
7902 | len = sprintf(page, "disable\n"); | 7566 | seq_printf(m, "disable\n"); |
7903 | else if (ret == 1) | 7567 | else if (ret == 1) |
7904 | len = sprintf(page, "success\n"); | 7568 | seq_printf(m, "success\n"); |
7905 | 7569 | return 0; | |
7906 | *eof = 1; | ||
7907 | return len; | ||
7908 | } | 7570 | } |
7571 | RO_FOPS(reset_bypass_wd) | ||
7909 | 7572 | ||
7910 | int | 7573 | static ssize_t dis_bypass_write(struct file *file, const char __user *buffer, |
7911 | set_dis_bypass_pfs(struct file *file, const char *buffer, | 7574 | size_t count, loff_t *pos) |
7912 | unsigned long count, void *data) | ||
7913 | { | 7575 | { |
7914 | 7576 | int bypass_param = user_on_off(buffer, count); | |
7915 | char kbuf[256]; | 7577 | if (bypass_param < 0) |
7916 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
7917 | |||
7918 | int bypass_param = 0, length = 0; | ||
7919 | |||
7920 | if (count >= sizeof(kbuf)) | ||
7921 | return -EINVAL; | 7578 | return -EINVAL; |
7922 | 7579 | ||
7923 | if (copy_from_user(&kbuf, buffer, count)) { | 7580 | set_dis_bypass_fn(PDE_DATA(file_inode(file)), bypass_param); |
7924 | return -1; | ||
7925 | } | ||
7926 | |||
7927 | kbuf[count] = '\0'; | ||
7928 | length = strlen(kbuf); | ||
7929 | if (kbuf[length - 1] == '\n') | ||
7930 | kbuf[--length] = '\0'; | ||
7931 | |||
7932 | if (strcmp(kbuf, "on") == 0) | ||
7933 | bypass_param = 1; | ||
7934 | else if (strcmp(kbuf, "off") == 0) | ||
7935 | bypass_param = 0; | ||
7936 | |||
7937 | set_dis_bypass_fn(pbp_device_block, bypass_param); | ||
7938 | |||
7939 | return count; | 7581 | return count; |
7940 | } | 7582 | } |
7941 | 7583 | static int show_dis_bypass(struct seq_file *m, void *v) | |
7942 | int | ||
7943 | set_dis_tap_pfs(struct file *file, const char *buffer, | ||
7944 | unsigned long count, void *data) | ||
7945 | { | 7584 | { |
7946 | 7585 | bpctl_dev_t *dev = m->private; | |
7947 | char kbuf[256]; | 7586 | int ret = get_dis_bypass_fn(dev); |
7948 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7587 | if (ret == BP_NOT_CAP) |
7949 | 7588 | seq_printf(m, "fail\n"); | |
7950 | int tap_param = 0, length = 0; | 7589 | else if (ret == 0) |
7951 | 7590 | seq_printf(m, "off\n"); | |
7952 | if (count >= sizeof(kbuf)) | 7591 | else |
7953 | return -EINVAL; | 7592 | seq_printf(m, "on\n"); |
7954 | 7593 | return 0; | |
7955 | if (copy_from_user(&kbuf, buffer, count)) { | ||
7956 | return -1; | ||
7957 | } | ||
7958 | |||
7959 | kbuf[count] = '\0'; | ||
7960 | length = strlen(kbuf); | ||
7961 | if (kbuf[length - 1] == '\n') | ||
7962 | kbuf[--length] = '\0'; | ||
7963 | |||
7964 | if (strcmp(kbuf, "on") == 0) | ||
7965 | tap_param = 1; | ||
7966 | else if (strcmp(kbuf, "off") == 0) | ||
7967 | tap_param = 0; | ||
7968 | |||
7969 | set_dis_tap_fn(pbp_device_block, tap_param); | ||
7970 | |||
7971 | return count; | ||
7972 | } | 7594 | } |
7595 | RW_FOPS(dis_bypass) | ||
7973 | 7596 | ||
7974 | int | 7597 | static ssize_t dis_tap_write(struct file *file, const char __user *buffer, |
7975 | set_dis_disc_pfs(struct file *file, const char *buffer, | 7598 | size_t count, loff_t *pos) |
7976 | unsigned long count, void *data) | ||
7977 | { | 7599 | { |
7978 | 7600 | int tap_param = user_on_off(buffer, count); | |
7979 | char kbuf[256]; | 7601 | if (tap_param < 0) |
7980 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
7981 | |||
7982 | int tap_param = 0, length = 0; | ||
7983 | |||
7984 | if (count >= sizeof(kbuf)) | ||
7985 | return -EINVAL; | 7602 | return -EINVAL; |
7986 | 7603 | ||
7987 | if (copy_from_user(&kbuf, buffer, count)) { | 7604 | set_dis_tap_fn(PDE_DATA(file_inode(file)), tap_param); |
7988 | return -1; | ||
7989 | } | ||
7990 | |||
7991 | kbuf[count] = '\0'; | ||
7992 | length = strlen(kbuf); | ||
7993 | if (kbuf[length - 1] == '\n') | ||
7994 | kbuf[--length] = '\0'; | ||
7995 | |||
7996 | if (strcmp(kbuf, "on") == 0) | ||
7997 | tap_param = 1; | ||
7998 | else if (strcmp(kbuf, "off") == 0) | ||
7999 | tap_param = 0; | ||
8000 | |||
8001 | set_dis_disc_fn(pbp_device_block, tap_param); | ||
8002 | |||
8003 | return count; | 7605 | return count; |
8004 | } | 7606 | } |
8005 | 7607 | static int show_dis_tap(struct seq_file *m, void *v) | |
8006 | int | ||
8007 | get_dis_bypass_pfs(char *page, char **start, off_t off, int count, | ||
8008 | int *eof, void *data) | ||
8009 | { | 7608 | { |
8010 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7609 | bpctl_dev_t *dev = m->private; |
8011 | 7610 | int ret = get_dis_tap_fn(dev); | |
8012 | int len = 0, ret = 0; | ||
8013 | |||
8014 | ret = get_dis_bypass_fn(pbp_device_block); | ||
8015 | if (ret == BP_NOT_CAP) | 7611 | if (ret == BP_NOT_CAP) |
8016 | len = sprintf(page, "fail\n"); | 7612 | seq_printf(m, "fail\n"); |
8017 | else if (ret == 0) | 7613 | else if (ret == 0) |
8018 | len = sprintf(page, "off\n"); | 7614 | seq_printf(m, "off\n"); |
8019 | else | 7615 | else |
8020 | len = sprintf(page, "on\n"); | 7616 | seq_printf(m, "on\n"); |
8021 | 7617 | return 0; | |
8022 | *eof = 1; | ||
8023 | return len; | ||
8024 | } | 7618 | } |
7619 | RW_FOPS(dis_tap) | ||
8025 | 7620 | ||
8026 | int | 7621 | static ssize_t dis_disc_write(struct file *file, const char __user *buffer, |
8027 | get_dis_tap_pfs(char *page, char **start, off_t off, int count, | 7622 | size_t count, loff_t *pos) |
8028 | int *eof, void *data) | ||
8029 | { | 7623 | { |
8030 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7624 | int tap_param = user_on_off(buffer, count); |
8031 | 7625 | if (tap_param < 0) | |
8032 | int len = 0, ret = 0; | 7626 | return -EINVAL; |
8033 | |||
8034 | ret = get_dis_tap_fn(pbp_device_block); | ||
8035 | if (ret == BP_NOT_CAP) | ||
8036 | len = sprintf(page, "fail\n"); | ||
8037 | else if (ret == 0) | ||
8038 | len = sprintf(page, "off\n"); | ||
8039 | else | ||
8040 | len = sprintf(page, "on\n"); | ||
8041 | 7627 | ||
8042 | *eof = 1; | 7628 | set_dis_disc_fn(PDE_DATA(file_inode(file)), tap_param); |
8043 | return len; | 7629 | return count; |
8044 | } | 7630 | } |
8045 | 7631 | static int show_dis_disc(struct seq_file *m, void *v) | |
8046 | int | ||
8047 | get_dis_disc_pfs(char *page, char **start, off_t off, int count, | ||
8048 | int *eof, void *data) | ||
8049 | { | 7632 | { |
8050 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7633 | bpctl_dev_t *dev = m->private; |
8051 | 7634 | int ret = get_dis_disc_fn(dev); | |
8052 | int len = 0, ret = 0; | ||
8053 | |||
8054 | ret = get_dis_disc_fn(pbp_device_block); | ||
8055 | if (ret == BP_NOT_CAP) | 7635 | if (ret == BP_NOT_CAP) |
8056 | len = sprintf(page, "fail\n"); | 7636 | seq_printf(m, "fail\n"); |
8057 | else if (ret == 0) | 7637 | else if (ret == 0) |
8058 | len = sprintf(page, "off\n"); | 7638 | seq_printf(m, "off\n"); |
8059 | else | 7639 | else |
8060 | len = sprintf(page, "on\n"); | 7640 | seq_printf(m, "on\n"); |
8061 | 7641 | return 0; | |
8062 | *eof = 1; | ||
8063 | return len; | ||
8064 | } | ||
8065 | |||
8066 | int | ||
8067 | set_bypass_pwup_pfs(struct file *file, const char *buffer, | ||
8068 | unsigned long count, void *data) | ||
8069 | { | ||
8070 | |||
8071 | char kbuf[256]; | ||
8072 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8073 | |||
8074 | int bypass_param = 0, length = 0; | ||
8075 | |||
8076 | if (count >= sizeof(kbuf)) | ||
8077 | return -EINVAL; | ||
8078 | |||
8079 | if (copy_from_user(&kbuf, buffer, count)) { | ||
8080 | return -1; | ||
8081 | } | ||
8082 | |||
8083 | kbuf[count] = '\0'; | ||
8084 | length = strlen(kbuf); | ||
8085 | if (kbuf[length - 1] == '\n') | ||
8086 | kbuf[--length] = '\0'; | ||
8087 | |||
8088 | if (strcmp(kbuf, "on") == 0) | ||
8089 | bypass_param = 1; | ||
8090 | else if (strcmp(kbuf, "off") == 0) | ||
8091 | bypass_param = 0; | ||
8092 | |||
8093 | set_bypass_pwup_fn(pbp_device_block, bypass_param); | ||
8094 | |||
8095 | return count; | ||
8096 | } | 7642 | } |
7643 | RW_FOPS(dis_disc) | ||
8097 | 7644 | ||
8098 | int | 7645 | static ssize_t bypass_pwup_write(struct file *file, const char __user *buffer, |
8099 | set_bypass_pwoff_pfs(struct file *file, const char *buffer, | 7646 | size_t count, loff_t *pos) |
8100 | unsigned long count, void *data) | ||
8101 | { | 7647 | { |
8102 | 7648 | int bypass_param = user_on_off(buffer, count); | |
8103 | char kbuf[256]; | 7649 | if (bypass_param < 0) |
8104 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8105 | |||
8106 | int bypass_param = 0, length = 0; | ||
8107 | |||
8108 | if (count >= sizeof(kbuf)) | ||
8109 | return -EINVAL; | 7650 | return -EINVAL; |
8110 | 7651 | ||
8111 | if (copy_from_user(&kbuf, buffer, count)) { | 7652 | set_bypass_pwup_fn(PDE_DATA(file_inode(file)), bypass_param); |
8112 | return -1; | ||
8113 | } | ||
8114 | |||
8115 | kbuf[count] = '\0'; | ||
8116 | length = strlen(kbuf); | ||
8117 | if (kbuf[length - 1] == '\n') | ||
8118 | kbuf[--length] = '\0'; | ||
8119 | |||
8120 | if (strcmp(kbuf, "on") == 0) | ||
8121 | bypass_param = 1; | ||
8122 | else if (strcmp(kbuf, "off") == 0) | ||
8123 | bypass_param = 0; | ||
8124 | |||
8125 | set_bypass_pwoff_fn(pbp_device_block, bypass_param); | ||
8126 | |||
8127 | return count; | 7653 | return count; |
8128 | } | 7654 | } |
8129 | 7655 | static int show_bypass_pwup(struct seq_file *m, void *v) | |
8130 | int | ||
8131 | set_tap_pwup_pfs(struct file *file, const char *buffer, | ||
8132 | unsigned long count, void *data) | ||
8133 | { | 7656 | { |
8134 | 7657 | bpctl_dev_t *dev = m->private; | |
8135 | char kbuf[256]; | 7658 | int ret = get_bypass_pwup_fn(dev); |
8136 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7659 | if (ret == BP_NOT_CAP) |
8137 | 7660 | seq_printf(m, "fail\n"); | |
8138 | int tap_param = 0, length = 0; | 7661 | else if (ret == 0) |
8139 | 7662 | seq_printf(m, "off\n"); | |
8140 | if (count >= sizeof(kbuf)) | 7663 | else |
8141 | return -EINVAL; | 7664 | seq_printf(m, "on\n"); |
8142 | 7665 | return 0; | |
8143 | if (copy_from_user(&kbuf, buffer, count)) { | ||
8144 | return -1; | ||
8145 | } | ||
8146 | |||
8147 | kbuf[count] = '\0'; | ||
8148 | length = strlen(kbuf); | ||
8149 | if (kbuf[length - 1] == '\n') | ||
8150 | kbuf[--length] = '\0'; | ||
8151 | |||
8152 | if (strcmp(kbuf, "on") == 0) | ||
8153 | tap_param = 1; | ||
8154 | else if (strcmp(kbuf, "off") == 0) | ||
8155 | tap_param = 0; | ||
8156 | |||
8157 | set_tap_pwup_fn(pbp_device_block, tap_param); | ||
8158 | |||
8159 | return count; | ||
8160 | } | 7666 | } |
7667 | RW_FOPS(bypass_pwup) | ||
8161 | 7668 | ||
8162 | int | 7669 | static ssize_t bypass_pwoff_write(struct file *file, const char __user *buffer, |
8163 | set_disc_pwup_pfs(struct file *file, const char *buffer, | 7670 | size_t count, loff_t *pos) |
8164 | unsigned long count, void *data) | ||
8165 | { | 7671 | { |
8166 | 7672 | int bypass_param = user_on_off(buffer, count); | |
8167 | char kbuf[256]; | 7673 | if (bypass_param < 0) |
8168 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8169 | |||
8170 | int tap_param = 0, length = 0; | ||
8171 | |||
8172 | if (count >= sizeof(kbuf)) | ||
8173 | return -EINVAL; | 7674 | return -EINVAL; |
8174 | 7675 | ||
8175 | if (copy_from_user(&kbuf, buffer, count)) { | 7676 | set_bypass_pwoff_fn(PDE_DATA(file_inode(file)), bypass_param); |
8176 | return -1; | ||
8177 | } | ||
8178 | |||
8179 | kbuf[count] = '\0'; | ||
8180 | length = strlen(kbuf); | ||
8181 | if (kbuf[length - 1] == '\n') | ||
8182 | kbuf[--length] = '\0'; | ||
8183 | |||
8184 | if (strcmp(kbuf, "on") == 0) | ||
8185 | tap_param = 1; | ||
8186 | else if (strcmp(kbuf, "off") == 0) | ||
8187 | tap_param = 0; | ||
8188 | |||
8189 | set_disc_pwup_fn(pbp_device_block, tap_param); | ||
8190 | |||
8191 | return count; | 7677 | return count; |
8192 | } | 7678 | } |
8193 | 7679 | static int show_bypass_pwoff(struct seq_file *m, void *v) | |
8194 | int | ||
8195 | get_bypass_pwup_pfs(char *page, char **start, off_t off, int count, | ||
8196 | int *eof, void *data) | ||
8197 | { | 7680 | { |
8198 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7681 | bpctl_dev_t *dev = m->private; |
8199 | 7682 | int ret = get_bypass_pwoff_fn(dev); | |
8200 | int len = 0, ret = 0; | ||
8201 | |||
8202 | ret = get_bypass_pwup_fn(pbp_device_block); | ||
8203 | if (ret == BP_NOT_CAP) | 7683 | if (ret == BP_NOT_CAP) |
8204 | len = sprintf(page, "fail\n"); | 7684 | seq_printf(m, "fail\n"); |
8205 | else if (ret == 0) | 7685 | else if (ret == 0) |
8206 | len = sprintf(page, "off\n"); | 7686 | seq_printf(m, "off\n"); |
8207 | else | 7687 | else |
8208 | len = sprintf(page, "on\n"); | 7688 | seq_printf(m, "on\n"); |
8209 | 7689 | return 0; | |
8210 | *eof = 1; | ||
8211 | return len; | ||
8212 | } | 7690 | } |
7691 | RW_FOPS(bypass_pwoff) | ||
8213 | 7692 | ||
8214 | int | 7693 | static ssize_t tap_pwup_write(struct file *file, const char __user *buffer, |
8215 | get_bypass_pwoff_pfs(char *page, char **start, off_t off, int count, | 7694 | size_t count, loff_t *pos) |
8216 | int *eof, void *data) | ||
8217 | { | 7695 | { |
8218 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7696 | int tap_param = user_on_off(buffer, count); |
8219 | 7697 | if (tap_param < 0) | |
8220 | int len = 0, ret = 0; | 7698 | return -EINVAL; |
8221 | |||
8222 | ret = get_bypass_pwoff_fn(pbp_device_block); | ||
8223 | if (ret == BP_NOT_CAP) | ||
8224 | len = sprintf(page, "fail\n"); | ||
8225 | else if (ret == 0) | ||
8226 | len = sprintf(page, "off\n"); | ||
8227 | else | ||
8228 | len = sprintf(page, "on\n"); | ||
8229 | 7699 | ||
8230 | *eof = 1; | 7700 | set_tap_pwup_fn(PDE_DATA(file_inode(file)), tap_param); |
8231 | return len; | 7701 | return count; |
8232 | } | 7702 | } |
8233 | 7703 | static int show_tap_pwup(struct seq_file *m, void *v) | |
8234 | int | ||
8235 | get_tap_pwup_pfs(char *page, char **start, off_t off, int count, | ||
8236 | int *eof, void *data) | ||
8237 | { | 7704 | { |
8238 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7705 | bpctl_dev_t *dev = m->private; |
8239 | 7706 | int ret = get_tap_pwup_fn(dev); | |
8240 | int len = 0, ret = 0; | ||
8241 | |||
8242 | ret = get_tap_pwup_fn(pbp_device_block); | ||
8243 | if (ret == BP_NOT_CAP) | 7707 | if (ret == BP_NOT_CAP) |
8244 | len = sprintf(page, "fail\n"); | 7708 | seq_printf(m, "fail\n"); |
8245 | else if (ret == 0) | 7709 | else if (ret == 0) |
8246 | len = sprintf(page, "off\n"); | 7710 | seq_printf(m, "off\n"); |
8247 | else | 7711 | else |
8248 | len = sprintf(page, "on\n"); | 7712 | seq_printf(m, "on\n"); |
8249 | 7713 | return 0; | |
8250 | *eof = 1; | ||
8251 | return len; | ||
8252 | } | 7714 | } |
7715 | RW_FOPS(tap_pwup) | ||
8253 | 7716 | ||
8254 | int | 7717 | static ssize_t disc_pwup_write(struct file *file, const char __user *buffer, |
8255 | get_disc_pwup_pfs(char *page, char **start, off_t off, int count, | 7718 | size_t count, loff_t *pos) |
8256 | int *eof, void *data) | ||
8257 | { | 7719 | { |
8258 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7720 | int tap_param = user_on_off(buffer, count); |
8259 | 7721 | if (tap_param < 0) | |
8260 | int len = 0, ret = 0; | 7722 | return -EINVAL; |
8261 | 7723 | ||
8262 | ret = get_disc_pwup_fn(pbp_device_block); | 7724 | set_disc_pwup_fn(PDE_DATA(file_inode(file)), tap_param); |
7725 | return count; | ||
7726 | } | ||
7727 | static int show_disc_pwup(struct seq_file *m, void *v) | ||
7728 | { | ||
7729 | bpctl_dev_t *dev = m->private; | ||
7730 | int ret = get_disc_pwup_fn(dev); | ||
8263 | if (ret == BP_NOT_CAP) | 7731 | if (ret == BP_NOT_CAP) |
8264 | len = sprintf(page, "fail\n"); | 7732 | seq_printf(m, "fail\n"); |
8265 | else if (ret == 0) | 7733 | else if (ret == 0) |
8266 | len = sprintf(page, "off\n"); | 7734 | seq_printf(m, "off\n"); |
8267 | else | 7735 | else |
8268 | len = sprintf(page, "on\n"); | 7736 | seq_printf(m, "on\n"); |
8269 | 7737 | return 0; | |
8270 | *eof = 1; | ||
8271 | return len; | ||
8272 | } | 7738 | } |
7739 | RW_FOPS(disc_pwup) | ||
8273 | 7740 | ||
8274 | int | 7741 | static ssize_t std_nic_write(struct file *file, const char __user *buffer, |
8275 | set_std_nic_pfs(struct file *file, const char *buffer, | 7742 | size_t count, loff_t *pos) |
8276 | unsigned long count, void *data) | ||
8277 | { | 7743 | { |
8278 | 7744 | int bypass_param = user_on_off(buffer, count); | |
8279 | char kbuf[256]; | 7745 | if (bypass_param < 0) |
8280 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8281 | |||
8282 | int bypass_param = 0, length = 0; | ||
8283 | |||
8284 | if (count >= sizeof(kbuf)) | ||
8285 | return -EINVAL; | 7746 | return -EINVAL; |
8286 | 7747 | ||
8287 | if (copy_from_user(&kbuf, buffer, count)) { | 7748 | set_std_nic_fn(PDE_DATA(file_inode(file)), bypass_param); |
8288 | return -1; | ||
8289 | } | ||
8290 | |||
8291 | kbuf[count] = '\0'; | ||
8292 | length = strlen(kbuf); | ||
8293 | if (kbuf[length - 1] == '\n') | ||
8294 | kbuf[--length] = '\0'; | ||
8295 | |||
8296 | if (strcmp(kbuf, "on") == 0) | ||
8297 | bypass_param = 1; | ||
8298 | else if (strcmp(kbuf, "off") == 0) | ||
8299 | bypass_param = 0; | ||
8300 | |||
8301 | set_std_nic_fn(pbp_device_block, bypass_param); | ||
8302 | |||
8303 | return count; | 7749 | return count; |
8304 | } | 7750 | } |
8305 | 7751 | static int show_std_nic(struct seq_file *m, void *v) | |
8306 | int | ||
8307 | get_std_nic_pfs(char *page, char **start, off_t off, int count, | ||
8308 | int *eof, void *data) | ||
8309 | { | 7752 | { |
8310 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7753 | bpctl_dev_t *dev = m->private; |
8311 | 7754 | int ret = get_std_nic_fn(dev); | |
8312 | int len = 0, ret = 0; | ||
8313 | |||
8314 | ret = get_std_nic_fn(pbp_device_block); | ||
8315 | if (ret == BP_NOT_CAP) | 7755 | if (ret == BP_NOT_CAP) |
8316 | len = sprintf(page, "fail\n"); | 7756 | seq_printf(m, "fail\n"); |
8317 | else if (ret == 0) | 7757 | else if (ret == 0) |
8318 | len = sprintf(page, "off\n"); | 7758 | seq_printf(m, "off\n"); |
8319 | else | 7759 | else |
8320 | len = sprintf(page, "on\n"); | 7760 | seq_printf(m, "on\n"); |
8321 | 7761 | return 0; | |
8322 | *eof = 1; | ||
8323 | return len; | ||
8324 | } | ||
8325 | |||
8326 | int | ||
8327 | get_wd_exp_mode_pfs(char *page, char **start, off_t off, int count, | ||
8328 | int *eof, void *data) | ||
8329 | { | ||
8330 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8331 | |||
8332 | int len = 0, ret = 0; | ||
8333 | |||
8334 | ret = get_wd_exp_mode_fn(pbp_device_block); | ||
8335 | if (ret == 1) | ||
8336 | len = sprintf(page, "tap\n"); | ||
8337 | else if (ret == 0) | ||
8338 | len = sprintf(page, "bypass\n"); | ||
8339 | else if (ret == 2) | ||
8340 | len = sprintf(page, "disc\n"); | ||
8341 | |||
8342 | else | ||
8343 | len = sprintf(page, "fail\n"); | ||
8344 | |||
8345 | *eof = 1; | ||
8346 | return len; | ||
8347 | } | 7762 | } |
7763 | RW_FOPS(std_nic) | ||
8348 | 7764 | ||
8349 | int | 7765 | static ssize_t wd_exp_mode_write(struct file *file, const char __user *buffer, |
8350 | set_wd_exp_mode_pfs(struct file *file, const char *buffer, | 7766 | size_t count, loff_t *pos) |
8351 | unsigned long count, void *data) | ||
8352 | { | 7767 | { |
8353 | |||
8354 | char kbuf[256]; | 7768 | char kbuf[256]; |
8355 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8356 | |||
8357 | int bypass_param = 0, length = 0; | 7769 | int bypass_param = 0, length = 0; |
8358 | 7770 | ||
8359 | if (count > (sizeof(kbuf) - 1)) | 7771 | if (count > (sizeof(kbuf) - 1)) |
8360 | return -1; | 7772 | return -1; |
8361 | 7773 | ||
8362 | if (copy_from_user(&kbuf, buffer, count)) { | 7774 | if (copy_from_user(&kbuf, buffer, count)) |
8363 | return -1; | 7775 | return -1; |
8364 | } | ||
8365 | 7776 | ||
8366 | kbuf[count] = '\0'; | 7777 | kbuf[count] = '\0'; |
8367 | length = strlen(kbuf); | 7778 | length = strlen(kbuf); |
@@ -8375,143 +7786,47 @@ set_wd_exp_mode_pfs(struct file *file, const char *buffer, | |||
8375 | else if (strcmp(kbuf, "disc") == 0) | 7786 | else if (strcmp(kbuf, "disc") == 0) |
8376 | bypass_param = 2; | 7787 | bypass_param = 2; |
8377 | 7788 | ||
8378 | set_wd_exp_mode_fn(pbp_device_block, bypass_param); | 7789 | set_wd_exp_mode_fn(PDE_DATA(file_inode(file)), bypass_param); |
8379 | 7790 | ||
8380 | return count; | 7791 | return count; |
8381 | } | 7792 | } |
8382 | 7793 | static int show_wd_exp_mode(struct seq_file *m, void *v) | |
8383 | int | ||
8384 | get_wd_autoreset_pfs(char *page, char **start, off_t off, int count, | ||
8385 | int *eof, void *data) | ||
8386 | { | 7794 | { |
8387 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7795 | bpctl_dev_t *dev = m->private; |
8388 | 7796 | int ret = get_wd_exp_mode_fn(dev); | |
8389 | int len = 0, ret = 0; | 7797 | if (ret == 1) |
8390 | 7798 | seq_printf(m, "tap\n"); | |
8391 | ret = get_wd_autoreset_fn(pbp_device_block); | 7799 | else if (ret == 0) |
8392 | if (ret >= 0) | 7800 | seq_printf(m, "bypass\n"); |
8393 | len = sprintf(page, "%d\n", ret); | 7801 | else if (ret == 2) |
7802 | seq_printf(m, "disc\n"); | ||
8394 | else | 7803 | else |
8395 | len = sprintf(page, "fail\n"); | 7804 | seq_printf(m, "fail\n"); |
8396 | 7805 | return 0; | |
8397 | *eof = 1; | ||
8398 | return len; | ||
8399 | } | 7806 | } |
7807 | RW_FOPS(wd_exp_mode) | ||
8400 | 7808 | ||
8401 | int | 7809 | static ssize_t wd_autoreset_write(struct file *file, const char __user *buffer, |
8402 | set_wd_autoreset_pfs(struct file *file, const char *buffer, | 7810 | size_t count, loff_t *pos) |
8403 | unsigned long count, void *data) | ||
8404 | { | 7811 | { |
8405 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8406 | int timeout; | 7812 | int timeout; |
8407 | int ret; | 7813 | int ret = kstrtoint_from_user(buffer, count, 10, &timeout); |
8408 | |||
8409 | ret = kstrtoint_from_user(buffer, count, 10, &timeout); | ||
8410 | if (ret) | 7814 | if (ret) |
8411 | return ret; | 7815 | return ret; |
8412 | set_wd_autoreset_fn(pbp_device_block, timeout); | 7816 | set_wd_autoreset_fn(PDE_DATA(file_inode(file)), timeout); |
8413 | |||
8414 | return count; | ||
8415 | } | ||
8416 | |||
8417 | int | ||
8418 | set_tpl_pfs(struct file *file, const char *buffer, | ||
8419 | unsigned long count, void *data) | ||
8420 | { | ||
8421 | |||
8422 | char kbuf[256]; | ||
8423 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8424 | |||
8425 | int tpl_param = 0, length = 0; | ||
8426 | |||
8427 | if (count > (sizeof(kbuf) - 1)) | ||
8428 | return -1; | ||
8429 | |||
8430 | if (copy_from_user(&kbuf, buffer, count)) { | ||
8431 | return -1; | ||
8432 | } | ||
8433 | |||
8434 | kbuf[count] = '\0'; | ||
8435 | length = strlen(kbuf); | ||
8436 | if (kbuf[length - 1] == '\n') | ||
8437 | kbuf[--length] = '\0'; | ||
8438 | |||
8439 | if (strcmp(kbuf, "on") == 0) | ||
8440 | tpl_param = 1; | ||
8441 | else if (strcmp(kbuf, "off") == 0) | ||
8442 | tpl_param = 0; | ||
8443 | |||
8444 | set_tpl_fn(pbp_device_block, tpl_param); | ||
8445 | |||
8446 | return count; | 7817 | return count; |
8447 | } | 7818 | } |
8448 | 7819 | static int show_wd_autoreset(struct seq_file *m, void *v) | |
8449 | #ifdef PMC_FIX_FLAG | ||
8450 | int | ||
8451 | set_wait_at_pwup_pfs(struct file *file, const char *buffer, | ||
8452 | unsigned long count, void *data) | ||
8453 | { | ||
8454 | |||
8455 | char kbuf[256]; | ||
8456 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | ||
8457 | |||
8458 | int tpl_param = 0, length = 0; | ||
8459 | |||
8460 | if (count > (sizeof(kbuf) - 1)) | ||
8461 | return -1; | ||
8462 | |||
8463 | if (copy_from_user(&kbuf, buffer, count)) { | ||
8464 | return -1; | ||
8465 | } | ||
8466 | |||
8467 | kbuf[count] = '\0'; | ||
8468 | length = strlen(kbuf); | ||
8469 | if (kbuf[length - 1] == '\n') | ||
8470 | kbuf[--length] = '\0'; | ||
8471 | |||
8472 | if (strcmp(kbuf, "on") == 0) | ||
8473 | tpl_param = 1; | ||
8474 | else if (strcmp(kbuf, "off") == 0) | ||
8475 | tpl_param = 0; | ||
8476 | |||
8477 | set_bp_wait_at_pwup_fn(pbp_device_block, tpl_param); | ||
8478 | |||
8479 | return count; | ||
8480 | } | ||
8481 | |||
8482 | int | ||
8483 | set_hw_reset_pfs(struct file *file, const char *buffer, | ||
8484 | unsigned long count, void *data) | ||
8485 | { | 7820 | { |
8486 | 7821 | bpctl_dev_t *dev = m->private; | |
8487 | char kbuf[256]; | 7822 | int ret = get_wd_autoreset_fn(dev); |
8488 | bpctl_dev_t *pbp_device_block = (bpctl_dev_t *) data; | 7823 | if (ret >= 0) |
8489 | 7824 | seq_printf(m, "%d\n", ret); | |
8490 | int tpl_param = 0, length = 0; | 7825 | else |
8491 | 7826 | seq_printf(m, "fail\n"); | |
8492 | if (count > (sizeof(kbuf) - 1)) | 7827 | return 0; |
8493 | return -1; | ||
8494 | |||
8495 | if (copy_from_user(&kbuf, buffer, count)) { | ||
8496 | return -1; | ||
8497 | } | ||
8498 | |||
8499 | kbuf[count] = '\0'; | ||
8500 | length = strlen(kbuf); | ||
8501 | if (kbuf[length - 1] == '\n') | ||
8502 | kbuf[--length] = '\0'; | ||
8503 | |||
8504 | if (strcmp(kbuf, "on") == 0) | ||
8505 | tpl_param = 1; | ||
8506 | else if (strcmp(kbuf, "off") == 0) | ||
8507 | tpl_param = 0; | ||
8508 | |||
8509 | set_bp_hw_reset_fn(pbp_device_block, tpl_param); | ||
8510 | |||
8511 | return count; | ||
8512 | } | 7828 | } |
8513 | 7829 | RW_FOPS(wd_autoreset) | |
8514 | #endif /*PMC_FIX_FLAG */ | ||
8515 | 7830 | ||
8516 | int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block) | 7831 | int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block) |
8517 | { | 7832 | { |
@@ -8528,168 +7843,54 @@ int bypass_proc_create_dev_sd(bpctl_dev_t *pbp_device_block) | |||
8528 | return -1; | 7843 | return -1; |
8529 | 7844 | ||
8530 | /* create device proc dir */ | 7845 | /* create device proc dir */ |
8531 | procfs_dir = proc_getdir(current_pfs->dir_name, bp_procfs_dir); | 7846 | procfs_dir = proc_mkdir(current_pfs->dir_name, bp_procfs_dir); |
8532 | if (procfs_dir == 0) { | 7847 | if (!procfs_dir) { |
8533 | printk(KERN_DEBUG "Could not create procfs directory %s\n", | 7848 | printk(KERN_DEBUG "Could not create procfs directory %s\n", |
8534 | current_pfs->dir_name); | 7849 | current_pfs->dir_name); |
8535 | return -1; | 7850 | return -1; |
8536 | } | 7851 | } |
8537 | current_pfs->bypass_entry = procfs_dir; | 7852 | current_pfs->bypass_entry = procfs_dir; |
8538 | 7853 | ||
8539 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_info), BYPASS_INFO_ENTRY_SD, NULL, /* write */ | 7854 | #define ENTRY(x) ret |= procfs_add(#x, &x##_ops, pbp_device_block) |
8540 | get_bypass_info_pfs, /* read */ | 7855 | ENTRY(bypass_info); |
8541 | procfs_dir, pbp_device_block)) | ||
8542 | ret = -1; | ||
8543 | |||
8544 | if (pbp_device_block->bp_caps & SW_CTL_CAP) { | 7856 | if (pbp_device_block->bp_caps & SW_CTL_CAP) { |
8545 | |||
8546 | /* Create set param proc's */ | 7857 | /* Create set param proc's */ |
8547 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_slave), BYPASS_SLAVE_ENTRY_SD, NULL, /* write */ | 7858 | ENTRY(bypass_slave); |
8548 | get_bypass_slave_pfs, /* read */ | 7859 | ENTRY(bypass_caps); |
8549 | procfs_dir, pbp_device_block)) | 7860 | ENTRY(wd_set_caps); |
8550 | ret = -1; | 7861 | ENTRY(bypass_wd); |
8551 | 7862 | ENTRY(wd_expire_time); | |
8552 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_caps), BYPASS_CAPS_ENTRY_SD, NULL, /* write */ | 7863 | ENTRY(reset_bypass_wd); |
8553 | get_bypass_caps_pfs, /* read */ | 7864 | ENTRY(std_nic); |
8554 | procfs_dir, pbp_device_block)) | ||
8555 | ret = -1; | ||
8556 | |||
8557 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_set_caps), WD_SET_CAPS_ENTRY_SD, NULL, /* write */ | ||
8558 | get_wd_set_caps_pfs, /* read */ | ||
8559 | procfs_dir, pbp_device_block)) | ||
8560 | ret = -1; | ||
8561 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_wd), BYPASS_WD_ENTRY_SD, set_bypass_wd_pfs, /* write */ | ||
8562 | get_bypass_wd_pfs, /* read */ | ||
8563 | procfs_dir, pbp_device_block)) | ||
8564 | ret = -1; | ||
8565 | |||
8566 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_expire_time), WD_EXPIRE_TIME_ENTRY_SD, NULL, /* write */ | ||
8567 | get_wd_expire_time_pfs, /* read */ | ||
8568 | procfs_dir, pbp_device_block)) | ||
8569 | ret = -1; | ||
8570 | |||
8571 | if (bypass_proc_create_entry_sd(&(current_pfs->reset_bypass_wd), RESET_BYPASS_WD_ENTRY_SD, NULL, /* write */ | ||
8572 | reset_bypass_wd_pfs, /* read */ | ||
8573 | procfs_dir, pbp_device_block)) | ||
8574 | ret = -1; | ||
8575 | |||
8576 | if (bypass_proc_create_entry_sd(&(current_pfs->std_nic), STD_NIC_ENTRY_SD, set_std_nic_pfs, /* write */ | ||
8577 | get_std_nic_pfs, /* read */ | ||
8578 | procfs_dir, pbp_device_block)) | ||
8579 | ret = -1; | ||
8580 | |||
8581 | if (pbp_device_block->bp_caps & BP_CAP) { | 7865 | if (pbp_device_block->bp_caps & BP_CAP) { |
8582 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass), BYPASS_ENTRY_SD, set_bypass_pfs, /* write */ | 7866 | ENTRY(bypass); |
8583 | get_bypass_pfs, /* read */ | 7867 | ENTRY(dis_bypass); |
8584 | procfs_dir, | 7868 | ENTRY(bypass_pwup); |
8585 | pbp_device_block)) | 7869 | ENTRY(bypass_pwoff); |
8586 | ret = -1; | 7870 | ENTRY(bypass_change); |
8587 | |||
8588 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_bypass), DIS_BYPASS_ENTRY_SD, set_dis_bypass_pfs, /* write */ | ||
8589 | get_dis_bypass_pfs, /* read */ | ||
8590 | procfs_dir, | ||
8591 | pbp_device_block)) | ||
8592 | ret = -1; | ||
8593 | |||
8594 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwup), BYPASS_PWUP_ENTRY_SD, set_bypass_pwup_pfs, /* write */ | ||
8595 | get_bypass_pwup_pfs, /* read */ | ||
8596 | procfs_dir, | ||
8597 | pbp_device_block)) | ||
8598 | ret = -1; | ||
8599 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_pwoff), BYPASS_PWOFF_ENTRY_SD, set_bypass_pwoff_pfs, /* write */ | ||
8600 | get_bypass_pwoff_pfs, /* read */ | ||
8601 | procfs_dir, | ||
8602 | pbp_device_block)) | ||
8603 | ret = -1; | ||
8604 | |||
8605 | if (bypass_proc_create_entry_sd(&(current_pfs->bypass_change), BYPASS_CHANGE_ENTRY_SD, NULL, /* write */ | ||
8606 | get_bypass_change_pfs, /* read */ | ||
8607 | procfs_dir, | ||
8608 | pbp_device_block)) | ||
8609 | ret = -1; | ||
8610 | } | 7871 | } |
8611 | |||
8612 | if (pbp_device_block->bp_caps & TAP_CAP) { | 7872 | if (pbp_device_block->bp_caps & TAP_CAP) { |
8613 | 7873 | ENTRY(tap); | |
8614 | if (bypass_proc_create_entry_sd(&(current_pfs->tap), TAP_ENTRY_SD, set_tap_pfs, /* write */ | 7874 | ENTRY(dis_tap); |
8615 | get_tap_pfs, /* read */ | 7875 | ENTRY(tap_pwup); |
8616 | procfs_dir, | 7876 | ENTRY(tap_change); |
8617 | pbp_device_block)) | ||
8618 | ret = -1; | ||
8619 | |||
8620 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), DIS_TAP_ENTRY_SD, set_dis_tap_pfs, /* write */ | ||
8621 | get_dis_tap_pfs, /* read */ | ||
8622 | procfs_dir, | ||
8623 | pbp_device_block)) | ||
8624 | ret = -1; | ||
8625 | |||
8626 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), TAP_PWUP_ENTRY_SD, set_tap_pwup_pfs, /* write */ | ||
8627 | get_tap_pwup_pfs, /* read */ | ||
8628 | procfs_dir, | ||
8629 | pbp_device_block)) | ||
8630 | ret = -1; | ||
8631 | |||
8632 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), TAP_CHANGE_ENTRY_SD, NULL, /* write */ | ||
8633 | get_tap_change_pfs, /* read */ | ||
8634 | procfs_dir, | ||
8635 | pbp_device_block)) | ||
8636 | ret = -1; | ||
8637 | } | 7877 | } |
8638 | if (pbp_device_block->bp_caps & DISC_CAP) { | 7878 | if (pbp_device_block->bp_caps & DISC_CAP) { |
8639 | 7879 | ENTRY(disc); | |
8640 | if (bypass_proc_create_entry_sd(&(current_pfs->tap), DISC_ENTRY_SD, set_disc_pfs, /* write */ | 7880 | ENTRY(dis_disc); |
8641 | get_disc_pfs, /* read */ | 7881 | ENTRY(disc_pwup); |
8642 | procfs_dir, | 7882 | ENTRY(disc_change); |
8643 | pbp_device_block)) | ||
8644 | ret = -1; | ||
8645 | #if 1 | ||
8646 | |||
8647 | if (bypass_proc_create_entry_sd(&(current_pfs->dis_tap), DIS_DISC_ENTRY_SD, set_dis_disc_pfs, /* write */ | ||
8648 | get_dis_disc_pfs, /* read */ | ||
8649 | procfs_dir, | ||
8650 | pbp_device_block)) | ||
8651 | ret = -1; | ||
8652 | #endif | ||
8653 | |||
8654 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_pwup), DISC_PWUP_ENTRY_SD, set_disc_pwup_pfs, /* write */ | ||
8655 | get_disc_pwup_pfs, /* read */ | ||
8656 | procfs_dir, | ||
8657 | pbp_device_block)) | ||
8658 | ret = -1; | ||
8659 | |||
8660 | if (bypass_proc_create_entry_sd(&(current_pfs->tap_change), DISC_CHANGE_ENTRY_SD, NULL, /* write */ | ||
8661 | get_disc_change_pfs, /* read */ | ||
8662 | procfs_dir, | ||
8663 | pbp_device_block)) | ||
8664 | ret = -1; | ||
8665 | } | 7883 | } |
8666 | 7884 | ||
8667 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_exp_mode), WD_EXP_MODE_ENTRY_SD, set_wd_exp_mode_pfs, /* write */ | 7885 | ENTRY(wd_exp_mode); |
8668 | get_wd_exp_mode_pfs, /* read */ | 7886 | ENTRY(wd_autoreset); |
8669 | procfs_dir, pbp_device_block)) | 7887 | ENTRY(tpl); |
8670 | ret = -1; | ||
8671 | |||
8672 | if (bypass_proc_create_entry_sd(&(current_pfs->wd_autoreset), WD_AUTORESET_ENTRY_SD, set_wd_autoreset_pfs, /* write */ | ||
8673 | get_wd_autoreset_pfs, /* read */ | ||
8674 | procfs_dir, pbp_device_block)) | ||
8675 | ret = -1; | ||
8676 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), TPL_ENTRY_SD, set_tpl_pfs, /* write */ | ||
8677 | get_tpl_pfs, /* read */ | ||
8678 | procfs_dir, pbp_device_block)) | ||
8679 | ret = -1; | ||
8680 | #ifdef PMC_FIX_FLAG | 7888 | #ifdef PMC_FIX_FLAG |
8681 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), WAIT_AT_PWUP_ENTRY_SD, set_wait_at_pwup_pfs, /* write */ | 7889 | ENTRY(wait_at_pwup); |
8682 | get_wait_at_pwup_pfs, /* read */ | 7890 | ENTRY(hw_reset); |
8683 | procfs_dir, pbp_device_block)) | ||
8684 | ret = -1; | ||
8685 | if (bypass_proc_create_entry_sd(&(current_pfs->tpl), HW_RESET_ENTRY_SD, set_hw_reset_pfs, /* write */ | ||
8686 | get_hw_reset_pfs, /* read */ | ||
8687 | procfs_dir, pbp_device_block)) | ||
8688 | ret = -1; | ||
8689 | |||
8690 | #endif | 7891 | #endif |
8691 | |||
8692 | } | 7892 | } |
7893 | #undef ENTRY | ||
8693 | if (ret < 0) | 7894 | if (ret < 0) |
8694 | printk(KERN_DEBUG "Create proc entry failed\n"); | 7895 | printk(KERN_DEBUG "Create proc entry failed\n"); |
8695 | 7896 | ||
@@ -8700,21 +7901,7 @@ int bypass_proc_remove_dev_sd(bpctl_dev_t *pbp_device_block) | |||
8700 | { | 7901 | { |
8701 | 7902 | ||
8702 | struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; | 7903 | struct bypass_pfs_sd *current_pfs = &pbp_device_block->bypass_pfs_set; |
8703 | struct proc_dir_entry *pde = current_pfs->bypass_entry, *pde_curr = | 7904 | remove_proc_subtree(current_pfs->dir_name, bp_procfs_dir); |
8704 | NULL; | ||
8705 | char name[256]; | ||
8706 | |||
8707 | if (!pde) | ||
8708 | return 0; | ||
8709 | for (pde = pde->subdir; pde;) { | ||
8710 | strcpy(name, pde->name); | ||
8711 | pde_curr = pde; | ||
8712 | pde = pde->next; | ||
8713 | remove_proc_entry(name, current_pfs->bypass_entry); | ||
8714 | } | ||
8715 | if (!pde) | ||
8716 | remove_proc_entry(current_pfs->dir_name, bp_procfs_dir); | ||
8717 | current_pfs->bypass_entry = NULL; | 7905 | current_pfs->bypass_entry = NULL; |
8718 | |||
8719 | return 0; | 7906 | return 0; |
8720 | } | 7907 | } |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index be4f6c2ca3ff..08b250f01dae 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -60,6 +60,7 @@ | |||
60 | */ | 60 | */ |
61 | #undef __NO_VERSION__ | 61 | #undef __NO_VERSION__ |
62 | 62 | ||
63 | #include <linux/file.h> | ||
63 | #include "device.h" | 64 | #include "device.h" |
64 | #include "card.h" | 65 | #include "card.h" |
65 | #include "channel.h" | 66 | #include "channel.h" |
@@ -2737,83 +2738,50 @@ static int Config_FileGetParameter(unsigned char *string, | |||
2737 | return true; | 2738 | return true; |
2738 | } | 2739 | } |
2739 | 2740 | ||
2740 | int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter) { | 2741 | int Config_FileOperation(PSDevice pDevice,bool fwrite,unsigned char *Parameter) |
2741 | unsigned char *config_path = CONFIG_PATH; | 2742 | { |
2742 | unsigned char *buffer = NULL; | 2743 | unsigned char *buffer = kmalloc(1024, GFP_KERNEL); |
2743 | unsigned char tmpbuffer[20]; | 2744 | unsigned char tmpbuffer[20]; |
2744 | struct file *filp = NULL; | 2745 | struct file *file; |
2745 | mm_segment_t old_fs = get_fs(); | 2746 | int result=0; |
2746 | //int oldfsuid=0,oldfsgid=0; | ||
2747 | int result = 0; | ||
2748 | |||
2749 | set_fs(KERNEL_DS); | ||
2750 | |||
2751 | /* Can't do this anymore, so we rely on correct filesystem permissions: | ||
2752 | //Make sure a caller can read or write power as root | ||
2753 | oldfsuid=current->cred->fsuid; | ||
2754 | oldfsgid=current->cred->fsgid; | ||
2755 | current->cred->fsuid = 0; | ||
2756 | current->cred->fsgid = 0; | ||
2757 | */ | ||
2758 | |||
2759 | //open file | ||
2760 | filp = filp_open(config_path, O_RDWR, 0); | ||
2761 | if (IS_ERR(filp)) { | ||
2762 | printk("Config_FileOperation:open file fail?\n"); | ||
2763 | result = -1; | ||
2764 | goto error2; | ||
2765 | } | ||
2766 | 2747 | ||
2767 | if (!(filp->f_op) || !(filp->f_op->read) || !(filp->f_op->write)) { | 2748 | if (!buffer) { |
2768 | printk("file %s cann't readable or writable?\n", config_path); | ||
2769 | result = -1; | ||
2770 | goto error1; | ||
2771 | } | ||
2772 | |||
2773 | buffer = kmalloc(1024, GFP_KERNEL); | ||
2774 | if (buffer == NULL) { | ||
2775 | printk("allocate mem for file fail?\n"); | 2749 | printk("allocate mem for file fail?\n"); |
2776 | result = -1; | 2750 | return -1; |
2777 | goto error1; | 2751 | } |
2752 | file = filp_open(CONFIG_PATH, O_RDONLY, 0); | ||
2753 | if (IS_ERR(file)) { | ||
2754 | kfree(buffer); | ||
2755 | printk("Config_FileOperation:open file fail?\n"); | ||
2756 | return -1; | ||
2778 | } | 2757 | } |
2779 | 2758 | ||
2780 | if (filp->f_op->read(filp, buffer, 1024, &filp->f_pos) < 0) { | 2759 | if (kernel_read(file, 0, buffer, 1024) < 0) { |
2781 | printk("read file error?\n"); | 2760 | printk("read file error?\n"); |
2782 | result = -1; | 2761 | result = -1; |
2783 | goto error1; | 2762 | goto error1; |
2784 | } | 2763 | } |
2785 | 2764 | ||
2786 | if (Config_FileGetParameter("ZONETYPE", tmpbuffer, buffer) != true) { | 2765 | if (Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer)!=true) { |
2787 | printk("get parameter error?\n"); | 2766 | printk("get parameter error?\n"); |
2788 | result = -1; | 2767 | result = -1; |
2789 | goto error1; | 2768 | goto error1; |
2790 | } | 2769 | } |
2791 | 2770 | ||
2792 | if (memcmp(tmpbuffer, "USA", 3) == 0) { | 2771 | if (memcmp(tmpbuffer,"USA",3)==0) { |
2793 | result = ZoneType_USA; | 2772 | result = ZoneType_USA; |
2794 | } else if (memcmp(tmpbuffer, "JAPAN", 5) == 0) { | 2773 | } else if(memcmp(tmpbuffer,"JAPAN",5)==0) { |
2795 | result = ZoneType_Japan; | 2774 | result = ZoneType_Japan; |
2796 | } else if (memcmp(tmpbuffer, "EUROPE", 5) == 0) { | 2775 | } else if(memcmp(tmpbuffer,"EUROPE",5)==0) { |
2797 | result = ZoneType_Europe; | 2776 | result = ZoneType_Europe; |
2798 | } else { | 2777 | } else { |
2799 | result = -1; | 2778 | result = -1; |
2800 | printk("Unknown Zonetype[%s]?\n", tmpbuffer); | 2779 | printk("Unknown Zonetype[%s]?\n",tmpbuffer); |
2801 | } | 2780 | } |
2802 | 2781 | ||
2803 | error1: | 2782 | error1: |
2804 | kfree(buffer); | 2783 | kfree(buffer); |
2805 | 2784 | fput(file); | |
2806 | if (filp_close(filp, NULL)) | ||
2807 | printk("Config_FileOperation:close file fail\n"); | ||
2808 | |||
2809 | error2: | ||
2810 | set_fs(old_fs); | ||
2811 | |||
2812 | /* | ||
2813 | current->cred->fsuid=oldfsuid; | ||
2814 | current->cred->fsgid=oldfsgid; | ||
2815 | */ | ||
2816 | |||
2817 | return result; | 2785 | return result; |
2818 | } | 2786 | } |
2819 | 2787 | ||
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 2161af83eaa0..3a3fdc58b6da 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c | |||
@@ -46,6 +46,7 @@ | |||
46 | */ | 46 | */ |
47 | #undef __NO_VERSION__ | 47 | #undef __NO_VERSION__ |
48 | 48 | ||
49 | #include <linux/file.h> | ||
49 | #include "device.h" | 50 | #include "device.h" |
50 | #include "card.h" | 51 | #include "card.h" |
51 | #include "baseband.h" | 52 | #include "baseband.h" |
@@ -1273,53 +1274,29 @@ static int Config_FileGetParameter(unsigned char *string, | |||
1273 | /* if read fails, return NULL, or return data pointer */ | 1274 | /* if read fails, return NULL, or return data pointer */ |
1274 | static unsigned char *Config_FileOperation(struct vnt_private *pDevice) | 1275 | static unsigned char *Config_FileOperation(struct vnt_private *pDevice) |
1275 | { | 1276 | { |
1276 | unsigned char *config_path = CONFIG_PATH; | 1277 | unsigned char *buffer = kmalloc(1024, GFP_KERNEL); |
1277 | unsigned char *buffer = NULL; | 1278 | struct file *file; |
1278 | struct file *filp=NULL; | ||
1279 | mm_segment_t old_fs = get_fs(); | ||
1280 | 1279 | ||
1281 | int result = 0; | 1280 | if (!buffer) { |
1282 | 1281 | printk("allocate mem for file fail?\n"); | |
1283 | set_fs (KERNEL_DS); | 1282 | return NULL; |
1284 | 1283 | } | |
1285 | /* open file */ | ||
1286 | filp = filp_open(config_path, O_RDWR, 0); | ||
1287 | if (IS_ERR(filp)) { | ||
1288 | printk("Config_FileOperation file Not exist\n"); | ||
1289 | result=-1; | ||
1290 | goto error2; | ||
1291 | } | ||
1292 | |||
1293 | if(!(filp->f_op) || !(filp->f_op->read) ||!(filp->f_op->write)) { | ||
1294 | printk("file %s is not read or writeable?\n",config_path); | ||
1295 | result = -1; | ||
1296 | goto error1; | ||
1297 | } | ||
1298 | |||
1299 | buffer = kmalloc(1024, GFP_KERNEL); | ||
1300 | if(buffer==NULL) { | ||
1301 | printk("allocate mem for file fail?\n"); | ||
1302 | result = -1; | ||
1303 | goto error1; | ||
1304 | } | ||
1305 | |||
1306 | if(filp->f_op->read(filp, buffer, 1024, &filp->f_pos)<0) { | ||
1307 | printk("read file error?\n"); | ||
1308 | result = -1; | ||
1309 | } | ||
1310 | 1284 | ||
1311 | error1: | 1285 | file = filp_open(CONFIG_PATH, O_RDONLY, 0); |
1312 | if(filp_close(filp,NULL)) | 1286 | if (IS_ERR(file)) { |
1313 | printk("Config_FileOperation:close file fail\n"); | 1287 | kfree(buffer); |
1288 | printk("Config_FileOperation file Not exist\n"); | ||
1289 | return NULL; | ||
1290 | } | ||
1314 | 1291 | ||
1315 | error2: | 1292 | if (kernel_read(file, 0, buffer, 1024) < 0) { |
1316 | set_fs (old_fs); | 1293 | printk("read file error?\n"); |
1294 | kfree(buffer); | ||
1295 | buffer = NULL; | ||
1296 | } | ||
1317 | 1297 | ||
1318 | if(result!=0) { | 1298 | fput(file); |
1319 | kfree(buffer); | 1299 | return buffer; |
1320 | buffer=NULL; | ||
1321 | } | ||
1322 | return buffer; | ||
1323 | } | 1300 | } |
1324 | 1301 | ||
1325 | /* return --->-1:fail; >=0:successful */ | 1302 | /* return --->-1:fail; >=0:successful */ |
diff --git a/drivers/staging/wlags49_h2/wl_main.c b/drivers/staging/wlags49_h2/wl_main.c index f5f120a62460..c4264e8c877d 100644 --- a/drivers/staging/wlags49_h2/wl_main.c +++ b/drivers/staging/wlags49_h2/wl_main.c | |||
@@ -73,6 +73,7 @@ | |||
73 | 73 | ||
74 | #include <linux/module.h> | 74 | #include <linux/module.h> |
75 | #include <linux/proc_fs.h> | 75 | #include <linux/proc_fs.h> |
76 | #include <linux/seq_file.h> | ||
76 | #include <linux/types.h> | 77 | #include <linux/types.h> |
77 | #include <linux/kernel.h> | 78 | #include <linux/kernel.h> |
78 | // #include <linux/sched.h> | 79 | // #include <linux/sched.h> |
@@ -144,10 +145,23 @@ | |||
144 | void wl_isr_handler( unsigned long p ); | 145 | void wl_isr_handler( unsigned long p ); |
145 | 146 | ||
146 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ | 147 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ |
147 | //int scull_read_procmem(char *buf, char **start, off_t offset, int len, int unused); | 148 | static int scull_read_procmem(struct seq_file *m, void *v); |
148 | int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data ); | ||
149 | static int write_int(struct file *file, const char *buffer, unsigned long count, void *data); | 149 | static int write_int(struct file *file, const char *buffer, unsigned long count, void *data); |
150 | static void proc_write(const char *name, write_proc_t *w, void *data); | 150 | |
151 | /* | ||
152 | * seq_file wrappers for procfile show routines. | ||
153 | */ | ||
154 | static int scull_read_procmem_open(struct inode *inode, struct file *file) | ||
155 | { | ||
156 | return single_open(file, scull_read_procmem, PDE_DATA(inode)); | ||
157 | } | ||
158 | |||
159 | static const struct file_operations scull_read_procmem_fops = { | ||
160 | .open = scull_read_procmem_open, | ||
161 | .read = seq_read, | ||
162 | .llseek = seq_lseek, | ||
163 | .release = seq_release, | ||
164 | }; | ||
151 | 165 | ||
152 | #endif /* SCULL_USE_PROC */ | 166 | #endif /* SCULL_USE_PROC */ |
153 | 167 | ||
@@ -908,9 +922,8 @@ int wl_insert( struct net_device *dev ) | |||
908 | } | 922 | } |
909 | 923 | ||
910 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ | 924 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ |
911 | create_proc_read_entry( "wlags", 0, NULL, scull_read_procmem, dev ); | 925 | proc_create_data( "wlags", 0, NULL, &scull_read_procmem_fops, dev ); |
912 | proc_mkdir("driver/wlags49", 0); | 926 | proc_mkdir("driver/wlags49", 0); |
913 | proc_write("driver/wlags49/wlags49_type", write_int, &lp->wlags49_type); | ||
914 | #endif /* SCULL_USE_PROC */ | 927 | #endif /* SCULL_USE_PROC */ |
915 | 928 | ||
916 | DBG_LEAVE( DbgInfo ); | 929 | DBG_LEAVE( DbgInfo ); |
@@ -2097,7 +2110,7 @@ static void __exit wl_module_exit( void ) | |||
2097 | 2110 | ||
2098 | wl_adapter_cleanup_module( ); | 2111 | wl_adapter_cleanup_module( ); |
2099 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ | 2112 | #if 0 //SCULL_USE_PROC /* don't waste space if unused */ |
2100 | remove_proc_entry( "wlags", NULL ); //;?why so a-symmetric compared to location of create_proc_read_entry | 2113 | remove_proc_entry( "wlags", NULL ); //;?why so a-symmetric compared to location of proc_create_data |
2101 | #endif | 2114 | #endif |
2102 | 2115 | ||
2103 | DBG_LEAVE( DbgInfo ); | 2116 | DBG_LEAVE( DbgInfo ); |
@@ -3531,229 +3544,215 @@ void wl_wds_netdev_deregister( struct wl_private *lp ) | |||
3531 | /* | 3544 | /* |
3532 | * The proc filesystem: function to read and entry | 3545 | * The proc filesystem: function to read and entry |
3533 | */ | 3546 | */ |
3534 | int printf_hcf_16( char *s, char *buf, hcf_16* p, int n ); | 3547 | static void printf_hcf_16(struct seq_file *m, const char *s, hcf_16 *p, int n) |
3535 | int printf_hcf_16( char *s, char *buf, hcf_16* p, int n ) { | 3548 | { |
3549 | int i, len; | ||
3536 | 3550 | ||
3537 | int i, len; | 3551 | seq_printf(m, "%-20.20s: ", s); |
3552 | len = 22; | ||
3538 | 3553 | ||
3539 | len = sprintf(buf, "%s", s ); | 3554 | for (i = 0; i < n; i++) { |
3540 | while ( len < 20 ) len += sprintf(buf+len, " " ); | 3555 | if (len % 80 > 75) |
3541 | len += sprintf(buf+len,": " ); | 3556 | seq_putc(m, '\n'); |
3542 | for ( i = 0; i < n; i++ ) { | 3557 | seq_printf(m, "%04X ", p[i]); |
3543 | if ( len % 80 > 75 ) { | ||
3544 | len += sprintf(buf+len,"\n" ); | ||
3545 | } | ||
3546 | len += sprintf(buf+len,"%04X ", p[i] ); | ||
3547 | } | 3558 | } |
3548 | len += sprintf(buf+len,"\n" ); | 3559 | seq_putc(m, '\n'); |
3549 | return len; | 3560 | } |
3550 | } // printf_hcf_16 | ||
3551 | 3561 | ||
3552 | int printf_hcf_8( char *s, char *buf, hcf_8* p, int n ); | 3562 | static void printf_hcf_8(struct seq_file *m, const char *s, hcf_8 *p, int n) |
3553 | int printf_hcf_8( char *s, char *buf, hcf_8* p, int n ) { | 3563 | { |
3564 | int i, len; | ||
3554 | 3565 | ||
3555 | int i, len; | 3566 | seq_printf(m, "%-20.20s: ", s); |
3567 | len = 22; | ||
3556 | 3568 | ||
3557 | len = sprintf(buf, "%s", s ); | 3569 | for (i = 0; i <= n; i++) { |
3558 | while ( len < 20 ) len += sprintf(buf+len, " " ); | 3570 | if (len % 80 > 77) |
3559 | len += sprintf(buf+len,": " ); | 3571 | seq_putc(m, '\n'); |
3560 | for ( i = 0; i <= n; i++ ) { | 3572 | seq_printf(m, "%02X ", p[i]); |
3561 | if ( len % 80 > 77 ) { | ||
3562 | len += sprintf(buf+len,"\n" ); | ||
3563 | } | ||
3564 | len += sprintf(buf+len,"%02X ", p[i] ); | ||
3565 | } | 3573 | } |
3566 | len += sprintf(buf+len,"\n" ); | 3574 | seq_putc(m, '\n'); |
3567 | return len; | 3575 | } |
3568 | } // printf_hcf8 | ||
3569 | 3576 | ||
3570 | int printf_strct( char *s, char *buf, hcf_16* p ); | 3577 | static void printf_strct(struct seq_file *m, const char *s, hcf_16 *p) |
3571 | int printf_strct( char *s, char *buf, hcf_16* p ) { | 3578 | { |
3579 | int i, len; | ||
3572 | 3580 | ||
3573 | int i, len; | 3581 | seq_printf(m, "%-20.20s: ", s); |
3582 | len = 22; | ||
3574 | 3583 | ||
3575 | len = sprintf(buf, "%s", s ); | ||
3576 | while ( len < 20 ) len += sprintf(buf+len, " " ); | ||
3577 | len += sprintf(buf+len,": " ); | ||
3578 | for ( i = 0; i <= *p; i++ ) { | 3584 | for ( i = 0; i <= *p; i++ ) { |
3579 | if ( len % 80 > 75 ) { | 3585 | if (len % 80 > 75) |
3580 | len += sprintf(buf+len,"\n" ); | 3586 | seq_putc(m, '\n'); |
3581 | } | 3587 | seq_printf(m,"%04X ", p[i]); |
3582 | len += sprintf(buf+len,"%04X ", p[i] ); | ||
3583 | } | 3588 | } |
3584 | len += sprintf(buf+len,"\n" ); | 3589 | seq_putc(m, '\n'); |
3585 | return len; | 3590 | } |
3586 | } // printf_strct | ||
3587 | 3591 | ||
3588 | int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data ) | 3592 | int scull_read_procmem(struct seq_file *m, void *v) |
3589 | { | 3593 | { |
3590 | struct wl_private *lp = NULL; | 3594 | struct wl_private *lp = m->private; |
3591 | IFBP ifbp; | 3595 | IFBP ifbp; |
3592 | CFG_HERMES_TALLIES_STRCT *p; | 3596 | CFG_HERMES_TALLIES_STRCT *p; |
3593 | 3597 | ||
3594 | #define LIMIT (PAGE_SIZE-80) /* don't print any more after this size */ | ||
3595 | |||
3596 | len=0; | ||
3597 | |||
3598 | lp = ((struct net_device *)data)->priv; | ||
3599 | if (lp == NULL) { | 3598 | if (lp == NULL) { |
3600 | len += sprintf(buf+len,"No wl_private in scull_read_procmem\n" ); | 3599 | seq_puts(m, "No wl_private in scull_read_procmem\n" ); |
3601 | } else if ( lp->wlags49_type == 0 ){ | 3600 | } else if ( lp->wlags49_type == 0 ){ |
3602 | ifbp = &lp->hcfCtx; | 3601 | ifbp = &lp->hcfCtx; |
3603 | len += sprintf(buf+len,"Magic: 0x%04X\n", ifbp->IFB_Magic ); | 3602 | seq_printf(m, "Magic: 0x%04X\n", ifbp->IFB_Magic ); |
3604 | len += sprintf(buf+len,"IOBase: 0x%04X\n", ifbp->IFB_IOBase ); | 3603 | seq_printf(m, "IOBase: 0x%04X\n", ifbp->IFB_IOBase ); |
3605 | len += sprintf(buf+len,"LinkStat: 0x%04X\n", ifbp->IFB_LinkStat ); | 3604 | seq_printf(m, "LinkStat: 0x%04X\n", ifbp->IFB_LinkStat ); |
3606 | len += sprintf(buf+len,"DSLinkStat: 0x%04X\n", ifbp->IFB_DSLinkStat ); | 3605 | seq_printf(m, "DSLinkStat: 0x%04X\n", ifbp->IFB_DSLinkStat ); |
3607 | len += sprintf(buf+len,"TickIni: 0x%08lX\n", ifbp->IFB_TickIni ); | 3606 | seq_printf(m, "TickIni: 0x%08lX\n", ifbp->IFB_TickIni ); |
3608 | len += sprintf(buf+len,"TickCnt: 0x%04X\n", ifbp->IFB_TickCnt ); | 3607 | seq_printf(m, "TickCnt: 0x%04X\n", ifbp->IFB_TickCnt ); |
3609 | len += sprintf(buf+len,"IntOffCnt: 0x%04X\n", ifbp->IFB_IntOffCnt ); | 3608 | seq_printf(m, "IntOffCnt: 0x%04X\n", ifbp->IFB_IntOffCnt ); |
3610 | len += printf_hcf_16( "IFB_FWIdentity", &buf[len], | 3609 | printf_hcf_16(m, "IFB_FWIdentity", |
3611 | &ifbp->IFB_FWIdentity.len, ifbp->IFB_FWIdentity.len + 1 ); | 3610 | &ifbp->IFB_FWIdentity.len, ifbp->IFB_FWIdentity.len + 1 ); |
3612 | } else if ( lp->wlags49_type == 1 ) { | 3611 | } else if ( lp->wlags49_type == 1 ) { |
3613 | len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel ); | 3612 | seq_printf(m, "Channel: 0x%04X\n", lp->Channel ); |
3614 | /****** len += sprintf(buf+len,"slock: %d\n", lp->slock ); */ | 3613 | /****** seq_printf(m, "slock: %d\n", lp->slock ); */ |
3615 | //x struct tq_struct "task: 0x%04X\n", lp->task ); | 3614 | //x struct tq_struct "task: 0x%04X\n", lp->task ); |
3616 | //x struct net_device_stats "stats: 0x%04X\n", lp->stats ); | 3615 | //x struct net_device_stats "stats: 0x%04X\n", lp->stats ); |
3617 | #ifdef WIRELESS_EXT | 3616 | #ifdef WIRELESS_EXT |
3618 | //x struct iw_statistics "wstats: 0x%04X\n", lp->wstats ); | 3617 | //x struct iw_statistics "wstats: 0x%04X\n", lp->wstats ); |
3619 | //x len += sprintf(buf+len,"spy_number: 0x%04X\n", lp->spy_number ); | 3618 | //x seq_printf(m, "spy_number: 0x%04X\n", lp->spy_number ); |
3620 | //x u_char spy_address[IW_MAX_SPY][ETH_ALEN]; | 3619 | //x u_char spy_address[IW_MAX_SPY][ETH_ALEN]; |
3621 | //x struct iw_quality spy_stat[IW_MAX_SPY]; | 3620 | //x struct iw_quality spy_stat[IW_MAX_SPY]; |
3622 | #endif // WIRELESS_EXT | 3621 | #endif // WIRELESS_EXT |
3623 | len += sprintf(buf+len,"IFB: 0x%p\n", &lp->hcfCtx ); | 3622 | seq_printf(m, "IFB: 0x%p\n", &lp->hcfCtx ); |
3624 | len += sprintf(buf+len,"flags: %#.8lX\n", lp->flags ); //;?use this format from now on | 3623 | seq_printf(m, "flags: %#.8lX\n", lp->flags ); //;?use this format from now on |
3625 | len += sprintf(buf+len,"DebugFlag(wl_private) 0x%04X\n", lp->DebugFlag ); | 3624 | seq_printf(m, "DebugFlag(wl_private) 0x%04X\n", lp->DebugFlag ); |
3626 | #if DBG | 3625 | #if DBG |
3627 | len += sprintf(buf+len,"DebugFlag (DbgInfo): 0x%08lX\n", DbgInfo->DebugFlag ); | 3626 | seq_printf(m, "DebugFlag (DbgInfo): 0x%08lX\n", DbgInfo->DebugFlag ); |
3628 | #endif // DBG | 3627 | #endif // DBG |
3629 | len += sprintf(buf+len,"is_registered: 0x%04X\n", lp->is_registered ); | 3628 | seq_printf(m, "is_registered: 0x%04X\n", lp->is_registered ); |
3630 | //x CFG_DRV_INFO_STRCT "driverInfo: 0x%04X\n", lp->driverInfo ); | 3629 | //x CFG_DRV_INFO_STRCT "driverInfo: 0x%04X\n", lp->driverInfo ); |
3631 | len += printf_strct( "driverInfo", &buf[len], (hcf_16*)&lp->driverInfo ); | 3630 | printf_strct( m, "driverInfo", (hcf_16*)&lp->driverInfo ); |
3632 | //x CFG_IDENTITY_STRCT "driverIdentity: 0x%04X\n", lp->driverIdentity ); | 3631 | //x CFG_IDENTITY_STRCT "driverIdentity: 0x%04X\n", lp->driverIdentity ); |
3633 | len += printf_strct( "driverIdentity", &buf[len], (hcf_16*)&lp->driverIdentity ); | 3632 | printf_strct( m, "driverIdentity", (hcf_16*)&lp->driverIdentity ); |
3634 | //x CFG_FW_IDENTITY_STRCT "StationIdentity: 0x%04X\n", lp->StationIdentity ); | 3633 | //x CFG_FW_IDENTITY_STRCT "StationIdentity: 0x%04X\n", lp->StationIdentity ); |
3635 | len += printf_strct( "StationIdentity", &buf[len], (hcf_16*)&lp->StationIdentity ); | 3634 | printf_strct( m, "StationIdentity", (hcf_16*)&lp->StationIdentity ); |
3636 | //x CFG_PRI_IDENTITY_STRCT "PrimaryIdentity: 0x%04X\n", lp->PrimaryIdentity ); | 3635 | //x CFG_PRI_IDENTITY_STRCT "PrimaryIdentity: 0x%04X\n", lp->PrimaryIdentity ); |
3637 | len += printf_strct( "PrimaryIdentity", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRIIdentity ); | 3636 | printf_strct( m, "PrimaryIdentity", (hcf_16*)&lp->hcfCtx.IFB_PRIIdentity ); |
3638 | len += printf_strct( "PrimarySupplier", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRISup ); | 3637 | printf_strct( m, "PrimarySupplier", (hcf_16*)&lp->hcfCtx.IFB_PRISup ); |
3639 | //x CFG_PRI_IDENTITY_STRCT "NICIdentity: 0x%04X\n", lp->NICIdentity ); | 3638 | //x CFG_PRI_IDENTITY_STRCT "NICIdentity: 0x%04X\n", lp->NICIdentity ); |
3640 | len += printf_strct( "NICIdentity", &buf[len], (hcf_16*)&lp->NICIdentity ); | 3639 | printf_strct( m, "NICIdentity", (hcf_16*)&lp->NICIdentity ); |
3641 | //x ltv_t "ltvRecord: 0x%04X\n", lp->ltvRecord ); | 3640 | //x ltv_t "ltvRecord: 0x%04X\n", lp->ltvRecord ); |
3642 | len += sprintf(buf+len,"txBytes: 0x%08lX\n", lp->txBytes ); | 3641 | seq_printf(m, "txBytes: 0x%08lX\n", lp->txBytes ); |
3643 | len += sprintf(buf+len,"maxPort: 0x%04X\n", lp->maxPort ); /* 0 for STA, 6 for AP */ | 3642 | seq_printf(m, "maxPort: 0x%04X\n", lp->maxPort ); /* 0 for STA, 6 for AP */ |
3644 | /* Elements used for async notification from hardware */ | 3643 | /* Elements used for async notification from hardware */ |
3645 | //x RID_LOG_STRCT RidList[10]; | 3644 | //x RID_LOG_STRCT RidList[10]; |
3646 | //x ltv_t "updatedRecord: 0x%04X\n", lp->updatedRecord ); | 3645 | //x ltv_t "updatedRecord: 0x%04X\n", lp->updatedRecord ); |
3647 | //x PROBE_RESP "ProbeResp: 0x%04X\n", lp->ProbeResp ); | 3646 | //x PROBE_RESP "ProbeResp: 0x%04X\n", lp->ProbeResp ); |
3648 | //x ASSOC_STATUS_STRCT "assoc_stat: 0x%04X\n", lp->assoc_stat ); | 3647 | //x ASSOC_STATUS_STRCT "assoc_stat: 0x%04X\n", lp->assoc_stat ); |
3649 | //x SECURITY_STATUS_STRCT "sec_stat: 0x%04X\n", lp->sec_stat ); | 3648 | //x SECURITY_STATUS_STRCT "sec_stat: 0x%04X\n", lp->sec_stat ); |
3650 | //x u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD]; | 3649 | //x u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD]; |
3651 | len += sprintf(buf+len,"PortType: 0x%04X\n", lp->PortType ); // 1 - 3 (1 [Normal] | 3 [AdHoc]) | 3650 | seq_printf(m, "PortType: 0x%04X\n", lp->PortType ); // 1 - 3 (1 [Normal] | 3 [AdHoc]) |
3652 | len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel ); // 0 - 14 (0) | 3651 | seq_printf(m, "Channel: 0x%04X\n", lp->Channel ); // 0 - 14 (0) |
3653 | //x hcf_16 TxRateControl[2]; | 3652 | //x hcf_16 TxRateControl[2]; |
3654 | len += sprintf(buf+len,"TxRateControl[2]: 0x%04X 0x%04X\n", | 3653 | seq_printf(m, "TxRateControl[2]: 0x%04X 0x%04X\n", |
3655 | lp->TxRateControl[0], lp->TxRateControl[1] ); | 3654 | lp->TxRateControl[0], lp->TxRateControl[1] ); |
3656 | len += sprintf(buf+len,"DistanceBetweenAPs: 0x%04X\n", lp->DistanceBetweenAPs ); // 1 - 3 (1) | 3655 | seq_printf(m, "DistanceBetweenAPs: 0x%04X\n", lp->DistanceBetweenAPs ); // 1 - 3 (1) |
3657 | len += sprintf(buf+len,"RTSThreshold: 0x%04X\n", lp->RTSThreshold ); // 0 - 2347 (2347) | 3656 | seq_printf(m, "RTSThreshold: 0x%04X\n", lp->RTSThreshold ); // 0 - 2347 (2347) |
3658 | len += sprintf(buf+len,"PMEnabled: 0x%04X\n", lp->PMEnabled ); // 0 - 2, 8001 - 8002 (0) | 3657 | seq_printf(m, "PMEnabled: 0x%04X\n", lp->PMEnabled ); // 0 - 2, 8001 - 8002 (0) |
3659 | len += sprintf(buf+len,"MicrowaveRobustness: 0x%04X\n", lp->MicrowaveRobustness );// 0 - 1 (0) | 3658 | seq_printf(m, "MicrowaveRobustness: 0x%04X\n", lp->MicrowaveRobustness );// 0 - 1 (0) |
3660 | len += sprintf(buf+len,"CreateIBSS: 0x%04X\n", lp->CreateIBSS ); // 0 - 1 (0) | 3659 | seq_printf(m, "CreateIBSS: 0x%04X\n", lp->CreateIBSS ); // 0 - 1 (0) |
3661 | len += sprintf(buf+len,"MulticastReceive: 0x%04X\n", lp->MulticastReceive ); // 0 - 1 (1) | 3660 | seq_printf(m, "MulticastReceive: 0x%04X\n", lp->MulticastReceive ); // 0 - 1 (1) |
3662 | len += sprintf(buf+len,"MaxSleepDuration: 0x%04X\n", lp->MaxSleepDuration ); // 0 - 65535 (100) | 3661 | seq_printf(m, "MaxSleepDuration: 0x%04X\n", lp->MaxSleepDuration ); // 0 - 65535 (100) |
3663 | //x hcf_8 MACAddress[ETH_ALEN]; | 3662 | //x hcf_8 MACAddress[ETH_ALEN]; |
3664 | len += printf_hcf_8( "MACAddress", &buf[len], lp->MACAddress, ETH_ALEN ); | 3663 | printf_hcf_8(m, "MACAddress", lp->MACAddress, ETH_ALEN ); |
3665 | //x char NetworkName[HCF_MAX_NAME_LEN+1]; | 3664 | //x char NetworkName[HCF_MAX_NAME_LEN+1]; |
3666 | len += sprintf(buf+len,"NetworkName: %.32s\n", lp->NetworkName ); | 3665 | seq_printf(m, "NetworkName: %.32s\n", lp->NetworkName ); |
3667 | //x char StationName[HCF_MAX_NAME_LEN+1]; | 3666 | //x char StationName[HCF_MAX_NAME_LEN+1]; |
3668 | len += sprintf(buf+len,"EnableEncryption: 0x%04X\n", lp->EnableEncryption ); // 0 - 1 (0) | 3667 | seq_printf(m, "EnableEncryption: 0x%04X\n", lp->EnableEncryption ); // 0 - 1 (0) |
3669 | //x char Key1[MAX_KEY_LEN+1]; | 3668 | //x char Key1[MAX_KEY_LEN+1]; |
3670 | len += printf_hcf_8( "Key1", &buf[len], lp->Key1, MAX_KEY_LEN ); | 3669 | printf_hcf_8( m, "Key1", lp->Key1, MAX_KEY_LEN ); |
3671 | //x char Key2[MAX_KEY_LEN+1]; | 3670 | //x char Key2[MAX_KEY_LEN+1]; |
3672 | //x char Key3[MAX_KEY_LEN+1]; | 3671 | //x char Key3[MAX_KEY_LEN+1]; |
3673 | //x char Key4[MAX_KEY_LEN+1]; | 3672 | //x char Key4[MAX_KEY_LEN+1]; |
3674 | len += sprintf(buf+len,"TransmitKeyID: 0x%04X\n", lp->TransmitKeyID ); // 1 - 4 (1) | 3673 | seq_printf(m, "TransmitKeyID: 0x%04X\n", lp->TransmitKeyID ); // 1 - 4 (1) |
3675 | //x CFG_DEFAULT_KEYS_STRCT "DefaultKeys: 0x%04X\n", lp->DefaultKeys ); | 3674 | //x CFG_DEFAULT_KEYS_STRCT "DefaultKeys: 0x%04X\n", lp->DefaultKeys ); |
3676 | //x u_char mailbox[MB_SIZE]; | 3675 | //x u_char mailbox[MB_SIZE]; |
3677 | //x char szEncryption[MAX_ENC_LEN]; | 3676 | //x char szEncryption[MAX_ENC_LEN]; |
3678 | len += sprintf(buf+len,"driverEnable: 0x%04X\n", lp->driverEnable ); | 3677 | seq_printf(m, "driverEnable: 0x%04X\n", lp->driverEnable ); |
3679 | len += sprintf(buf+len,"wolasEnable: 0x%04X\n", lp->wolasEnable ); | 3678 | seq_printf(m, "wolasEnable: 0x%04X\n", lp->wolasEnable ); |
3680 | len += sprintf(buf+len,"atimWindow: 0x%04X\n", lp->atimWindow ); | 3679 | seq_printf(m, "atimWindow: 0x%04X\n", lp->atimWindow ); |
3681 | len += sprintf(buf+len,"holdoverDuration: 0x%04X\n", lp->holdoverDuration ); | 3680 | seq_printf(m, "holdoverDuration: 0x%04X\n", lp->holdoverDuration ); |
3682 | //x hcf_16 MulticastRate[2]; | 3681 | //x hcf_16 MulticastRate[2]; |
3683 | len += sprintf(buf+len,"authentication: 0x%04X\n", lp->authentication ); // is this AP specific? | 3682 | seq_printf(m, "authentication: 0x%04X\n", lp->authentication ); // is this AP specific? |
3684 | len += sprintf(buf+len,"promiscuousMode: 0x%04X\n", lp->promiscuousMode ); | 3683 | seq_printf(m, "promiscuousMode: 0x%04X\n", lp->promiscuousMode ); |
3685 | len += sprintf(buf+len,"DownloadFirmware: 0x%04X\n", lp->DownloadFirmware ); // 0 - 2 (0 [None] | 1 [STA] | 2 [AP]) | 3684 | seq_printf(m, "DownloadFirmware: 0x%04X\n", lp->DownloadFirmware ); // 0 - 2 (0 [None] | 1 [STA] | 2 [AP]) |
3686 | len += sprintf(buf+len,"AuthKeyMgmtSuite: 0x%04X\n", lp->AuthKeyMgmtSuite ); | 3685 | seq_printf(m, "AuthKeyMgmtSuite: 0x%04X\n", lp->AuthKeyMgmtSuite ); |
3687 | len += sprintf(buf+len,"loadBalancing: 0x%04X\n", lp->loadBalancing ); | 3686 | seq_printf(m, "loadBalancing: 0x%04X\n", lp->loadBalancing ); |
3688 | len += sprintf(buf+len,"mediumDistribution: 0x%04X\n", lp->mediumDistribution ); | 3687 | seq_printf(m, "mediumDistribution: 0x%04X\n", lp->mediumDistribution ); |
3689 | len += sprintf(buf+len,"txPowLevel: 0x%04X\n", lp->txPowLevel ); | 3688 | seq_printf(m, "txPowLevel: 0x%04X\n", lp->txPowLevel ); |
3690 | // len += sprintf(buf+len,"shortRetryLimit: 0x%04X\n", lp->shortRetryLimit ); | 3689 | // seq_printf(m, "shortRetryLimit: 0x%04X\n", lp->shortRetryLimit ); |
3691 | // len += sprintf(buf+len,"longRetryLimit: 0x%04X\n", lp->longRetryLimit ); | 3690 | // seq_printf(m, "longRetryLimit: 0x%04X\n", lp->longRetryLimit ); |
3692 | //x hcf_16 srsc[2]; | 3691 | //x hcf_16 srsc[2]; |
3693 | //x hcf_16 brsc[2]; | 3692 | //x hcf_16 brsc[2]; |
3694 | len += sprintf(buf+len,"connectionControl: 0x%04X\n", lp->connectionControl ); | 3693 | seq_printf(m, "connectionControl: 0x%04X\n", lp->connectionControl ); |
3695 | //x //hcf_16 probeDataRates[2]; | 3694 | //x //hcf_16 probeDataRates[2]; |
3696 | len += sprintf(buf+len,"ownBeaconInterval: 0x%04X\n", lp->ownBeaconInterval ); | 3695 | seq_printf(m, "ownBeaconInterval: 0x%04X\n", lp->ownBeaconInterval ); |
3697 | len += sprintf(buf+len,"coexistence: 0x%04X\n", lp->coexistence ); | 3696 | seq_printf(m, "coexistence: 0x%04X\n", lp->coexistence ); |
3698 | //x WVLAN_FRAME "txF: 0x%04X\n", lp->txF ); | 3697 | //x WVLAN_FRAME "txF: 0x%04X\n", lp->txF ); |
3699 | //x WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES]; | 3698 | //x WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES]; |
3700 | //x struct list_head "txFree: 0x%04X\n", lp->txFree ); | 3699 | //x struct list_head "txFree: 0x%04X\n", lp->txFree ); |
3701 | //x struct list_head txQ[WVLAN_MAX_TX_QUEUES]; | 3700 | //x struct list_head txQ[WVLAN_MAX_TX_QUEUES]; |
3702 | len += sprintf(buf+len,"netif_queue_on: 0x%04X\n", lp->netif_queue_on ); | 3701 | seq_printf(m, "netif_queue_on: 0x%04X\n", lp->netif_queue_on ); |
3703 | len += sprintf(buf+len,"txQ_count: 0x%04X\n", lp->txQ_count ); | 3702 | seq_printf(m, "txQ_count: 0x%04X\n", lp->txQ_count ); |
3704 | //x DESC_STRCT "desc_rx: 0x%04X\n", lp->desc_rx ); | 3703 | //x DESC_STRCT "desc_rx: 0x%04X\n", lp->desc_rx ); |
3705 | //x DESC_STRCT "desc_tx: 0x%04X\n", lp->desc_tx ); | 3704 | //x DESC_STRCT "desc_tx: 0x%04X\n", lp->desc_tx ); |
3706 | //x WVLAN_PORT_STATE "portState: 0x%04X\n", lp->portState ); | 3705 | //x WVLAN_PORT_STATE "portState: 0x%04X\n", lp->portState ); |
3707 | //x ScanResult "scan_results: 0x%04X\n", lp->scan_results ); | 3706 | //x ScanResult "scan_results: 0x%04X\n", lp->scan_results ); |
3708 | //x ProbeResult "probe_results: 0x%04X\n", lp->probe_results ); | 3707 | //x ProbeResult "probe_results: 0x%04X\n", lp->probe_results ); |
3709 | len += sprintf(buf+len,"probe_num_aps: 0x%04X\n", lp->probe_num_aps ); | 3708 | seq_printf(m, "probe_num_aps: 0x%04X\n", lp->probe_num_aps ); |
3710 | len += sprintf(buf+len,"use_dma: 0x%04X\n", lp->use_dma ); | 3709 | seq_printf(m, "use_dma: 0x%04X\n", lp->use_dma ); |
3711 | //x DMA_STRCT "dma: 0x%04X\n", lp->dma ); | 3710 | //x DMA_STRCT "dma: 0x%04X\n", lp->dma ); |
3712 | #ifdef USE_RTS | 3711 | #ifdef USE_RTS |
3713 | len += sprintf(buf+len,"useRTS: 0x%04X\n", lp->useRTS ); | 3712 | seq_printf(m, "useRTS: 0x%04X\n", lp->useRTS ); |
3714 | #endif // USE_RTS | 3713 | #endif // USE_RTS |
3715 | #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP | 3714 | #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP |
3716 | //;?should we restore this to allow smaller memory footprint | 3715 | //;?should we restore this to allow smaller memory footprint |
3717 | //;?I guess not. This should be brought under Debug mode only | 3716 | //;?I guess not. This should be brought under Debug mode only |
3718 | len += sprintf(buf+len,"DTIMPeriod: 0x%04X\n", lp->DTIMPeriod ); // 1 - 255 (1) | 3717 | seq_printf(m, "DTIMPeriod: 0x%04X\n", lp->DTIMPeriod ); // 1 - 255 (1) |
3719 | len += sprintf(buf+len,"multicastPMBuffering: 0x%04X\n", lp->multicastPMBuffering ); | 3718 | seq_printf(m, "multicastPMBuffering: 0x%04X\n", lp->multicastPMBuffering ); |
3720 | len += sprintf(buf+len,"RejectAny: 0x%04X\n", lp->RejectAny ); // 0 - 1 (0) | 3719 | seq_printf(m, "RejectAny: 0x%04X\n", lp->RejectAny ); // 0 - 1 (0) |
3721 | len += sprintf(buf+len,"ExcludeUnencrypted: 0x%04X\n", lp->ExcludeUnencrypted ); // 0 - 1 (1) | 3720 | seq_printf(m, "ExcludeUnencrypted: 0x%04X\n", lp->ExcludeUnencrypted ); // 0 - 1 (1) |
3722 | len += sprintf(buf+len,"intraBSSRelay: 0x%04X\n", lp->intraBSSRelay ); | 3721 | seq_printf(m, "intraBSSRelay: 0x%04X\n", lp->intraBSSRelay ); |
3723 | len += sprintf(buf+len,"wlags49_type: 0x%08lX\n", lp->wlags49_type ); | 3722 | seq_printf(m, "wlags49_type: 0x%08lX\n", lp->wlags49_type ); |
3724 | #ifdef USE_WDS | 3723 | #ifdef USE_WDS |
3725 | //x WVLAN_WDS_IF wds_port[NUM_WDS_PORTS]; | 3724 | //x WVLAN_WDS_IF wds_port[NUM_WDS_PORTS]; |
3726 | #endif // USE_WDS | 3725 | #endif // USE_WDS |
3727 | #endif // HCF_AP | 3726 | #endif // HCF_AP |
3728 | } else if ( lp->wlags49_type == 2 ){ | 3727 | } else if ( lp->wlags49_type == 2 ){ |
3729 | len += sprintf(buf+len,"tallies to be added\n" ); | 3728 | seq_printf(m, "tallies to be added\n" ); |
3730 | //Hermes Tallies (IFB substructure) { | 3729 | //Hermes Tallies (IFB substructure) { |
3731 | p = &lp->hcfCtx.IFB_NIC_Tallies; | 3730 | p = &lp->hcfCtx.IFB_NIC_Tallies; |
3732 | len += sprintf(buf+len,"TxUnicastFrames: %08lX\n", p->TxUnicastFrames ); | 3731 | seq_printf(m, "TxUnicastFrames: %08lX\n", p->TxUnicastFrames ); |
3733 | len += sprintf(buf+len,"TxMulticastFrames: %08lX\n", p->TxMulticastFrames ); | 3732 | seq_printf(m, "TxMulticastFrames: %08lX\n", p->TxMulticastFrames ); |
3734 | len += sprintf(buf+len,"TxFragments: %08lX\n", p->TxFragments ); | 3733 | seq_printf(m, "TxFragments: %08lX\n", p->TxFragments ); |
3735 | len += sprintf(buf+len,"TxUnicastOctets: %08lX\n", p->TxUnicastOctets ); | 3734 | seq_printf(m, "TxUnicastOctets: %08lX\n", p->TxUnicastOctets ); |
3736 | len += sprintf(buf+len,"TxMulticastOctets: %08lX\n", p->TxMulticastOctets ); | 3735 | seq_printf(m, "TxMulticastOctets: %08lX\n", p->TxMulticastOctets ); |
3737 | len += sprintf(buf+len,"TxDeferredTransmissions: %08lX\n", p->TxDeferredTransmissions ); | 3736 | seq_printf(m, "TxDeferredTransmissions: %08lX\n", p->TxDeferredTransmissions ); |
3738 | len += sprintf(buf+len,"TxSingleRetryFrames: %08lX\n", p->TxSingleRetryFrames ); | 3737 | seq_printf(m, "TxSingleRetryFrames: %08lX\n", p->TxSingleRetryFrames ); |
3739 | len += sprintf(buf+len,"TxMultipleRetryFrames: %08lX\n", p->TxMultipleRetryFrames ); | 3738 | seq_printf(m, "TxMultipleRetryFrames: %08lX\n", p->TxMultipleRetryFrames ); |
3740 | len += sprintf(buf+len,"TxRetryLimitExceeded: %08lX\n", p->TxRetryLimitExceeded ); | 3739 | seq_printf(m, "TxRetryLimitExceeded: %08lX\n", p->TxRetryLimitExceeded ); |
3741 | len += sprintf(buf+len,"TxDiscards: %08lX\n", p->TxDiscards ); | 3740 | seq_printf(m, "TxDiscards: %08lX\n", p->TxDiscards ); |
3742 | len += sprintf(buf+len,"RxUnicastFrames: %08lX\n", p->RxUnicastFrames ); | 3741 | seq_printf(m, "RxUnicastFrames: %08lX\n", p->RxUnicastFrames ); |
3743 | len += sprintf(buf+len,"RxMulticastFrames: %08lX\n", p->RxMulticastFrames ); | 3742 | seq_printf(m, "RxMulticastFrames: %08lX\n", p->RxMulticastFrames ); |
3744 | len += sprintf(buf+len,"RxFragments: %08lX\n", p->RxFragments ); | 3743 | seq_printf(m, "RxFragments: %08lX\n", p->RxFragments ); |
3745 | len += sprintf(buf+len,"RxUnicastOctets: %08lX\n", p->RxUnicastOctets ); | 3744 | seq_printf(m, "RxUnicastOctets: %08lX\n", p->RxUnicastOctets ); |
3746 | len += sprintf(buf+len,"RxMulticastOctets: %08lX\n", p->RxMulticastOctets ); | 3745 | seq_printf(m, "RxMulticastOctets: %08lX\n", p->RxMulticastOctets ); |
3747 | len += sprintf(buf+len,"RxFCSErrors: %08lX\n", p->RxFCSErrors ); | 3746 | seq_printf(m, "RxFCSErrors: %08lX\n", p->RxFCSErrors ); |
3748 | len += sprintf(buf+len,"RxDiscardsNoBuffer: %08lX\n", p->RxDiscardsNoBuffer ); | 3747 | seq_printf(m, "RxDiscardsNoBuffer: %08lX\n", p->RxDiscardsNoBuffer ); |
3749 | len += sprintf(buf+len,"TxDiscardsWrongSA: %08lX\n", p->TxDiscardsWrongSA ); | 3748 | seq_printf(m, "TxDiscardsWrongSA: %08lX\n", p->TxDiscardsWrongSA ); |
3750 | len += sprintf(buf+len,"RxWEPUndecryptable: %08lX\n", p->RxWEPUndecryptable ); | 3749 | seq_printf(m, "RxWEPUndecryptable: %08lX\n", p->RxWEPUndecryptable ); |
3751 | len += sprintf(buf+len,"RxMsgInMsgFragments: %08lX\n", p->RxMsgInMsgFragments ); | 3750 | seq_printf(m, "RxMsgInMsgFragments: %08lX\n", p->RxMsgInMsgFragments ); |
3752 | len += sprintf(buf+len,"RxMsgInBadMsgFragments: %08lX\n", p->RxMsgInBadMsgFragments ); | 3751 | seq_printf(m, "RxMsgInBadMsgFragments: %08lX\n", p->RxMsgInBadMsgFragments ); |
3753 | len += sprintf(buf+len,"RxDiscardsWEPICVError: %08lX\n", p->RxDiscardsWEPICVError ); | 3752 | seq_printf(m, "RxDiscardsWEPICVError: %08lX\n", p->RxDiscardsWEPICVError ); |
3754 | len += sprintf(buf+len,"RxDiscardsWEPExcluded: %08lX\n", p->RxDiscardsWEPExcluded ); | 3753 | seq_printf(m, "RxDiscardsWEPExcluded: %08lX\n", p->RxDiscardsWEPExcluded ); |
3755 | #if (HCF_EXT) & HCF_EXT_TALLIES_FW | 3754 | #if (HCF_EXT) & HCF_EXT_TALLIES_FW |
3756 | //to be added ;? | 3755 | //to be added ;? |
3757 | #endif // HCF_EXT_TALLIES_FW | 3756 | #endif // HCF_EXT_TALLIES_FW |
3758 | } else if ( lp->wlags49_type & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this | 3757 | } else if ( lp->wlags49_type & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this |
3759 | #if DBG | 3758 | #if DBG |
@@ -3761,27 +3760,19 @@ int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, | |||
3761 | #endif // DBG | 3760 | #endif // DBG |
3762 | lp->wlags49_type = 0; //default to IFB again ;? | 3761 | lp->wlags49_type = 0; //default to IFB again ;? |
3763 | } else { | 3762 | } else { |
3764 | len += sprintf(buf+len,"unknown value for wlags49_type: 0x%08lX\n", lp->wlags49_type ); | 3763 | seq_printf(m, "unknown value for wlags49_type: 0x%08lX\n", lp->wlags49_type ); |
3765 | len += sprintf(buf+len,"0x0000 - IFB\n" ); | 3764 | seq_puts(m, |
3766 | len += sprintf(buf+len,"0x0001 - wl_private\n" ); | 3765 | "0x0000 - IFB\n" |
3767 | len += sprintf(buf+len,"0x0002 - Tallies\n" ); | 3766 | "0x0001 - wl_private\n" |
3768 | len += sprintf(buf+len,"0x8xxx - Change debufflag\n" ); | 3767 | "0x0002 - Tallies\n" |
3769 | len += sprintf(buf+len,"ERROR 0001\nWARNING 0002\nNOTICE 0004\nTRACE 0008\n" ); | 3768 | "0x8xxx - Change debufflag\n" |
3770 | len += sprintf(buf+len,"VERBOSE 0010\nPARAM 0020\nBREAK 0040\nRX 0100\n" ); | 3769 | "ERROR 0001\nWARNING 0002\nNOTICE 0004\nTRACE 0008\n" |
3771 | len += sprintf(buf+len,"TX 0200\nDS 0400\n" ); | 3770 | "VERBOSE 0010\nPARAM 0020\nBREAK 0040\nRX 0100\n" |
3772 | } | 3771 | "TX 0200\nDS 0400\n"); |
3773 | return len; | 3772 | } |
3773 | return 0; | ||
3774 | } // scull_read_procmem | 3774 | } // scull_read_procmem |
3775 | 3775 | ||
3776 | static void proc_write(const char *name, write_proc_t *w, void *data) | ||
3777 | { | ||
3778 | struct proc_dir_entry * entry = create_proc_entry(name, S_IFREG | S_IWUSR, NULL); | ||
3779 | if (entry) { | ||
3780 | entry->write_proc = w; | ||
3781 | entry->data = data; | ||
3782 | } | ||
3783 | } // proc_write | ||
3784 | |||
3785 | static int write_int(struct file *file, const char *buffer, unsigned long count, void *data) | 3776 | static int write_int(struct file *file, const char *buffer, unsigned long count, void *data) |
3786 | { | 3777 | { |
3787 | static char proc_number[11]; | 3778 | static char proc_number[11]; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 2d444b1ccd33..7c908141cc8a 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -79,11 +79,10 @@ static void tcm_loop_release_cmd(struct se_cmd *se_cmd) | |||
79 | kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); | 79 | kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); |
80 | } | 80 | } |
81 | 81 | ||
82 | static int tcm_loop_proc_info(struct Scsi_Host *host, char *buffer, | 82 | static int tcm_loop_show_info(struct seq_file *m, struct Scsi_Host *host) |
83 | char **start, off_t offset, | ||
84 | int length, int inout) | ||
85 | { | 83 | { |
86 | return sprintf(buffer, "tcm_loop_proc_info()\n"); | 84 | seq_printf(m, "tcm_loop_proc_info()\n"); |
85 | return 0; | ||
87 | } | 86 | } |
88 | 87 | ||
89 | static int tcm_loop_driver_probe(struct device *); | 88 | static int tcm_loop_driver_probe(struct device *); |
@@ -336,7 +335,7 @@ static int tcm_loop_slave_configure(struct scsi_device *sd) | |||
336 | } | 335 | } |
337 | 336 | ||
338 | static struct scsi_host_template tcm_loop_driver_template = { | 337 | static struct scsi_host_template tcm_loop_driver_template = { |
339 | .proc_info = tcm_loop_proc_info, | 338 | .show_info = tcm_loop_show_info, |
340 | .proc_name = "tcm_loopback", | 339 | .proc_name = "tcm_loopback", |
341 | .name = "TCM_Loopback", | 340 | .name = "TCM_Loopback", |
342 | .queuecommand = tcm_loop_queuecommand, | 341 | .queuecommand = tcm_loop_queuecommand, |
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 8fbb6d22cdc8..f87dbfd32770 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -1711,7 +1711,7 @@ static int uart_proc_show(struct seq_file *m, void *v) | |||
1711 | 1711 | ||
1712 | static int uart_proc_open(struct inode *inode, struct file *file) | 1712 | static int uart_proc_open(struct inode *inode, struct file *file) |
1713 | { | 1713 | { |
1714 | return single_open(file, uart_proc_show, PDE(inode)->data); | 1714 | return single_open(file, uart_proc_show, PDE_DATA(inode)); |
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | static const struct file_operations uart_proc_fops = { | 1717 | static const struct file_operations uart_proc_fops = { |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index a690d64217f4..073b938f9135 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -221,7 +221,7 @@ static int proc_udc_show(struct seq_file *s, void *unused) | |||
221 | 221 | ||
222 | static int proc_udc_open(struct inode *inode, struct file *file) | 222 | static int proc_udc_open(struct inode *inode, struct file *file) |
223 | { | 223 | { |
224 | return single_open(file, proc_udc_show, PDE(inode)->data); | 224 | return single_open(file, proc_udc_show, PDE_DATA(inode)); |
225 | } | 225 | } |
226 | 226 | ||
227 | static const struct file_operations proc_ops = { | 227 | static const struct file_operations proc_ops = { |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index c377ff84bf2c..f394f295d63d 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -727,7 +727,6 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | |||
727 | } | 727 | } |
728 | 728 | ||
729 | static const struct file_operations ffs_ep0_operations = { | 729 | static const struct file_operations ffs_ep0_operations = { |
730 | .owner = THIS_MODULE, | ||
731 | .llseek = no_llseek, | 730 | .llseek = no_llseek, |
732 | 731 | ||
733 | .open = ffs_ep0_open, | 732 | .open = ffs_ep0_open, |
@@ -947,7 +946,6 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, | |||
947 | } | 946 | } |
948 | 947 | ||
949 | static const struct file_operations ffs_epfile_operations = { | 948 | static const struct file_operations ffs_epfile_operations = { |
950 | .owner = THIS_MODULE, | ||
951 | .llseek = no_llseek, | 949 | .llseek = no_llseek, |
952 | 950 | ||
953 | .open = ffs_epfile_open, | 951 | .open = ffs_epfile_open, |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 7c2a101d19ac..2d8c1cfea699 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -2010,47 +2010,37 @@ static int fsl_udc_stop(struct usb_gadget *g, | |||
2010 | 2010 | ||
2011 | static const char proc_filename[] = "driver/fsl_usb2_udc"; | 2011 | static const char proc_filename[] = "driver/fsl_usb2_udc"; |
2012 | 2012 | ||
2013 | static int fsl_proc_read(char *page, char **start, off_t off, int count, | 2013 | static int fsl_proc_read(struct seq_file *m, void *v) |
2014 | int *eof, void *_dev) | ||
2015 | { | 2014 | { |
2016 | char *buf = page; | ||
2017 | char *next = buf; | ||
2018 | unsigned size = count; | ||
2019 | unsigned long flags; | 2015 | unsigned long flags; |
2020 | int t, i; | 2016 | int i; |
2021 | u32 tmp_reg; | 2017 | u32 tmp_reg; |
2022 | struct fsl_ep *ep = NULL; | 2018 | struct fsl_ep *ep = NULL; |
2023 | struct fsl_req *req; | 2019 | struct fsl_req *req; |
2024 | 2020 | ||
2025 | struct fsl_udc *udc = udc_controller; | 2021 | struct fsl_udc *udc = udc_controller; |
2026 | if (off != 0) | ||
2027 | return 0; | ||
2028 | 2022 | ||
2029 | spin_lock_irqsave(&udc->lock, flags); | 2023 | spin_lock_irqsave(&udc->lock, flags); |
2030 | 2024 | ||
2031 | /* ------basic driver information ---- */ | 2025 | /* ------basic driver information ---- */ |
2032 | t = scnprintf(next, size, | 2026 | seq_printf(m, |
2033 | DRIVER_DESC "\n" | 2027 | DRIVER_DESC "\n" |
2034 | "%s version: %s\n" | 2028 | "%s version: %s\n" |
2035 | "Gadget driver: %s\n\n", | 2029 | "Gadget driver: %s\n\n", |
2036 | driver_name, DRIVER_VERSION, | 2030 | driver_name, DRIVER_VERSION, |
2037 | udc->driver ? udc->driver->driver.name : "(none)"); | 2031 | udc->driver ? udc->driver->driver.name : "(none)"); |
2038 | size -= t; | ||
2039 | next += t; | ||
2040 | 2032 | ||
2041 | /* ------ DR Registers ----- */ | 2033 | /* ------ DR Registers ----- */ |
2042 | tmp_reg = fsl_readl(&dr_regs->usbcmd); | 2034 | tmp_reg = fsl_readl(&dr_regs->usbcmd); |
2043 | t = scnprintf(next, size, | 2035 | seq_printf(m, |
2044 | "USBCMD reg:\n" | 2036 | "USBCMD reg:\n" |
2045 | "SetupTW: %d\n" | 2037 | "SetupTW: %d\n" |
2046 | "Run/Stop: %s\n\n", | 2038 | "Run/Stop: %s\n\n", |
2047 | (tmp_reg & USB_CMD_SUTW) ? 1 : 0, | 2039 | (tmp_reg & USB_CMD_SUTW) ? 1 : 0, |
2048 | (tmp_reg & USB_CMD_RUN_STOP) ? "Run" : "Stop"); | 2040 | (tmp_reg & USB_CMD_RUN_STOP) ? "Run" : "Stop"); |
2049 | size -= t; | ||
2050 | next += t; | ||
2051 | 2041 | ||
2052 | tmp_reg = fsl_readl(&dr_regs->usbsts); | 2042 | tmp_reg = fsl_readl(&dr_regs->usbsts); |
2053 | t = scnprintf(next, size, | 2043 | seq_printf(m, |
2054 | "USB Status Reg:\n" | 2044 | "USB Status Reg:\n" |
2055 | "Dr Suspend: %d Reset Received: %d System Error: %s " | 2045 | "Dr Suspend: %d Reset Received: %d System Error: %s " |
2056 | "USB Error Interrupt: %s\n\n", | 2046 | "USB Error Interrupt: %s\n\n", |
@@ -2058,11 +2048,9 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, | |||
2058 | (tmp_reg & USB_STS_RESET) ? 1 : 0, | 2048 | (tmp_reg & USB_STS_RESET) ? 1 : 0, |
2059 | (tmp_reg & USB_STS_SYS_ERR) ? "Err" : "Normal", | 2049 | (tmp_reg & USB_STS_SYS_ERR) ? "Err" : "Normal", |
2060 | (tmp_reg & USB_STS_ERR) ? "Err detected" : "No err"); | 2050 | (tmp_reg & USB_STS_ERR) ? "Err detected" : "No err"); |
2061 | size -= t; | ||
2062 | next += t; | ||
2063 | 2051 | ||
2064 | tmp_reg = fsl_readl(&dr_regs->usbintr); | 2052 | tmp_reg = fsl_readl(&dr_regs->usbintr); |
2065 | t = scnprintf(next, size, | 2053 | seq_printf(m, |
2066 | "USB Interrupt Enable Reg:\n" | 2054 | "USB Interrupt Enable Reg:\n" |
2067 | "Sleep Enable: %d SOF Received Enable: %d " | 2055 | "Sleep Enable: %d SOF Received Enable: %d " |
2068 | "Reset Enable: %d\n" | 2056 | "Reset Enable: %d\n" |
@@ -2076,33 +2064,25 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, | |||
2076 | (tmp_reg & USB_INTR_PTC_DETECT_EN) ? 1 : 0, | 2064 | (tmp_reg & USB_INTR_PTC_DETECT_EN) ? 1 : 0, |
2077 | (tmp_reg & USB_INTR_ERR_INT_EN) ? 1 : 0, | 2065 | (tmp_reg & USB_INTR_ERR_INT_EN) ? 1 : 0, |
2078 | (tmp_reg & USB_INTR_INT_EN) ? 1 : 0); | 2066 | (tmp_reg & USB_INTR_INT_EN) ? 1 : 0); |
2079 | size -= t; | ||
2080 | next += t; | ||
2081 | 2067 | ||
2082 | tmp_reg = fsl_readl(&dr_regs->frindex); | 2068 | tmp_reg = fsl_readl(&dr_regs->frindex); |
2083 | t = scnprintf(next, size, | 2069 | seq_printf(m, |
2084 | "USB Frame Index Reg: Frame Number is 0x%x\n\n", | 2070 | "USB Frame Index Reg: Frame Number is 0x%x\n\n", |
2085 | (tmp_reg & USB_FRINDEX_MASKS)); | 2071 | (tmp_reg & USB_FRINDEX_MASKS)); |
2086 | size -= t; | ||
2087 | next += t; | ||
2088 | 2072 | ||
2089 | tmp_reg = fsl_readl(&dr_regs->deviceaddr); | 2073 | tmp_reg = fsl_readl(&dr_regs->deviceaddr); |
2090 | t = scnprintf(next, size, | 2074 | seq_printf(m, |
2091 | "USB Device Address Reg: Device Addr is 0x%x\n\n", | 2075 | "USB Device Address Reg: Device Addr is 0x%x\n\n", |
2092 | (tmp_reg & USB_DEVICE_ADDRESS_MASK)); | 2076 | (tmp_reg & USB_DEVICE_ADDRESS_MASK)); |
2093 | size -= t; | ||
2094 | next += t; | ||
2095 | 2077 | ||
2096 | tmp_reg = fsl_readl(&dr_regs->endpointlistaddr); | 2078 | tmp_reg = fsl_readl(&dr_regs->endpointlistaddr); |
2097 | t = scnprintf(next, size, | 2079 | seq_printf(m, |
2098 | "USB Endpoint List Address Reg: " | 2080 | "USB Endpoint List Address Reg: " |
2099 | "Device Addr is 0x%x\n\n", | 2081 | "Device Addr is 0x%x\n\n", |
2100 | (tmp_reg & USB_EP_LIST_ADDRESS_MASK)); | 2082 | (tmp_reg & USB_EP_LIST_ADDRESS_MASK)); |
2101 | size -= t; | ||
2102 | next += t; | ||
2103 | 2083 | ||
2104 | tmp_reg = fsl_readl(&dr_regs->portsc1); | 2084 | tmp_reg = fsl_readl(&dr_regs->portsc1); |
2105 | t = scnprintf(next, size, | 2085 | seq_printf(m, |
2106 | "USB Port Status&Control Reg:\n" | 2086 | "USB Port Status&Control Reg:\n" |
2107 | "Port Transceiver Type : %s Port Speed: %s\n" | 2087 | "Port Transceiver Type : %s Port Speed: %s\n" |
2108 | "PHY Low Power Suspend: %s Port Reset: %s " | 2088 | "PHY Low Power Suspend: %s Port Reset: %s " |
@@ -2111,7 +2091,7 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, | |||
2111 | "Port Enable/Disable Change: %s\n" | 2091 | "Port Enable/Disable Change: %s\n" |
2112 | "Port Enabled/Disabled: %s " | 2092 | "Port Enabled/Disabled: %s " |
2113 | "Current Connect Status: %s\n\n", ( { | 2093 | "Current Connect Status: %s\n\n", ( { |
2114 | char *s; | 2094 | const char *s; |
2115 | switch (tmp_reg & PORTSCX_PTS_FSLS) { | 2095 | switch (tmp_reg & PORTSCX_PTS_FSLS) { |
2116 | case PORTSCX_PTS_UTMI: | 2096 | case PORTSCX_PTS_UTMI: |
2117 | s = "UTMI"; break; | 2097 | s = "UTMI"; break; |
@@ -2137,13 +2117,11 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, | |||
2137 | "Not correct", | 2117 | "Not correct", |
2138 | (tmp_reg & PORTSCX_CURRENT_CONNECT_STATUS) ? | 2118 | (tmp_reg & PORTSCX_CURRENT_CONNECT_STATUS) ? |
2139 | "Attached" : "Not-Att"); | 2119 | "Attached" : "Not-Att"); |
2140 | size -= t; | ||
2141 | next += t; | ||
2142 | 2120 | ||
2143 | tmp_reg = fsl_readl(&dr_regs->usbmode); | 2121 | tmp_reg = fsl_readl(&dr_regs->usbmode); |
2144 | t = scnprintf(next, size, | 2122 | seq_printf(m, |
2145 | "USB Mode Reg: Controller Mode is: %s\n\n", ( { | 2123 | "USB Mode Reg: Controller Mode is: %s\n\n", ( { |
2146 | char *s; | 2124 | const char *s; |
2147 | switch (tmp_reg & USB_MODE_CTRL_MODE_HOST) { | 2125 | switch (tmp_reg & USB_MODE_CTRL_MODE_HOST) { |
2148 | case USB_MODE_CTRL_MODE_IDLE: | 2126 | case USB_MODE_CTRL_MODE_IDLE: |
2149 | s = "Idle"; break; | 2127 | s = "Idle"; break; |
@@ -2156,103 +2134,87 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, | |||
2156 | } | 2134 | } |
2157 | s; | 2135 | s; |
2158 | } )); | 2136 | } )); |
2159 | size -= t; | ||
2160 | next += t; | ||
2161 | 2137 | ||
2162 | tmp_reg = fsl_readl(&dr_regs->endptsetupstat); | 2138 | tmp_reg = fsl_readl(&dr_regs->endptsetupstat); |
2163 | t = scnprintf(next, size, | 2139 | seq_printf(m, |
2164 | "Endpoint Setup Status Reg: SETUP on ep 0x%x\n\n", | 2140 | "Endpoint Setup Status Reg: SETUP on ep 0x%x\n\n", |
2165 | (tmp_reg & EP_SETUP_STATUS_MASK)); | 2141 | (tmp_reg & EP_SETUP_STATUS_MASK)); |
2166 | size -= t; | ||
2167 | next += t; | ||
2168 | 2142 | ||
2169 | for (i = 0; i < udc->max_ep / 2; i++) { | 2143 | for (i = 0; i < udc->max_ep / 2; i++) { |
2170 | tmp_reg = fsl_readl(&dr_regs->endptctrl[i]); | 2144 | tmp_reg = fsl_readl(&dr_regs->endptctrl[i]); |
2171 | t = scnprintf(next, size, "EP Ctrl Reg [0x%x]: = [0x%x]\n", | 2145 | seq_printf(m, "EP Ctrl Reg [0x%x]: = [0x%x]\n", i, tmp_reg); |
2172 | i, tmp_reg); | ||
2173 | size -= t; | ||
2174 | next += t; | ||
2175 | } | 2146 | } |
2176 | tmp_reg = fsl_readl(&dr_regs->endpointprime); | 2147 | tmp_reg = fsl_readl(&dr_regs->endpointprime); |
2177 | t = scnprintf(next, size, "EP Prime Reg = [0x%x]\n\n", tmp_reg); | 2148 | seq_printf(m, "EP Prime Reg = [0x%x]\n\n", tmp_reg); |
2178 | size -= t; | ||
2179 | next += t; | ||
2180 | 2149 | ||
2181 | #ifndef CONFIG_ARCH_MXC | 2150 | #ifndef CONFIG_ARCH_MXC |
2182 | if (udc->pdata->have_sysif_regs) { | 2151 | if (udc->pdata->have_sysif_regs) { |
2183 | tmp_reg = usb_sys_regs->snoop1; | 2152 | tmp_reg = usb_sys_regs->snoop1; |
2184 | t = scnprintf(next, size, "Snoop1 Reg : = [0x%x]\n\n", tmp_reg); | 2153 | seq_printf(m, "Snoop1 Reg : = [0x%x]\n\n", tmp_reg); |
2185 | size -= t; | ||
2186 | next += t; | ||
2187 | 2154 | ||
2188 | tmp_reg = usb_sys_regs->control; | 2155 | tmp_reg = usb_sys_regs->control; |
2189 | t = scnprintf(next, size, "General Control Reg : = [0x%x]\n\n", | 2156 | seq_printf(m, "General Control Reg : = [0x%x]\n\n", tmp_reg); |
2190 | tmp_reg); | ||
2191 | size -= t; | ||
2192 | next += t; | ||
2193 | } | 2157 | } |
2194 | #endif | 2158 | #endif |
2195 | 2159 | ||
2196 | /* ------fsl_udc, fsl_ep, fsl_request structure information ----- */ | 2160 | /* ------fsl_udc, fsl_ep, fsl_request structure information ----- */ |
2197 | ep = &udc->eps[0]; | 2161 | ep = &udc->eps[0]; |
2198 | t = scnprintf(next, size, "For %s Maxpkt is 0x%x index is 0x%x\n", | 2162 | seq_printf(m, "For %s Maxpkt is 0x%x index is 0x%x\n", |
2199 | ep->ep.name, ep_maxpacket(ep), ep_index(ep)); | 2163 | ep->ep.name, ep_maxpacket(ep), ep_index(ep)); |
2200 | size -= t; | ||
2201 | next += t; | ||
2202 | 2164 | ||
2203 | if (list_empty(&ep->queue)) { | 2165 | if (list_empty(&ep->queue)) { |
2204 | t = scnprintf(next, size, "its req queue is empty\n\n"); | 2166 | seq_puts(m, "its req queue is empty\n\n"); |
2205 | size -= t; | ||
2206 | next += t; | ||
2207 | } else { | 2167 | } else { |
2208 | list_for_each_entry(req, &ep->queue, queue) { | 2168 | list_for_each_entry(req, &ep->queue, queue) { |
2209 | t = scnprintf(next, size, | 2169 | seq_printf(m, |
2210 | "req %p actual 0x%x length 0x%x buf %p\n", | 2170 | "req %p actual 0x%x length 0x%x buf %p\n", |
2211 | &req->req, req->req.actual, | 2171 | &req->req, req->req.actual, |
2212 | req->req.length, req->req.buf); | 2172 | req->req.length, req->req.buf); |
2213 | size -= t; | ||
2214 | next += t; | ||
2215 | } | 2173 | } |
2216 | } | 2174 | } |
2217 | /* other gadget->eplist ep */ | 2175 | /* other gadget->eplist ep */ |
2218 | list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { | 2176 | list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { |
2219 | if (ep->ep.desc) { | 2177 | if (ep->ep.desc) { |
2220 | t = scnprintf(next, size, | 2178 | seq_printf(m, |
2221 | "\nFor %s Maxpkt is 0x%x " | 2179 | "\nFor %s Maxpkt is 0x%x " |
2222 | "index is 0x%x\n", | 2180 | "index is 0x%x\n", |
2223 | ep->ep.name, ep_maxpacket(ep), | 2181 | ep->ep.name, ep_maxpacket(ep), |
2224 | ep_index(ep)); | 2182 | ep_index(ep)); |
2225 | size -= t; | ||
2226 | next += t; | ||
2227 | 2183 | ||
2228 | if (list_empty(&ep->queue)) { | 2184 | if (list_empty(&ep->queue)) { |
2229 | t = scnprintf(next, size, | 2185 | seq_puts(m, "its req queue is empty\n\n"); |
2230 | "its req queue is empty\n\n"); | ||
2231 | size -= t; | ||
2232 | next += t; | ||
2233 | } else { | 2186 | } else { |
2234 | list_for_each_entry(req, &ep->queue, queue) { | 2187 | list_for_each_entry(req, &ep->queue, queue) { |
2235 | t = scnprintf(next, size, | 2188 | seq_printf(m, |
2236 | "req %p actual 0x%x length " | 2189 | "req %p actual 0x%x length " |
2237 | "0x%x buf %p\n", | 2190 | "0x%x buf %p\n", |
2238 | &req->req, req->req.actual, | 2191 | &req->req, req->req.actual, |
2239 | req->req.length, req->req.buf); | 2192 | req->req.length, req->req.buf); |
2240 | size -= t; | 2193 | } /* end for each_entry of ep req */ |
2241 | next += t; | 2194 | } /* end for else */ |
2242 | } /* end for each_entry of ep req */ | 2195 | } /* end for if(ep->queue) */ |
2243 | } /* end for else */ | 2196 | } /* end (ep->desc) */ |
2244 | } /* end for if(ep->queue) */ | ||
2245 | } /* end (ep->desc) */ | ||
2246 | 2197 | ||
2247 | spin_unlock_irqrestore(&udc->lock, flags); | 2198 | spin_unlock_irqrestore(&udc->lock, flags); |
2199 | return 0; | ||
2200 | } | ||
2248 | 2201 | ||
2249 | *eof = 1; | 2202 | /* |
2250 | return count - size; | 2203 | * seq_file wrappers for procfile show routines. |
2204 | */ | ||
2205 | static int fsl_proc_open(struct inode *inode, struct file *file) | ||
2206 | { | ||
2207 | return single_open(file, fsl_proc_read, NULL); | ||
2251 | } | 2208 | } |
2252 | 2209 | ||
2253 | #define create_proc_file() create_proc_read_entry(proc_filename, \ | 2210 | static const struct file_operations fsl_proc_fops = { |
2254 | 0, NULL, fsl_proc_read, NULL) | 2211 | .open = fsl_proc_open, |
2212 | .read = seq_read, | ||
2213 | .llseek = seq_lseek, | ||
2214 | .release = seq_release, | ||
2215 | }; | ||
2255 | 2216 | ||
2217 | #define create_proc_file() proc_create(proc_filename, 0, NULL, &fsl_proc_fops) | ||
2256 | #define remove_proc_file() remove_proc_entry(proc_filename, NULL) | 2218 | #define remove_proc_file() remove_proc_entry(proc_filename, NULL) |
2257 | 2219 | ||
2258 | #else /* !CONFIG_USB_GADGET_DEBUG_FILES */ | 2220 | #else /* !CONFIG_USB_GADGET_DEBUG_FILES */ |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 991aba390d9d..480eeb7cfd92 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/list.h> | 35 | #include <linux/list.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/proc_fs.h> | 37 | #include <linux/proc_fs.h> |
38 | #include <linux/seq_file.h> | ||
38 | #include <linux/device.h> | 39 | #include <linux/device.h> |
39 | #include <linux/usb/ch9.h> | 40 | #include <linux/usb/ch9.h> |
40 | #include <linux/usb/gadget.h> | 41 | #include <linux/usb/gadget.h> |
@@ -1005,7 +1006,7 @@ static const struct usb_gadget_ops goku_ops = { | |||
1005 | 1006 | ||
1006 | /*-------------------------------------------------------------------------*/ | 1007 | /*-------------------------------------------------------------------------*/ |
1007 | 1008 | ||
1008 | static inline char *dmastr(void) | 1009 | static inline const char *dmastr(void) |
1009 | { | 1010 | { |
1010 | if (use_dma == 0) | 1011 | if (use_dma == 0) |
1011 | return "(dma disabled)"; | 1012 | return "(dma disabled)"; |
@@ -1022,13 +1023,10 @@ static const char proc_node_name [] = "driver/udc"; | |||
1022 | #define FOURBITS "%s%s%s%s" | 1023 | #define FOURBITS "%s%s%s%s" |
1023 | #define EIGHTBITS FOURBITS FOURBITS | 1024 | #define EIGHTBITS FOURBITS FOURBITS |
1024 | 1025 | ||
1025 | static void | 1026 | static void dump_intmask(struct seq_file *m, const char *label, u32 mask) |
1026 | dump_intmask(const char *label, u32 mask, char **next, unsigned *size) | ||
1027 | { | 1027 | { |
1028 | int t; | ||
1029 | |||
1030 | /* int_status is the same format ... */ | 1028 | /* int_status is the same format ... */ |
1031 | t = scnprintf(*next, *size, | 1029 | seq_printf(m, |
1032 | "%s %05X =" FOURBITS EIGHTBITS EIGHTBITS "\n", | 1030 | "%s %05X =" FOURBITS EIGHTBITS EIGHTBITS "\n", |
1033 | label, mask, | 1031 | label, mask, |
1034 | (mask & INT_PWRDETECT) ? " power" : "", | 1032 | (mask & INT_PWRDETECT) ? " power" : "", |
@@ -1055,33 +1053,23 @@ dump_intmask(const char *label, u32 mask, char **next, unsigned *size) | |||
1055 | (mask & INT_ENDPOINT0) ? " ep0" : "", | 1053 | (mask & INT_ENDPOINT0) ? " ep0" : "", |
1056 | (mask & INT_USBRESET) ? " reset" : "", | 1054 | (mask & INT_USBRESET) ? " reset" : "", |
1057 | (mask & INT_SUSPEND) ? " suspend" : ""); | 1055 | (mask & INT_SUSPEND) ? " suspend" : ""); |
1058 | *size -= t; | ||
1059 | *next += t; | ||
1060 | } | 1056 | } |
1061 | 1057 | ||
1062 | 1058 | ||
1063 | static int | 1059 | static int udc_proc_read(struct seq_file *m, void *v) |
1064 | udc_proc_read(char *buffer, char **start, off_t off, int count, | ||
1065 | int *eof, void *_dev) | ||
1066 | { | 1060 | { |
1067 | char *buf = buffer; | 1061 | struct goku_udc *dev = m->private; |
1068 | struct goku_udc *dev = _dev; | ||
1069 | struct goku_udc_regs __iomem *regs = dev->regs; | 1062 | struct goku_udc_regs __iomem *regs = dev->regs; |
1070 | char *next = buf; | ||
1071 | unsigned size = count; | ||
1072 | unsigned long flags; | 1063 | unsigned long flags; |
1073 | int i, t, is_usb_connected; | 1064 | int i, is_usb_connected; |
1074 | u32 tmp; | 1065 | u32 tmp; |
1075 | 1066 | ||
1076 | if (off != 0) | ||
1077 | return 0; | ||
1078 | |||
1079 | local_irq_save(flags); | 1067 | local_irq_save(flags); |
1080 | 1068 | ||
1081 | /* basic device status */ | 1069 | /* basic device status */ |
1082 | tmp = readl(®s->power_detect); | 1070 | tmp = readl(®s->power_detect); |
1083 | is_usb_connected = tmp & PW_DETECT; | 1071 | is_usb_connected = tmp & PW_DETECT; |
1084 | t = scnprintf(next, size, | 1072 | seq_printf(m, |
1085 | "%s - %s\n" | 1073 | "%s - %s\n" |
1086 | "%s version: %s %s\n" | 1074 | "%s version: %s %s\n" |
1087 | "Gadget driver: %s\n" | 1075 | "Gadget driver: %s\n" |
@@ -1093,7 +1081,7 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1093 | is_usb_connected | 1081 | is_usb_connected |
1094 | ? ((tmp & PW_PULLUP) ? "full speed" : "powered") | 1082 | ? ((tmp & PW_PULLUP) ? "full speed" : "powered") |
1095 | : "disconnected", | 1083 | : "disconnected", |
1096 | ({char *state; | 1084 | ({const char *state; |
1097 | switch(dev->ep0state){ | 1085 | switch(dev->ep0state){ |
1098 | case EP0_DISCONNECT: state = "ep0_disconnect"; break; | 1086 | case EP0_DISCONNECT: state = "ep0_disconnect"; break; |
1099 | case EP0_IDLE: state = "ep0_idle"; break; | 1087 | case EP0_IDLE: state = "ep0_idle"; break; |
@@ -1105,27 +1093,24 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1105 | default: state = "ep0_?"; break; | 1093 | default: state = "ep0_?"; break; |
1106 | } state; }) | 1094 | } state; }) |
1107 | ); | 1095 | ); |
1108 | size -= t; | ||
1109 | next += t; | ||
1110 | 1096 | ||
1111 | dump_intmask("int_status", readl(®s->int_status), &next, &size); | 1097 | dump_intmask(m, "int_status", readl(®s->int_status)); |
1112 | dump_intmask("int_enable", readl(®s->int_enable), &next, &size); | 1098 | dump_intmask(m, "int_enable", readl(®s->int_enable)); |
1113 | 1099 | ||
1114 | if (!is_usb_connected || !dev->driver || (tmp & PW_PULLUP) == 0) | 1100 | if (!is_usb_connected || !dev->driver || (tmp & PW_PULLUP) == 0) |
1115 | goto done; | 1101 | goto done; |
1116 | 1102 | ||
1117 | /* registers for (active) device and ep0 */ | 1103 | /* registers for (active) device and ep0 */ |
1118 | t = scnprintf(next, size, "\nirqs %lu\ndataset %02x " | 1104 | if (seq_printf(m, "\nirqs %lu\ndataset %02x " |
1119 | "single.bcs %02x.%02x state %x addr %u\n", | 1105 | "single.bcs %02x.%02x state %x addr %u\n", |
1120 | dev->irqs, readl(®s->DataSet), | 1106 | dev->irqs, readl(®s->DataSet), |
1121 | readl(®s->EPxSingle), readl(®s->EPxBCS), | 1107 | readl(®s->EPxSingle), readl(®s->EPxBCS), |
1122 | readl(®s->UsbState), | 1108 | readl(®s->UsbState), |
1123 | readl(®s->address)); | 1109 | readl(®s->address)) < 0) |
1124 | size -= t; | 1110 | goto done; |
1125 | next += t; | ||
1126 | 1111 | ||
1127 | tmp = readl(®s->dma_master); | 1112 | tmp = readl(®s->dma_master); |
1128 | t = scnprintf(next, size, | 1113 | if (seq_printf(m, |
1129 | "dma %03X =" EIGHTBITS "%s %s\n", tmp, | 1114 | "dma %03X =" EIGHTBITS "%s %s\n", tmp, |
1130 | (tmp & MST_EOPB_DIS) ? " eopb-" : "", | 1115 | (tmp & MST_EOPB_DIS) ? " eopb-" : "", |
1131 | (tmp & MST_EOPB_ENA) ? " eopb+" : "", | 1116 | (tmp & MST_EOPB_ENA) ? " eopb+" : "", |
@@ -1140,9 +1125,8 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1140 | (tmp & MST_WR_ENA) ? " OUT" : "", | 1125 | (tmp & MST_WR_ENA) ? " OUT" : "", |
1141 | (tmp & MST_CONNECTION) | 1126 | (tmp & MST_CONNECTION) |
1142 | ? "ep1in/ep2out" | 1127 | ? "ep1in/ep2out" |
1143 | : "ep1out/ep2in"); | 1128 | : "ep1out/ep2in") < 0) |
1144 | size -= t; | 1129 | goto done; |
1145 | next += t; | ||
1146 | 1130 | ||
1147 | /* dump endpoint queues */ | 1131 | /* dump endpoint queues */ |
1148 | for (i = 0; i < 4; i++) { | 1132 | for (i = 0; i < 4; i++) { |
@@ -1153,7 +1137,7 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1153 | continue; | 1137 | continue; |
1154 | 1138 | ||
1155 | tmp = readl(ep->reg_status); | 1139 | tmp = readl(ep->reg_status); |
1156 | t = scnprintf(next, size, | 1140 | if (seq_printf(m, |
1157 | "%s %s max %u %s, irqs %lu, " | 1141 | "%s %s max %u %s, irqs %lu, " |
1158 | "status %02x (%s) " FOURBITS "\n", | 1142 | "status %02x (%s) " FOURBITS "\n", |
1159 | ep->ep.name, | 1143 | ep->ep.name, |
@@ -1186,18 +1170,12 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1186 | (tmp & EPxSTATUS_SUSPEND) ? " suspend" : "", | 1170 | (tmp & EPxSTATUS_SUSPEND) ? " suspend" : "", |
1187 | (tmp & EPxSTATUS_FIFO_DISABLE) ? " disable" : "", | 1171 | (tmp & EPxSTATUS_FIFO_DISABLE) ? " disable" : "", |
1188 | (tmp & EPxSTATUS_STAGE_ERROR) ? " ep0stat" : "" | 1172 | (tmp & EPxSTATUS_STAGE_ERROR) ? " ep0stat" : "" |
1189 | ); | 1173 | ) < 0) |
1190 | if (t <= 0 || t > size) | ||
1191 | goto done; | 1174 | goto done; |
1192 | size -= t; | ||
1193 | next += t; | ||
1194 | 1175 | ||
1195 | if (list_empty(&ep->queue)) { | 1176 | if (list_empty(&ep->queue)) { |
1196 | t = scnprintf(next, size, "\t(nothing queued)\n"); | 1177 | if (seq_puts(m, "\t(nothing queued)\n") < 0) |
1197 | if (t <= 0 || t > size) | ||
1198 | goto done; | 1178 | goto done; |
1199 | size -= t; | ||
1200 | next += t; | ||
1201 | continue; | 1179 | continue; |
1202 | } | 1180 | } |
1203 | list_for_each_entry(req, &ep->queue, queue) { | 1181 | list_for_each_entry(req, &ep->queue, queue) { |
@@ -1211,23 +1189,34 @@ udc_proc_read(char *buffer, char **start, off_t off, int count, | |||
1211 | } else | 1189 | } else |
1212 | tmp = req->req.actual; | 1190 | tmp = req->req.actual; |
1213 | 1191 | ||
1214 | t = scnprintf(next, size, | 1192 | if (seq_printf(m, |
1215 | "\treq %p len %u/%u buf %p\n", | 1193 | "\treq %p len %u/%u buf %p\n", |
1216 | &req->req, tmp, req->req.length, | 1194 | &req->req, tmp, req->req.length, |
1217 | req->req.buf); | 1195 | req->req.buf) < 0) |
1218 | if (t <= 0 || t > size) | ||
1219 | goto done; | 1196 | goto done; |
1220 | size -= t; | ||
1221 | next += t; | ||
1222 | } | 1197 | } |
1223 | } | 1198 | } |
1224 | 1199 | ||
1225 | done: | 1200 | done: |
1226 | local_irq_restore(flags); | 1201 | local_irq_restore(flags); |
1227 | *eof = 1; | 1202 | return 0; |
1228 | return count - size; | 1203 | } |
1204 | |||
1205 | /* | ||
1206 | * seq_file wrappers for procfile show routines. | ||
1207 | */ | ||
1208 | static int udc_proc_open(struct inode *inode, struct file *file) | ||
1209 | { | ||
1210 | return single_open(file, udc_proc_read, PDE_DATA(file_inode(file))); | ||
1229 | } | 1211 | } |
1230 | 1212 | ||
1213 | static const struct file_operations udc_proc_fops = { | ||
1214 | .open = udc_proc_open, | ||
1215 | .read = seq_read, | ||
1216 | .llseek = seq_lseek, | ||
1217 | .release = seq_release, | ||
1218 | }; | ||
1219 | |||
1231 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ | 1220 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
1232 | 1221 | ||
1233 | /*-------------------------------------------------------------------------*/ | 1222 | /*-------------------------------------------------------------------------*/ |
@@ -1796,7 +1785,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1796 | 1785 | ||
1797 | 1786 | ||
1798 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 1787 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
1799 | create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev); | 1788 | proc_create_data(proc_node_name, 0, NULL, &udc_proc_fops, dev); |
1800 | #endif | 1789 | #endif |
1801 | 1790 | ||
1802 | retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget, | 1791 | retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget, |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index e2b2e9cf254a..dda0dc4a5567 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -887,7 +887,6 @@ ep_open (struct inode *inode, struct file *fd) | |||
887 | 887 | ||
888 | /* used before endpoint configuration */ | 888 | /* used before endpoint configuration */ |
889 | static const struct file_operations ep_config_operations = { | 889 | static const struct file_operations ep_config_operations = { |
890 | .owner = THIS_MODULE, | ||
891 | .llseek = no_llseek, | 890 | .llseek = no_llseek, |
892 | 891 | ||
893 | .open = ep_open, | 892 | .open = ep_open, |
@@ -1940,7 +1939,6 @@ dev_open (struct inode *inode, struct file *fd) | |||
1940 | } | 1939 | } |
1941 | 1940 | ||
1942 | static const struct file_operations dev_init_operations = { | 1941 | static const struct file_operations dev_init_operations = { |
1943 | .owner = THIS_MODULE, | ||
1944 | .llseek = no_llseek, | 1942 | .llseek = no_llseek, |
1945 | 1943 | ||
1946 | .open = dev_open, | 1944 | .open = dev_open, |
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c index b943d8cdfbf7..67128be1e1b7 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c | |||
@@ -565,7 +565,7 @@ static int proc_udc_show(struct seq_file *s, void *unused) | |||
565 | 565 | ||
566 | static int proc_udc_open(struct inode *inode, struct file *file) | 566 | static int proc_udc_open(struct inode *inode, struct file *file) |
567 | { | 567 | { |
568 | return single_open(file, proc_udc_show, PDE(inode)->data); | 568 | return single_open(file, proc_udc_show, PDE_DATA(inode)); |
569 | } | 569 | } |
570 | 570 | ||
571 | static const struct file_operations proc_ops = { | 571 | static const struct file_operations proc_ops = { |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index d9297eebbf73..1e4cfb05f70b 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1065,7 +1065,7 @@ static int rndis_proc_show(struct seq_file *m, void *v) | |||
1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, | 1065 | static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, |
1066 | size_t count, loff_t *ppos) | 1066 | size_t count, loff_t *ppos) |
1067 | { | 1067 | { |
1068 | rndis_params *p = PDE(file_inode(file))->data; | 1068 | rndis_params *p = PDE_DATA(file_inode(file)); |
1069 | u32 speed = 0; | 1069 | u32 speed = 0; |
1070 | int i, fl_speed = 0; | 1070 | int i, fl_speed = 0; |
1071 | 1071 | ||
@@ -1109,7 +1109,7 @@ static ssize_t rndis_proc_write(struct file *file, const char __user *buffer, | |||
1109 | 1109 | ||
1110 | static int rndis_proc_open(struct inode *inode, struct file *file) | 1110 | static int rndis_proc_open(struct inode *inode, struct file *file) |
1111 | { | 1111 | { |
1112 | return single_open(file, rndis_proc_show, PDE(inode)->data); | 1112 | return single_open(file, rndis_proc_show, PDE_DATA(inode)); |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | static const struct file_operations rndis_proc_fops = { | 1115 | static const struct file_operations rndis_proc_fops = { |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 974480c516fa..b04e8ece4d35 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
@@ -2175,7 +2175,7 @@ static int proc_isp1362_show(struct seq_file *s, void *unused) | |||
2175 | 2175 | ||
2176 | static int proc_isp1362_open(struct inode *inode, struct file *file) | 2176 | static int proc_isp1362_open(struct inode *inode, struct file *file) |
2177 | { | 2177 | { |
2178 | return single_open(file, proc_isp1362_show, PDE(inode)->data); | 2178 | return single_open(file, proc_isp1362_show, PDE_DATA(inode)); |
2179 | } | 2179 | } |
2180 | 2180 | ||
2181 | static const struct file_operations proc_ops = { | 2181 | static const struct file_operations proc_ops = { |
@@ -2192,14 +2192,11 @@ static void create_debug_file(struct isp1362_hcd *isp1362_hcd) | |||
2192 | { | 2192 | { |
2193 | struct proc_dir_entry *pde; | 2193 | struct proc_dir_entry *pde; |
2194 | 2194 | ||
2195 | pde = create_proc_entry(proc_filename, 0, NULL); | 2195 | pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, isp1362_hcd); |
2196 | if (pde == NULL) { | 2196 | if (pde == NULL) { |
2197 | pr_warning("%s: Failed to create debug file '%s'\n", __func__, proc_filename); | 2197 | pr_warning("%s: Failed to create debug file '%s'\n", __func__, proc_filename); |
2198 | return; | 2198 | return; |
2199 | } | 2199 | } |
2200 | |||
2201 | pde->proc_fops = &proc_ops; | ||
2202 | pde->data = isp1362_hcd; | ||
2203 | isp1362_hcd->pde = pde; | 2200 | isp1362_hcd->pde = pde; |
2204 | } | 2201 | } |
2205 | 2202 | ||
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 15ed7e8d887f..ad4483efb6d6 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -1494,7 +1494,7 @@ static int proc_sl811h_show(struct seq_file *s, void *unused) | |||
1494 | 1494 | ||
1495 | static int proc_sl811h_open(struct inode *inode, struct file *file) | 1495 | static int proc_sl811h_open(struct inode *inode, struct file *file) |
1496 | { | 1496 | { |
1497 | return single_open(file, proc_sl811h_show, PDE(inode)->data); | 1497 | return single_open(file, proc_sl811h_show, PDE_DATA(inode)); |
1498 | } | 1498 | } |
1499 | 1499 | ||
1500 | static const struct file_operations proc_ops = { | 1500 | static const struct file_operations proc_ops = { |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 42ad2e6d86c4..b6ab515bfc6c 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -407,8 +407,6 @@ static int yurex_release(struct inode *inode, struct file *file) | |||
407 | if (dev == NULL) | 407 | if (dev == NULL) |
408 | return -ENODEV; | 408 | return -ENODEV; |
409 | 409 | ||
410 | yurex_fasync(-1, file, 0); | ||
411 | |||
412 | /* decrement the count on our device */ | 410 | /* decrement the count on our device */ |
413 | kref_put(&dev->kref, yurex_delete); | 411 | kref_put(&dev->kref, yurex_delete); |
414 | return 0; | 412 | return 0; |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 4faa982807f2..92b05d95ec5e 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -437,22 +437,21 @@ void usb_stor_report_bus_reset(struct us_data *us) | |||
437 | * /proc/scsi/ functions | 437 | * /proc/scsi/ functions |
438 | ***********************************************************************/ | 438 | ***********************************************************************/ |
439 | 439 | ||
440 | static int write_info(struct Scsi_Host *host, char *buffer, int length) | ||
441 | { | ||
442 | /* if someone is sending us data, just throw it away */ | ||
443 | return length; | ||
444 | } | ||
445 | |||
440 | /* we use this macro to help us write into the buffer */ | 446 | /* we use this macro to help us write into the buffer */ |
441 | #undef SPRINTF | 447 | #undef SPRINTF |
442 | #define SPRINTF(args...) \ | 448 | #define SPRINTF(args...) seq_printf(m, ## args) |
443 | do { if (pos < buffer+length) pos += sprintf(pos, ## args); } while (0) | ||
444 | 449 | ||
445 | static int proc_info (struct Scsi_Host *host, char *buffer, | 450 | static int show_info (struct seq_file *m, struct Scsi_Host *host) |
446 | char **start, off_t offset, int length, int inout) | ||
447 | { | 451 | { |
448 | struct us_data *us = host_to_us(host); | 452 | struct us_data *us = host_to_us(host); |
449 | char *pos = buffer; | ||
450 | const char *string; | 453 | const char *string; |
451 | 454 | ||
452 | /* if someone is sending us data, just throw it away */ | ||
453 | if (inout) | ||
454 | return length; | ||
455 | |||
456 | /* print the controller name */ | 455 | /* print the controller name */ |
457 | SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); | 456 | SPRINTF(" Host scsi%d: usb-storage\n", host->host_no); |
458 | 457 | ||
@@ -482,28 +481,14 @@ static int proc_info (struct Scsi_Host *host, char *buffer, | |||
482 | SPRINTF(" Transport: %s\n", us->transport_name); | 481 | SPRINTF(" Transport: %s\n", us->transport_name); |
483 | 482 | ||
484 | /* show the device flags */ | 483 | /* show the device flags */ |
485 | if (pos < buffer + length) { | 484 | SPRINTF(" Quirks:"); |
486 | pos += sprintf(pos, " Quirks:"); | ||
487 | 485 | ||
488 | #define US_FLAG(name, value) \ | 486 | #define US_FLAG(name, value) \ |
489 | if (us->fflags & value) pos += sprintf(pos, " " #name); | 487 | if (us->fflags & value) seq_printf(m, " " #name); |
490 | US_DO_ALL_FLAGS | 488 | US_DO_ALL_FLAGS |
491 | #undef US_FLAG | 489 | #undef US_FLAG |
492 | 490 | seq_putc(m, '\n'); | |
493 | *(pos++) = '\n'; | 491 | return 0; |
494 | } | ||
495 | |||
496 | /* | ||
497 | * Calculate start of next buffer, and return value. | ||
498 | */ | ||
499 | *start = buffer + offset; | ||
500 | |||
501 | if ((pos - buffer) < offset) | ||
502 | return (0); | ||
503 | else if ((pos - buffer - offset) < length) | ||
504 | return (pos - buffer - offset); | ||
505 | else | ||
506 | return (length); | ||
507 | } | 492 | } |
508 | 493 | ||
509 | /*********************************************************************** | 494 | /*********************************************************************** |
@@ -548,7 +533,8 @@ struct scsi_host_template usb_stor_host_template = { | |||
548 | /* basic userland interface stuff */ | 533 | /* basic userland interface stuff */ |
549 | .name = "usb-storage", | 534 | .name = "usb-storage", |
550 | .proc_name = "usb-storage", | 535 | .proc_name = "usb-storage", |
551 | .proc_info = proc_info, | 536 | .show_info = show_info, |
537 | .write_info = write_info, | ||
552 | .info = host_info, | 538 | .info = host_info, |
553 | 539 | ||
554 | /* command interface -- queued only */ | 540 | /* command interface -- queued only */ |
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c index 8d411a3c9966..a54f7f7d763b 100644 --- a/drivers/video/bfin_adv7393fb.c +++ b/drivers/video/bfin_adv7393fb.c | |||
@@ -333,29 +333,23 @@ static int proc_output(char *buf) | |||
333 | return p - buf; | 333 | return p - buf; |
334 | } | 334 | } |
335 | 335 | ||
336 | static int | 336 | static ssize_t |
337 | adv7393_read_proc(char *page, char **start, off_t off, | 337 | adv7393_read_proc(struct file *file, char __user *buf, |
338 | int count, int *eof, void *data) | 338 | size_t size, loff_t *ppos) |
339 | { | 339 | { |
340 | int len; | 340 | static const char message[] = "Usage:\n" |
341 | 341 | "echo 0x[REG][Value] > adv7393\n" | |
342 | len = proc_output(page); | 342 | "example: echo 0x1234 >adv7393\n" |
343 | if (len <= off + count) | 343 | "writes 0x34 into Register 0x12\n"; |
344 | *eof = 1; | 344 | return simple_read_from_buffer(buf, size, ppos, message, |
345 | *start = page + off; | 345 | sizeof(message)); |
346 | len -= off; | ||
347 | if (len > count) | ||
348 | len = count; | ||
349 | if (len < 0) | ||
350 | len = 0; | ||
351 | return len; | ||
352 | } | 346 | } |
353 | 347 | ||
354 | static int | 348 | static ssize_t |
355 | adv7393_write_proc(struct file *file, const char __user * buffer, | 349 | adv7393_write_proc(struct file *file, const char __user * buffer, |
356 | size_t count, void *data) | 350 | size_t count, loff_t *ppos) |
357 | { | 351 | { |
358 | struct adv7393fb_device *fbdev = data; | 352 | struct adv7393fb_device *fbdev = PDE_DATA(file_inode(file)); |
359 | unsigned int val; | 353 | unsigned int val; |
360 | int ret; | 354 | int ret; |
361 | 355 | ||
@@ -368,6 +362,12 @@ adv7393_write_proc(struct file *file, const char __user * buffer, | |||
368 | return count; | 362 | return count; |
369 | } | 363 | } |
370 | 364 | ||
365 | static const struct file_operations fops = { | ||
366 | .read = adv7393_read_proc, | ||
367 | .write = adv7393_write_proc, | ||
368 | .llseek = default_llseek, | ||
369 | }; | ||
370 | |||
371 | static int bfin_adv7393_fb_probe(struct i2c_client *client, | 371 | static int bfin_adv7393_fb_probe(struct i2c_client *client, |
372 | const struct i2c_device_id *id) | 372 | const struct i2c_device_id *id) |
373 | { | 373 | { |
@@ -506,17 +506,12 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, | |||
506 | fbdev->info.node, fbdev->info.fix.id); | 506 | fbdev->info.node, fbdev->info.fix.id); |
507 | dev_info(&client->dev, "fb memory address : 0x%p\n", fbdev->fb_mem); | 507 | dev_info(&client->dev, "fb memory address : 0x%p\n", fbdev->fb_mem); |
508 | 508 | ||
509 | entry = create_proc_entry("driver/adv7393", 0, NULL); | 509 | entry = proc_create_data("driver/adv7393", 0, NULL, &fops, fbdev); |
510 | if (!entry) { | 510 | if (!entry) { |
511 | dev_err(&client->dev, "unable to create /proc entry\n"); | 511 | dev_err(&client->dev, "unable to create /proc entry\n"); |
512 | ret = -EFAULT; | 512 | ret = -EFAULT; |
513 | goto free_fb; | 513 | goto free_fb; |
514 | } | 514 | } |
515 | |||
516 | entry->read_proc = adv7393_read_proc; | ||
517 | entry->write_proc = adv7393_write_proc; | ||
518 | entry->data = fbdev; | ||
519 | |||
520 | return 0; | 515 | return 0; |
521 | 516 | ||
522 | free_fb: | 517 | free_fb: |
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c index 6c984eacc7e3..97563c55af63 100644 --- a/drivers/video/pxa3xx-gcu.c +++ b/drivers/video/pxa3xx-gcu.c | |||
@@ -101,7 +101,6 @@ struct pxa3xx_gcu_priv { | |||
101 | dma_addr_t shared_phys; | 101 | dma_addr_t shared_phys; |
102 | struct resource *resource_mem; | 102 | struct resource *resource_mem; |
103 | struct miscdevice misc_dev; | 103 | struct miscdevice misc_dev; |
104 | struct file_operations misc_fops; | ||
105 | wait_queue_head_t wait_idle; | 104 | wait_queue_head_t wait_idle; |
106 | wait_queue_head_t wait_free; | 105 | wait_queue_head_t wait_free; |
107 | spinlock_t spinlock; | 106 | spinlock_t spinlock; |
@@ -369,15 +368,20 @@ pxa3xx_gcu_wait_free(struct pxa3xx_gcu_priv *priv) | |||
369 | 368 | ||
370 | /* Misc device layer */ | 369 | /* Misc device layer */ |
371 | 370 | ||
371 | static inline struct pxa3xx_gcu_priv *file_dev(struct file *file) | ||
372 | { | ||
373 | struct miscdevice *dev = file->private_data; | ||
374 | return container_of(dev, struct pxa3xx_gcu_priv, misc_dev); | ||
375 | } | ||
376 | |||
372 | static ssize_t | 377 | static ssize_t |
373 | pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | 378 | pxa3xx_gcu_misc_write(struct file *file, const char *buff, |
374 | size_t count, loff_t *offp) | 379 | size_t count, loff_t *offp) |
375 | { | 380 | { |
376 | int ret; | 381 | int ret; |
377 | unsigned long flags; | 382 | unsigned long flags; |
378 | struct pxa3xx_gcu_batch *buffer; | 383 | struct pxa3xx_gcu_batch *buffer; |
379 | struct pxa3xx_gcu_priv *priv = | 384 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
380 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
381 | 385 | ||
382 | int words = count / 4; | 386 | int words = count / 4; |
383 | 387 | ||
@@ -450,11 +454,10 @@ pxa3xx_gcu_misc_write(struct file *filp, const char *buff, | |||
450 | 454 | ||
451 | 455 | ||
452 | static long | 456 | static long |
453 | pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 457 | pxa3xx_gcu_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
454 | { | 458 | { |
455 | unsigned long flags; | 459 | unsigned long flags; |
456 | struct pxa3xx_gcu_priv *priv = | 460 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
457 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
458 | 461 | ||
459 | switch (cmd) { | 462 | switch (cmd) { |
460 | case PXA3XX_GCU_IOCTL_RESET: | 463 | case PXA3XX_GCU_IOCTL_RESET: |
@@ -471,11 +474,10 @@ pxa3xx_gcu_misc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
471 | } | 474 | } |
472 | 475 | ||
473 | static int | 476 | static int |
474 | pxa3xx_gcu_misc_mmap(struct file *filp, struct vm_area_struct *vma) | 477 | pxa3xx_gcu_misc_mmap(struct file *file, struct vm_area_struct *vma) |
475 | { | 478 | { |
476 | unsigned int size = vma->vm_end - vma->vm_start; | 479 | unsigned int size = vma->vm_end - vma->vm_start; |
477 | struct pxa3xx_gcu_priv *priv = | 480 | struct pxa3xx_gcu_priv *priv = file_dev(file); |
478 | container_of(filp->f_op, struct pxa3xx_gcu_priv, misc_fops); | ||
479 | 481 | ||
480 | switch (vma->vm_pgoff) { | 482 | switch (vma->vm_pgoff) { |
481 | case 0: | 483 | case 0: |
@@ -574,6 +576,13 @@ free_buffers(struct platform_device *dev, | |||
574 | priv->free = NULL; | 576 | priv->free = NULL; |
575 | } | 577 | } |
576 | 578 | ||
579 | static const struct file_operations misc_fops = { | ||
580 | .owner = THIS_MODULE, | ||
581 | .write = pxa3xx_gcu_misc_write, | ||
582 | .unlocked_ioctl = pxa3xx_gcu_misc_ioctl, | ||
583 | .mmap = pxa3xx_gcu_misc_mmap | ||
584 | }; | ||
585 | |||
577 | static int pxa3xx_gcu_probe(struct platform_device *dev) | 586 | static int pxa3xx_gcu_probe(struct platform_device *dev) |
578 | { | 587 | { |
579 | int i, ret, irq; | 588 | int i, ret, irq; |
@@ -601,14 +610,9 @@ static int pxa3xx_gcu_probe(struct platform_device *dev) | |||
601 | * container_of(). This isn't really necessary as we have a fixed minor | 610 | * container_of(). This isn't really necessary as we have a fixed minor |
602 | * number anyway, but this is to avoid statics. */ | 611 | * number anyway, but this is to avoid statics. */ |
603 | 612 | ||
604 | priv->misc_fops.owner = THIS_MODULE; | ||
605 | priv->misc_fops.write = pxa3xx_gcu_misc_write; | ||
606 | priv->misc_fops.unlocked_ioctl = pxa3xx_gcu_misc_ioctl; | ||
607 | priv->misc_fops.mmap = pxa3xx_gcu_misc_mmap; | ||
608 | |||
609 | priv->misc_dev.minor = MISCDEV_MINOR, | 613 | priv->misc_dev.minor = MISCDEV_MINOR, |
610 | priv->misc_dev.name = DRV_NAME, | 614 | priv->misc_dev.name = DRV_NAME, |
611 | priv->misc_dev.fops = &priv->misc_fops, | 615 | priv->misc_dev.fops = &misc_fops, |
612 | 616 | ||
613 | /* register misc device */ | 617 | /* register misc device */ |
614 | ret = misc_register(&priv->misc_dev); | 618 | ret = misc_register(&priv->misc_dev); |
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 73b33837e12c..1c15ee7456b6 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -47,9 +47,7 @@ proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) | |||
47 | static ssize_t | 47 | static ssize_t |
48 | proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 48 | proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
49 | { | 49 | { |
50 | struct inode *ino = file_inode(file); | 50 | struct zorro_dev *z = PDE_DATA(file_inode(file)); |
51 | struct proc_dir_entry *dp = PDE(ino); | ||
52 | struct zorro_dev *z = dp->data; | ||
53 | struct ConfigDev cd; | 51 | struct ConfigDev cd; |
54 | loff_t pos = *ppos; | 52 | loff_t pos = *ppos; |
55 | 53 | ||
@@ -141,7 +139,7 @@ static int __init zorro_proc_attach_device(unsigned int slot) | |||
141 | &zorro_autocon[slot]); | 139 | &zorro_autocon[slot]); |
142 | if (!entry) | 140 | if (!entry) |
143 | return -ENOMEM; | 141 | return -ENOMEM; |
144 | entry->size = sizeof(struct zorro_dev); | 142 | proc_set_size(entry, sizeof(struct zorro_dev)); |
145 | return 0; | 143 | return 0; |
146 | } | 144 | } |
147 | 145 | ||
diff --git a/fs/Makefile b/fs/Makefile index f0db9c941a5f..4fe6df3ec28f 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | obj-y := open.o read_write.o file_table.o super.o \ | 8 | obj-y := open.o read_write.o file_table.o super.o \ |
9 | char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ | 9 | char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ |
10 | ioctl.o readdir.o select.o fifo.o dcache.o inode.o \ | 10 | ioctl.o readdir.o select.o dcache.o inode.o \ |
11 | attr.o bad_inode.o file.o filesystems.o namespace.o \ | 11 | attr.o bad_inode.o file.o filesystems.o namespace.o \ |
12 | seq_file.o xattr.o libfs.o fs-writeback.o \ | 12 | seq_file.o xattr.o libfs.o fs-writeback.o \ |
13 | pnode.o splice.o sync.o utimes.o \ | 13 | pnode.o splice.o sync.o utimes.o \ |
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 096b23f821a1..526e4bbbde59 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -190,7 +190,7 @@ static int afs_proc_cells_open(struct inode *inode, struct file *file) | |||
190 | return ret; | 190 | return ret; |
191 | 191 | ||
192 | m = file->private_data; | 192 | m = file->private_data; |
193 | m->private = PDE(inode)->data; | 193 | m->private = PDE_DATA(inode); |
194 | 194 | ||
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
@@ -448,7 +448,7 @@ static int afs_proc_cell_volumes_open(struct inode *inode, struct file *file) | |||
448 | struct seq_file *m; | 448 | struct seq_file *m; |
449 | int ret; | 449 | int ret; |
450 | 450 | ||
451 | cell = PDE(inode)->data; | 451 | cell = PDE_DATA(inode); |
452 | if (!cell) | 452 | if (!cell) |
453 | return -ENOENT; | 453 | return -ENOENT; |
454 | 454 | ||
@@ -554,7 +554,7 @@ static int afs_proc_cell_vlservers_open(struct inode *inode, struct file *file) | |||
554 | struct seq_file *m; | 554 | struct seq_file *m; |
555 | int ret; | 555 | int ret; |
556 | 556 | ||
557 | cell = PDE(inode)->data; | 557 | cell = PDE_DATA(inode); |
558 | if (!cell) | 558 | if (!cell) |
559 | return -ENOENT; | 559 | return -ENOENT; |
560 | 560 | ||
@@ -659,7 +659,7 @@ static int afs_proc_cell_servers_open(struct inode *inode, struct file *file) | |||
659 | struct seq_file *m; | 659 | struct seq_file *m; |
660 | int ret; | 660 | int ret; |
661 | 661 | ||
662 | cell = PDE(inode)->data; | 662 | cell = PDE_DATA(inode); |
663 | if (!cell) | 663 | if (!cell) |
664 | return -ENOENT; | 664 | return -ENOENT; |
665 | 665 | ||
@@ -1324,6 +1324,8 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) | |||
1324 | if (iocb->ki_pos < 0) | 1324 | if (iocb->ki_pos < 0) |
1325 | return -EINVAL; | 1325 | return -EINVAL; |
1326 | 1326 | ||
1327 | if (opcode == IOCB_CMD_PWRITEV) | ||
1328 | file_start_write(file); | ||
1327 | do { | 1329 | do { |
1328 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], | 1330 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], |
1329 | iocb->ki_nr_segs - iocb->ki_cur_seg, | 1331 | iocb->ki_nr_segs - iocb->ki_cur_seg, |
@@ -1336,6 +1338,8 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) | |||
1336 | } while (ret > 0 && iocb->ki_left > 0 && | 1338 | } while (ret > 0 && iocb->ki_left > 0 && |
1337 | (opcode == IOCB_CMD_PWRITEV || | 1339 | (opcode == IOCB_CMD_PWRITEV || |
1338 | (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)))); | 1340 | (!S_ISFIFO(inode->i_mode) && !S_ISSOCK(inode->i_mode)))); |
1341 | if (opcode == IOCB_CMD_PWRITEV) | ||
1342 | file_end_write(file); | ||
1339 | 1343 | ||
1340 | /* This means we must have transferred all that we could */ | 1344 | /* This means we must have transferred all that we could */ |
1341 | /* No need to retry anymore */ | 1345 | /* No need to retry anymore */ |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 02fe378fc506..bce87694f7b0 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -286,15 +286,12 @@ static int load_aout_binary(struct linux_binprm * bprm) | |||
286 | return error; | 286 | return error; |
287 | } | 287 | } |
288 | 288 | ||
289 | error = bprm->file->f_op->read(bprm->file, | 289 | error = read_code(bprm->file, text_addr, pos, |
290 | (char __user *)text_addr, | 290 | ex.a_text+ex.a_data); |
291 | ex.a_text+ex.a_data, &pos); | ||
292 | if ((signed long)error < 0) { | 291 | if ((signed long)error < 0) { |
293 | send_sig(SIGKILL, current, 0); | 292 | send_sig(SIGKILL, current, 0); |
294 | return error; | 293 | return error; |
295 | } | 294 | } |
296 | |||
297 | flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data); | ||
298 | } else { | 295 | } else { |
299 | if ((ex.a_text & 0xfff || ex.a_data & 0xfff) && | 296 | if ((ex.a_text & 0xfff || ex.a_data & 0xfff) && |
300 | (N_MAGIC(ex) != NMAGIC) && printk_ratelimit()) | 297 | (N_MAGIC(ex) != NMAGIC) && printk_ratelimit()) |
@@ -310,14 +307,9 @@ static int load_aout_binary(struct linux_binprm * bprm) | |||
310 | } | 307 | } |
311 | 308 | ||
312 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { | 309 | if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { |
313 | loff_t pos = fd_offset; | ||
314 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); | 310 | vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); |
315 | bprm->file->f_op->read(bprm->file, | 311 | read_code(bprm->file, N_TXTADDR(ex), fd_offset, |
316 | (char __user *)N_TXTADDR(ex), | 312 | ex.a_text + ex.a_data); |
317 | ex.a_text+ex.a_data, &pos); | ||
318 | flush_icache_range((unsigned long) N_TXTADDR(ex), | ||
319 | (unsigned long) N_TXTADDR(ex) + | ||
320 | ex.a_text+ex.a_data); | ||
321 | goto beyond_if; | 313 | goto beyond_if; |
322 | } | 314 | } |
323 | 315 | ||
@@ -396,8 +388,6 @@ static int load_aout_library(struct file *file) | |||
396 | start_addr = ex.a_entry & 0xfffff000; | 388 | start_addr = ex.a_entry & 0xfffff000; |
397 | 389 | ||
398 | if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { | 390 | if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) { |
399 | loff_t pos = N_TXTOFF(ex); | ||
400 | |||
401 | if (printk_ratelimit()) | 391 | if (printk_ratelimit()) |
402 | { | 392 | { |
403 | printk(KERN_WARNING | 393 | printk(KERN_WARNING |
@@ -406,11 +396,8 @@ static int load_aout_library(struct file *file) | |||
406 | } | 396 | } |
407 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); | 397 | vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); |
408 | 398 | ||
409 | file->f_op->read(file, (char __user *)start_addr, | 399 | read_code(file, start_addr, N_TXTOFF(ex), |
410 | ex.a_text + ex.a_data, &pos); | 400 | ex.a_text + ex.a_data); |
411 | flush_icache_range((unsigned long) start_addr, | ||
412 | (unsigned long) start_addr + ex.a_text + ex.a_data); | ||
413 | |||
414 | retval = 0; | 401 | retval = 0; |
415 | goto out; | 402 | goto out; |
416 | } | 403 | } |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index c1cc06aed601..9dac212fc6f9 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -926,7 +926,6 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
926 | struct elf32_fdpic_loadseg *seg; | 926 | struct elf32_fdpic_loadseg *seg; |
927 | struct elf32_phdr *phdr; | 927 | struct elf32_phdr *phdr; |
928 | unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0, mflags; | 928 | unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0, mflags; |
929 | loff_t fpos; | ||
930 | int loop, ret; | 929 | int loop, ret; |
931 | 930 | ||
932 | load_addr = params->load_addr; | 931 | load_addr = params->load_addr; |
@@ -964,14 +963,12 @@ static int elf_fdpic_map_file_constdisp_on_uclinux( | |||
964 | if (params->phdrs[loop].p_type != PT_LOAD) | 963 | if (params->phdrs[loop].p_type != PT_LOAD) |
965 | continue; | 964 | continue; |
966 | 965 | ||
967 | fpos = phdr->p_offset; | ||
968 | |||
969 | seg->addr = maddr + (phdr->p_vaddr - base); | 966 | seg->addr = maddr + (phdr->p_vaddr - base); |
970 | seg->p_vaddr = phdr->p_vaddr; | 967 | seg->p_vaddr = phdr->p_vaddr; |
971 | seg->p_memsz = phdr->p_memsz; | 968 | seg->p_memsz = phdr->p_memsz; |
972 | 969 | ||
973 | ret = file->f_op->read(file, (void *) seg->addr, | 970 | ret = read_code(file, seg->addr, phdr->p_offset, |
974 | phdr->p_filesz, &fpos); | 971 | phdr->p_filesz); |
975 | if (ret < 0) | 972 | if (ret < 0) |
976 | return ret; | 973 | return ret; |
977 | 974 | ||
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 2036d21baaef..d50bbe59da1e 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -207,11 +207,12 @@ static int decompress_exec( | |||
207 | 207 | ||
208 | /* Read in first chunk of data and parse gzip header. */ | 208 | /* Read in first chunk of data and parse gzip header. */ |
209 | fpos = offset; | 209 | fpos = offset; |
210 | ret = bprm->file->f_op->read(bprm->file, buf, LBUFSIZE, &fpos); | 210 | ret = kernel_read(bprm->file, offset, buf, LBUFSIZE); |
211 | 211 | ||
212 | strm.next_in = buf; | 212 | strm.next_in = buf; |
213 | strm.avail_in = ret; | 213 | strm.avail_in = ret; |
214 | strm.total_in = 0; | 214 | strm.total_in = 0; |
215 | fpos += ret; | ||
215 | 216 | ||
216 | retval = -ENOEXEC; | 217 | retval = -ENOEXEC; |
217 | 218 | ||
@@ -277,7 +278,7 @@ static int decompress_exec( | |||
277 | } | 278 | } |
278 | 279 | ||
279 | while ((ret = zlib_inflate(&strm, Z_NO_FLUSH)) == Z_OK) { | 280 | while ((ret = zlib_inflate(&strm, Z_NO_FLUSH)) == Z_OK) { |
280 | ret = bprm->file->f_op->read(bprm->file, buf, LBUFSIZE, &fpos); | 281 | ret = kernel_read(bprm->file, fpos, buf, LBUFSIZE); |
281 | if (ret <= 0) | 282 | if (ret <= 0) |
282 | break; | 283 | break; |
283 | len -= ret; | 284 | len -= ret; |
@@ -285,6 +286,7 @@ static int decompress_exec( | |||
285 | strm.next_in = buf; | 286 | strm.next_in = buf; |
286 | strm.avail_in = ret; | 287 | strm.avail_in = ret; |
287 | strm.total_in = 0; | 288 | strm.total_in = 0; |
289 | fpos += ret; | ||
288 | } | 290 | } |
289 | 291 | ||
290 | if (ret < 0) { | 292 | if (ret < 0) { |
@@ -428,6 +430,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
428 | unsigned long textpos = 0, datapos = 0, result; | 430 | unsigned long textpos = 0, datapos = 0, result; |
429 | unsigned long realdatastart = 0; | 431 | unsigned long realdatastart = 0; |
430 | unsigned long text_len, data_len, bss_len, stack_len, flags; | 432 | unsigned long text_len, data_len, bss_len, stack_len, flags; |
433 | unsigned long full_data; | ||
431 | unsigned long len, memp = 0; | 434 | unsigned long len, memp = 0; |
432 | unsigned long memp_size, extra, rlim; | 435 | unsigned long memp_size, extra, rlim; |
433 | unsigned long *reloc = 0, *rp; | 436 | unsigned long *reloc = 0, *rp; |
@@ -451,6 +454,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
451 | relocs = ntohl(hdr->reloc_count); | 454 | relocs = ntohl(hdr->reloc_count); |
452 | flags = ntohl(hdr->flags); | 455 | flags = ntohl(hdr->flags); |
453 | rev = ntohl(hdr->rev); | 456 | rev = ntohl(hdr->rev); |
457 | full_data = data_len + relocs * sizeof(unsigned long); | ||
454 | 458 | ||
455 | if (strncmp(hdr->magic, "bFLT", 4)) { | 459 | if (strncmp(hdr->magic, "bFLT", 4)) { |
456 | /* | 460 | /* |
@@ -577,12 +581,12 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
577 | #ifdef CONFIG_BINFMT_ZFLAT | 581 | #ifdef CONFIG_BINFMT_ZFLAT |
578 | if (flags & FLAT_FLAG_GZDATA) { | 582 | if (flags & FLAT_FLAG_GZDATA) { |
579 | result = decompress_exec(bprm, fpos, (char *) datapos, | 583 | result = decompress_exec(bprm, fpos, (char *) datapos, |
580 | data_len + (relocs * sizeof(unsigned long)), 0); | 584 | full_data, 0); |
581 | } else | 585 | } else |
582 | #endif | 586 | #endif |
583 | { | 587 | { |
584 | result = bprm->file->f_op->read(bprm->file, (char *) datapos, | 588 | result = read_code(bprm->file, datapos, fpos, |
585 | data_len + (relocs * sizeof(unsigned long)), &fpos); | 589 | full_data); |
586 | } | 590 | } |
587 | if (IS_ERR_VALUE(result)) { | 591 | if (IS_ERR_VALUE(result)) { |
588 | printk("Unable to read data+bss, errno %d\n", (int)-result); | 592 | printk("Unable to read data+bss, errno %d\n", (int)-result); |
@@ -627,30 +631,25 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
627 | if (flags & FLAT_FLAG_GZIP) { | 631 | if (flags & FLAT_FLAG_GZIP) { |
628 | result = decompress_exec(bprm, sizeof (struct flat_hdr), | 632 | result = decompress_exec(bprm, sizeof (struct flat_hdr), |
629 | (((char *) textpos) + sizeof (struct flat_hdr)), | 633 | (((char *) textpos) + sizeof (struct flat_hdr)), |
630 | (text_len + data_len + (relocs * sizeof(unsigned long)) | 634 | (text_len + full_data |
631 | - sizeof (struct flat_hdr)), | 635 | - sizeof (struct flat_hdr)), |
632 | 0); | 636 | 0); |
633 | memmove((void *) datapos, (void *) realdatastart, | 637 | memmove((void *) datapos, (void *) realdatastart, |
634 | data_len + (relocs * sizeof(unsigned long))); | 638 | full_data); |
635 | } else if (flags & FLAT_FLAG_GZDATA) { | 639 | } else if (flags & FLAT_FLAG_GZDATA) { |
636 | fpos = 0; | 640 | result = read_code(bprm->file, textpos, 0, text_len); |
637 | result = bprm->file->f_op->read(bprm->file, | ||
638 | (char *) textpos, text_len, &fpos); | ||
639 | if (!IS_ERR_VALUE(result)) | 641 | if (!IS_ERR_VALUE(result)) |
640 | result = decompress_exec(bprm, text_len, (char *) datapos, | 642 | result = decompress_exec(bprm, text_len, (char *) datapos, |
641 | data_len + (relocs * sizeof(unsigned long)), 0); | 643 | full_data, 0); |
642 | } | 644 | } |
643 | else | 645 | else |
644 | #endif | 646 | #endif |
645 | { | 647 | { |
646 | fpos = 0; | 648 | result = read_code(bprm->file, textpos, 0, text_len); |
647 | result = bprm->file->f_op->read(bprm->file, | 649 | if (!IS_ERR_VALUE(result)) |
648 | (char *) textpos, text_len, &fpos); | 650 | result = read_code(bprm->file, datapos, |
649 | if (!IS_ERR_VALUE(result)) { | 651 | ntohl(hdr->data_start), |
650 | fpos = ntohl(hdr->data_start); | 652 | full_data); |
651 | result = bprm->file->f_op->read(bprm->file, (char *) datapos, | ||
652 | data_len + (relocs * sizeof(unsigned long)), &fpos); | ||
653 | } | ||
654 | } | 653 | } |
655 | if (IS_ERR_VALUE(result)) { | 654 | if (IS_ERR_VALUE(result)) { |
656 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); | 655 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index ade03e6f7bd2..bb8b7a0e28a6 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1514,8 +1514,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1514 | size_t count, ocount; | 1514 | size_t count, ocount; |
1515 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); | 1515 | bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); |
1516 | 1516 | ||
1517 | sb_start_write(inode->i_sb); | ||
1518 | |||
1519 | mutex_lock(&inode->i_mutex); | 1517 | mutex_lock(&inode->i_mutex); |
1520 | 1518 | ||
1521 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); | 1519 | err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); |
@@ -1617,7 +1615,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1617 | if (sync) | 1615 | if (sync) |
1618 | atomic_dec(&BTRFS_I(inode)->sync_writers); | 1616 | atomic_dec(&BTRFS_I(inode)->sync_writers); |
1619 | out: | 1617 | out: |
1620 | sb_end_write(inode->i_sb); | ||
1621 | current->backing_dev_info = NULL; | 1618 | current->backing_dev_info = NULL; |
1622 | return num_written ? num_written : err; | 1619 | return num_written ? num_written : err; |
1623 | } | 1620 | } |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 480992259707..317f9ee9c991 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -962,12 +962,14 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) | |||
962 | } | 962 | } |
963 | 963 | ||
964 | data = kmap(page); | 964 | data = kmap(page); |
965 | file_start_write(file); | ||
965 | old_fs = get_fs(); | 966 | old_fs = get_fs(); |
966 | set_fs(KERNEL_DS); | 967 | set_fs(KERNEL_DS); |
967 | ret = file->f_op->write( | 968 | ret = file->f_op->write( |
968 | file, (const void __user *) data, len, &pos); | 969 | file, (const void __user *) data, len, &pos); |
969 | set_fs(old_fs); | 970 | set_fs(old_fs); |
970 | kunmap(page); | 971 | kunmap(page); |
972 | file_end_write(file); | ||
971 | if (ret != len) | 973 | if (ret != len) |
972 | ret = -EIO; | 974 | ret = -EIO; |
973 | } | 975 | } |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7a0dd99e4507..2d4a231dd70b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2520,8 +2520,6 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2520 | 2520 | ||
2521 | BUG_ON(iocb->ki_pos != pos); | 2521 | BUG_ON(iocb->ki_pos != pos); |
2522 | 2522 | ||
2523 | sb_start_write(inode->i_sb); | ||
2524 | |||
2525 | /* | 2523 | /* |
2526 | * We need to hold the sem to be sure nobody modifies lock list | 2524 | * We need to hold the sem to be sure nobody modifies lock list |
2527 | * with a brlock that prevents writing. | 2525 | * with a brlock that prevents writing. |
@@ -2545,7 +2543,6 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2545 | } | 2543 | } |
2546 | 2544 | ||
2547 | up_read(&cinode->lock_sem); | 2545 | up_read(&cinode->lock_sem); |
2548 | sb_end_write(inode->i_sb); | ||
2549 | return rc; | 2546 | return rc; |
2550 | } | 2547 | } |
2551 | 2548 | ||
diff --git a/fs/coda/file.c b/fs/coda/file.c index fa4c100bdc7d..380b798f8443 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -79,6 +79,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo | |||
79 | return -EINVAL; | 79 | return -EINVAL; |
80 | 80 | ||
81 | host_inode = file_inode(host_file); | 81 | host_inode = file_inode(host_file); |
82 | file_start_write(host_file); | ||
82 | mutex_lock(&coda_inode->i_mutex); | 83 | mutex_lock(&coda_inode->i_mutex); |
83 | 84 | ||
84 | ret = host_file->f_op->write(host_file, buf, count, ppos); | 85 | ret = host_file->f_op->write(host_file, buf, count, ppos); |
@@ -87,6 +88,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo | |||
87 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; | 88 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; |
88 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; | 89 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; |
89 | mutex_unlock(&coda_inode->i_mutex); | 90 | mutex_unlock(&coda_inode->i_mutex); |
91 | file_end_write(host_file); | ||
90 | 92 | ||
91 | return ret; | 93 | return ret; |
92 | } | 94 | } |
diff --git a/fs/compat.c b/fs/compat.c index 5f83ffa42115..d0560c93973d 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1068,190 +1068,6 @@ asmlinkage long compat_sys_getdents64(unsigned int fd, | |||
1068 | } | 1068 | } |
1069 | #endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ | 1069 | #endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ |
1070 | 1070 | ||
1071 | static ssize_t compat_do_readv_writev(int type, struct file *file, | ||
1072 | const struct compat_iovec __user *uvector, | ||
1073 | unsigned long nr_segs, loff_t *pos) | ||
1074 | { | ||
1075 | compat_ssize_t tot_len; | ||
1076 | struct iovec iovstack[UIO_FASTIOV]; | ||
1077 | struct iovec *iov = iovstack; | ||
1078 | ssize_t ret; | ||
1079 | io_fn_t fn; | ||
1080 | iov_fn_t fnv; | ||
1081 | |||
1082 | ret = -EINVAL; | ||
1083 | if (!file->f_op) | ||
1084 | goto out; | ||
1085 | |||
1086 | ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
1087 | UIO_FASTIOV, iovstack, &iov); | ||
1088 | if (ret <= 0) | ||
1089 | goto out; | ||
1090 | |||
1091 | tot_len = ret; | ||
1092 | ret = rw_verify_area(type, file, pos, tot_len); | ||
1093 | if (ret < 0) | ||
1094 | goto out; | ||
1095 | |||
1096 | fnv = NULL; | ||
1097 | if (type == READ) { | ||
1098 | fn = file->f_op->read; | ||
1099 | fnv = file->f_op->aio_read; | ||
1100 | } else { | ||
1101 | fn = (io_fn_t)file->f_op->write; | ||
1102 | fnv = file->f_op->aio_write; | ||
1103 | } | ||
1104 | |||
1105 | if (fnv) | ||
1106 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | ||
1107 | pos, fnv); | ||
1108 | else | ||
1109 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | ||
1110 | |||
1111 | out: | ||
1112 | if (iov != iovstack) | ||
1113 | kfree(iov); | ||
1114 | if ((ret + (type == READ)) > 0) { | ||
1115 | if (type == READ) | ||
1116 | fsnotify_access(file); | ||
1117 | else | ||
1118 | fsnotify_modify(file); | ||
1119 | } | ||
1120 | return ret; | ||
1121 | } | ||
1122 | |||
1123 | static size_t compat_readv(struct file *file, | ||
1124 | const struct compat_iovec __user *vec, | ||
1125 | unsigned long vlen, loff_t *pos) | ||
1126 | { | ||
1127 | ssize_t ret = -EBADF; | ||
1128 | |||
1129 | if (!(file->f_mode & FMODE_READ)) | ||
1130 | goto out; | ||
1131 | |||
1132 | ret = -EINVAL; | ||
1133 | if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) | ||
1134 | goto out; | ||
1135 | |||
1136 | ret = compat_do_readv_writev(READ, file, vec, vlen, pos); | ||
1137 | |||
1138 | out: | ||
1139 | if (ret > 0) | ||
1140 | add_rchar(current, ret); | ||
1141 | inc_syscr(current); | ||
1142 | return ret; | ||
1143 | } | ||
1144 | |||
1145 | asmlinkage ssize_t | ||
1146 | compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, | ||
1147 | unsigned long vlen) | ||
1148 | { | ||
1149 | struct fd f = fdget(fd); | ||
1150 | ssize_t ret; | ||
1151 | loff_t pos; | ||
1152 | |||
1153 | if (!f.file) | ||
1154 | return -EBADF; | ||
1155 | pos = f.file->f_pos; | ||
1156 | ret = compat_readv(f.file, vec, vlen, &pos); | ||
1157 | f.file->f_pos = pos; | ||
1158 | fdput(f); | ||
1159 | return ret; | ||
1160 | } | ||
1161 | |||
1162 | asmlinkage ssize_t | ||
1163 | compat_sys_preadv64(unsigned long fd, const struct compat_iovec __user *vec, | ||
1164 | unsigned long vlen, loff_t pos) | ||
1165 | { | ||
1166 | struct fd f; | ||
1167 | ssize_t ret; | ||
1168 | |||
1169 | if (pos < 0) | ||
1170 | return -EINVAL; | ||
1171 | f = fdget(fd); | ||
1172 | if (!f.file) | ||
1173 | return -EBADF; | ||
1174 | ret = -ESPIPE; | ||
1175 | if (f.file->f_mode & FMODE_PREAD) | ||
1176 | ret = compat_readv(f.file, vec, vlen, &pos); | ||
1177 | fdput(f); | ||
1178 | return ret; | ||
1179 | } | ||
1180 | |||
1181 | asmlinkage ssize_t | ||
1182 | compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec, | ||
1183 | unsigned long vlen, u32 pos_low, u32 pos_high) | ||
1184 | { | ||
1185 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | ||
1186 | return compat_sys_preadv64(fd, vec, vlen, pos); | ||
1187 | } | ||
1188 | |||
1189 | static size_t compat_writev(struct file *file, | ||
1190 | const struct compat_iovec __user *vec, | ||
1191 | unsigned long vlen, loff_t *pos) | ||
1192 | { | ||
1193 | ssize_t ret = -EBADF; | ||
1194 | |||
1195 | if (!(file->f_mode & FMODE_WRITE)) | ||
1196 | goto out; | ||
1197 | |||
1198 | ret = -EINVAL; | ||
1199 | if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) | ||
1200 | goto out; | ||
1201 | |||
1202 | ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos); | ||
1203 | |||
1204 | out: | ||
1205 | if (ret > 0) | ||
1206 | add_wchar(current, ret); | ||
1207 | inc_syscw(current); | ||
1208 | return ret; | ||
1209 | } | ||
1210 | |||
1211 | asmlinkage ssize_t | ||
1212 | compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, | ||
1213 | unsigned long vlen) | ||
1214 | { | ||
1215 | struct fd f = fdget(fd); | ||
1216 | ssize_t ret; | ||
1217 | loff_t pos; | ||
1218 | |||
1219 | if (!f.file) | ||
1220 | return -EBADF; | ||
1221 | pos = f.file->f_pos; | ||
1222 | ret = compat_writev(f.file, vec, vlen, &pos); | ||
1223 | f.file->f_pos = pos; | ||
1224 | fdput(f); | ||
1225 | return ret; | ||
1226 | } | ||
1227 | |||
1228 | asmlinkage ssize_t | ||
1229 | compat_sys_pwritev64(unsigned long fd, const struct compat_iovec __user *vec, | ||
1230 | unsigned long vlen, loff_t pos) | ||
1231 | { | ||
1232 | struct fd f; | ||
1233 | ssize_t ret; | ||
1234 | |||
1235 | if (pos < 0) | ||
1236 | return -EINVAL; | ||
1237 | f = fdget(fd); | ||
1238 | if (!f.file) | ||
1239 | return -EBADF; | ||
1240 | ret = -ESPIPE; | ||
1241 | if (f.file->f_mode & FMODE_PWRITE) | ||
1242 | ret = compat_writev(f.file, vec, vlen, &pos); | ||
1243 | fdput(f); | ||
1244 | return ret; | ||
1245 | } | ||
1246 | |||
1247 | asmlinkage ssize_t | ||
1248 | compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec, | ||
1249 | unsigned long vlen, u32 pos_low, u32 pos_high) | ||
1250 | { | ||
1251 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | ||
1252 | return compat_sys_pwritev64(fd, vec, vlen, pos); | ||
1253 | } | ||
1254 | |||
1255 | /* | 1071 | /* |
1256 | * Exactly like fs/open.c:sys_open(), except that it doesn't set the | 1072 | * Exactly like fs/open.c:sys_open(), except that it doesn't set the |
1257 | * O_LARGEFILE flag. | 1073 | * O_LARGEFILE flag. |
diff --git a/fs/coredump.c b/fs/coredump.c index ec306cc9a28a..a9abe313e8d5 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -432,9 +432,7 @@ static bool dump_interrupted(void) | |||
432 | 432 | ||
433 | static void wait_for_dump_helpers(struct file *file) | 433 | static void wait_for_dump_helpers(struct file *file) |
434 | { | 434 | { |
435 | struct pipe_inode_info *pipe; | 435 | struct pipe_inode_info *pipe = file->private_data; |
436 | |||
437 | pipe = file_inode(file)->i_pipe; | ||
438 | 436 | ||
439 | pipe_lock(pipe); | 437 | pipe_lock(pipe); |
440 | pipe->readers++; | 438 | pipe->readers++; |
@@ -656,7 +654,9 @@ void do_coredump(siginfo_t *siginfo) | |||
656 | goto close_fail; | 654 | goto close_fail; |
657 | if (displaced) | 655 | if (displaced) |
658 | put_files_struct(displaced); | 656 | put_files_struct(displaced); |
657 | file_start_write(cprm.file); | ||
659 | core_dumped = !dump_interrupted() && binfmt->core_dump(&cprm); | 658 | core_dumped = !dump_interrupted() && binfmt->core_dump(&cprm); |
659 | file_end_write(cprm.file); | ||
660 | 660 | ||
661 | if (ispipe && core_pipe_limit) | 661 | if (ispipe && core_pipe_limit) |
662 | wait_for_dump_helpers(cprm.file); | 662 | wait_for_dump_helpers(cprm.file); |
diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index ede07fc7309f..bfb531564319 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/efi.h> | 10 | #include <linux/efi.h> |
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/slab.h> | ||
12 | 13 | ||
13 | #include "internal.h" | 14 | #include "internal.h" |
14 | 15 | ||
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c index 640e289d522e..7e787fb90293 100644 --- a/fs/efivarfs/inode.c +++ b/fs/efivarfs/inode.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/efi.h> | 10 | #include <linux/efi.h> |
11 | #include <linux/fs.h> | 11 | #include <linux/fs.h> |
12 | #include <linux/ctype.h> | 12 | #include <linux/ctype.h> |
13 | #include <linux/slab.h> | ||
13 | 14 | ||
14 | #include "internal.h" | 15 | #include "internal.h" |
15 | 16 | ||
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 525a2a1ac16c..141aee31884f 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pagemap.h> | 14 | #include <linux/pagemap.h> |
15 | #include <linux/ucs2_string.h> | 15 | #include <linux/ucs2_string.h> |
16 | #include <linux/slab.h> | ||
17 | #include <linux/magic.h> | ||
16 | 18 | ||
17 | #include "internal.h" | 19 | #include "internal.h" |
18 | 20 | ||
@@ -802,6 +802,15 @@ int kernel_read(struct file *file, loff_t offset, | |||
802 | 802 | ||
803 | EXPORT_SYMBOL(kernel_read); | 803 | EXPORT_SYMBOL(kernel_read); |
804 | 804 | ||
805 | ssize_t read_code(struct file *file, unsigned long addr, loff_t pos, size_t len) | ||
806 | { | ||
807 | ssize_t res = file->f_op->read(file, (void __user *)addr, len, &pos); | ||
808 | if (res > 0) | ||
809 | flush_icache_range(addr, addr + len); | ||
810 | return res; | ||
811 | } | ||
812 | EXPORT_SYMBOL(read_code); | ||
813 | |||
805 | static int exec_mmap(struct mm_struct *mm) | 814 | static int exec_mmap(struct mm_struct *mm) |
806 | { | 815 | { |
807 | struct task_struct *tsk; | 816 | struct task_struct *tsk; |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index a11ea4d6164c..b1ed9e07434b 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2260,7 +2260,7 @@ static const struct seq_operations ext4_mb_seq_groups_ops = { | |||
2260 | 2260 | ||
2261 | static int ext4_mb_seq_groups_open(struct inode *inode, struct file *file) | 2261 | static int ext4_mb_seq_groups_open(struct inode *inode, struct file *file) |
2262 | { | 2262 | { |
2263 | struct super_block *sb = PDE(inode)->data; | 2263 | struct super_block *sb = PDE_DATA(inode); |
2264 | int rc; | 2264 | int rc; |
2265 | 2265 | ||
2266 | rc = seq_open(file, &ext4_mb_seq_groups_ops); | 2266 | rc = seq_open(file, &ext4_mb_seq_groups_ops); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index dbc7c090c13a..24a146bde742 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1806,7 +1806,7 @@ static int options_seq_show(struct seq_file *seq, void *offset) | |||
1806 | 1806 | ||
1807 | static int options_open_fs(struct inode *inode, struct file *file) | 1807 | static int options_open_fs(struct inode *inode, struct file *file) |
1808 | { | 1808 | { |
1809 | return single_open(file, options_seq_show, PDE(inode)->data); | 1809 | return single_open(file, options_seq_show, PDE_DATA(inode)); |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | static const struct file_operations ext4_seq_options_fops = { | 1812 | static const struct file_operations ext4_seq_options_fops = { |
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 137af4255da6..44abc2f286e0 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c | |||
@@ -299,7 +299,7 @@ int f2fs_acl_chmod(struct inode *inode) | |||
299 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 299 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
300 | struct posix_acl *acl; | 300 | struct posix_acl *acl; |
301 | int error; | 301 | int error; |
302 | mode_t mode = get_inode_mode(inode); | 302 | umode_t mode = get_inode_mode(inode); |
303 | 303 | ||
304 | if (!test_opt(sbi, POSIX_ACL)) | 304 | if (!test_opt(sbi, POSIX_ACL)) |
305 | return 0; | 305 | return 0; |
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index a1f38443ecee..1be948768e2f 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -60,7 +60,7 @@ static unsigned char f2fs_type_by_mode[S_IFMT >> S_SHIFT] = { | |||
60 | 60 | ||
61 | static void set_de_type(struct f2fs_dir_entry *de, struct inode *inode) | 61 | static void set_de_type(struct f2fs_dir_entry *de, struct inode *inode) |
62 | { | 62 | { |
63 | mode_t mode = inode->i_mode; | 63 | umode_t mode = inode->i_mode; |
64 | de->file_type = f2fs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; | 64 | de->file_type = f2fs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 958a46da19ae..db626282d424 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -590,7 +590,7 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
590 | { | 590 | { |
591 | unsigned int oldflags; | 591 | unsigned int oldflags; |
592 | 592 | ||
593 | ret = mnt_want_write(filp->f_path.mnt); | 593 | ret = mnt_want_write_file(filp); |
594 | if (ret) | 594 | if (ret) |
595 | return ret; | 595 | return ret; |
596 | 596 | ||
@@ -627,7 +627,7 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
627 | inode->i_ctime = CURRENT_TIME; | 627 | inode->i_ctime = CURRENT_TIME; |
628 | mark_inode_dirty(inode); | 628 | mark_inode_dirty(inode); |
629 | out: | 629 | out: |
630 | mnt_drop_write(filp->f_path.mnt); | 630 | mnt_drop_write_file(filp); |
631 | return ret; | 631 | return ret; |
632 | } | 632 | } |
633 | default: | 633 | default: |
diff --git a/fs/fifo.c b/fs/fifo.c deleted file mode 100644 index cf6f4345ceb0..000000000000 --- a/fs/fifo.c +++ /dev/null | |||
@@ -1,153 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/fifo.c | ||
3 | * | ||
4 | * written by Paul H. Hargrove | ||
5 | * | ||
6 | * Fixes: | ||
7 | * 10-06-1999, AV: fixed OOM handling in fifo_open(), moved | ||
8 | * initialization there, switched to external | ||
9 | * allocation of pipe_inode_info. | ||
10 | */ | ||
11 | |||
12 | #include <linux/mm.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/pipe_fs_i.h> | ||
16 | |||
17 | static int wait_for_partner(struct inode* inode, unsigned int *cnt) | ||
18 | { | ||
19 | int cur = *cnt; | ||
20 | |||
21 | while (cur == *cnt) { | ||
22 | pipe_wait(inode->i_pipe); | ||
23 | if (signal_pending(current)) | ||
24 | break; | ||
25 | } | ||
26 | return cur == *cnt ? -ERESTARTSYS : 0; | ||
27 | } | ||
28 | |||
29 | static void wake_up_partner(struct inode* inode) | ||
30 | { | ||
31 | wake_up_interruptible(&inode->i_pipe->wait); | ||
32 | } | ||
33 | |||
34 | static int fifo_open(struct inode *inode, struct file *filp) | ||
35 | { | ||
36 | struct pipe_inode_info *pipe; | ||
37 | int ret; | ||
38 | |||
39 | mutex_lock(&inode->i_mutex); | ||
40 | pipe = inode->i_pipe; | ||
41 | if (!pipe) { | ||
42 | ret = -ENOMEM; | ||
43 | pipe = alloc_pipe_info(inode); | ||
44 | if (!pipe) | ||
45 | goto err_nocleanup; | ||
46 | inode->i_pipe = pipe; | ||
47 | } | ||
48 | filp->f_version = 0; | ||
49 | |||
50 | /* We can only do regular read/write on fifos */ | ||
51 | filp->f_mode &= (FMODE_READ | FMODE_WRITE); | ||
52 | |||
53 | switch (filp->f_mode) { | ||
54 | case FMODE_READ: | ||
55 | /* | ||
56 | * O_RDONLY | ||
57 | * POSIX.1 says that O_NONBLOCK means return with the FIFO | ||
58 | * opened, even when there is no process writing the FIFO. | ||
59 | */ | ||
60 | filp->f_op = &read_pipefifo_fops; | ||
61 | pipe->r_counter++; | ||
62 | if (pipe->readers++ == 0) | ||
63 | wake_up_partner(inode); | ||
64 | |||
65 | if (!pipe->writers) { | ||
66 | if ((filp->f_flags & O_NONBLOCK)) { | ||
67 | /* suppress POLLHUP until we have | ||
68 | * seen a writer */ | ||
69 | filp->f_version = pipe->w_counter; | ||
70 | } else { | ||
71 | if (wait_for_partner(inode, &pipe->w_counter)) | ||
72 | goto err_rd; | ||
73 | } | ||
74 | } | ||
75 | break; | ||
76 | |||
77 | case FMODE_WRITE: | ||
78 | /* | ||
79 | * O_WRONLY | ||
80 | * POSIX.1 says that O_NONBLOCK means return -1 with | ||
81 | * errno=ENXIO when there is no process reading the FIFO. | ||
82 | */ | ||
83 | ret = -ENXIO; | ||
84 | if ((filp->f_flags & O_NONBLOCK) && !pipe->readers) | ||
85 | goto err; | ||
86 | |||
87 | filp->f_op = &write_pipefifo_fops; | ||
88 | pipe->w_counter++; | ||
89 | if (!pipe->writers++) | ||
90 | wake_up_partner(inode); | ||
91 | |||
92 | if (!pipe->readers) { | ||
93 | if (wait_for_partner(inode, &pipe->r_counter)) | ||
94 | goto err_wr; | ||
95 | } | ||
96 | break; | ||
97 | |||
98 | case FMODE_READ | FMODE_WRITE: | ||
99 | /* | ||
100 | * O_RDWR | ||
101 | * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. | ||
102 | * This implementation will NEVER block on a O_RDWR open, since | ||
103 | * the process can at least talk to itself. | ||
104 | */ | ||
105 | filp->f_op = &rdwr_pipefifo_fops; | ||
106 | |||
107 | pipe->readers++; | ||
108 | pipe->writers++; | ||
109 | pipe->r_counter++; | ||
110 | pipe->w_counter++; | ||
111 | if (pipe->readers == 1 || pipe->writers == 1) | ||
112 | wake_up_partner(inode); | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | ret = -EINVAL; | ||
117 | goto err; | ||
118 | } | ||
119 | |||
120 | /* Ok! */ | ||
121 | mutex_unlock(&inode->i_mutex); | ||
122 | return 0; | ||
123 | |||
124 | err_rd: | ||
125 | if (!--pipe->readers) | ||
126 | wake_up_interruptible(&pipe->wait); | ||
127 | ret = -ERESTARTSYS; | ||
128 | goto err; | ||
129 | |||
130 | err_wr: | ||
131 | if (!--pipe->writers) | ||
132 | wake_up_interruptible(&pipe->wait); | ||
133 | ret = -ERESTARTSYS; | ||
134 | goto err; | ||
135 | |||
136 | err: | ||
137 | if (!pipe->readers && !pipe->writers) | ||
138 | free_pipe_info(inode); | ||
139 | |||
140 | err_nocleanup: | ||
141 | mutex_unlock(&inode->i_mutex); | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | /* | ||
146 | * Dummy default file-operations: the only thing this does | ||
147 | * is contain the open that then fills in the correct operations | ||
148 | * depending on the access mode of the file... | ||
149 | */ | ||
150 | const struct file_operations def_fifo_fops = { | ||
151 | .open = fifo_open, /* will set read_ or write_pipefifo_fops */ | ||
152 | .llseek = noop_llseek, | ||
153 | }; | ||
@@ -23,24 +23,10 @@ | |||
23 | #include <linux/rcupdate.h> | 23 | #include <linux/rcupdate.h> |
24 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
25 | 25 | ||
26 | struct fdtable_defer { | ||
27 | spinlock_t lock; | ||
28 | struct work_struct wq; | ||
29 | struct fdtable *next; | ||
30 | }; | ||
31 | |||
32 | int sysctl_nr_open __read_mostly = 1024*1024; | 26 | int sysctl_nr_open __read_mostly = 1024*1024; |
33 | int sysctl_nr_open_min = BITS_PER_LONG; | 27 | int sysctl_nr_open_min = BITS_PER_LONG; |
34 | int sysctl_nr_open_max = 1024 * 1024; /* raised later */ | 28 | int sysctl_nr_open_max = 1024 * 1024; /* raised later */ |
35 | 29 | ||
36 | /* | ||
37 | * We use this list to defer free fdtables that have vmalloced | ||
38 | * sets/arrays. By keeping a per-cpu list, we avoid having to embed | ||
39 | * the work_struct in fdtable itself which avoids a 64 byte (i386) increase in | ||
40 | * this per-task structure. | ||
41 | */ | ||
42 | static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list); | ||
43 | |||
44 | static void *alloc_fdmem(size_t size) | 30 | static void *alloc_fdmem(size_t size) |
45 | { | 31 | { |
46 | /* | 32 | /* |
@@ -67,46 +53,9 @@ static void __free_fdtable(struct fdtable *fdt) | |||
67 | kfree(fdt); | 53 | kfree(fdt); |
68 | } | 54 | } |
69 | 55 | ||
70 | static void free_fdtable_work(struct work_struct *work) | ||
71 | { | ||
72 | struct fdtable_defer *f = | ||
73 | container_of(work, struct fdtable_defer, wq); | ||
74 | struct fdtable *fdt; | ||
75 | |||
76 | spin_lock_bh(&f->lock); | ||
77 | fdt = f->next; | ||
78 | f->next = NULL; | ||
79 | spin_unlock_bh(&f->lock); | ||
80 | while(fdt) { | ||
81 | struct fdtable *next = fdt->next; | ||
82 | |||
83 | __free_fdtable(fdt); | ||
84 | fdt = next; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | static void free_fdtable_rcu(struct rcu_head *rcu) | 56 | static void free_fdtable_rcu(struct rcu_head *rcu) |
89 | { | 57 | { |
90 | struct fdtable *fdt = container_of(rcu, struct fdtable, rcu); | 58 | __free_fdtable(container_of(rcu, struct fdtable, rcu)); |
91 | struct fdtable_defer *fddef; | ||
92 | |||
93 | BUG_ON(!fdt); | ||
94 | BUG_ON(fdt->max_fds <= NR_OPEN_DEFAULT); | ||
95 | |||
96 | if (!is_vmalloc_addr(fdt->fd) && !is_vmalloc_addr(fdt->open_fds)) { | ||
97 | kfree(fdt->fd); | ||
98 | kfree(fdt->open_fds); | ||
99 | kfree(fdt); | ||
100 | } else { | ||
101 | fddef = &get_cpu_var(fdtable_defer_list); | ||
102 | spin_lock(&fddef->lock); | ||
103 | fdt->next = fddef->next; | ||
104 | fddef->next = fdt; | ||
105 | /* vmallocs are handled from the workqueue context */ | ||
106 | schedule_work(&fddef->wq); | ||
107 | spin_unlock(&fddef->lock); | ||
108 | put_cpu_var(fdtable_defer_list); | ||
109 | } | ||
110 | } | 59 | } |
111 | 60 | ||
112 | /* | 61 | /* |
@@ -174,7 +123,6 @@ static struct fdtable * alloc_fdtable(unsigned int nr) | |||
174 | fdt->open_fds = data; | 123 | fdt->open_fds = data; |
175 | data += nr / BITS_PER_BYTE; | 124 | data += nr / BITS_PER_BYTE; |
176 | fdt->close_on_exec = data; | 125 | fdt->close_on_exec = data; |
177 | fdt->next = NULL; | ||
178 | 126 | ||
179 | return fdt; | 127 | return fdt; |
180 | 128 | ||
@@ -221,7 +169,7 @@ static int expand_fdtable(struct files_struct *files, int nr) | |||
221 | /* Continue as planned */ | 169 | /* Continue as planned */ |
222 | copy_fdtable(new_fdt, cur_fdt); | 170 | copy_fdtable(new_fdt, cur_fdt); |
223 | rcu_assign_pointer(files->fdt, new_fdt); | 171 | rcu_assign_pointer(files->fdt, new_fdt); |
224 | if (cur_fdt->max_fds > NR_OPEN_DEFAULT) | 172 | if (cur_fdt != &files->fdtab) |
225 | call_rcu(&cur_fdt->rcu, free_fdtable_rcu); | 173 | call_rcu(&cur_fdt->rcu, free_fdtable_rcu); |
226 | } else { | 174 | } else { |
227 | /* Somebody else expanded, so undo our attempt */ | 175 | /* Somebody else expanded, so undo our attempt */ |
@@ -316,7 +264,6 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) | |||
316 | new_fdt->close_on_exec = newf->close_on_exec_init; | 264 | new_fdt->close_on_exec = newf->close_on_exec_init; |
317 | new_fdt->open_fds = newf->open_fds_init; | 265 | new_fdt->open_fds = newf->open_fds_init; |
318 | new_fdt->fd = &newf->fd_array[0]; | 266 | new_fdt->fd = &newf->fd_array[0]; |
319 | new_fdt->next = NULL; | ||
320 | 267 | ||
321 | spin_lock(&oldf->file_lock); | 268 | spin_lock(&oldf->file_lock); |
322 | old_fdt = files_fdtable(oldf); | 269 | old_fdt = files_fdtable(oldf); |
@@ -490,19 +437,8 @@ void exit_files(struct task_struct *tsk) | |||
490 | } | 437 | } |
491 | } | 438 | } |
492 | 439 | ||
493 | static void fdtable_defer_list_init(int cpu) | ||
494 | { | ||
495 | struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu); | ||
496 | spin_lock_init(&fddef->lock); | ||
497 | INIT_WORK(&fddef->wq, free_fdtable_work); | ||
498 | fddef->next = NULL; | ||
499 | } | ||
500 | |||
501 | void __init files_defer_init(void) | 440 | void __init files_defer_init(void) |
502 | { | 441 | { |
503 | int i; | ||
504 | for_each_possible_cpu(i) | ||
505 | fdtable_defer_list_init(i); | ||
506 | sysctl_nr_open_max = min((size_t)INT_MAX, ~(size_t)0/sizeof(void *)) & | 442 | sysctl_nr_open_max = min((size_t)INT_MAX, ~(size_t)0/sizeof(void *)) & |
507 | -BITS_PER_LONG; | 443 | -BITS_PER_LONG; |
508 | } | 444 | } |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 11dfa0c3fb46..9bfd1a3214e6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1319,7 +1319,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos, | |||
1319 | page_nr++; | 1319 | page_nr++; |
1320 | ret += buf->len; | 1320 | ret += buf->len; |
1321 | 1321 | ||
1322 | if (pipe->inode) | 1322 | if (pipe->files) |
1323 | do_wakeup = 1; | 1323 | do_wakeup = 1; |
1324 | } | 1324 | } |
1325 | 1325 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 34b80ba95bad..d15c6f21c17f 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -971,7 +971,6 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
971 | return err; | 971 | return err; |
972 | 972 | ||
973 | count = ocount; | 973 | count = ocount; |
974 | sb_start_write(inode->i_sb); | ||
975 | mutex_lock(&inode->i_mutex); | 974 | mutex_lock(&inode->i_mutex); |
976 | 975 | ||
977 | /* We can write back this queue in page reclaim */ | 976 | /* We can write back this queue in page reclaim */ |
@@ -1030,7 +1029,6 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
1030 | out: | 1029 | out: |
1031 | current->backing_dev_info = NULL; | 1030 | current->backing_dev_info = NULL; |
1032 | mutex_unlock(&inode->i_mutex); | 1031 | mutex_unlock(&inode->i_mutex); |
1033 | sb_end_write(inode->i_sb); | ||
1034 | 1032 | ||
1035 | return written ? written : err; | 1033 | return written ? written : err; |
1036 | } | 1034 | } |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 9f9dbeceeee7..3027f4dbbab5 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -131,6 +131,24 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping, | |||
131 | return ret; | 131 | return ret; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int hpfs_write_end(struct file *file, struct address_space *mapping, | ||
135 | loff_t pos, unsigned len, unsigned copied, | ||
136 | struct page *pagep, void *fsdata) | ||
137 | { | ||
138 | struct inode *inode = mapping->host; | ||
139 | int err; | ||
140 | err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata); | ||
141 | if (err < len) | ||
142 | hpfs_write_failed(mapping, pos + len); | ||
143 | if (!(err < 0)) { | ||
144 | /* make sure we write it on close, if not earlier */ | ||
145 | hpfs_lock(inode->i_sb); | ||
146 | hpfs_i(inode)->i_dirty = 1; | ||
147 | hpfs_unlock(inode->i_sb); | ||
148 | } | ||
149 | return err; | ||
150 | } | ||
151 | |||
134 | static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block) | 152 | static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block) |
135 | { | 153 | { |
136 | return generic_block_bmap(mapping,block,hpfs_get_block); | 154 | return generic_block_bmap(mapping,block,hpfs_get_block); |
@@ -140,30 +158,16 @@ const struct address_space_operations hpfs_aops = { | |||
140 | .readpage = hpfs_readpage, | 158 | .readpage = hpfs_readpage, |
141 | .writepage = hpfs_writepage, | 159 | .writepage = hpfs_writepage, |
142 | .write_begin = hpfs_write_begin, | 160 | .write_begin = hpfs_write_begin, |
143 | .write_end = generic_write_end, | 161 | .write_end = hpfs_write_end, |
144 | .bmap = _hpfs_bmap | 162 | .bmap = _hpfs_bmap |
145 | }; | 163 | }; |
146 | 164 | ||
147 | static ssize_t hpfs_file_write(struct file *file, const char __user *buf, | ||
148 | size_t count, loff_t *ppos) | ||
149 | { | ||
150 | ssize_t retval; | ||
151 | |||
152 | retval = do_sync_write(file, buf, count, ppos); | ||
153 | if (retval > 0) { | ||
154 | hpfs_lock(file->f_path.dentry->d_sb); | ||
155 | hpfs_i(file_inode(file))->i_dirty = 1; | ||
156 | hpfs_unlock(file->f_path.dentry->d_sb); | ||
157 | } | ||
158 | return retval; | ||
159 | } | ||
160 | |||
161 | const struct file_operations hpfs_file_ops = | 165 | const struct file_operations hpfs_file_ops = |
162 | { | 166 | { |
163 | .llseek = generic_file_llseek, | 167 | .llseek = generic_file_llseek, |
164 | .read = do_sync_read, | 168 | .read = do_sync_read, |
165 | .aio_read = generic_file_aio_read, | 169 | .aio_read = generic_file_aio_read, |
166 | .write = hpfs_file_write, | 170 | .write = do_sync_write, |
167 | .aio_write = generic_file_aio_write, | 171 | .aio_write = generic_file_aio_write, |
168 | .mmap = generic_file_mmap, | 172 | .mmap = generic_file_mmap, |
169 | .release = hpfs_file_release, | 173 | .release = hpfs_file_release, |
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 126d3c2e2dee..cd3e38972c86 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
@@ -436,7 +436,6 @@ static int hppfs_open(struct inode *inode, struct file *file) | |||
436 | path.mnt = inode->i_sb->s_fs_info; | 436 | path.mnt = inode->i_sb->s_fs_info; |
437 | path.dentry = HPPFS_I(inode)->proc_dentry; | 437 | path.dentry = HPPFS_I(inode)->proc_dentry; |
438 | 438 | ||
439 | /* XXX This isn't closed anywhere */ | ||
440 | data->proc_file = dentry_open(&path, file_mode(file->f_mode), cred); | 439 | data->proc_file = dentry_open(&path, file_mode(file->f_mode), cred); |
441 | err = PTR_ERR(data->proc_file); | 440 | err = PTR_ERR(data->proc_file); |
442 | if (IS_ERR(data->proc_file)) | 441 | if (IS_ERR(data->proc_file)) |
@@ -523,12 +522,23 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where) | |||
523 | return default_llseek(file, off, where); | 522 | return default_llseek(file, off, where); |
524 | } | 523 | } |
525 | 524 | ||
525 | static int hppfs_release(struct inode *inode, struct file *file) | ||
526 | { | ||
527 | struct hppfs_private *data = file->private_data; | ||
528 | struct file *proc_file = data->proc_file; | ||
529 | if (proc_file) | ||
530 | fput(proc_file); | ||
531 | kfree(data); | ||
532 | return 0; | ||
533 | } | ||
534 | |||
526 | static const struct file_operations hppfs_file_fops = { | 535 | static const struct file_operations hppfs_file_fops = { |
527 | .owner = NULL, | 536 | .owner = NULL, |
528 | .llseek = hppfs_llseek, | 537 | .llseek = hppfs_llseek, |
529 | .read = hppfs_read, | 538 | .read = hppfs_read, |
530 | .write = hppfs_write, | 539 | .write = hppfs_write, |
531 | .open = hppfs_open, | 540 | .open = hppfs_open, |
541 | .release = hppfs_release, | ||
532 | }; | 542 | }; |
533 | 543 | ||
534 | struct hppfs_dirent { | 544 | struct hppfs_dirent { |
@@ -570,18 +580,12 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) | |||
570 | return err; | 580 | return err; |
571 | } | 581 | } |
572 | 582 | ||
573 | static int hppfs_fsync(struct file *file, loff_t start, loff_t end, | ||
574 | int datasync) | ||
575 | { | ||
576 | return filemap_write_and_wait_range(file->f_mapping, start, end); | ||
577 | } | ||
578 | |||
579 | static const struct file_operations hppfs_dir_fops = { | 583 | static const struct file_operations hppfs_dir_fops = { |
580 | .owner = NULL, | 584 | .owner = NULL, |
581 | .readdir = hppfs_readdir, | 585 | .readdir = hppfs_readdir, |
582 | .open = hppfs_dir_open, | 586 | .open = hppfs_dir_open, |
583 | .fsync = hppfs_fsync, | ||
584 | .llseek = default_llseek, | 587 | .llseek = default_llseek, |
588 | .release = hppfs_release, | ||
585 | }; | 589 | }; |
586 | 590 | ||
587 | static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) | 591 | static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) |
diff --git a/fs/inode.c b/fs/inode.c index a898b3d43ccf..00d5fc3b86e1 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1803,7 +1803,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev) | |||
1803 | inode->i_fop = &def_blk_fops; | 1803 | inode->i_fop = &def_blk_fops; |
1804 | inode->i_rdev = rdev; | 1804 | inode->i_rdev = rdev; |
1805 | } else if (S_ISFIFO(mode)) | 1805 | } else if (S_ISFIFO(mode)) |
1806 | inode->i_fop = &def_fifo_fops; | 1806 | inode->i_fop = &pipefifo_fops; |
1807 | else if (S_ISSOCK(mode)) | 1807 | else if (S_ISSOCK(mode)) |
1808 | inode->i_fop = &bad_sock_fops; | 1808 | inode->i_fop = &bad_sock_fops; |
1809 | else | 1809 | else |
diff --git a/fs/internal.h b/fs/internal.h index 4be78237d896..eaa75f75b625 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -130,3 +130,8 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *); | |||
130 | * read_write.c | 130 | * read_write.c |
131 | */ | 131 | */ |
132 | extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); | 132 | extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); |
133 | |||
134 | /* | ||
135 | * pipe.c | ||
136 | */ | ||
137 | extern const struct file_operations pipefifo_fops; | ||
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index f6c5ba027f4f..95457576e434 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -979,7 +979,7 @@ static const struct seq_operations jbd2_seq_info_ops = { | |||
979 | 979 | ||
980 | static int jbd2_seq_info_open(struct inode *inode, struct file *file) | 980 | static int jbd2_seq_info_open(struct inode *inode, struct file *file) |
981 | { | 981 | { |
982 | journal_t *journal = PDE(inode)->data; | 982 | journal_t *journal = PDE_DATA(inode); |
983 | struct jbd2_stats_proc_session *s; | 983 | struct jbd2_stats_proc_session *s; |
984 | int rc, size; | 984 | int rc, size; |
985 | 985 | ||
diff --git a/fs/mount.h b/fs/mount.h index cd5007980400..64a858143ff9 100644 --- a/fs/mount.h +++ b/fs/mount.h | |||
@@ -18,6 +18,12 @@ struct mnt_pcp { | |||
18 | int mnt_writers; | 18 | int mnt_writers; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct mountpoint { | ||
22 | struct list_head m_hash; | ||
23 | struct dentry *m_dentry; | ||
24 | int m_count; | ||
25 | }; | ||
26 | |||
21 | struct mount { | 27 | struct mount { |
22 | struct list_head mnt_hash; | 28 | struct list_head mnt_hash; |
23 | struct mount *mnt_parent; | 29 | struct mount *mnt_parent; |
@@ -40,6 +46,7 @@ struct mount { | |||
40 | struct list_head mnt_slave; /* slave list entry */ | 46 | struct list_head mnt_slave; /* slave list entry */ |
41 | struct mount *mnt_master; /* slave is on master->mnt_slave_list */ | 47 | struct mount *mnt_master; /* slave is on master->mnt_slave_list */ |
42 | struct mnt_namespace *mnt_ns; /* containing namespace */ | 48 | struct mnt_namespace *mnt_ns; /* containing namespace */ |
49 | struct mountpoint *mnt_mp; /* where is it mounted */ | ||
43 | #ifdef CONFIG_FSNOTIFY | 50 | #ifdef CONFIG_FSNOTIFY |
44 | struct hlist_head mnt_fsnotify_marks; | 51 | struct hlist_head mnt_fsnotify_marks; |
45 | __u32 mnt_fsnotify_mask; | 52 | __u32 mnt_fsnotify_mask; |
diff --git a/fs/namespace.c b/fs/namespace.c index 341d3f564082..b4f96a5230a3 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -21,7 +21,8 @@ | |||
21 | #include <linux/fs_struct.h> /* get_fs_root et.al. */ | 21 | #include <linux/fs_struct.h> /* get_fs_root et.al. */ |
22 | #include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */ | 22 | #include <linux/fsnotify.h> /* fsnotify_vfsmount_delete */ |
23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
24 | #include <linux/proc_fs.h> | 24 | #include <linux/proc_ns.h> |
25 | #include <linux/magic.h> | ||
25 | #include "pnode.h" | 26 | #include "pnode.h" |
26 | #include "internal.h" | 27 | #include "internal.h" |
27 | 28 | ||
@@ -36,6 +37,7 @@ static int mnt_id_start = 0; | |||
36 | static int mnt_group_start = 1; | 37 | static int mnt_group_start = 1; |
37 | 38 | ||
38 | static struct list_head *mount_hashtable __read_mostly; | 39 | static struct list_head *mount_hashtable __read_mostly; |
40 | static struct list_head *mountpoint_hashtable __read_mostly; | ||
39 | static struct kmem_cache *mnt_cache __read_mostly; | 41 | static struct kmem_cache *mnt_cache __read_mostly; |
40 | static struct rw_semaphore namespace_sem; | 42 | static struct rw_semaphore namespace_sem; |
41 | 43 | ||
@@ -605,6 +607,51 @@ struct vfsmount *lookup_mnt(struct path *path) | |||
605 | } | 607 | } |
606 | } | 608 | } |
607 | 609 | ||
610 | static struct mountpoint *new_mountpoint(struct dentry *dentry) | ||
611 | { | ||
612 | struct list_head *chain = mountpoint_hashtable + hash(NULL, dentry); | ||
613 | struct mountpoint *mp; | ||
614 | |||
615 | list_for_each_entry(mp, chain, m_hash) { | ||
616 | if (mp->m_dentry == dentry) { | ||
617 | /* might be worth a WARN_ON() */ | ||
618 | if (d_unlinked(dentry)) | ||
619 | return ERR_PTR(-ENOENT); | ||
620 | mp->m_count++; | ||
621 | return mp; | ||
622 | } | ||
623 | } | ||
624 | |||
625 | mp = kmalloc(sizeof(struct mountpoint), GFP_KERNEL); | ||
626 | if (!mp) | ||
627 | return ERR_PTR(-ENOMEM); | ||
628 | |||
629 | spin_lock(&dentry->d_lock); | ||
630 | if (d_unlinked(dentry)) { | ||
631 | spin_unlock(&dentry->d_lock); | ||
632 | kfree(mp); | ||
633 | return ERR_PTR(-ENOENT); | ||
634 | } | ||
635 | dentry->d_flags |= DCACHE_MOUNTED; | ||
636 | spin_unlock(&dentry->d_lock); | ||
637 | mp->m_dentry = dentry; | ||
638 | mp->m_count = 1; | ||
639 | list_add(&mp->m_hash, chain); | ||
640 | return mp; | ||
641 | } | ||
642 | |||
643 | static void put_mountpoint(struct mountpoint *mp) | ||
644 | { | ||
645 | if (!--mp->m_count) { | ||
646 | struct dentry *dentry = mp->m_dentry; | ||
647 | spin_lock(&dentry->d_lock); | ||
648 | dentry->d_flags &= ~DCACHE_MOUNTED; | ||
649 | spin_unlock(&dentry->d_lock); | ||
650 | list_del(&mp->m_hash); | ||
651 | kfree(mp); | ||
652 | } | ||
653 | } | ||
654 | |||
608 | static inline int check_mnt(struct mount *mnt) | 655 | static inline int check_mnt(struct mount *mnt) |
609 | { | 656 | { |
610 | return mnt->mnt_ns == current->nsproxy->mnt_ns; | 657 | return mnt->mnt_ns == current->nsproxy->mnt_ns; |
@@ -633,27 +680,6 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns) | |||
633 | } | 680 | } |
634 | 681 | ||
635 | /* | 682 | /* |
636 | * Clear dentry's mounted state if it has no remaining mounts. | ||
637 | * vfsmount_lock must be held for write. | ||
638 | */ | ||
639 | static void dentry_reset_mounted(struct dentry *dentry) | ||
640 | { | ||
641 | unsigned u; | ||
642 | |||
643 | for (u = 0; u < HASH_SIZE; u++) { | ||
644 | struct mount *p; | ||
645 | |||
646 | list_for_each_entry(p, &mount_hashtable[u], mnt_hash) { | ||
647 | if (p->mnt_mountpoint == dentry) | ||
648 | return; | ||
649 | } | ||
650 | } | ||
651 | spin_lock(&dentry->d_lock); | ||
652 | dentry->d_flags &= ~DCACHE_MOUNTED; | ||
653 | spin_unlock(&dentry->d_lock); | ||
654 | } | ||
655 | |||
656 | /* | ||
657 | * vfsmount lock must be held for write | 683 | * vfsmount lock must be held for write |
658 | */ | 684 | */ |
659 | static void detach_mnt(struct mount *mnt, struct path *old_path) | 685 | static void detach_mnt(struct mount *mnt, struct path *old_path) |
@@ -664,32 +690,35 @@ static void detach_mnt(struct mount *mnt, struct path *old_path) | |||
664 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; | 690 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; |
665 | list_del_init(&mnt->mnt_child); | 691 | list_del_init(&mnt->mnt_child); |
666 | list_del_init(&mnt->mnt_hash); | 692 | list_del_init(&mnt->mnt_hash); |
667 | dentry_reset_mounted(old_path->dentry); | 693 | put_mountpoint(mnt->mnt_mp); |
694 | mnt->mnt_mp = NULL; | ||
668 | } | 695 | } |
669 | 696 | ||
670 | /* | 697 | /* |
671 | * vfsmount lock must be held for write | 698 | * vfsmount lock must be held for write |
672 | */ | 699 | */ |
673 | void mnt_set_mountpoint(struct mount *mnt, struct dentry *dentry, | 700 | void mnt_set_mountpoint(struct mount *mnt, |
701 | struct mountpoint *mp, | ||
674 | struct mount *child_mnt) | 702 | struct mount *child_mnt) |
675 | { | 703 | { |
704 | mp->m_count++; | ||
676 | mnt_add_count(mnt, 1); /* essentially, that's mntget */ | 705 | mnt_add_count(mnt, 1); /* essentially, that's mntget */ |
677 | child_mnt->mnt_mountpoint = dget(dentry); | 706 | child_mnt->mnt_mountpoint = dget(mp->m_dentry); |
678 | child_mnt->mnt_parent = mnt; | 707 | child_mnt->mnt_parent = mnt; |
679 | spin_lock(&dentry->d_lock); | 708 | child_mnt->mnt_mp = mp; |
680 | dentry->d_flags |= DCACHE_MOUNTED; | ||
681 | spin_unlock(&dentry->d_lock); | ||
682 | } | 709 | } |
683 | 710 | ||
684 | /* | 711 | /* |
685 | * vfsmount lock must be held for write | 712 | * vfsmount lock must be held for write |
686 | */ | 713 | */ |
687 | static void attach_mnt(struct mount *mnt, struct path *path) | 714 | static void attach_mnt(struct mount *mnt, |
715 | struct mount *parent, | ||
716 | struct mountpoint *mp) | ||
688 | { | 717 | { |
689 | mnt_set_mountpoint(real_mount(path->mnt), path->dentry, mnt); | 718 | mnt_set_mountpoint(parent, mp, mnt); |
690 | list_add_tail(&mnt->mnt_hash, mount_hashtable + | 719 | list_add_tail(&mnt->mnt_hash, mount_hashtable + |
691 | hash(path->mnt, path->dentry)); | 720 | hash(&parent->mnt, mp->m_dentry)); |
692 | list_add_tail(&mnt->mnt_child, &real_mount(path->mnt)->mnt_mounts); | 721 | list_add_tail(&mnt->mnt_child, &parent->mnt_mounts); |
693 | } | 722 | } |
694 | 723 | ||
695 | /* | 724 | /* |
@@ -1095,11 +1124,23 @@ int may_umount(struct vfsmount *mnt) | |||
1095 | 1124 | ||
1096 | EXPORT_SYMBOL(may_umount); | 1125 | EXPORT_SYMBOL(may_umount); |
1097 | 1126 | ||
1098 | void release_mounts(struct list_head *head) | 1127 | static LIST_HEAD(unmounted); /* protected by namespace_sem */ |
1128 | |||
1129 | static void namespace_unlock(void) | ||
1099 | { | 1130 | { |
1100 | struct mount *mnt; | 1131 | struct mount *mnt; |
1101 | while (!list_empty(head)) { | 1132 | LIST_HEAD(head); |
1102 | mnt = list_first_entry(head, struct mount, mnt_hash); | 1133 | |
1134 | if (likely(list_empty(&unmounted))) { | ||
1135 | up_write(&namespace_sem); | ||
1136 | return; | ||
1137 | } | ||
1138 | |||
1139 | list_splice_init(&unmounted, &head); | ||
1140 | up_write(&namespace_sem); | ||
1141 | |||
1142 | while (!list_empty(&head)) { | ||
1143 | mnt = list_first_entry(&head, struct mount, mnt_hash); | ||
1103 | list_del_init(&mnt->mnt_hash); | 1144 | list_del_init(&mnt->mnt_hash); |
1104 | if (mnt_has_parent(mnt)) { | 1145 | if (mnt_has_parent(mnt)) { |
1105 | struct dentry *dentry; | 1146 | struct dentry *dentry; |
@@ -1119,11 +1160,16 @@ void release_mounts(struct list_head *head) | |||
1119 | } | 1160 | } |
1120 | } | 1161 | } |
1121 | 1162 | ||
1163 | static inline void namespace_lock(void) | ||
1164 | { | ||
1165 | down_write(&namespace_sem); | ||
1166 | } | ||
1167 | |||
1122 | /* | 1168 | /* |
1123 | * vfsmount lock must be held for write | 1169 | * vfsmount lock must be held for write |
1124 | * namespace_sem must be held for write | 1170 | * namespace_sem must be held for write |
1125 | */ | 1171 | */ |
1126 | void umount_tree(struct mount *mnt, int propagate, struct list_head *kill) | 1172 | void umount_tree(struct mount *mnt, int propagate) |
1127 | { | 1173 | { |
1128 | LIST_HEAD(tmp_list); | 1174 | LIST_HEAD(tmp_list); |
1129 | struct mount *p; | 1175 | struct mount *p; |
@@ -1142,20 +1188,20 @@ void umount_tree(struct mount *mnt, int propagate, struct list_head *kill) | |||
1142 | list_del_init(&p->mnt_child); | 1188 | list_del_init(&p->mnt_child); |
1143 | if (mnt_has_parent(p)) { | 1189 | if (mnt_has_parent(p)) { |
1144 | p->mnt_parent->mnt_ghosts++; | 1190 | p->mnt_parent->mnt_ghosts++; |
1145 | dentry_reset_mounted(p->mnt_mountpoint); | 1191 | put_mountpoint(p->mnt_mp); |
1192 | p->mnt_mp = NULL; | ||
1146 | } | 1193 | } |
1147 | change_mnt_propagation(p, MS_PRIVATE); | 1194 | change_mnt_propagation(p, MS_PRIVATE); |
1148 | } | 1195 | } |
1149 | list_splice(&tmp_list, kill); | 1196 | list_splice(&tmp_list, &unmounted); |
1150 | } | 1197 | } |
1151 | 1198 | ||
1152 | static void shrink_submounts(struct mount *mnt, struct list_head *umounts); | 1199 | static void shrink_submounts(struct mount *mnt); |
1153 | 1200 | ||
1154 | static int do_umount(struct mount *mnt, int flags) | 1201 | static int do_umount(struct mount *mnt, int flags) |
1155 | { | 1202 | { |
1156 | struct super_block *sb = mnt->mnt.mnt_sb; | 1203 | struct super_block *sb = mnt->mnt.mnt_sb; |
1157 | int retval; | 1204 | int retval; |
1158 | LIST_HEAD(umount_list); | ||
1159 | 1205 | ||
1160 | retval = security_sb_umount(&mnt->mnt, flags); | 1206 | retval = security_sb_umount(&mnt->mnt, flags); |
1161 | if (retval) | 1207 | if (retval) |
@@ -1222,22 +1268,21 @@ static int do_umount(struct mount *mnt, int flags) | |||
1222 | return retval; | 1268 | return retval; |
1223 | } | 1269 | } |
1224 | 1270 | ||
1225 | down_write(&namespace_sem); | 1271 | namespace_lock(); |
1226 | br_write_lock(&vfsmount_lock); | 1272 | br_write_lock(&vfsmount_lock); |
1227 | event++; | 1273 | event++; |
1228 | 1274 | ||
1229 | if (!(flags & MNT_DETACH)) | 1275 | if (!(flags & MNT_DETACH)) |
1230 | shrink_submounts(mnt, &umount_list); | 1276 | shrink_submounts(mnt); |
1231 | 1277 | ||
1232 | retval = -EBUSY; | 1278 | retval = -EBUSY; |
1233 | if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { | 1279 | if (flags & MNT_DETACH || !propagate_mount_busy(mnt, 2)) { |
1234 | if (!list_empty(&mnt->mnt_list)) | 1280 | if (!list_empty(&mnt->mnt_list)) |
1235 | umount_tree(mnt, 1, &umount_list); | 1281 | umount_tree(mnt, 1); |
1236 | retval = 0; | 1282 | retval = 0; |
1237 | } | 1283 | } |
1238 | br_write_unlock(&vfsmount_lock); | 1284 | br_write_unlock(&vfsmount_lock); |
1239 | up_write(&namespace_sem); | 1285 | namespace_unlock(); |
1240 | release_mounts(&umount_list); | ||
1241 | return retval; | 1286 | return retval; |
1242 | } | 1287 | } |
1243 | 1288 | ||
@@ -1310,13 +1355,13 @@ static bool mnt_ns_loop(struct path *path) | |||
1310 | * mount namespace loop? | 1355 | * mount namespace loop? |
1311 | */ | 1356 | */ |
1312 | struct inode *inode = path->dentry->d_inode; | 1357 | struct inode *inode = path->dentry->d_inode; |
1313 | struct proc_inode *ei; | 1358 | struct proc_ns *ei; |
1314 | struct mnt_namespace *mnt_ns; | 1359 | struct mnt_namespace *mnt_ns; |
1315 | 1360 | ||
1316 | if (!proc_ns_inode(inode)) | 1361 | if (!proc_ns_inode(inode)) |
1317 | return false; | 1362 | return false; |
1318 | 1363 | ||
1319 | ei = PROC_I(inode); | 1364 | ei = get_proc_ns(inode); |
1320 | if (ei->ns_ops != &mntns_operations) | 1365 | if (ei->ns_ops != &mntns_operations) |
1321 | return false; | 1366 | return false; |
1322 | 1367 | ||
@@ -1327,8 +1372,7 @@ static bool mnt_ns_loop(struct path *path) | |||
1327 | struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, | 1372 | struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, |
1328 | int flag) | 1373 | int flag) |
1329 | { | 1374 | { |
1330 | struct mount *res, *p, *q, *r; | 1375 | struct mount *res, *p, *q, *r, *parent; |
1331 | struct path path; | ||
1332 | 1376 | ||
1333 | if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt)) | 1377 | if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt)) |
1334 | return ERR_PTR(-EINVAL); | 1378 | return ERR_PTR(-EINVAL); |
@@ -1355,25 +1399,22 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, | |||
1355 | q = q->mnt_parent; | 1399 | q = q->mnt_parent; |
1356 | } | 1400 | } |
1357 | p = s; | 1401 | p = s; |
1358 | path.mnt = &q->mnt; | 1402 | parent = q; |
1359 | path.dentry = p->mnt_mountpoint; | ||
1360 | q = clone_mnt(p, p->mnt.mnt_root, flag); | 1403 | q = clone_mnt(p, p->mnt.mnt_root, flag); |
1361 | if (IS_ERR(q)) | 1404 | if (IS_ERR(q)) |
1362 | goto out; | 1405 | goto out; |
1363 | br_write_lock(&vfsmount_lock); | 1406 | br_write_lock(&vfsmount_lock); |
1364 | list_add_tail(&q->mnt_list, &res->mnt_list); | 1407 | list_add_tail(&q->mnt_list, &res->mnt_list); |
1365 | attach_mnt(q, &path); | 1408 | attach_mnt(q, parent, p->mnt_mp); |
1366 | br_write_unlock(&vfsmount_lock); | 1409 | br_write_unlock(&vfsmount_lock); |
1367 | } | 1410 | } |
1368 | } | 1411 | } |
1369 | return res; | 1412 | return res; |
1370 | out: | 1413 | out: |
1371 | if (res) { | 1414 | if (res) { |
1372 | LIST_HEAD(umount_list); | ||
1373 | br_write_lock(&vfsmount_lock); | 1415 | br_write_lock(&vfsmount_lock); |
1374 | umount_tree(res, 0, &umount_list); | 1416 | umount_tree(res, 0); |
1375 | br_write_unlock(&vfsmount_lock); | 1417 | br_write_unlock(&vfsmount_lock); |
1376 | release_mounts(&umount_list); | ||
1377 | } | 1418 | } |
1378 | return q; | 1419 | return q; |
1379 | } | 1420 | } |
@@ -1383,10 +1424,10 @@ out: | |||
1383 | struct vfsmount *collect_mounts(struct path *path) | 1424 | struct vfsmount *collect_mounts(struct path *path) |
1384 | { | 1425 | { |
1385 | struct mount *tree; | 1426 | struct mount *tree; |
1386 | down_write(&namespace_sem); | 1427 | namespace_lock(); |
1387 | tree = copy_tree(real_mount(path->mnt), path->dentry, | 1428 | tree = copy_tree(real_mount(path->mnt), path->dentry, |
1388 | CL_COPY_ALL | CL_PRIVATE); | 1429 | CL_COPY_ALL | CL_PRIVATE); |
1389 | up_write(&namespace_sem); | 1430 | namespace_unlock(); |
1390 | if (IS_ERR(tree)) | 1431 | if (IS_ERR(tree)) |
1391 | return NULL; | 1432 | return NULL; |
1392 | return &tree->mnt; | 1433 | return &tree->mnt; |
@@ -1394,13 +1435,11 @@ struct vfsmount *collect_mounts(struct path *path) | |||
1394 | 1435 | ||
1395 | void drop_collected_mounts(struct vfsmount *mnt) | 1436 | void drop_collected_mounts(struct vfsmount *mnt) |
1396 | { | 1437 | { |
1397 | LIST_HEAD(umount_list); | 1438 | namespace_lock(); |
1398 | down_write(&namespace_sem); | ||
1399 | br_write_lock(&vfsmount_lock); | 1439 | br_write_lock(&vfsmount_lock); |
1400 | umount_tree(real_mount(mnt), 0, &umount_list); | 1440 | umount_tree(real_mount(mnt), 0); |
1401 | br_write_unlock(&vfsmount_lock); | 1441 | br_write_unlock(&vfsmount_lock); |
1402 | up_write(&namespace_sem); | 1442 | namespace_unlock(); |
1403 | release_mounts(&umount_list); | ||
1404 | } | 1443 | } |
1405 | 1444 | ||
1406 | int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, | 1445 | int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, |
@@ -1509,11 +1548,11 @@ static int invent_group_ids(struct mount *mnt, bool recurse) | |||
1509 | * in allocations. | 1548 | * in allocations. |
1510 | */ | 1549 | */ |
1511 | static int attach_recursive_mnt(struct mount *source_mnt, | 1550 | static int attach_recursive_mnt(struct mount *source_mnt, |
1512 | struct path *path, struct path *parent_path) | 1551 | struct mount *dest_mnt, |
1552 | struct mountpoint *dest_mp, | ||
1553 | struct path *parent_path) | ||
1513 | { | 1554 | { |
1514 | LIST_HEAD(tree_list); | 1555 | LIST_HEAD(tree_list); |
1515 | struct mount *dest_mnt = real_mount(path->mnt); | ||
1516 | struct dentry *dest_dentry = path->dentry; | ||
1517 | struct mount *child, *p; | 1556 | struct mount *child, *p; |
1518 | int err; | 1557 | int err; |
1519 | 1558 | ||
@@ -1522,7 +1561,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
1522 | if (err) | 1561 | if (err) |
1523 | goto out; | 1562 | goto out; |
1524 | } | 1563 | } |
1525 | err = propagate_mnt(dest_mnt, dest_dentry, source_mnt, &tree_list); | 1564 | err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); |
1526 | if (err) | 1565 | if (err) |
1527 | goto out_cleanup_ids; | 1566 | goto out_cleanup_ids; |
1528 | 1567 | ||
@@ -1534,10 +1573,10 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
1534 | } | 1573 | } |
1535 | if (parent_path) { | 1574 | if (parent_path) { |
1536 | detach_mnt(source_mnt, parent_path); | 1575 | detach_mnt(source_mnt, parent_path); |
1537 | attach_mnt(source_mnt, path); | 1576 | attach_mnt(source_mnt, dest_mnt, dest_mp); |
1538 | touch_mnt_namespace(source_mnt->mnt_ns); | 1577 | touch_mnt_namespace(source_mnt->mnt_ns); |
1539 | } else { | 1578 | } else { |
1540 | mnt_set_mountpoint(dest_mnt, dest_dentry, source_mnt); | 1579 | mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt); |
1541 | commit_tree(source_mnt); | 1580 | commit_tree(source_mnt); |
1542 | } | 1581 | } |
1543 | 1582 | ||
@@ -1556,46 +1595,53 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
1556 | return err; | 1595 | return err; |
1557 | } | 1596 | } |
1558 | 1597 | ||
1559 | static int lock_mount(struct path *path) | 1598 | static struct mountpoint *lock_mount(struct path *path) |
1560 | { | 1599 | { |
1561 | struct vfsmount *mnt; | 1600 | struct vfsmount *mnt; |
1601 | struct dentry *dentry = path->dentry; | ||
1562 | retry: | 1602 | retry: |
1563 | mutex_lock(&path->dentry->d_inode->i_mutex); | 1603 | mutex_lock(&dentry->d_inode->i_mutex); |
1564 | if (unlikely(cant_mount(path->dentry))) { | 1604 | if (unlikely(cant_mount(dentry))) { |
1565 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 1605 | mutex_unlock(&dentry->d_inode->i_mutex); |
1566 | return -ENOENT; | 1606 | return ERR_PTR(-ENOENT); |
1567 | } | 1607 | } |
1568 | down_write(&namespace_sem); | 1608 | namespace_lock(); |
1569 | mnt = lookup_mnt(path); | 1609 | mnt = lookup_mnt(path); |
1570 | if (likely(!mnt)) | 1610 | if (likely(!mnt)) { |
1571 | return 0; | 1611 | struct mountpoint *mp = new_mountpoint(dentry); |
1572 | up_write(&namespace_sem); | 1612 | if (IS_ERR(mp)) { |
1613 | namespace_unlock(); | ||
1614 | mutex_unlock(&dentry->d_inode->i_mutex); | ||
1615 | return mp; | ||
1616 | } | ||
1617 | return mp; | ||
1618 | } | ||
1619 | namespace_unlock(); | ||
1573 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 1620 | mutex_unlock(&path->dentry->d_inode->i_mutex); |
1574 | path_put(path); | 1621 | path_put(path); |
1575 | path->mnt = mnt; | 1622 | path->mnt = mnt; |
1576 | path->dentry = dget(mnt->mnt_root); | 1623 | dentry = path->dentry = dget(mnt->mnt_root); |
1577 | goto retry; | 1624 | goto retry; |
1578 | } | 1625 | } |
1579 | 1626 | ||
1580 | static void unlock_mount(struct path *path) | 1627 | static void unlock_mount(struct mountpoint *where) |
1581 | { | 1628 | { |
1582 | up_write(&namespace_sem); | 1629 | struct dentry *dentry = where->m_dentry; |
1583 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 1630 | put_mountpoint(where); |
1631 | namespace_unlock(); | ||
1632 | mutex_unlock(&dentry->d_inode->i_mutex); | ||
1584 | } | 1633 | } |
1585 | 1634 | ||
1586 | static int graft_tree(struct mount *mnt, struct path *path) | 1635 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) |
1587 | { | 1636 | { |
1588 | if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) | 1637 | if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) |
1589 | return -EINVAL; | 1638 | return -EINVAL; |
1590 | 1639 | ||
1591 | if (S_ISDIR(path->dentry->d_inode->i_mode) != | 1640 | if (S_ISDIR(mp->m_dentry->d_inode->i_mode) != |
1592 | S_ISDIR(mnt->mnt.mnt_root->d_inode->i_mode)) | 1641 | S_ISDIR(mnt->mnt.mnt_root->d_inode->i_mode)) |
1593 | return -ENOTDIR; | 1642 | return -ENOTDIR; |
1594 | 1643 | ||
1595 | if (d_unlinked(path->dentry)) | 1644 | return attach_recursive_mnt(mnt, p, mp, NULL); |
1596 | return -ENOENT; | ||
1597 | |||
1598 | return attach_recursive_mnt(mnt, path, NULL); | ||
1599 | } | 1645 | } |
1600 | 1646 | ||
1601 | /* | 1647 | /* |
@@ -1633,7 +1679,7 @@ static int do_change_type(struct path *path, int flag) | |||
1633 | if (!type) | 1679 | if (!type) |
1634 | return -EINVAL; | 1680 | return -EINVAL; |
1635 | 1681 | ||
1636 | down_write(&namespace_sem); | 1682 | namespace_lock(); |
1637 | if (type == MS_SHARED) { | 1683 | if (type == MS_SHARED) { |
1638 | err = invent_group_ids(mnt, recurse); | 1684 | err = invent_group_ids(mnt, recurse); |
1639 | if (err) | 1685 | if (err) |
@@ -1646,7 +1692,7 @@ static int do_change_type(struct path *path, int flag) | |||
1646 | br_write_unlock(&vfsmount_lock); | 1692 | br_write_unlock(&vfsmount_lock); |
1647 | 1693 | ||
1648 | out_unlock: | 1694 | out_unlock: |
1649 | up_write(&namespace_sem); | 1695 | namespace_unlock(); |
1650 | return err; | 1696 | return err; |
1651 | } | 1697 | } |
1652 | 1698 | ||
@@ -1656,9 +1702,9 @@ static int do_change_type(struct path *path, int flag) | |||
1656 | static int do_loopback(struct path *path, const char *old_name, | 1702 | static int do_loopback(struct path *path, const char *old_name, |
1657 | int recurse) | 1703 | int recurse) |
1658 | { | 1704 | { |
1659 | LIST_HEAD(umount_list); | ||
1660 | struct path old_path; | 1705 | struct path old_path; |
1661 | struct mount *mnt = NULL, *old; | 1706 | struct mount *mnt = NULL, *old, *parent; |
1707 | struct mountpoint *mp; | ||
1662 | int err; | 1708 | int err; |
1663 | if (!old_name || !*old_name) | 1709 | if (!old_name || !*old_name) |
1664 | return -EINVAL; | 1710 | return -EINVAL; |
@@ -1670,17 +1716,19 @@ static int do_loopback(struct path *path, const char *old_name, | |||
1670 | if (mnt_ns_loop(&old_path)) | 1716 | if (mnt_ns_loop(&old_path)) |
1671 | goto out; | 1717 | goto out; |
1672 | 1718 | ||
1673 | err = lock_mount(path); | 1719 | mp = lock_mount(path); |
1674 | if (err) | 1720 | err = PTR_ERR(mp); |
1721 | if (IS_ERR(mp)) | ||
1675 | goto out; | 1722 | goto out; |
1676 | 1723 | ||
1677 | old = real_mount(old_path.mnt); | 1724 | old = real_mount(old_path.mnt); |
1725 | parent = real_mount(path->mnt); | ||
1678 | 1726 | ||
1679 | err = -EINVAL; | 1727 | err = -EINVAL; |
1680 | if (IS_MNT_UNBINDABLE(old)) | 1728 | if (IS_MNT_UNBINDABLE(old)) |
1681 | goto out2; | 1729 | goto out2; |
1682 | 1730 | ||
1683 | if (!check_mnt(real_mount(path->mnt)) || !check_mnt(old)) | 1731 | if (!check_mnt(parent) || !check_mnt(old)) |
1684 | goto out2; | 1732 | goto out2; |
1685 | 1733 | ||
1686 | if (recurse) | 1734 | if (recurse) |
@@ -1693,15 +1741,14 @@ static int do_loopback(struct path *path, const char *old_name, | |||
1693 | goto out2; | 1741 | goto out2; |
1694 | } | 1742 | } |
1695 | 1743 | ||
1696 | err = graft_tree(mnt, path); | 1744 | err = graft_tree(mnt, parent, mp); |
1697 | if (err) { | 1745 | if (err) { |
1698 | br_write_lock(&vfsmount_lock); | 1746 | br_write_lock(&vfsmount_lock); |
1699 | umount_tree(mnt, 0, &umount_list); | 1747 | umount_tree(mnt, 0); |
1700 | br_write_unlock(&vfsmount_lock); | 1748 | br_write_unlock(&vfsmount_lock); |
1701 | } | 1749 | } |
1702 | out2: | 1750 | out2: |
1703 | unlock_mount(path); | 1751 | unlock_mount(mp); |
1704 | release_mounts(&umount_list); | ||
1705 | out: | 1752 | out: |
1706 | path_put(&old_path); | 1753 | path_put(&old_path); |
1707 | return err; | 1754 | return err; |
@@ -1786,6 +1833,7 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1786 | struct path old_path, parent_path; | 1833 | struct path old_path, parent_path; |
1787 | struct mount *p; | 1834 | struct mount *p; |
1788 | struct mount *old; | 1835 | struct mount *old; |
1836 | struct mountpoint *mp; | ||
1789 | int err; | 1837 | int err; |
1790 | if (!old_name || !*old_name) | 1838 | if (!old_name || !*old_name) |
1791 | return -EINVAL; | 1839 | return -EINVAL; |
@@ -1793,8 +1841,9 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1793 | if (err) | 1841 | if (err) |
1794 | return err; | 1842 | return err; |
1795 | 1843 | ||
1796 | err = lock_mount(path); | 1844 | mp = lock_mount(path); |
1797 | if (err < 0) | 1845 | err = PTR_ERR(mp); |
1846 | if (IS_ERR(mp)) | ||
1798 | goto out; | 1847 | goto out; |
1799 | 1848 | ||
1800 | old = real_mount(old_path.mnt); | 1849 | old = real_mount(old_path.mnt); |
@@ -1804,9 +1853,6 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1804 | if (!check_mnt(p) || !check_mnt(old)) | 1853 | if (!check_mnt(p) || !check_mnt(old)) |
1805 | goto out1; | 1854 | goto out1; |
1806 | 1855 | ||
1807 | if (d_unlinked(path->dentry)) | ||
1808 | goto out1; | ||
1809 | |||
1810 | err = -EINVAL; | 1856 | err = -EINVAL; |
1811 | if (old_path.dentry != old_path.mnt->mnt_root) | 1857 | if (old_path.dentry != old_path.mnt->mnt_root) |
1812 | goto out1; | 1858 | goto out1; |
@@ -1833,7 +1879,7 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1833 | if (p == old) | 1879 | if (p == old) |
1834 | goto out1; | 1880 | goto out1; |
1835 | 1881 | ||
1836 | err = attach_recursive_mnt(old, path, &parent_path); | 1882 | err = attach_recursive_mnt(old, real_mount(path->mnt), mp, &parent_path); |
1837 | if (err) | 1883 | if (err) |
1838 | goto out1; | 1884 | goto out1; |
1839 | 1885 | ||
@@ -1841,7 +1887,7 @@ static int do_move_mount(struct path *path, const char *old_name) | |||
1841 | * automatically */ | 1887 | * automatically */ |
1842 | list_del_init(&old->mnt_expire); | 1888 | list_del_init(&old->mnt_expire); |
1843 | out1: | 1889 | out1: |
1844 | unlock_mount(path); | 1890 | unlock_mount(mp); |
1845 | out: | 1891 | out: |
1846 | if (!err) | 1892 | if (!err) |
1847 | path_put(&parent_path); | 1893 | path_put(&parent_path); |
@@ -1877,21 +1923,24 @@ static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype) | |||
1877 | */ | 1923 | */ |
1878 | static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) | 1924 | static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) |
1879 | { | 1925 | { |
1926 | struct mountpoint *mp; | ||
1927 | struct mount *parent; | ||
1880 | int err; | 1928 | int err; |
1881 | 1929 | ||
1882 | mnt_flags &= ~(MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL); | 1930 | mnt_flags &= ~(MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL); |
1883 | 1931 | ||
1884 | err = lock_mount(path); | 1932 | mp = lock_mount(path); |
1885 | if (err) | 1933 | if (IS_ERR(mp)) |
1886 | return err; | 1934 | return PTR_ERR(mp); |
1887 | 1935 | ||
1936 | parent = real_mount(path->mnt); | ||
1888 | err = -EINVAL; | 1937 | err = -EINVAL; |
1889 | if (unlikely(!check_mnt(real_mount(path->mnt)))) { | 1938 | if (unlikely(!check_mnt(parent))) { |
1890 | /* that's acceptable only for automounts done in private ns */ | 1939 | /* that's acceptable only for automounts done in private ns */ |
1891 | if (!(mnt_flags & MNT_SHRINKABLE)) | 1940 | if (!(mnt_flags & MNT_SHRINKABLE)) |
1892 | goto unlock; | 1941 | goto unlock; |
1893 | /* ... and for those we'd better have mountpoint still alive */ | 1942 | /* ... and for those we'd better have mountpoint still alive */ |
1894 | if (!real_mount(path->mnt)->mnt_ns) | 1943 | if (!parent->mnt_ns) |
1895 | goto unlock; | 1944 | goto unlock; |
1896 | } | 1945 | } |
1897 | 1946 | ||
@@ -1906,10 +1955,10 @@ static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) | |||
1906 | goto unlock; | 1955 | goto unlock; |
1907 | 1956 | ||
1908 | newmnt->mnt.mnt_flags = mnt_flags; | 1957 | newmnt->mnt.mnt_flags = mnt_flags; |
1909 | err = graft_tree(newmnt, path); | 1958 | err = graft_tree(newmnt, parent, mp); |
1910 | 1959 | ||
1911 | unlock: | 1960 | unlock: |
1912 | unlock_mount(path); | 1961 | unlock_mount(mp); |
1913 | return err; | 1962 | return err; |
1914 | } | 1963 | } |
1915 | 1964 | ||
@@ -1982,11 +2031,11 @@ int finish_automount(struct vfsmount *m, struct path *path) | |||
1982 | fail: | 2031 | fail: |
1983 | /* remove m from any expiration list it may be on */ | 2032 | /* remove m from any expiration list it may be on */ |
1984 | if (!list_empty(&mnt->mnt_expire)) { | 2033 | if (!list_empty(&mnt->mnt_expire)) { |
1985 | down_write(&namespace_sem); | 2034 | namespace_lock(); |
1986 | br_write_lock(&vfsmount_lock); | 2035 | br_write_lock(&vfsmount_lock); |
1987 | list_del_init(&mnt->mnt_expire); | 2036 | list_del_init(&mnt->mnt_expire); |
1988 | br_write_unlock(&vfsmount_lock); | 2037 | br_write_unlock(&vfsmount_lock); |
1989 | up_write(&namespace_sem); | 2038 | namespace_unlock(); |
1990 | } | 2039 | } |
1991 | mntput(m); | 2040 | mntput(m); |
1992 | mntput(m); | 2041 | mntput(m); |
@@ -2000,13 +2049,13 @@ fail: | |||
2000 | */ | 2049 | */ |
2001 | void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list) | 2050 | void mnt_set_expiry(struct vfsmount *mnt, struct list_head *expiry_list) |
2002 | { | 2051 | { |
2003 | down_write(&namespace_sem); | 2052 | namespace_lock(); |
2004 | br_write_lock(&vfsmount_lock); | 2053 | br_write_lock(&vfsmount_lock); |
2005 | 2054 | ||
2006 | list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list); | 2055 | list_add_tail(&real_mount(mnt)->mnt_expire, expiry_list); |
2007 | 2056 | ||
2008 | br_write_unlock(&vfsmount_lock); | 2057 | br_write_unlock(&vfsmount_lock); |
2009 | up_write(&namespace_sem); | 2058 | namespace_unlock(); |
2010 | } | 2059 | } |
2011 | EXPORT_SYMBOL(mnt_set_expiry); | 2060 | EXPORT_SYMBOL(mnt_set_expiry); |
2012 | 2061 | ||
@@ -2019,12 +2068,11 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
2019 | { | 2068 | { |
2020 | struct mount *mnt, *next; | 2069 | struct mount *mnt, *next; |
2021 | LIST_HEAD(graveyard); | 2070 | LIST_HEAD(graveyard); |
2022 | LIST_HEAD(umounts); | ||
2023 | 2071 | ||
2024 | if (list_empty(mounts)) | 2072 | if (list_empty(mounts)) |
2025 | return; | 2073 | return; |
2026 | 2074 | ||
2027 | down_write(&namespace_sem); | 2075 | namespace_lock(); |
2028 | br_write_lock(&vfsmount_lock); | 2076 | br_write_lock(&vfsmount_lock); |
2029 | 2077 | ||
2030 | /* extract from the expiration list every vfsmount that matches the | 2078 | /* extract from the expiration list every vfsmount that matches the |
@@ -2042,12 +2090,10 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
2042 | while (!list_empty(&graveyard)) { | 2090 | while (!list_empty(&graveyard)) { |
2043 | mnt = list_first_entry(&graveyard, struct mount, mnt_expire); | 2091 | mnt = list_first_entry(&graveyard, struct mount, mnt_expire); |
2044 | touch_mnt_namespace(mnt->mnt_ns); | 2092 | touch_mnt_namespace(mnt->mnt_ns); |
2045 | umount_tree(mnt, 1, &umounts); | 2093 | umount_tree(mnt, 1); |
2046 | } | 2094 | } |
2047 | br_write_unlock(&vfsmount_lock); | 2095 | br_write_unlock(&vfsmount_lock); |
2048 | up_write(&namespace_sem); | 2096 | namespace_unlock(); |
2049 | |||
2050 | release_mounts(&umounts); | ||
2051 | } | 2097 | } |
2052 | 2098 | ||
2053 | EXPORT_SYMBOL_GPL(mark_mounts_for_expiry); | 2099 | EXPORT_SYMBOL_GPL(mark_mounts_for_expiry); |
@@ -2104,7 +2150,7 @@ resume: | |||
2104 | * | 2150 | * |
2105 | * vfsmount_lock must be held for write | 2151 | * vfsmount_lock must be held for write |
2106 | */ | 2152 | */ |
2107 | static void shrink_submounts(struct mount *mnt, struct list_head *umounts) | 2153 | static void shrink_submounts(struct mount *mnt) |
2108 | { | 2154 | { |
2109 | LIST_HEAD(graveyard); | 2155 | LIST_HEAD(graveyard); |
2110 | struct mount *m; | 2156 | struct mount *m; |
@@ -2115,7 +2161,7 @@ static void shrink_submounts(struct mount *mnt, struct list_head *umounts) | |||
2115 | m = list_first_entry(&graveyard, struct mount, | 2161 | m = list_first_entry(&graveyard, struct mount, |
2116 | mnt_expire); | 2162 | mnt_expire); |
2117 | touch_mnt_namespace(m->mnt_ns); | 2163 | touch_mnt_namespace(m->mnt_ns); |
2118 | umount_tree(m, 1, umounts); | 2164 | umount_tree(m, 1); |
2119 | } | 2165 | } |
2120 | } | 2166 | } |
2121 | } | 2167 | } |
@@ -2342,14 +2388,14 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, | |||
2342 | if (IS_ERR(new_ns)) | 2388 | if (IS_ERR(new_ns)) |
2343 | return new_ns; | 2389 | return new_ns; |
2344 | 2390 | ||
2345 | down_write(&namespace_sem); | 2391 | namespace_lock(); |
2346 | /* First pass: copy the tree topology */ | 2392 | /* First pass: copy the tree topology */ |
2347 | copy_flags = CL_COPY_ALL | CL_EXPIRE; | 2393 | copy_flags = CL_COPY_ALL | CL_EXPIRE; |
2348 | if (user_ns != mnt_ns->user_ns) | 2394 | if (user_ns != mnt_ns->user_ns) |
2349 | copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED; | 2395 | copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED; |
2350 | new = copy_tree(old, old->mnt.mnt_root, copy_flags); | 2396 | new = copy_tree(old, old->mnt.mnt_root, copy_flags); |
2351 | if (IS_ERR(new)) { | 2397 | if (IS_ERR(new)) { |
2352 | up_write(&namespace_sem); | 2398 | namespace_unlock(); |
2353 | free_mnt_ns(new_ns); | 2399 | free_mnt_ns(new_ns); |
2354 | return ERR_CAST(new); | 2400 | return ERR_CAST(new); |
2355 | } | 2401 | } |
@@ -2380,7 +2426,7 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, | |||
2380 | p = next_mnt(p, old); | 2426 | p = next_mnt(p, old); |
2381 | q = next_mnt(q, new); | 2427 | q = next_mnt(q, new); |
2382 | } | 2428 | } |
2383 | up_write(&namespace_sem); | 2429 | namespace_unlock(); |
2384 | 2430 | ||
2385 | if (rootmnt) | 2431 | if (rootmnt) |
2386 | mntput(rootmnt); | 2432 | mntput(rootmnt); |
@@ -2550,7 +2596,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, | |||
2550 | const char __user *, put_old) | 2596 | const char __user *, put_old) |
2551 | { | 2597 | { |
2552 | struct path new, old, parent_path, root_parent, root; | 2598 | struct path new, old, parent_path, root_parent, root; |
2553 | struct mount *new_mnt, *root_mnt; | 2599 | struct mount *new_mnt, *root_mnt, *old_mnt; |
2600 | struct mountpoint *old_mp, *root_mp; | ||
2554 | int error; | 2601 | int error; |
2555 | 2602 | ||
2556 | if (!may_mount()) | 2603 | if (!may_mount()) |
@@ -2569,14 +2616,16 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, | |||
2569 | goto out2; | 2616 | goto out2; |
2570 | 2617 | ||
2571 | get_fs_root(current->fs, &root); | 2618 | get_fs_root(current->fs, &root); |
2572 | error = lock_mount(&old); | 2619 | old_mp = lock_mount(&old); |
2573 | if (error) | 2620 | error = PTR_ERR(old_mp); |
2621 | if (IS_ERR(old_mp)) | ||
2574 | goto out3; | 2622 | goto out3; |
2575 | 2623 | ||
2576 | error = -EINVAL; | 2624 | error = -EINVAL; |
2577 | new_mnt = real_mount(new.mnt); | 2625 | new_mnt = real_mount(new.mnt); |
2578 | root_mnt = real_mount(root.mnt); | 2626 | root_mnt = real_mount(root.mnt); |
2579 | if (IS_MNT_SHARED(real_mount(old.mnt)) || | 2627 | old_mnt = real_mount(old.mnt); |
2628 | if (IS_MNT_SHARED(old_mnt) || | ||
2580 | IS_MNT_SHARED(new_mnt->mnt_parent) || | 2629 | IS_MNT_SHARED(new_mnt->mnt_parent) || |
2581 | IS_MNT_SHARED(root_mnt->mnt_parent)) | 2630 | IS_MNT_SHARED(root_mnt->mnt_parent)) |
2582 | goto out4; | 2631 | goto out4; |
@@ -2585,37 +2634,37 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root, | |||
2585 | error = -ENOENT; | 2634 | error = -ENOENT; |
2586 | if (d_unlinked(new.dentry)) | 2635 | if (d_unlinked(new.dentry)) |
2587 | goto out4; | 2636 | goto out4; |
2588 | if (d_unlinked(old.dentry)) | ||
2589 | goto out4; | ||
2590 | error = -EBUSY; | 2637 | error = -EBUSY; |
2591 | if (new.mnt == root.mnt || | 2638 | if (new_mnt == root_mnt || old_mnt == root_mnt) |
2592 | old.mnt == root.mnt) | ||
2593 | goto out4; /* loop, on the same file system */ | 2639 | goto out4; /* loop, on the same file system */ |
2594 | error = -EINVAL; | 2640 | error = -EINVAL; |
2595 | if (root.mnt->mnt_root != root.dentry) | 2641 | if (root.mnt->mnt_root != root.dentry) |
2596 | goto out4; /* not a mountpoint */ | 2642 | goto out4; /* not a mountpoint */ |
2597 | if (!mnt_has_parent(root_mnt)) | 2643 | if (!mnt_has_parent(root_mnt)) |
2598 | goto out4; /* not attached */ | 2644 | goto out4; /* not attached */ |
2645 | root_mp = root_mnt->mnt_mp; | ||
2599 | if (new.mnt->mnt_root != new.dentry) | 2646 | if (new.mnt->mnt_root != new.dentry) |
2600 | goto out4; /* not a mountpoint */ | 2647 | goto out4; /* not a mountpoint */ |
2601 | if (!mnt_has_parent(new_mnt)) | 2648 | if (!mnt_has_parent(new_mnt)) |
2602 | goto out4; /* not attached */ | 2649 | goto out4; /* not attached */ |
2603 | /* make sure we can reach put_old from new_root */ | 2650 | /* make sure we can reach put_old from new_root */ |
2604 | if (!is_path_reachable(real_mount(old.mnt), old.dentry, &new)) | 2651 | if (!is_path_reachable(old_mnt, old.dentry, &new)) |
2605 | goto out4; | 2652 | goto out4; |
2653 | root_mp->m_count++; /* pin it so it won't go away */ | ||
2606 | br_write_lock(&vfsmount_lock); | 2654 | br_write_lock(&vfsmount_lock); |
2607 | detach_mnt(new_mnt, &parent_path); | 2655 | detach_mnt(new_mnt, &parent_path); |
2608 | detach_mnt(root_mnt, &root_parent); | 2656 | detach_mnt(root_mnt, &root_parent); |
2609 | /* mount old root on put_old */ | 2657 | /* mount old root on put_old */ |
2610 | attach_mnt(root_mnt, &old); | 2658 | attach_mnt(root_mnt, old_mnt, old_mp); |
2611 | /* mount new_root on / */ | 2659 | /* mount new_root on / */ |
2612 | attach_mnt(new_mnt, &root_parent); | 2660 | attach_mnt(new_mnt, real_mount(root_parent.mnt), root_mp); |
2613 | touch_mnt_namespace(current->nsproxy->mnt_ns); | 2661 | touch_mnt_namespace(current->nsproxy->mnt_ns); |
2614 | br_write_unlock(&vfsmount_lock); | 2662 | br_write_unlock(&vfsmount_lock); |
2615 | chroot_fs_refs(&root, &new); | 2663 | chroot_fs_refs(&root, &new); |
2664 | put_mountpoint(root_mp); | ||
2616 | error = 0; | 2665 | error = 0; |
2617 | out4: | 2666 | out4: |
2618 | unlock_mount(&old); | 2667 | unlock_mount(old_mp); |
2619 | if (!error) { | 2668 | if (!error) { |
2620 | path_put(&root_parent); | 2669 | path_put(&root_parent); |
2621 | path_put(&parent_path); | 2670 | path_put(&parent_path); |
@@ -2670,14 +2719,17 @@ void __init mnt_init(void) | |||
2670 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); | 2719 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); |
2671 | 2720 | ||
2672 | mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC); | 2721 | mount_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC); |
2722 | mountpoint_hashtable = (struct list_head *)__get_free_page(GFP_ATOMIC); | ||
2673 | 2723 | ||
2674 | if (!mount_hashtable) | 2724 | if (!mount_hashtable || !mountpoint_hashtable) |
2675 | panic("Failed to allocate mount hash table\n"); | 2725 | panic("Failed to allocate mount hash table\n"); |
2676 | 2726 | ||
2677 | printk(KERN_INFO "Mount-cache hash table entries: %lu\n", HASH_SIZE); | 2727 | printk(KERN_INFO "Mount-cache hash table entries: %lu\n", HASH_SIZE); |
2678 | 2728 | ||
2679 | for (u = 0; u < HASH_SIZE; u++) | 2729 | for (u = 0; u < HASH_SIZE; u++) |
2680 | INIT_LIST_HEAD(&mount_hashtable[u]); | 2730 | INIT_LIST_HEAD(&mount_hashtable[u]); |
2731 | for (u = 0; u < HASH_SIZE; u++) | ||
2732 | INIT_LIST_HEAD(&mountpoint_hashtable[u]); | ||
2681 | 2733 | ||
2682 | br_lock_init(&vfsmount_lock); | 2734 | br_lock_init(&vfsmount_lock); |
2683 | 2735 | ||
@@ -2694,16 +2746,13 @@ void __init mnt_init(void) | |||
2694 | 2746 | ||
2695 | void put_mnt_ns(struct mnt_namespace *ns) | 2747 | void put_mnt_ns(struct mnt_namespace *ns) |
2696 | { | 2748 | { |
2697 | LIST_HEAD(umount_list); | ||
2698 | |||
2699 | if (!atomic_dec_and_test(&ns->count)) | 2749 | if (!atomic_dec_and_test(&ns->count)) |
2700 | return; | 2750 | return; |
2701 | down_write(&namespace_sem); | 2751 | namespace_lock(); |
2702 | br_write_lock(&vfsmount_lock); | 2752 | br_write_lock(&vfsmount_lock); |
2703 | umount_tree(ns->root, 0, &umount_list); | 2753 | umount_tree(ns->root, 0); |
2704 | br_write_unlock(&vfsmount_lock); | 2754 | br_write_unlock(&vfsmount_lock); |
2705 | up_write(&namespace_sem); | 2755 | namespace_unlock(); |
2706 | release_mounts(&umount_list); | ||
2707 | free_mnt_ns(ns); | 2756 | free_mnt_ns(ns); |
2708 | } | 2757 | } |
2709 | 2758 | ||
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index f33455b4d957..5bee0313dffd 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -177,7 +177,7 @@ static int export_features_open(struct inode *inode, struct file *file) | |||
177 | return single_open(file, export_features_show, NULL); | 177 | return single_open(file, export_features_show, NULL); |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct file_operations export_features_operations = { | 180 | static const struct file_operations export_features_operations = { |
181 | .open = export_features_open, | 181 | .open = export_features_open, |
182 | .read = seq_read, | 182 | .read = seq_read, |
183 | .llseek = seq_lseek, | 183 | .llseek = seq_lseek, |
@@ -196,7 +196,7 @@ static int supported_enctypes_open(struct inode *inode, struct file *file) | |||
196 | return single_open(file, supported_enctypes_show, NULL); | 196 | return single_open(file, supported_enctypes_show, NULL); |
197 | } | 197 | } |
198 | 198 | ||
199 | static struct file_operations supported_enctypes_ops = { | 199 | static const struct file_operations supported_enctypes_ops = { |
200 | .open = supported_enctypes_open, | 200 | .open = supported_enctypes_open, |
201 | .read = seq_read, | 201 | .read = seq_read, |
202 | .llseek = seq_lseek, | 202 | .llseek = seq_lseek, |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index c616a70e8cf9..959815c1e017 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -287,9 +287,6 @@ static int inotify_release(struct inode *ignored, struct file *file) | |||
287 | 287 | ||
288 | pr_debug("%s: group=%p\n", __func__, group); | 288 | pr_debug("%s: group=%p\n", __func__, group); |
289 | 289 | ||
290 | if (file->f_flags & FASYNC) | ||
291 | fsnotify_fasync(-1, file, 0); | ||
292 | |||
293 | /* free this group, matching get was inotify_init->fsnotify_obtain_group */ | 290 | /* free this group, matching get was inotify_init->fsnotify_obtain_group */ |
294 | fsnotify_destroy_group(group); | 291 | fsnotify_destroy_group(group); |
295 | 292 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 5b2d4f0853ac..1da4b81e6f76 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2129,7 +2129,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2129 | 2129 | ||
2130 | BUG_ON(iocb->ki_pos != pos); | 2130 | BUG_ON(iocb->ki_pos != pos); |
2131 | 2131 | ||
2132 | sb_start_write(inode->i_sb); | ||
2133 | mutex_lock(&inode->i_mutex); | 2132 | mutex_lock(&inode->i_mutex); |
2134 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); | 2133 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); |
2135 | mutex_unlock(&inode->i_mutex); | 2134 | mutex_unlock(&inode->i_mutex); |
@@ -2138,7 +2137,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2138 | if (err < 0) | 2137 | if (err < 0) |
2139 | ret = err; | 2138 | ret = err; |
2140 | } | 2139 | } |
2141 | sb_end_write(inode->i_sb); | ||
2142 | return ret; | 2140 | return ret; |
2143 | } | 2141 | } |
2144 | 2142 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 6474cb44004d..8a7509f9e6f5 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2248,8 +2248,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2248 | if (iocb->ki_left == 0) | 2248 | if (iocb->ki_left == 0) |
2249 | return 0; | 2249 | return 0; |
2250 | 2250 | ||
2251 | sb_start_write(inode->i_sb); | ||
2252 | |||
2253 | appending = file->f_flags & O_APPEND ? 1 : 0; | 2251 | appending = file->f_flags & O_APPEND ? 1 : 0; |
2254 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; | 2252 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; |
2255 | 2253 | ||
@@ -2423,7 +2421,6 @@ out_sems: | |||
2423 | ocfs2_iocb_clear_sem_locked(iocb); | 2421 | ocfs2_iocb_clear_sem_locked(iocb); |
2424 | 2422 | ||
2425 | mutex_unlock(&inode->i_mutex); | 2423 | mutex_unlock(&inode->i_mutex); |
2426 | sb_end_write(inode->i_sb); | ||
2427 | 2424 | ||
2428 | if (written) | 2425 | if (written) |
2429 | ret = written; | 2426 | ret = written; |
@@ -2468,8 +2465,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2468 | out->f_path.dentry->d_name.len, | 2465 | out->f_path.dentry->d_name.len, |
2469 | out->f_path.dentry->d_name.name, len); | 2466 | out->f_path.dentry->d_name.name, len); |
2470 | 2467 | ||
2471 | if (pipe->inode) | 2468 | pipe_lock(pipe); |
2472 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); | ||
2473 | 2469 | ||
2474 | splice_from_pipe_begin(&sd); | 2470 | splice_from_pipe_begin(&sd); |
2475 | do { | 2471 | do { |
@@ -2489,8 +2485,7 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2489 | } while (ret > 0); | 2485 | } while (ret > 0); |
2490 | splice_from_pipe_end(pipe, &sd); | 2486 | splice_from_pipe_end(pipe, &sd); |
2491 | 2487 | ||
2492 | if (pipe->inode) | 2488 | pipe_unlock(pipe); |
2493 | mutex_unlock(&pipe->inode->i_mutex); | ||
2494 | 2489 | ||
2495 | if (sd.num_spliced) | 2490 | if (sd.num_spliced) |
2496 | ret = sd.num_spliced; | 2491 | ret = sd.num_spliced; |
@@ -25,6 +25,8 @@ | |||
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <asm/ioctls.h> | 26 | #include <asm/ioctls.h> |
27 | 27 | ||
28 | #include "internal.h" | ||
29 | |||
28 | /* | 30 | /* |
29 | * The max size that a non-root user is allowed to grow the pipe. Can | 31 | * The max size that a non-root user is allowed to grow the pipe. Can |
30 | * be set by root in /proc/sys/fs/pipe-max-size | 32 | * be set by root in /proc/sys/fs/pipe-max-size |
@@ -53,8 +55,8 @@ unsigned int pipe_min_size = PAGE_SIZE; | |||
53 | 55 | ||
54 | static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass) | 56 | static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass) |
55 | { | 57 | { |
56 | if (pipe->inode) | 58 | if (pipe->files) |
57 | mutex_lock_nested(&pipe->inode->i_mutex, subclass); | 59 | mutex_lock_nested(&pipe->mutex, subclass); |
58 | } | 60 | } |
59 | 61 | ||
60 | void pipe_lock(struct pipe_inode_info *pipe) | 62 | void pipe_lock(struct pipe_inode_info *pipe) |
@@ -68,11 +70,21 @@ EXPORT_SYMBOL(pipe_lock); | |||
68 | 70 | ||
69 | void pipe_unlock(struct pipe_inode_info *pipe) | 71 | void pipe_unlock(struct pipe_inode_info *pipe) |
70 | { | 72 | { |
71 | if (pipe->inode) | 73 | if (pipe->files) |
72 | mutex_unlock(&pipe->inode->i_mutex); | 74 | mutex_unlock(&pipe->mutex); |
73 | } | 75 | } |
74 | EXPORT_SYMBOL(pipe_unlock); | 76 | EXPORT_SYMBOL(pipe_unlock); |
75 | 77 | ||
78 | static inline void __pipe_lock(struct pipe_inode_info *pipe) | ||
79 | { | ||
80 | mutex_lock_nested(&pipe->mutex, I_MUTEX_PARENT); | ||
81 | } | ||
82 | |||
83 | static inline void __pipe_unlock(struct pipe_inode_info *pipe) | ||
84 | { | ||
85 | mutex_unlock(&pipe->mutex); | ||
86 | } | ||
87 | |||
76 | void pipe_double_lock(struct pipe_inode_info *pipe1, | 88 | void pipe_double_lock(struct pipe_inode_info *pipe1, |
77 | struct pipe_inode_info *pipe2) | 89 | struct pipe_inode_info *pipe2) |
78 | { | 90 | { |
@@ -361,8 +373,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
361 | unsigned long nr_segs, loff_t pos) | 373 | unsigned long nr_segs, loff_t pos) |
362 | { | 374 | { |
363 | struct file *filp = iocb->ki_filp; | 375 | struct file *filp = iocb->ki_filp; |
364 | struct inode *inode = file_inode(filp); | 376 | struct pipe_inode_info *pipe = filp->private_data; |
365 | struct pipe_inode_info *pipe; | ||
366 | int do_wakeup; | 377 | int do_wakeup; |
367 | ssize_t ret; | 378 | ssize_t ret; |
368 | struct iovec *iov = (struct iovec *)_iov; | 379 | struct iovec *iov = (struct iovec *)_iov; |
@@ -375,8 +386,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
375 | 386 | ||
376 | do_wakeup = 0; | 387 | do_wakeup = 0; |
377 | ret = 0; | 388 | ret = 0; |
378 | mutex_lock(&inode->i_mutex); | 389 | __pipe_lock(pipe); |
379 | pipe = inode->i_pipe; | ||
380 | for (;;) { | 390 | for (;;) { |
381 | int bufs = pipe->nrbufs; | 391 | int bufs = pipe->nrbufs; |
382 | if (bufs) { | 392 | if (bufs) { |
@@ -464,7 +474,7 @@ redo: | |||
464 | } | 474 | } |
465 | pipe_wait(pipe); | 475 | pipe_wait(pipe); |
466 | } | 476 | } |
467 | mutex_unlock(&inode->i_mutex); | 477 | __pipe_unlock(pipe); |
468 | 478 | ||
469 | /* Signal writers asynchronously that there is more room. */ | 479 | /* Signal writers asynchronously that there is more room. */ |
470 | if (do_wakeup) { | 480 | if (do_wakeup) { |
@@ -486,8 +496,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |||
486 | unsigned long nr_segs, loff_t ppos) | 496 | unsigned long nr_segs, loff_t ppos) |
487 | { | 497 | { |
488 | struct file *filp = iocb->ki_filp; | 498 | struct file *filp = iocb->ki_filp; |
489 | struct inode *inode = file_inode(filp); | 499 | struct pipe_inode_info *pipe = filp->private_data; |
490 | struct pipe_inode_info *pipe; | ||
491 | ssize_t ret; | 500 | ssize_t ret; |
492 | int do_wakeup; | 501 | int do_wakeup; |
493 | struct iovec *iov = (struct iovec *)_iov; | 502 | struct iovec *iov = (struct iovec *)_iov; |
@@ -501,8 +510,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |||
501 | 510 | ||
502 | do_wakeup = 0; | 511 | do_wakeup = 0; |
503 | ret = 0; | 512 | ret = 0; |
504 | mutex_lock(&inode->i_mutex); | 513 | __pipe_lock(pipe); |
505 | pipe = inode->i_pipe; | ||
506 | 514 | ||
507 | if (!pipe->readers) { | 515 | if (!pipe->readers) { |
508 | send_sig(SIGPIPE, current, 0); | 516 | send_sig(SIGPIPE, current, 0); |
@@ -649,7 +657,7 @@ redo2: | |||
649 | pipe->waiting_writers--; | 657 | pipe->waiting_writers--; |
650 | } | 658 | } |
651 | out: | 659 | out: |
652 | mutex_unlock(&inode->i_mutex); | 660 | __pipe_unlock(pipe); |
653 | if (do_wakeup) { | 661 | if (do_wakeup) { |
654 | wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); | 662 | wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); |
655 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | 663 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); |
@@ -662,29 +670,14 @@ out: | |||
662 | return ret; | 670 | return ret; |
663 | } | 671 | } |
664 | 672 | ||
665 | static ssize_t | ||
666 | bad_pipe_r(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | ||
667 | { | ||
668 | return -EBADF; | ||
669 | } | ||
670 | |||
671 | static ssize_t | ||
672 | bad_pipe_w(struct file *filp, const char __user *buf, size_t count, | ||
673 | loff_t *ppos) | ||
674 | { | ||
675 | return -EBADF; | ||
676 | } | ||
677 | |||
678 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 673 | static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
679 | { | 674 | { |
680 | struct inode *inode = file_inode(filp); | 675 | struct pipe_inode_info *pipe = filp->private_data; |
681 | struct pipe_inode_info *pipe; | ||
682 | int count, buf, nrbufs; | 676 | int count, buf, nrbufs; |
683 | 677 | ||
684 | switch (cmd) { | 678 | switch (cmd) { |
685 | case FIONREAD: | 679 | case FIONREAD: |
686 | mutex_lock(&inode->i_mutex); | 680 | __pipe_lock(pipe); |
687 | pipe = inode->i_pipe; | ||
688 | count = 0; | 681 | count = 0; |
689 | buf = pipe->curbuf; | 682 | buf = pipe->curbuf; |
690 | nrbufs = pipe->nrbufs; | 683 | nrbufs = pipe->nrbufs; |
@@ -692,7 +685,7 @@ static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
692 | count += pipe->bufs[buf].len; | 685 | count += pipe->bufs[buf].len; |
693 | buf = (buf+1) & (pipe->buffers - 1); | 686 | buf = (buf+1) & (pipe->buffers - 1); |
694 | } | 687 | } |
695 | mutex_unlock(&inode->i_mutex); | 688 | __pipe_unlock(pipe); |
696 | 689 | ||
697 | return put_user(count, (int __user *)arg); | 690 | return put_user(count, (int __user *)arg); |
698 | default: | 691 | default: |
@@ -705,8 +698,7 @@ static unsigned int | |||
705 | pipe_poll(struct file *filp, poll_table *wait) | 698 | pipe_poll(struct file *filp, poll_table *wait) |
706 | { | 699 | { |
707 | unsigned int mask; | 700 | unsigned int mask; |
708 | struct inode *inode = file_inode(filp); | 701 | struct pipe_inode_info *pipe = filp->private_data; |
709 | struct pipe_inode_info *pipe = inode->i_pipe; | ||
710 | int nrbufs; | 702 | int nrbufs; |
711 | 703 | ||
712 | poll_wait(filp, &pipe->wait, wait); | 704 | poll_wait(filp, &pipe->wait, wait); |
@@ -734,197 +726,56 @@ pipe_poll(struct file *filp, poll_table *wait) | |||
734 | } | 726 | } |
735 | 727 | ||
736 | static int | 728 | static int |
737 | pipe_release(struct inode *inode, int decr, int decw) | 729 | pipe_release(struct inode *inode, struct file *file) |
738 | { | 730 | { |
739 | struct pipe_inode_info *pipe; | 731 | struct pipe_inode_info *pipe = inode->i_pipe; |
732 | int kill = 0; | ||
740 | 733 | ||
741 | mutex_lock(&inode->i_mutex); | 734 | __pipe_lock(pipe); |
742 | pipe = inode->i_pipe; | 735 | if (file->f_mode & FMODE_READ) |
743 | pipe->readers -= decr; | 736 | pipe->readers--; |
744 | pipe->writers -= decw; | 737 | if (file->f_mode & FMODE_WRITE) |
738 | pipe->writers--; | ||
745 | 739 | ||
746 | if (!pipe->readers && !pipe->writers) { | 740 | if (pipe->readers || pipe->writers) { |
747 | free_pipe_info(inode); | ||
748 | } else { | ||
749 | wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP); | 741 | wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP); |
750 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | 742 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); |
751 | kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); | 743 | kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); |
752 | } | 744 | } |
753 | mutex_unlock(&inode->i_mutex); | 745 | spin_lock(&inode->i_lock); |
754 | 746 | if (!--pipe->files) { | |
755 | return 0; | 747 | inode->i_pipe = NULL; |
756 | } | 748 | kill = 1; |
757 | 749 | } | |
758 | static int | 750 | spin_unlock(&inode->i_lock); |
759 | pipe_read_fasync(int fd, struct file *filp, int on) | 751 | __pipe_unlock(pipe); |
760 | { | ||
761 | struct inode *inode = file_inode(filp); | ||
762 | int retval; | ||
763 | |||
764 | mutex_lock(&inode->i_mutex); | ||
765 | retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_readers); | ||
766 | mutex_unlock(&inode->i_mutex); | ||
767 | |||
768 | return retval; | ||
769 | } | ||
770 | |||
771 | |||
772 | static int | ||
773 | pipe_write_fasync(int fd, struct file *filp, int on) | ||
774 | { | ||
775 | struct inode *inode = file_inode(filp); | ||
776 | int retval; | ||
777 | 752 | ||
778 | mutex_lock(&inode->i_mutex); | 753 | if (kill) |
779 | retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_writers); | 754 | free_pipe_info(pipe); |
780 | mutex_unlock(&inode->i_mutex); | ||
781 | 755 | ||
782 | return retval; | 756 | return 0; |
783 | } | 757 | } |
784 | 758 | ||
785 | |||
786 | static int | 759 | static int |
787 | pipe_rdwr_fasync(int fd, struct file *filp, int on) | 760 | pipe_fasync(int fd, struct file *filp, int on) |
788 | { | 761 | { |
789 | struct inode *inode = file_inode(filp); | 762 | struct pipe_inode_info *pipe = filp->private_data; |
790 | struct pipe_inode_info *pipe = inode->i_pipe; | 763 | int retval = 0; |
791 | int retval; | ||
792 | 764 | ||
793 | mutex_lock(&inode->i_mutex); | 765 | __pipe_lock(pipe); |
794 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); | 766 | if (filp->f_mode & FMODE_READ) |
795 | if (retval >= 0) { | 767 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); |
768 | if ((filp->f_mode & FMODE_WRITE) && retval >= 0) { | ||
796 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); | 769 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); |
797 | if (retval < 0) /* this can happen only if on == T */ | 770 | if (retval < 0 && (filp->f_mode & FMODE_READ)) |
771 | /* this can happen only if on == T */ | ||
798 | fasync_helper(-1, filp, 0, &pipe->fasync_readers); | 772 | fasync_helper(-1, filp, 0, &pipe->fasync_readers); |
799 | } | 773 | } |
800 | mutex_unlock(&inode->i_mutex); | 774 | __pipe_unlock(pipe); |
801 | return retval; | 775 | return retval; |
802 | } | 776 | } |
803 | 777 | ||
804 | 778 | struct pipe_inode_info *alloc_pipe_info(void) | |
805 | static int | ||
806 | pipe_read_release(struct inode *inode, struct file *filp) | ||
807 | { | ||
808 | return pipe_release(inode, 1, 0); | ||
809 | } | ||
810 | |||
811 | static int | ||
812 | pipe_write_release(struct inode *inode, struct file *filp) | ||
813 | { | ||
814 | return pipe_release(inode, 0, 1); | ||
815 | } | ||
816 | |||
817 | static int | ||
818 | pipe_rdwr_release(struct inode *inode, struct file *filp) | ||
819 | { | ||
820 | int decr, decw; | ||
821 | |||
822 | decr = (filp->f_mode & FMODE_READ) != 0; | ||
823 | decw = (filp->f_mode & FMODE_WRITE) != 0; | ||
824 | return pipe_release(inode, decr, decw); | ||
825 | } | ||
826 | |||
827 | static int | ||
828 | pipe_read_open(struct inode *inode, struct file *filp) | ||
829 | { | ||
830 | int ret = -ENOENT; | ||
831 | |||
832 | mutex_lock(&inode->i_mutex); | ||
833 | |||
834 | if (inode->i_pipe) { | ||
835 | ret = 0; | ||
836 | inode->i_pipe->readers++; | ||
837 | } | ||
838 | |||
839 | mutex_unlock(&inode->i_mutex); | ||
840 | |||
841 | return ret; | ||
842 | } | ||
843 | |||
844 | static int | ||
845 | pipe_write_open(struct inode *inode, struct file *filp) | ||
846 | { | ||
847 | int ret = -ENOENT; | ||
848 | |||
849 | mutex_lock(&inode->i_mutex); | ||
850 | |||
851 | if (inode->i_pipe) { | ||
852 | ret = 0; | ||
853 | inode->i_pipe->writers++; | ||
854 | } | ||
855 | |||
856 | mutex_unlock(&inode->i_mutex); | ||
857 | |||
858 | return ret; | ||
859 | } | ||
860 | |||
861 | static int | ||
862 | pipe_rdwr_open(struct inode *inode, struct file *filp) | ||
863 | { | ||
864 | int ret = -ENOENT; | ||
865 | |||
866 | if (!(filp->f_mode & (FMODE_READ|FMODE_WRITE))) | ||
867 | return -EINVAL; | ||
868 | |||
869 | mutex_lock(&inode->i_mutex); | ||
870 | |||
871 | if (inode->i_pipe) { | ||
872 | ret = 0; | ||
873 | if (filp->f_mode & FMODE_READ) | ||
874 | inode->i_pipe->readers++; | ||
875 | if (filp->f_mode & FMODE_WRITE) | ||
876 | inode->i_pipe->writers++; | ||
877 | } | ||
878 | |||
879 | mutex_unlock(&inode->i_mutex); | ||
880 | |||
881 | return ret; | ||
882 | } | ||
883 | |||
884 | /* | ||
885 | * The file_operations structs are not static because they | ||
886 | * are also used in linux/fs/fifo.c to do operations on FIFOs. | ||
887 | * | ||
888 | * Pipes reuse fifos' file_operations structs. | ||
889 | */ | ||
890 | const struct file_operations read_pipefifo_fops = { | ||
891 | .llseek = no_llseek, | ||
892 | .read = do_sync_read, | ||
893 | .aio_read = pipe_read, | ||
894 | .write = bad_pipe_w, | ||
895 | .poll = pipe_poll, | ||
896 | .unlocked_ioctl = pipe_ioctl, | ||
897 | .open = pipe_read_open, | ||
898 | .release = pipe_read_release, | ||
899 | .fasync = pipe_read_fasync, | ||
900 | }; | ||
901 | |||
902 | const struct file_operations write_pipefifo_fops = { | ||
903 | .llseek = no_llseek, | ||
904 | .read = bad_pipe_r, | ||
905 | .write = do_sync_write, | ||
906 | .aio_write = pipe_write, | ||
907 | .poll = pipe_poll, | ||
908 | .unlocked_ioctl = pipe_ioctl, | ||
909 | .open = pipe_write_open, | ||
910 | .release = pipe_write_release, | ||
911 | .fasync = pipe_write_fasync, | ||
912 | }; | ||
913 | |||
914 | const struct file_operations rdwr_pipefifo_fops = { | ||
915 | .llseek = no_llseek, | ||
916 | .read = do_sync_read, | ||
917 | .aio_read = pipe_read, | ||
918 | .write = do_sync_write, | ||
919 | .aio_write = pipe_write, | ||
920 | .poll = pipe_poll, | ||
921 | .unlocked_ioctl = pipe_ioctl, | ||
922 | .open = pipe_rdwr_open, | ||
923 | .release = pipe_rdwr_release, | ||
924 | .fasync = pipe_rdwr_fasync, | ||
925 | }; | ||
926 | |||
927 | struct pipe_inode_info * alloc_pipe_info(struct inode *inode) | ||
928 | { | 779 | { |
929 | struct pipe_inode_info *pipe; | 780 | struct pipe_inode_info *pipe; |
930 | 781 | ||
@@ -934,8 +785,8 @@ struct pipe_inode_info * alloc_pipe_info(struct inode *inode) | |||
934 | if (pipe->bufs) { | 785 | if (pipe->bufs) { |
935 | init_waitqueue_head(&pipe->wait); | 786 | init_waitqueue_head(&pipe->wait); |
936 | pipe->r_counter = pipe->w_counter = 1; | 787 | pipe->r_counter = pipe->w_counter = 1; |
937 | pipe->inode = inode; | ||
938 | pipe->buffers = PIPE_DEF_BUFFERS; | 788 | pipe->buffers = PIPE_DEF_BUFFERS; |
789 | mutex_init(&pipe->mutex); | ||
939 | return pipe; | 790 | return pipe; |
940 | } | 791 | } |
941 | kfree(pipe); | 792 | kfree(pipe); |
@@ -944,7 +795,7 @@ struct pipe_inode_info * alloc_pipe_info(struct inode *inode) | |||
944 | return NULL; | 795 | return NULL; |
945 | } | 796 | } |
946 | 797 | ||
947 | void __free_pipe_info(struct pipe_inode_info *pipe) | 798 | void free_pipe_info(struct pipe_inode_info *pipe) |
948 | { | 799 | { |
949 | int i; | 800 | int i; |
950 | 801 | ||
@@ -959,12 +810,6 @@ void __free_pipe_info(struct pipe_inode_info *pipe) | |||
959 | kfree(pipe); | 810 | kfree(pipe); |
960 | } | 811 | } |
961 | 812 | ||
962 | void free_pipe_info(struct inode *inode) | ||
963 | { | ||
964 | __free_pipe_info(inode->i_pipe); | ||
965 | inode->i_pipe = NULL; | ||
966 | } | ||
967 | |||
968 | static struct vfsmount *pipe_mnt __read_mostly; | 813 | static struct vfsmount *pipe_mnt __read_mostly; |
969 | 814 | ||
970 | /* | 815 | /* |
@@ -990,13 +835,14 @@ static struct inode * get_pipe_inode(void) | |||
990 | 835 | ||
991 | inode->i_ino = get_next_ino(); | 836 | inode->i_ino = get_next_ino(); |
992 | 837 | ||
993 | pipe = alloc_pipe_info(inode); | 838 | pipe = alloc_pipe_info(); |
994 | if (!pipe) | 839 | if (!pipe) |
995 | goto fail_iput; | 840 | goto fail_iput; |
996 | inode->i_pipe = pipe; | ||
997 | 841 | ||
842 | inode->i_pipe = pipe; | ||
843 | pipe->files = 2; | ||
998 | pipe->readers = pipe->writers = 1; | 844 | pipe->readers = pipe->writers = 1; |
999 | inode->i_fop = &rdwr_pipefifo_fops; | 845 | inode->i_fop = &pipefifo_fops; |
1000 | 846 | ||
1001 | /* | 847 | /* |
1002 | * Mark the inode dirty from the very beginning, | 848 | * Mark the inode dirty from the very beginning, |
@@ -1039,17 +885,19 @@ int create_pipe_files(struct file **res, int flags) | |||
1039 | d_instantiate(path.dentry, inode); | 885 | d_instantiate(path.dentry, inode); |
1040 | 886 | ||
1041 | err = -ENFILE; | 887 | err = -ENFILE; |
1042 | f = alloc_file(&path, FMODE_WRITE, &write_pipefifo_fops); | 888 | f = alloc_file(&path, FMODE_WRITE, &pipefifo_fops); |
1043 | if (IS_ERR(f)) | 889 | if (IS_ERR(f)) |
1044 | goto err_dentry; | 890 | goto err_dentry; |
1045 | 891 | ||
1046 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); | 892 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); |
893 | f->private_data = inode->i_pipe; | ||
1047 | 894 | ||
1048 | res[0] = alloc_file(&path, FMODE_READ, &read_pipefifo_fops); | 895 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); |
1049 | if (IS_ERR(res[0])) | 896 | if (IS_ERR(res[0])) |
1050 | goto err_file; | 897 | goto err_file; |
1051 | 898 | ||
1052 | path_get(&path); | 899 | path_get(&path); |
900 | res[0]->private_data = inode->i_pipe; | ||
1053 | res[0]->f_flags = O_RDONLY | (flags & O_NONBLOCK); | 901 | res[0]->f_flags = O_RDONLY | (flags & O_NONBLOCK); |
1054 | res[1] = f; | 902 | res[1] = f; |
1055 | return 0; | 903 | return 0; |
@@ -1057,12 +905,12 @@ int create_pipe_files(struct file **res, int flags) | |||
1057 | err_file: | 905 | err_file: |
1058 | put_filp(f); | 906 | put_filp(f); |
1059 | err_dentry: | 907 | err_dentry: |
1060 | free_pipe_info(inode); | 908 | free_pipe_info(inode->i_pipe); |
1061 | path_put(&path); | 909 | path_put(&path); |
1062 | return err; | 910 | return err; |
1063 | 911 | ||
1064 | err_inode: | 912 | err_inode: |
1065 | free_pipe_info(inode); | 913 | free_pipe_info(inode->i_pipe); |
1066 | iput(inode); | 914 | iput(inode); |
1067 | return err; | 915 | return err; |
1068 | } | 916 | } |
@@ -1144,6 +992,168 @@ SYSCALL_DEFINE1(pipe, int __user *, fildes) | |||
1144 | return sys_pipe2(fildes, 0); | 992 | return sys_pipe2(fildes, 0); |
1145 | } | 993 | } |
1146 | 994 | ||
995 | static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt) | ||
996 | { | ||
997 | int cur = *cnt; | ||
998 | |||
999 | while (cur == *cnt) { | ||
1000 | pipe_wait(pipe); | ||
1001 | if (signal_pending(current)) | ||
1002 | break; | ||
1003 | } | ||
1004 | return cur == *cnt ? -ERESTARTSYS : 0; | ||
1005 | } | ||
1006 | |||
1007 | static void wake_up_partner(struct pipe_inode_info *pipe) | ||
1008 | { | ||
1009 | wake_up_interruptible(&pipe->wait); | ||
1010 | } | ||
1011 | |||
1012 | static int fifo_open(struct inode *inode, struct file *filp) | ||
1013 | { | ||
1014 | struct pipe_inode_info *pipe; | ||
1015 | bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC; | ||
1016 | int kill = 0; | ||
1017 | int ret; | ||
1018 | |||
1019 | filp->f_version = 0; | ||
1020 | |||
1021 | spin_lock(&inode->i_lock); | ||
1022 | if (inode->i_pipe) { | ||
1023 | pipe = inode->i_pipe; | ||
1024 | pipe->files++; | ||
1025 | spin_unlock(&inode->i_lock); | ||
1026 | } else { | ||
1027 | spin_unlock(&inode->i_lock); | ||
1028 | pipe = alloc_pipe_info(); | ||
1029 | if (!pipe) | ||
1030 | return -ENOMEM; | ||
1031 | pipe->files = 1; | ||
1032 | spin_lock(&inode->i_lock); | ||
1033 | if (unlikely(inode->i_pipe)) { | ||
1034 | inode->i_pipe->files++; | ||
1035 | spin_unlock(&inode->i_lock); | ||
1036 | free_pipe_info(pipe); | ||
1037 | pipe = inode->i_pipe; | ||
1038 | } else { | ||
1039 | inode->i_pipe = pipe; | ||
1040 | spin_unlock(&inode->i_lock); | ||
1041 | } | ||
1042 | } | ||
1043 | filp->private_data = pipe; | ||
1044 | /* OK, we have a pipe and it's pinned down */ | ||
1045 | |||
1046 | __pipe_lock(pipe); | ||
1047 | |||
1048 | /* We can only do regular read/write on fifos */ | ||
1049 | filp->f_mode &= (FMODE_READ | FMODE_WRITE); | ||
1050 | |||
1051 | switch (filp->f_mode) { | ||
1052 | case FMODE_READ: | ||
1053 | /* | ||
1054 | * O_RDONLY | ||
1055 | * POSIX.1 says that O_NONBLOCK means return with the FIFO | ||
1056 | * opened, even when there is no process writing the FIFO. | ||
1057 | */ | ||
1058 | pipe->r_counter++; | ||
1059 | if (pipe->readers++ == 0) | ||
1060 | wake_up_partner(pipe); | ||
1061 | |||
1062 | if (!is_pipe && !pipe->writers) { | ||
1063 | if ((filp->f_flags & O_NONBLOCK)) { | ||
1064 | /* suppress POLLHUP until we have | ||
1065 | * seen a writer */ | ||
1066 | filp->f_version = pipe->w_counter; | ||
1067 | } else { | ||
1068 | if (wait_for_partner(pipe, &pipe->w_counter)) | ||
1069 | goto err_rd; | ||
1070 | } | ||
1071 | } | ||
1072 | break; | ||
1073 | |||
1074 | case FMODE_WRITE: | ||
1075 | /* | ||
1076 | * O_WRONLY | ||
1077 | * POSIX.1 says that O_NONBLOCK means return -1 with | ||
1078 | * errno=ENXIO when there is no process reading the FIFO. | ||
1079 | */ | ||
1080 | ret = -ENXIO; | ||
1081 | if (!is_pipe && (filp->f_flags & O_NONBLOCK) && !pipe->readers) | ||
1082 | goto err; | ||
1083 | |||
1084 | pipe->w_counter++; | ||
1085 | if (!pipe->writers++) | ||
1086 | wake_up_partner(pipe); | ||
1087 | |||
1088 | if (!is_pipe && !pipe->readers) { | ||
1089 | if (wait_for_partner(pipe, &pipe->r_counter)) | ||
1090 | goto err_wr; | ||
1091 | } | ||
1092 | break; | ||
1093 | |||
1094 | case FMODE_READ | FMODE_WRITE: | ||
1095 | /* | ||
1096 | * O_RDWR | ||
1097 | * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. | ||
1098 | * This implementation will NEVER block on a O_RDWR open, since | ||
1099 | * the process can at least talk to itself. | ||
1100 | */ | ||
1101 | |||
1102 | pipe->readers++; | ||
1103 | pipe->writers++; | ||
1104 | pipe->r_counter++; | ||
1105 | pipe->w_counter++; | ||
1106 | if (pipe->readers == 1 || pipe->writers == 1) | ||
1107 | wake_up_partner(pipe); | ||
1108 | break; | ||
1109 | |||
1110 | default: | ||
1111 | ret = -EINVAL; | ||
1112 | goto err; | ||
1113 | } | ||
1114 | |||
1115 | /* Ok! */ | ||
1116 | __pipe_unlock(pipe); | ||
1117 | return 0; | ||
1118 | |||
1119 | err_rd: | ||
1120 | if (!--pipe->readers) | ||
1121 | wake_up_interruptible(&pipe->wait); | ||
1122 | ret = -ERESTARTSYS; | ||
1123 | goto err; | ||
1124 | |||
1125 | err_wr: | ||
1126 | if (!--pipe->writers) | ||
1127 | wake_up_interruptible(&pipe->wait); | ||
1128 | ret = -ERESTARTSYS; | ||
1129 | goto err; | ||
1130 | |||
1131 | err: | ||
1132 | spin_lock(&inode->i_lock); | ||
1133 | if (!--pipe->files) { | ||
1134 | inode->i_pipe = NULL; | ||
1135 | kill = 1; | ||
1136 | } | ||
1137 | spin_unlock(&inode->i_lock); | ||
1138 | __pipe_unlock(pipe); | ||
1139 | if (kill) | ||
1140 | free_pipe_info(pipe); | ||
1141 | return ret; | ||
1142 | } | ||
1143 | |||
1144 | const struct file_operations pipefifo_fops = { | ||
1145 | .open = fifo_open, | ||
1146 | .llseek = no_llseek, | ||
1147 | .read = do_sync_read, | ||
1148 | .aio_read = pipe_read, | ||
1149 | .write = do_sync_write, | ||
1150 | .aio_write = pipe_write, | ||
1151 | .poll = pipe_poll, | ||
1152 | .unlocked_ioctl = pipe_ioctl, | ||
1153 | .release = pipe_release, | ||
1154 | .fasync = pipe_fasync, | ||
1155 | }; | ||
1156 | |||
1147 | /* | 1157 | /* |
1148 | * Allocate a new array of pipe buffers and copy the info over. Returns the | 1158 | * Allocate a new array of pipe buffers and copy the info over. Returns the |
1149 | * pipe size if successful, or return -ERROR on error. | 1159 | * pipe size if successful, or return -ERROR on error. |
@@ -1229,9 +1239,7 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, | |||
1229 | */ | 1239 | */ |
1230 | struct pipe_inode_info *get_pipe_info(struct file *file) | 1240 | struct pipe_inode_info *get_pipe_info(struct file *file) |
1231 | { | 1241 | { |
1232 | struct inode *i = file_inode(file); | 1242 | return file->f_op == &pipefifo_fops ? file->private_data : NULL; |
1233 | |||
1234 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; | ||
1235 | } | 1243 | } |
1236 | 1244 | ||
1237 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | 1245 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
@@ -1243,7 +1251,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1243 | if (!pipe) | 1251 | if (!pipe) |
1244 | return -EBADF; | 1252 | return -EBADF; |
1245 | 1253 | ||
1246 | mutex_lock(&pipe->inode->i_mutex); | 1254 | __pipe_lock(pipe); |
1247 | 1255 | ||
1248 | switch (cmd) { | 1256 | switch (cmd) { |
1249 | case F_SETPIPE_SZ: { | 1257 | case F_SETPIPE_SZ: { |
@@ -1272,7 +1280,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1272 | } | 1280 | } |
1273 | 1281 | ||
1274 | out: | 1282 | out: |
1275 | mutex_unlock(&pipe->inode->i_mutex); | 1283 | __pipe_unlock(pipe); |
1276 | return ret; | 1284 | return ret; |
1277 | } | 1285 | } |
1278 | 1286 | ||
diff --git a/fs/pnode.c b/fs/pnode.c index 8b29d2164da6..3d2a7141b87a 100644 --- a/fs/pnode.c +++ b/fs/pnode.c | |||
@@ -218,7 +218,7 @@ static struct mount *get_source(struct mount *dest, | |||
218 | * @source_mnt: source mount. | 218 | * @source_mnt: source mount. |
219 | * @tree_list : list of heads of trees to be attached. | 219 | * @tree_list : list of heads of trees to be attached. |
220 | */ | 220 | */ |
221 | int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry, | 221 | int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, |
222 | struct mount *source_mnt, struct list_head *tree_list) | 222 | struct mount *source_mnt, struct list_head *tree_list) |
223 | { | 223 | { |
224 | struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns; | 224 | struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns; |
@@ -227,7 +227,6 @@ int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry, | |||
227 | struct mount *prev_dest_mnt = dest_mnt; | 227 | struct mount *prev_dest_mnt = dest_mnt; |
228 | struct mount *prev_src_mnt = source_mnt; | 228 | struct mount *prev_src_mnt = source_mnt; |
229 | LIST_HEAD(tmp_list); | 229 | LIST_HEAD(tmp_list); |
230 | LIST_HEAD(umount_list); | ||
231 | 230 | ||
232 | for (m = propagation_next(dest_mnt, dest_mnt); m; | 231 | for (m = propagation_next(dest_mnt, dest_mnt); m; |
233 | m = propagation_next(m, dest_mnt)) { | 232 | m = propagation_next(m, dest_mnt)) { |
@@ -250,8 +249,8 @@ int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry, | |||
250 | goto out; | 249 | goto out; |
251 | } | 250 | } |
252 | 251 | ||
253 | if (is_subdir(dest_dentry, m->mnt.mnt_root)) { | 252 | if (is_subdir(dest_mp->m_dentry, m->mnt.mnt_root)) { |
254 | mnt_set_mountpoint(m, dest_dentry, child); | 253 | mnt_set_mountpoint(m, dest_mp, child); |
255 | list_add_tail(&child->mnt_hash, tree_list); | 254 | list_add_tail(&child->mnt_hash, tree_list); |
256 | } else { | 255 | } else { |
257 | /* | 256 | /* |
@@ -267,10 +266,9 @@ out: | |||
267 | br_write_lock(&vfsmount_lock); | 266 | br_write_lock(&vfsmount_lock); |
268 | while (!list_empty(&tmp_list)) { | 267 | while (!list_empty(&tmp_list)) { |
269 | child = list_first_entry(&tmp_list, struct mount, mnt_hash); | 268 | child = list_first_entry(&tmp_list, struct mount, mnt_hash); |
270 | umount_tree(child, 0, &umount_list); | 269 | umount_tree(child, 0); |
271 | } | 270 | } |
272 | br_write_unlock(&vfsmount_lock); | 271 | br_write_unlock(&vfsmount_lock); |
273 | release_mounts(&umount_list); | ||
274 | return ret; | 272 | return ret; |
275 | } | 273 | } |
276 | 274 | ||
diff --git a/fs/pnode.h b/fs/pnode.h index a0493d5ebfbf..b091445c1c4a 100644 --- a/fs/pnode.h +++ b/fs/pnode.h | |||
@@ -32,17 +32,16 @@ static inline void set_mnt_shared(struct mount *mnt) | |||
32 | } | 32 | } |
33 | 33 | ||
34 | void change_mnt_propagation(struct mount *, int); | 34 | void change_mnt_propagation(struct mount *, int); |
35 | int propagate_mnt(struct mount *, struct dentry *, struct mount *, | 35 | int propagate_mnt(struct mount *, struct mountpoint *, struct mount *, |
36 | struct list_head *); | 36 | struct list_head *); |
37 | int propagate_umount(struct list_head *); | 37 | int propagate_umount(struct list_head *); |
38 | int propagate_mount_busy(struct mount *, int); | 38 | int propagate_mount_busy(struct mount *, int); |
39 | void mnt_release_group_id(struct mount *); | 39 | void mnt_release_group_id(struct mount *); |
40 | int get_dominating_id(struct mount *mnt, const struct path *root); | 40 | int get_dominating_id(struct mount *mnt, const struct path *root); |
41 | unsigned int mnt_get_count(struct mount *mnt); | 41 | unsigned int mnt_get_count(struct mount *mnt); |
42 | void mnt_set_mountpoint(struct mount *, struct dentry *, | 42 | void mnt_set_mountpoint(struct mount *, struct mountpoint *, |
43 | struct mount *); | 43 | struct mount *); |
44 | void release_mounts(struct list_head *); | 44 | void umount_tree(struct mount *, int); |
45 | void umount_tree(struct mount *, int, struct list_head *); | ||
46 | struct mount *copy_tree(struct mount *, struct dentry *, int); | 45 | struct mount *copy_tree(struct mount *, struct dentry *, int); |
47 | bool is_path_reachable(struct mount *, struct dentry *, | 46 | bool is_path_reachable(struct mount *, struct dentry *, |
48 | const struct path *root); | 47 | const struct path *root); |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3861bcec41ff..dd51e50001fe 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -405,6 +405,37 @@ static const struct file_operations proc_lstats_operations = { | |||
405 | 405 | ||
406 | #endif | 406 | #endif |
407 | 407 | ||
408 | #ifdef CONFIG_CGROUPS | ||
409 | static int cgroup_open(struct inode *inode, struct file *file) | ||
410 | { | ||
411 | struct pid *pid = PROC_I(inode)->pid; | ||
412 | return single_open(file, proc_cgroup_show, pid); | ||
413 | } | ||
414 | |||
415 | static const struct file_operations proc_cgroup_operations = { | ||
416 | .open = cgroup_open, | ||
417 | .read = seq_read, | ||
418 | .llseek = seq_lseek, | ||
419 | .release = single_release, | ||
420 | }; | ||
421 | #endif | ||
422 | |||
423 | #ifdef CONFIG_PROC_PID_CPUSET | ||
424 | |||
425 | static int cpuset_open(struct inode *inode, struct file *file) | ||
426 | { | ||
427 | struct pid *pid = PROC_I(inode)->pid; | ||
428 | return single_open(file, proc_cpuset_show, pid); | ||
429 | } | ||
430 | |||
431 | static const struct file_operations proc_cpuset_operations = { | ||
432 | .open = cpuset_open, | ||
433 | .read = seq_read, | ||
434 | .llseek = seq_lseek, | ||
435 | .release = single_release, | ||
436 | }; | ||
437 | #endif | ||
438 | |||
408 | static int proc_oom_score(struct task_struct *task, char *buffer) | 439 | static int proc_oom_score(struct task_struct *task, char *buffer) |
409 | { | 440 | { |
410 | unsigned long totalpages = totalram_pages + total_swap_pages; | 441 | unsigned long totalpages = totalram_pages + total_swap_pages; |
@@ -1621,6 +1652,15 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags) | |||
1621 | return 0; | 1652 | return 0; |
1622 | } | 1653 | } |
1623 | 1654 | ||
1655 | int pid_delete_dentry(const struct dentry *dentry) | ||
1656 | { | ||
1657 | /* Is the task we represent dead? | ||
1658 | * If so, then don't put the dentry on the lru list, | ||
1659 | * kill it immediately. | ||
1660 | */ | ||
1661 | return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first; | ||
1662 | } | ||
1663 | |||
1624 | const struct dentry_operations pid_dentry_operations = | 1664 | const struct dentry_operations pid_dentry_operations = |
1625 | { | 1665 | { |
1626 | .d_revalidate = pid_revalidate, | 1666 | .d_revalidate = pid_revalidate, |
@@ -2893,7 +2933,7 @@ retry: | |||
2893 | return iter; | 2933 | return iter; |
2894 | } | 2934 | } |
2895 | 2935 | ||
2896 | #define TGID_OFFSET (FIRST_PROCESS_ENTRY) | 2936 | #define TGID_OFFSET (FIRST_PROCESS_ENTRY + 1) |
2897 | 2937 | ||
2898 | static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | 2938 | static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir, |
2899 | struct tgid_iter iter) | 2939 | struct tgid_iter iter) |
@@ -2916,13 +2956,21 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2916 | struct tgid_iter iter; | 2956 | struct tgid_iter iter; |
2917 | struct pid_namespace *ns; | 2957 | struct pid_namespace *ns; |
2918 | filldir_t __filldir; | 2958 | filldir_t __filldir; |
2959 | loff_t pos = filp->f_pos; | ||
2919 | 2960 | ||
2920 | if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET) | 2961 | if (pos >= PID_MAX_LIMIT + TGID_OFFSET) |
2921 | goto out; | 2962 | goto out; |
2922 | 2963 | ||
2923 | ns = filp->f_dentry->d_sb->s_fs_info; | 2964 | if (pos == TGID_OFFSET - 1) { |
2965 | if (proc_fill_cache(filp, dirent, filldir, "self", 4, | ||
2966 | NULL, NULL, NULL) < 0) | ||
2967 | goto out; | ||
2968 | iter.tgid = 0; | ||
2969 | } else { | ||
2970 | iter.tgid = pos - TGID_OFFSET; | ||
2971 | } | ||
2924 | iter.task = NULL; | 2972 | iter.task = NULL; |
2925 | iter.tgid = filp->f_pos - TGID_OFFSET; | 2973 | ns = filp->f_dentry->d_sb->s_fs_info; |
2926 | for (iter = next_tgid(ns, iter); | 2974 | for (iter = next_tgid(ns, iter); |
2927 | iter.task; | 2975 | iter.task; |
2928 | iter.tgid += 1, iter = next_tgid(ns, iter)) { | 2976 | iter.tgid += 1, iter = next_tgid(ns, iter)) { |
diff --git a/fs/proc/fd.h b/fs/proc/fd.h index cbb1d47deda8..7c047f256ae2 100644 --- a/fs/proc/fd.h +++ b/fs/proc/fd.h | |||
@@ -11,4 +11,9 @@ extern const struct inode_operations proc_fdinfo_inode_operations; | |||
11 | 11 | ||
12 | extern int proc_fd_permission(struct inode *inode, int mask); | 12 | extern int proc_fd_permission(struct inode *inode, int mask); |
13 | 13 | ||
14 | static inline int proc_fd(struct inode *inode) | ||
15 | { | ||
16 | return PROC_I(inode)->fd; | ||
17 | } | ||
18 | |||
14 | #endif /* __PROCFS_FD_H__ */ | 19 | #endif /* __PROCFS_FD_H__ */ |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 21e1a8f1659d..a2596afffae6 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -36,212 +36,6 @@ static int proc_match(unsigned int len, const char *name, struct proc_dir_entry | |||
36 | return !memcmp(name, de->name, len); | 36 | return !memcmp(name, de->name, len); |
37 | } | 37 | } |
38 | 38 | ||
39 | /* buffer size is one page but our output routines use some slack for overruns */ | ||
40 | #define PROC_BLOCK_SIZE (PAGE_SIZE - 1024) | ||
41 | |||
42 | static ssize_t | ||
43 | __proc_file_read(struct file *file, char __user *buf, size_t nbytes, | ||
44 | loff_t *ppos) | ||
45 | { | ||
46 | struct inode * inode = file_inode(file); | ||
47 | char *page; | ||
48 | ssize_t retval=0; | ||
49 | int eof=0; | ||
50 | ssize_t n, count; | ||
51 | char *start; | ||
52 | struct proc_dir_entry * dp; | ||
53 | unsigned long long pos; | ||
54 | |||
55 | /* | ||
56 | * Gaah, please just use "seq_file" instead. The legacy /proc | ||
57 | * interfaces cut loff_t down to off_t for reads, and ignore | ||
58 | * the offset entirely for writes.. | ||
59 | */ | ||
60 | pos = *ppos; | ||
61 | if (pos > MAX_NON_LFS) | ||
62 | return 0; | ||
63 | if (nbytes > MAX_NON_LFS - pos) | ||
64 | nbytes = MAX_NON_LFS - pos; | ||
65 | |||
66 | dp = PDE(inode); | ||
67 | if (!(page = (char*) __get_free_page(GFP_TEMPORARY))) | ||
68 | return -ENOMEM; | ||
69 | |||
70 | while ((nbytes > 0) && !eof) { | ||
71 | count = min_t(size_t, PROC_BLOCK_SIZE, nbytes); | ||
72 | |||
73 | start = NULL; | ||
74 | if (dp->read_proc) { | ||
75 | /* | ||
76 | * How to be a proc read function | ||
77 | * ------------------------------ | ||
78 | * Prototype: | ||
79 | * int f(char *buffer, char **start, off_t offset, | ||
80 | * int count, int *peof, void *dat) | ||
81 | * | ||
82 | * Assume that the buffer is "count" bytes in size. | ||
83 | * | ||
84 | * If you know you have supplied all the data you | ||
85 | * have, set *peof. | ||
86 | * | ||
87 | * You have three ways to return data: | ||
88 | * 0) Leave *start = NULL. (This is the default.) | ||
89 | * Put the data of the requested offset at that | ||
90 | * offset within the buffer. Return the number (n) | ||
91 | * of bytes there are from the beginning of the | ||
92 | * buffer up to the last byte of data. If the | ||
93 | * number of supplied bytes (= n - offset) is | ||
94 | * greater than zero and you didn't signal eof | ||
95 | * and the reader is prepared to take more data | ||
96 | * you will be called again with the requested | ||
97 | * offset advanced by the number of bytes | ||
98 | * absorbed. This interface is useful for files | ||
99 | * no larger than the buffer. | ||
100 | * 1) Set *start = an unsigned long value less than | ||
101 | * the buffer address but greater than zero. | ||
102 | * Put the data of the requested offset at the | ||
103 | * beginning of the buffer. Return the number of | ||
104 | * bytes of data placed there. If this number is | ||
105 | * greater than zero and you didn't signal eof | ||
106 | * and the reader is prepared to take more data | ||
107 | * you will be called again with the requested | ||
108 | * offset advanced by *start. This interface is | ||
109 | * useful when you have a large file consisting | ||
110 | * of a series of blocks which you want to count | ||
111 | * and return as wholes. | ||
112 | * (Hack by Paul.Russell@rustcorp.com.au) | ||
113 | * 2) Set *start = an address within the buffer. | ||
114 | * Put the data of the requested offset at *start. | ||
115 | * Return the number of bytes of data placed there. | ||
116 | * If this number is greater than zero and you | ||
117 | * didn't signal eof and the reader is prepared to | ||
118 | * take more data you will be called again with the | ||
119 | * requested offset advanced by the number of bytes | ||
120 | * absorbed. | ||
121 | */ | ||
122 | n = dp->read_proc(page, &start, *ppos, | ||
123 | count, &eof, dp->data); | ||
124 | } else | ||
125 | break; | ||
126 | |||
127 | if (n == 0) /* end of file */ | ||
128 | break; | ||
129 | if (n < 0) { /* error */ | ||
130 | if (retval == 0) | ||
131 | retval = n; | ||
132 | break; | ||
133 | } | ||
134 | |||
135 | if (start == NULL) { | ||
136 | if (n > PAGE_SIZE) /* Apparent buffer overflow */ | ||
137 | n = PAGE_SIZE; | ||
138 | n -= *ppos; | ||
139 | if (n <= 0) | ||
140 | break; | ||
141 | if (n > count) | ||
142 | n = count; | ||
143 | start = page + *ppos; | ||
144 | } else if (start < page) { | ||
145 | if (n > PAGE_SIZE) /* Apparent buffer overflow */ | ||
146 | n = PAGE_SIZE; | ||
147 | if (n > count) { | ||
148 | /* | ||
149 | * Don't reduce n because doing so might | ||
150 | * cut off part of a data block. | ||
151 | */ | ||
152 | pr_warn("proc_file_read: count exceeded\n"); | ||
153 | } | ||
154 | } else /* start >= page */ { | ||
155 | unsigned long startoff = (unsigned long)(start - page); | ||
156 | if (n > (PAGE_SIZE - startoff)) /* buffer overflow? */ | ||
157 | n = PAGE_SIZE - startoff; | ||
158 | if (n > count) | ||
159 | n = count; | ||
160 | } | ||
161 | |||
162 | n -= copy_to_user(buf, start < page ? page : start, n); | ||
163 | if (n == 0) { | ||
164 | if (retval == 0) | ||
165 | retval = -EFAULT; | ||
166 | break; | ||
167 | } | ||
168 | |||
169 | *ppos += start < page ? (unsigned long)start : n; | ||
170 | nbytes -= n; | ||
171 | buf += n; | ||
172 | retval += n; | ||
173 | } | ||
174 | free_page((unsigned long) page); | ||
175 | return retval; | ||
176 | } | ||
177 | |||
178 | static ssize_t | ||
179 | proc_file_read(struct file *file, char __user *buf, size_t nbytes, | ||
180 | loff_t *ppos) | ||
181 | { | ||
182 | struct proc_dir_entry *pde = PDE(file_inode(file)); | ||
183 | ssize_t rv = -EIO; | ||
184 | |||
185 | spin_lock(&pde->pde_unload_lock); | ||
186 | if (!pde->proc_fops) { | ||
187 | spin_unlock(&pde->pde_unload_lock); | ||
188 | return rv; | ||
189 | } | ||
190 | pde->pde_users++; | ||
191 | spin_unlock(&pde->pde_unload_lock); | ||
192 | |||
193 | rv = __proc_file_read(file, buf, nbytes, ppos); | ||
194 | |||
195 | pde_users_dec(pde); | ||
196 | return rv; | ||
197 | } | ||
198 | |||
199 | static ssize_t | ||
200 | proc_file_write(struct file *file, const char __user *buffer, | ||
201 | size_t count, loff_t *ppos) | ||
202 | { | ||
203 | struct proc_dir_entry *pde = PDE(file_inode(file)); | ||
204 | ssize_t rv = -EIO; | ||
205 | |||
206 | if (pde->write_proc) { | ||
207 | spin_lock(&pde->pde_unload_lock); | ||
208 | if (!pde->proc_fops) { | ||
209 | spin_unlock(&pde->pde_unload_lock); | ||
210 | return rv; | ||
211 | } | ||
212 | pde->pde_users++; | ||
213 | spin_unlock(&pde->pde_unload_lock); | ||
214 | |||
215 | /* FIXME: does this routine need ppos? probably... */ | ||
216 | rv = pde->write_proc(file, buffer, count, pde->data); | ||
217 | pde_users_dec(pde); | ||
218 | } | ||
219 | return rv; | ||
220 | } | ||
221 | |||
222 | |||
223 | static loff_t | ||
224 | proc_file_lseek(struct file *file, loff_t offset, int orig) | ||
225 | { | ||
226 | loff_t retval = -EINVAL; | ||
227 | switch (orig) { | ||
228 | case 1: | ||
229 | offset += file->f_pos; | ||
230 | /* fallthrough */ | ||
231 | case 0: | ||
232 | if (offset < 0 || offset > MAX_NON_LFS) | ||
233 | break; | ||
234 | file->f_pos = retval = offset; | ||
235 | } | ||
236 | return retval; | ||
237 | } | ||
238 | |||
239 | static const struct file_operations proc_file_operations = { | ||
240 | .llseek = proc_file_lseek, | ||
241 | .read = proc_file_read, | ||
242 | .write = proc_file_write, | ||
243 | }; | ||
244 | |||
245 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | 39 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) |
246 | { | 40 | { |
247 | struct inode *inode = dentry->d_inode; | 41 | struct inode *inode = dentry->d_inode; |
@@ -371,7 +165,7 @@ void proc_free_inum(unsigned int inum) | |||
371 | 165 | ||
372 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) | 166 | static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) |
373 | { | 167 | { |
374 | nd_set_link(nd, PDE(dentry->d_inode)->data); | 168 | nd_set_link(nd, __PDE_DATA(dentry->d_inode)); |
375 | return NULL; | 169 | return NULL; |
376 | } | 170 | } |
377 | 171 | ||
@@ -541,19 +335,17 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
541 | return ret; | 335 | return ret; |
542 | 336 | ||
543 | if (S_ISDIR(dp->mode)) { | 337 | if (S_ISDIR(dp->mode)) { |
544 | if (dp->proc_iops == NULL) { | 338 | dp->proc_fops = &proc_dir_operations; |
545 | dp->proc_fops = &proc_dir_operations; | 339 | dp->proc_iops = &proc_dir_inode_operations; |
546 | dp->proc_iops = &proc_dir_inode_operations; | ||
547 | } | ||
548 | dir->nlink++; | 340 | dir->nlink++; |
549 | } else if (S_ISLNK(dp->mode)) { | 341 | } else if (S_ISLNK(dp->mode)) { |
550 | if (dp->proc_iops == NULL) | 342 | dp->proc_iops = &proc_link_inode_operations; |
551 | dp->proc_iops = &proc_link_inode_operations; | ||
552 | } else if (S_ISREG(dp->mode)) { | 343 | } else if (S_ISREG(dp->mode)) { |
553 | if (dp->proc_fops == NULL) | 344 | BUG_ON(dp->proc_fops == NULL); |
554 | dp->proc_fops = &proc_file_operations; | 345 | dp->proc_iops = &proc_file_inode_operations; |
555 | if (dp->proc_iops == NULL) | 346 | } else { |
556 | dp->proc_iops = &proc_file_inode_operations; | 347 | WARN_ON(1); |
348 | return -EINVAL; | ||
557 | } | 349 | } |
558 | 350 | ||
559 | spin_lock(&proc_subdir_lock); | 351 | spin_lock(&proc_subdir_lock); |
@@ -636,13 +428,17 @@ struct proc_dir_entry *proc_symlink(const char *name, | |||
636 | } | 428 | } |
637 | EXPORT_SYMBOL(proc_symlink); | 429 | EXPORT_SYMBOL(proc_symlink); |
638 | 430 | ||
639 | struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, | 431 | struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode, |
640 | struct proc_dir_entry *parent) | 432 | struct proc_dir_entry *parent, void *data) |
641 | { | 433 | { |
642 | struct proc_dir_entry *ent; | 434 | struct proc_dir_entry *ent; |
643 | 435 | ||
436 | if (mode == 0) | ||
437 | mode = S_IRUGO | S_IXUGO; | ||
438 | |||
644 | ent = __proc_create(&parent, name, S_IFDIR | mode, 2); | 439 | ent = __proc_create(&parent, name, S_IFDIR | mode, 2); |
645 | if (ent) { | 440 | if (ent) { |
441 | ent->data = data; | ||
646 | if (proc_register(parent, ent) < 0) { | 442 | if (proc_register(parent, ent) < 0) { |
647 | kfree(ent); | 443 | kfree(ent); |
648 | ent = NULL; | 444 | ent = NULL; |
@@ -650,82 +446,39 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, | |||
650 | } | 446 | } |
651 | return ent; | 447 | return ent; |
652 | } | 448 | } |
653 | EXPORT_SYMBOL(proc_mkdir_mode); | 449 | EXPORT_SYMBOL_GPL(proc_mkdir_data); |
654 | 450 | ||
655 | struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | 451 | struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, |
656 | struct proc_dir_entry *parent) | 452 | struct proc_dir_entry *parent) |
657 | { | 453 | { |
658 | struct proc_dir_entry *ent; | 454 | return proc_mkdir_data(name, mode, parent, NULL); |
659 | |||
660 | ent = __proc_create(&parent, name, S_IFDIR | S_IRUGO | S_IXUGO, 2); | ||
661 | if (ent) { | ||
662 | ent->data = net; | ||
663 | if (proc_register(parent, ent) < 0) { | ||
664 | kfree(ent); | ||
665 | ent = NULL; | ||
666 | } | ||
667 | } | ||
668 | return ent; | ||
669 | } | 455 | } |
670 | EXPORT_SYMBOL_GPL(proc_net_mkdir); | 456 | EXPORT_SYMBOL(proc_mkdir_mode); |
671 | 457 | ||
672 | struct proc_dir_entry *proc_mkdir(const char *name, | 458 | struct proc_dir_entry *proc_mkdir(const char *name, |
673 | struct proc_dir_entry *parent) | 459 | struct proc_dir_entry *parent) |
674 | { | 460 | { |
675 | return proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent); | 461 | return proc_mkdir_data(name, 0, parent, NULL); |
676 | } | 462 | } |
677 | EXPORT_SYMBOL(proc_mkdir); | 463 | EXPORT_SYMBOL(proc_mkdir); |
678 | 464 | ||
679 | struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, | ||
680 | struct proc_dir_entry *parent) | ||
681 | { | ||
682 | struct proc_dir_entry *ent; | ||
683 | nlink_t nlink; | ||
684 | |||
685 | if (S_ISDIR(mode)) { | ||
686 | if ((mode & S_IALLUGO) == 0) | ||
687 | mode |= S_IRUGO | S_IXUGO; | ||
688 | nlink = 2; | ||
689 | } else { | ||
690 | if ((mode & S_IFMT) == 0) | ||
691 | mode |= S_IFREG; | ||
692 | if ((mode & S_IALLUGO) == 0) | ||
693 | mode |= S_IRUGO; | ||
694 | nlink = 1; | ||
695 | } | ||
696 | |||
697 | ent = __proc_create(&parent, name, mode, nlink); | ||
698 | if (ent) { | ||
699 | if (proc_register(parent, ent) < 0) { | ||
700 | kfree(ent); | ||
701 | ent = NULL; | ||
702 | } | ||
703 | } | ||
704 | return ent; | ||
705 | } | ||
706 | EXPORT_SYMBOL(create_proc_entry); | ||
707 | |||
708 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | 465 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, |
709 | struct proc_dir_entry *parent, | 466 | struct proc_dir_entry *parent, |
710 | const struct file_operations *proc_fops, | 467 | const struct file_operations *proc_fops, |
711 | void *data) | 468 | void *data) |
712 | { | 469 | { |
713 | struct proc_dir_entry *pde; | 470 | struct proc_dir_entry *pde; |
714 | nlink_t nlink; | 471 | if ((mode & S_IFMT) == 0) |
472 | mode |= S_IFREG; | ||
715 | 473 | ||
716 | if (S_ISDIR(mode)) { | 474 | if (!S_ISREG(mode)) { |
717 | if ((mode & S_IALLUGO) == 0) | 475 | WARN_ON(1); /* use proc_mkdir() */ |
718 | mode |= S_IRUGO | S_IXUGO; | 476 | return NULL; |
719 | nlink = 2; | ||
720 | } else { | ||
721 | if ((mode & S_IFMT) == 0) | ||
722 | mode |= S_IFREG; | ||
723 | if ((mode & S_IALLUGO) == 0) | ||
724 | mode |= S_IRUGO; | ||
725 | nlink = 1; | ||
726 | } | 477 | } |
727 | 478 | ||
728 | pde = __proc_create(&parent, name, mode, nlink); | 479 | if ((mode & S_IALLUGO) == 0) |
480 | mode |= S_IRUGO; | ||
481 | pde = __proc_create(&parent, name, mode, 1); | ||
729 | if (!pde) | 482 | if (!pde) |
730 | goto out; | 483 | goto out; |
731 | pde->proc_fops = proc_fops; | 484 | pde->proc_fops = proc_fops; |
@@ -739,6 +492,19 @@ out: | |||
739 | return NULL; | 492 | return NULL; |
740 | } | 493 | } |
741 | EXPORT_SYMBOL(proc_create_data); | 494 | EXPORT_SYMBOL(proc_create_data); |
495 | |||
496 | void proc_set_size(struct proc_dir_entry *de, loff_t size) | ||
497 | { | ||
498 | de->size = size; | ||
499 | } | ||
500 | EXPORT_SYMBOL(proc_set_size); | ||
501 | |||
502 | void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) | ||
503 | { | ||
504 | de->uid = uid; | ||
505 | de->gid = gid; | ||
506 | } | ||
507 | EXPORT_SYMBOL(proc_set_user); | ||
742 | 508 | ||
743 | static void free_proc_entry(struct proc_dir_entry *de) | 509 | static void free_proc_entry(struct proc_dir_entry *de) |
744 | { | 510 | { |
@@ -755,41 +521,6 @@ void pde_put(struct proc_dir_entry *pde) | |||
755 | free_proc_entry(pde); | 521 | free_proc_entry(pde); |
756 | } | 522 | } |
757 | 523 | ||
758 | static void entry_rundown(struct proc_dir_entry *de) | ||
759 | { | ||
760 | spin_lock(&de->pde_unload_lock); | ||
761 | /* | ||
762 | * Stop accepting new callers into module. If you're | ||
763 | * dynamically allocating ->proc_fops, save a pointer somewhere. | ||
764 | */ | ||
765 | de->proc_fops = NULL; | ||
766 | /* Wait until all existing callers into module are done. */ | ||
767 | if (de->pde_users > 0) { | ||
768 | DECLARE_COMPLETION_ONSTACK(c); | ||
769 | |||
770 | if (!de->pde_unload_completion) | ||
771 | de->pde_unload_completion = &c; | ||
772 | |||
773 | spin_unlock(&de->pde_unload_lock); | ||
774 | |||
775 | wait_for_completion(de->pde_unload_completion); | ||
776 | |||
777 | spin_lock(&de->pde_unload_lock); | ||
778 | } | ||
779 | |||
780 | while (!list_empty(&de->pde_openers)) { | ||
781 | struct pde_opener *pdeo; | ||
782 | |||
783 | pdeo = list_first_entry(&de->pde_openers, struct pde_opener, lh); | ||
784 | list_del(&pdeo->lh); | ||
785 | spin_unlock(&de->pde_unload_lock); | ||
786 | pdeo->release(pdeo->inode, pdeo->file); | ||
787 | kfree(pdeo); | ||
788 | spin_lock(&de->pde_unload_lock); | ||
789 | } | ||
790 | spin_unlock(&de->pde_unload_lock); | ||
791 | } | ||
792 | |||
793 | /* | 524 | /* |
794 | * Remove a /proc entry and free it if it's not currently in use. | 525 | * Remove a /proc entry and free it if it's not currently in use. |
795 | */ | 526 | */ |
@@ -821,7 +552,7 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent) | |||
821 | return; | 552 | return; |
822 | } | 553 | } |
823 | 554 | ||
824 | entry_rundown(de); | 555 | proc_entry_rundown(de); |
825 | 556 | ||
826 | if (S_ISDIR(de->mode)) | 557 | if (S_ISDIR(de->mode)) |
827 | parent->nlink--; | 558 | parent->nlink--; |
@@ -870,7 +601,7 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) | |||
870 | } | 601 | } |
871 | spin_unlock(&proc_subdir_lock); | 602 | spin_unlock(&proc_subdir_lock); |
872 | 603 | ||
873 | entry_rundown(de); | 604 | proc_entry_rundown(de); |
874 | next = de->parent; | 605 | next = de->parent; |
875 | if (S_ISDIR(de->mode)) | 606 | if (S_ISDIR(de->mode)) |
876 | next->nlink--; | 607 | next->nlink--; |
@@ -886,3 +617,23 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) | |||
886 | return 0; | 617 | return 0; |
887 | } | 618 | } |
888 | EXPORT_SYMBOL(remove_proc_subtree); | 619 | EXPORT_SYMBOL(remove_proc_subtree); |
620 | |||
621 | void *proc_get_parent_data(const struct inode *inode) | ||
622 | { | ||
623 | struct proc_dir_entry *de = PDE(inode); | ||
624 | return de->parent->data; | ||
625 | } | ||
626 | EXPORT_SYMBOL_GPL(proc_get_parent_data); | ||
627 | |||
628 | void proc_remove(struct proc_dir_entry *de) | ||
629 | { | ||
630 | if (de) | ||
631 | remove_proc_subtree(de->name, de->parent); | ||
632 | } | ||
633 | EXPORT_SYMBOL(proc_remove); | ||
634 | |||
635 | void *PDE_DATA(const struct inode *inode) | ||
636 | { | ||
637 | return __PDE_DATA(inode); | ||
638 | } | ||
639 | EXPORT_SYMBOL(PDE_DATA); | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 869116c2afbe..073aea60cf8f 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/mount.h> | 24 | #include <linux/mount.h> |
25 | #include <linux/magic.h> | ||
25 | 26 | ||
26 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
27 | 28 | ||
@@ -50,8 +51,8 @@ static void proc_evict_inode(struct inode *inode) | |||
50 | sysctl_head_put(head); | 51 | sysctl_head_put(head); |
51 | } | 52 | } |
52 | /* Release any associated namespace */ | 53 | /* Release any associated namespace */ |
53 | ns_ops = PROC_I(inode)->ns_ops; | 54 | ns_ops = PROC_I(inode)->ns.ns_ops; |
54 | ns = PROC_I(inode)->ns; | 55 | ns = PROC_I(inode)->ns.ns; |
55 | if (ns_ops && ns) | 56 | if (ns_ops && ns) |
56 | ns_ops->put(ns); | 57 | ns_ops->put(ns); |
57 | } | 58 | } |
@@ -72,8 +73,8 @@ static struct inode *proc_alloc_inode(struct super_block *sb) | |||
72 | ei->pde = NULL; | 73 | ei->pde = NULL; |
73 | ei->sysctl = NULL; | 74 | ei->sysctl = NULL; |
74 | ei->sysctl_entry = NULL; | 75 | ei->sysctl_entry = NULL; |
75 | ei->ns = NULL; | 76 | ei->ns.ns = NULL; |
76 | ei->ns_ops = NULL; | 77 | ei->ns.ns_ops = NULL; |
77 | inode = &ei->vfs_inode; | 78 | inode = &ei->vfs_inode; |
78 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 79 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
79 | return inode; | 80 | return inode; |
@@ -129,96 +130,100 @@ static const struct super_operations proc_sops = { | |||
129 | .show_options = proc_show_options, | 130 | .show_options = proc_show_options, |
130 | }; | 131 | }; |
131 | 132 | ||
132 | static void __pde_users_dec(struct proc_dir_entry *pde) | 133 | enum {BIAS = -1U<<31}; |
134 | |||
135 | static inline int use_pde(struct proc_dir_entry *pde) | ||
136 | { | ||
137 | return atomic_inc_unless_negative(&pde->in_use); | ||
138 | } | ||
139 | |||
140 | static void unuse_pde(struct proc_dir_entry *pde) | ||
133 | { | 141 | { |
134 | pde->pde_users--; | 142 | if (atomic_dec_return(&pde->in_use) == BIAS) |
135 | if (pde->pde_unload_completion && pde->pde_users == 0) | ||
136 | complete(pde->pde_unload_completion); | 143 | complete(pde->pde_unload_completion); |
137 | } | 144 | } |
138 | 145 | ||
139 | void pde_users_dec(struct proc_dir_entry *pde) | 146 | /* pde is locked */ |
147 | static void close_pdeo(struct proc_dir_entry *pde, struct pde_opener *pdeo) | ||
140 | { | 148 | { |
141 | spin_lock(&pde->pde_unload_lock); | 149 | if (pdeo->closing) { |
142 | __pde_users_dec(pde); | 150 | /* somebody else is doing that, just wait */ |
143 | spin_unlock(&pde->pde_unload_lock); | 151 | DECLARE_COMPLETION_ONSTACK(c); |
152 | pdeo->c = &c; | ||
153 | spin_unlock(&pde->pde_unload_lock); | ||
154 | wait_for_completion(&c); | ||
155 | spin_lock(&pde->pde_unload_lock); | ||
156 | } else { | ||
157 | struct file *file; | ||
158 | pdeo->closing = 1; | ||
159 | spin_unlock(&pde->pde_unload_lock); | ||
160 | file = pdeo->file; | ||
161 | pde->proc_fops->release(file_inode(file), file); | ||
162 | spin_lock(&pde->pde_unload_lock); | ||
163 | list_del_init(&pdeo->lh); | ||
164 | if (pdeo->c) | ||
165 | complete(pdeo->c); | ||
166 | kfree(pdeo); | ||
167 | } | ||
168 | } | ||
169 | |||
170 | void proc_entry_rundown(struct proc_dir_entry *de) | ||
171 | { | ||
172 | DECLARE_COMPLETION_ONSTACK(c); | ||
173 | /* Wait until all existing callers into module are done. */ | ||
174 | de->pde_unload_completion = &c; | ||
175 | if (atomic_add_return(BIAS, &de->in_use) != BIAS) | ||
176 | wait_for_completion(&c); | ||
177 | |||
178 | spin_lock(&de->pde_unload_lock); | ||
179 | while (!list_empty(&de->pde_openers)) { | ||
180 | struct pde_opener *pdeo; | ||
181 | pdeo = list_first_entry(&de->pde_openers, struct pde_opener, lh); | ||
182 | close_pdeo(de, pdeo); | ||
183 | } | ||
184 | spin_unlock(&de->pde_unload_lock); | ||
144 | } | 185 | } |
145 | 186 | ||
146 | static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | 187 | static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) |
147 | { | 188 | { |
148 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 189 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
149 | loff_t rv = -EINVAL; | 190 | loff_t rv = -EINVAL; |
150 | loff_t (*llseek)(struct file *, loff_t, int); | 191 | if (use_pde(pde)) { |
151 | 192 | loff_t (*llseek)(struct file *, loff_t, int); | |
152 | spin_lock(&pde->pde_unload_lock); | 193 | llseek = pde->proc_fops->llseek; |
153 | /* | 194 | if (!llseek) |
154 | * remove_proc_entry() is going to delete PDE (as part of module | 195 | llseek = default_llseek; |
155 | * cleanup sequence). No new callers into module allowed. | 196 | rv = llseek(file, offset, whence); |
156 | */ | 197 | unuse_pde(pde); |
157 | if (!pde->proc_fops) { | ||
158 | spin_unlock(&pde->pde_unload_lock); | ||
159 | return rv; | ||
160 | } | 198 | } |
161 | /* | ||
162 | * Bump refcount so that remove_proc_entry will wail for ->llseek to | ||
163 | * complete. | ||
164 | */ | ||
165 | pde->pde_users++; | ||
166 | /* | ||
167 | * Save function pointer under lock, to protect against ->proc_fops | ||
168 | * NULL'ifying right after ->pde_unload_lock is dropped. | ||
169 | */ | ||
170 | llseek = pde->proc_fops->llseek; | ||
171 | spin_unlock(&pde->pde_unload_lock); | ||
172 | |||
173 | if (!llseek) | ||
174 | llseek = default_llseek; | ||
175 | rv = llseek(file, offset, whence); | ||
176 | |||
177 | pde_users_dec(pde); | ||
178 | return rv; | 199 | return rv; |
179 | } | 200 | } |
180 | 201 | ||
181 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 202 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
182 | { | 203 | { |
204 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | ||
183 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 205 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
184 | ssize_t rv = -EIO; | 206 | ssize_t rv = -EIO; |
185 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | 207 | if (use_pde(pde)) { |
186 | 208 | read = pde->proc_fops->read; | |
187 | spin_lock(&pde->pde_unload_lock); | 209 | if (read) |
188 | if (!pde->proc_fops) { | 210 | rv = read(file, buf, count, ppos); |
189 | spin_unlock(&pde->pde_unload_lock); | 211 | unuse_pde(pde); |
190 | return rv; | ||
191 | } | 212 | } |
192 | pde->pde_users++; | ||
193 | read = pde->proc_fops->read; | ||
194 | spin_unlock(&pde->pde_unload_lock); | ||
195 | |||
196 | if (read) | ||
197 | rv = read(file, buf, count, ppos); | ||
198 | |||
199 | pde_users_dec(pde); | ||
200 | return rv; | 213 | return rv; |
201 | } | 214 | } |
202 | 215 | ||
203 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 216 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
204 | { | 217 | { |
218 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | ||
205 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 219 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
206 | ssize_t rv = -EIO; | 220 | ssize_t rv = -EIO; |
207 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | 221 | if (use_pde(pde)) { |
208 | 222 | write = pde->proc_fops->write; | |
209 | spin_lock(&pde->pde_unload_lock); | 223 | if (write) |
210 | if (!pde->proc_fops) { | 224 | rv = write(file, buf, count, ppos); |
211 | spin_unlock(&pde->pde_unload_lock); | 225 | unuse_pde(pde); |
212 | return rv; | ||
213 | } | 226 | } |
214 | pde->pde_users++; | ||
215 | write = pde->proc_fops->write; | ||
216 | spin_unlock(&pde->pde_unload_lock); | ||
217 | |||
218 | if (write) | ||
219 | rv = write(file, buf, count, ppos); | ||
220 | |||
221 | pde_users_dec(pde); | ||
222 | return rv; | 227 | return rv; |
223 | } | 228 | } |
224 | 229 | ||
@@ -227,20 +232,12 @@ static unsigned int proc_reg_poll(struct file *file, struct poll_table_struct *p | |||
227 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 232 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
228 | unsigned int rv = DEFAULT_POLLMASK; | 233 | unsigned int rv = DEFAULT_POLLMASK; |
229 | unsigned int (*poll)(struct file *, struct poll_table_struct *); | 234 | unsigned int (*poll)(struct file *, struct poll_table_struct *); |
230 | 235 | if (use_pde(pde)) { | |
231 | spin_lock(&pde->pde_unload_lock); | 236 | poll = pde->proc_fops->poll; |
232 | if (!pde->proc_fops) { | 237 | if (poll) |
233 | spin_unlock(&pde->pde_unload_lock); | 238 | rv = poll(file, pts); |
234 | return rv; | 239 | unuse_pde(pde); |
235 | } | 240 | } |
236 | pde->pde_users++; | ||
237 | poll = pde->proc_fops->poll; | ||
238 | spin_unlock(&pde->pde_unload_lock); | ||
239 | |||
240 | if (poll) | ||
241 | rv = poll(file, pts); | ||
242 | |||
243 | pde_users_dec(pde); | ||
244 | return rv; | 241 | return rv; |
245 | } | 242 | } |
246 | 243 | ||
@@ -249,20 +246,12 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne | |||
249 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 246 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
250 | long rv = -ENOTTY; | 247 | long rv = -ENOTTY; |
251 | long (*ioctl)(struct file *, unsigned int, unsigned long); | 248 | long (*ioctl)(struct file *, unsigned int, unsigned long); |
252 | 249 | if (use_pde(pde)) { | |
253 | spin_lock(&pde->pde_unload_lock); | 250 | ioctl = pde->proc_fops->unlocked_ioctl; |
254 | if (!pde->proc_fops) { | 251 | if (ioctl) |
255 | spin_unlock(&pde->pde_unload_lock); | 252 | rv = ioctl(file, cmd, arg); |
256 | return rv; | 253 | unuse_pde(pde); |
257 | } | 254 | } |
258 | pde->pde_users++; | ||
259 | ioctl = pde->proc_fops->unlocked_ioctl; | ||
260 | spin_unlock(&pde->pde_unload_lock); | ||
261 | |||
262 | if (ioctl) | ||
263 | rv = ioctl(file, cmd, arg); | ||
264 | |||
265 | pde_users_dec(pde); | ||
266 | return rv; | 255 | return rv; |
267 | } | 256 | } |
268 | 257 | ||
@@ -272,20 +261,12 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned | |||
272 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 261 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
273 | long rv = -ENOTTY; | 262 | long rv = -ENOTTY; |
274 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); | 263 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); |
275 | 264 | if (use_pde(pde)) { | |
276 | spin_lock(&pde->pde_unload_lock); | 265 | compat_ioctl = pde->proc_fops->compat_ioctl; |
277 | if (!pde->proc_fops) { | 266 | if (compat_ioctl) |
278 | spin_unlock(&pde->pde_unload_lock); | 267 | rv = compat_ioctl(file, cmd, arg); |
279 | return rv; | 268 | unuse_pde(pde); |
280 | } | 269 | } |
281 | pde->pde_users++; | ||
282 | compat_ioctl = pde->proc_fops->compat_ioctl; | ||
283 | spin_unlock(&pde->pde_unload_lock); | ||
284 | |||
285 | if (compat_ioctl) | ||
286 | rv = compat_ioctl(file, cmd, arg); | ||
287 | |||
288 | pde_users_dec(pde); | ||
289 | return rv; | 270 | return rv; |
290 | } | 271 | } |
291 | #endif | 272 | #endif |
@@ -295,20 +276,12 @@ static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) | |||
295 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 276 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
296 | int rv = -EIO; | 277 | int rv = -EIO; |
297 | int (*mmap)(struct file *, struct vm_area_struct *); | 278 | int (*mmap)(struct file *, struct vm_area_struct *); |
298 | 279 | if (use_pde(pde)) { | |
299 | spin_lock(&pde->pde_unload_lock); | 280 | mmap = pde->proc_fops->mmap; |
300 | if (!pde->proc_fops) { | 281 | if (mmap) |
301 | spin_unlock(&pde->pde_unload_lock); | 282 | rv = mmap(file, vma); |
302 | return rv; | 283 | unuse_pde(pde); |
303 | } | 284 | } |
304 | pde->pde_users++; | ||
305 | mmap = pde->proc_fops->mmap; | ||
306 | spin_unlock(&pde->pde_unload_lock); | ||
307 | |||
308 | if (mmap) | ||
309 | rv = mmap(file, vma); | ||
310 | |||
311 | pde_users_dec(pde); | ||
312 | return rv; | 285 | return rv; |
313 | } | 286 | } |
314 | 287 | ||
@@ -330,91 +303,47 @@ static int proc_reg_open(struct inode *inode, struct file *file) | |||
330 | * by hand in remove_proc_entry(). For this, save opener's credentials | 303 | * by hand in remove_proc_entry(). For this, save opener's credentials |
331 | * for later. | 304 | * for later. |
332 | */ | 305 | */ |
333 | pdeo = kmalloc(sizeof(struct pde_opener), GFP_KERNEL); | 306 | pdeo = kzalloc(sizeof(struct pde_opener), GFP_KERNEL); |
334 | if (!pdeo) | 307 | if (!pdeo) |
335 | return -ENOMEM; | 308 | return -ENOMEM; |
336 | 309 | ||
337 | spin_lock(&pde->pde_unload_lock); | 310 | if (!use_pde(pde)) { |
338 | if (!pde->proc_fops) { | ||
339 | spin_unlock(&pde->pde_unload_lock); | ||
340 | kfree(pdeo); | 311 | kfree(pdeo); |
341 | return -ENOENT; | 312 | return -ENOENT; |
342 | } | 313 | } |
343 | pde->pde_users++; | ||
344 | open = pde->proc_fops->open; | 314 | open = pde->proc_fops->open; |
345 | release = pde->proc_fops->release; | 315 | release = pde->proc_fops->release; |
346 | spin_unlock(&pde->pde_unload_lock); | ||
347 | 316 | ||
348 | if (open) | 317 | if (open) |
349 | rv = open(inode, file); | 318 | rv = open(inode, file); |
350 | 319 | ||
351 | spin_lock(&pde->pde_unload_lock); | ||
352 | if (rv == 0 && release) { | 320 | if (rv == 0 && release) { |
353 | /* To know what to release. */ | 321 | /* To know what to release. */ |
354 | pdeo->inode = inode; | ||
355 | pdeo->file = file; | 322 | pdeo->file = file; |
356 | /* Strictly for "too late" ->release in proc_reg_release(). */ | 323 | /* Strictly for "too late" ->release in proc_reg_release(). */ |
357 | pdeo->release = release; | 324 | spin_lock(&pde->pde_unload_lock); |
358 | list_add(&pdeo->lh, &pde->pde_openers); | 325 | list_add(&pdeo->lh, &pde->pde_openers); |
326 | spin_unlock(&pde->pde_unload_lock); | ||
359 | } else | 327 | } else |
360 | kfree(pdeo); | 328 | kfree(pdeo); |
361 | __pde_users_dec(pde); | ||
362 | spin_unlock(&pde->pde_unload_lock); | ||
363 | return rv; | ||
364 | } | ||
365 | |||
366 | static struct pde_opener *find_pde_opener(struct proc_dir_entry *pde, | ||
367 | struct inode *inode, struct file *file) | ||
368 | { | ||
369 | struct pde_opener *pdeo; | ||
370 | 329 | ||
371 | list_for_each_entry(pdeo, &pde->pde_openers, lh) { | 330 | unuse_pde(pde); |
372 | if (pdeo->inode == inode && pdeo->file == file) | 331 | return rv; |
373 | return pdeo; | ||
374 | } | ||
375 | return NULL; | ||
376 | } | 332 | } |
377 | 333 | ||
378 | static int proc_reg_release(struct inode *inode, struct file *file) | 334 | static int proc_reg_release(struct inode *inode, struct file *file) |
379 | { | 335 | { |
380 | struct proc_dir_entry *pde = PDE(inode); | 336 | struct proc_dir_entry *pde = PDE(inode); |
381 | int rv = 0; | ||
382 | int (*release)(struct inode *, struct file *); | ||
383 | struct pde_opener *pdeo; | 337 | struct pde_opener *pdeo; |
384 | |||
385 | spin_lock(&pde->pde_unload_lock); | 338 | spin_lock(&pde->pde_unload_lock); |
386 | pdeo = find_pde_opener(pde, inode, file); | 339 | list_for_each_entry(pdeo, &pde->pde_openers, lh) { |
387 | if (!pde->proc_fops) { | 340 | if (pdeo->file == file) { |
388 | /* | 341 | close_pdeo(pde, pdeo); |
389 | * Can't simply exit, __fput() will think that everything is OK, | 342 | break; |
390 | * and move on to freeing struct file. remove_proc_entry() will | 343 | } |
391 | * find slacker in opener's list and will try to do non-trivial | ||
392 | * things with struct file. Therefore, remove opener from list. | ||
393 | * | ||
394 | * But if opener is removed from list, who will ->release it? | ||
395 | */ | ||
396 | if (pdeo) { | ||
397 | list_del(&pdeo->lh); | ||
398 | spin_unlock(&pde->pde_unload_lock); | ||
399 | rv = pdeo->release(inode, file); | ||
400 | kfree(pdeo); | ||
401 | } else | ||
402 | spin_unlock(&pde->pde_unload_lock); | ||
403 | return rv; | ||
404 | } | ||
405 | pde->pde_users++; | ||
406 | release = pde->proc_fops->release; | ||
407 | if (pdeo) { | ||
408 | list_del(&pdeo->lh); | ||
409 | kfree(pdeo); | ||
410 | } | 344 | } |
411 | spin_unlock(&pde->pde_unload_lock); | 345 | spin_unlock(&pde->pde_unload_lock); |
412 | 346 | return 0; | |
413 | if (release) | ||
414 | rv = release(inode, file); | ||
415 | |||
416 | pde_users_dec(pde); | ||
417 | return rv; | ||
418 | } | 347 | } |
419 | 348 | ||
420 | static const struct file_operations proc_reg_file_ops = { | 349 | static const struct file_operations proc_reg_file_ops = { |
@@ -462,8 +391,8 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | |||
462 | inode->i_size = de->size; | 391 | inode->i_size = de->size; |
463 | if (de->nlink) | 392 | if (de->nlink) |
464 | set_nlink(inode, de->nlink); | 393 | set_nlink(inode, de->nlink); |
465 | if (de->proc_iops) | 394 | WARN_ON(!de->proc_iops); |
466 | inode->i_op = de->proc_iops; | 395 | inode->i_op = de->proc_iops; |
467 | if (de->proc_fops) { | 396 | if (de->proc_fops) { |
468 | if (S_ISREG(inode->i_mode)) { | 397 | if (S_ISREG(inode->i_mode)) { |
469 | #ifdef CONFIG_COMPAT | 398 | #ifdef CONFIG_COMPAT |
@@ -506,5 +435,5 @@ int proc_fill_super(struct super_block *s) | |||
506 | return -ENOMEM; | 435 | return -ENOMEM; |
507 | } | 436 | } |
508 | 437 | ||
509 | return 0; | 438 | return proc_setup_self(s); |
510 | } | 439 | } |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 75710357a517..d600fb098b6a 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* internal.h: internal procfs definitions | 1 | /* Internal procfs definitions |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
@@ -9,62 +9,83 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | #include <linux/proc_ns.h> | ||
14 | #include <linux/spinlock.h> | ||
15 | #include <linux/atomic.h> | ||
14 | #include <linux/binfmts.h> | 16 | #include <linux/binfmts.h> |
15 | struct ctl_table_header; | ||
16 | struct mempolicy; | ||
17 | 17 | ||
18 | extern struct proc_dir_entry proc_root; | 18 | struct ctl_table_header; |
19 | extern void proc_self_init(void); | 19 | struct mempolicy; |
20 | #ifdef CONFIG_PROC_SYSCTL | ||
21 | extern int proc_sys_init(void); | ||
22 | extern void sysctl_head_put(struct ctl_table_header *head); | ||
23 | #else | ||
24 | static inline void proc_sys_init(void) { } | ||
25 | static inline void sysctl_head_put(struct ctl_table_header *head) { } | ||
26 | #endif | ||
27 | #ifdef CONFIG_NET | ||
28 | extern int proc_net_init(void); | ||
29 | #else | ||
30 | static inline int proc_net_init(void) { return 0; } | ||
31 | #endif | ||
32 | 20 | ||
33 | extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, | 21 | /* |
34 | struct pid *pid, struct task_struct *task); | 22 | * This is not completely implemented yet. The idea is to |
35 | extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, | 23 | * create an in-memory tree (like the actual /proc filesystem |
36 | struct pid *pid, struct task_struct *task); | 24 | * tree) of these proc_dir_entries, so that we can dynamically |
37 | extern int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | 25 | * add new files to /proc. |
38 | struct pid *pid, struct task_struct *task); | 26 | * |
39 | extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, | 27 | * The "next" pointer creates a linked list of one /proc directory, |
40 | struct pid *pid, struct task_struct *task); | 28 | * while parent/subdir create the directory structure (every |
41 | extern loff_t mem_lseek(struct file *file, loff_t offset, int orig); | 29 | * /proc file has a parent, but "subdir" is NULL for all |
30 | * non-directory entries). | ||
31 | */ | ||
32 | struct proc_dir_entry { | ||
33 | unsigned int low_ino; | ||
34 | umode_t mode; | ||
35 | nlink_t nlink; | ||
36 | kuid_t uid; | ||
37 | kgid_t gid; | ||
38 | loff_t size; | ||
39 | const struct inode_operations *proc_iops; | ||
40 | const struct file_operations *proc_fops; | ||
41 | struct proc_dir_entry *next, *parent, *subdir; | ||
42 | void *data; | ||
43 | atomic_t count; /* use count */ | ||
44 | atomic_t in_use; /* number of callers into module in progress; */ | ||
45 | /* negative -> it's going away RSN */ | ||
46 | struct completion *pde_unload_completion; | ||
47 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
48 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | ||
49 | u8 namelen; | ||
50 | char name[]; | ||
51 | }; | ||
42 | 52 | ||
43 | extern const struct file_operations proc_tid_children_operations; | 53 | union proc_op { |
44 | extern const struct file_operations proc_pid_maps_operations; | 54 | int (*proc_get_link)(struct dentry *, struct path *); |
45 | extern const struct file_operations proc_tid_maps_operations; | 55 | int (*proc_read)(struct task_struct *task, char *page); |
46 | extern const struct file_operations proc_pid_numa_maps_operations; | 56 | int (*proc_show)(struct seq_file *m, |
47 | extern const struct file_operations proc_tid_numa_maps_operations; | 57 | struct pid_namespace *ns, struct pid *pid, |
48 | extern const struct file_operations proc_pid_smaps_operations; | 58 | struct task_struct *task); |
49 | extern const struct file_operations proc_tid_smaps_operations; | 59 | }; |
50 | extern const struct file_operations proc_clear_refs_operations; | ||
51 | extern const struct file_operations proc_pagemap_operations; | ||
52 | extern const struct file_operations proc_net_operations; | ||
53 | extern const struct inode_operations proc_net_inode_operations; | ||
54 | extern const struct inode_operations proc_pid_link_inode_operations; | ||
55 | 60 | ||
56 | struct proc_maps_private { | 61 | struct proc_inode { |
57 | struct pid *pid; | 62 | struct pid *pid; |
58 | struct task_struct *task; | 63 | int fd; |
59 | #ifdef CONFIG_MMU | 64 | union proc_op op; |
60 | struct vm_area_struct *tail_vma; | 65 | struct proc_dir_entry *pde; |
61 | #endif | 66 | struct ctl_table_header *sysctl; |
62 | #ifdef CONFIG_NUMA | 67 | struct ctl_table *sysctl_entry; |
63 | struct mempolicy *task_mempolicy; | 68 | struct proc_ns ns; |
64 | #endif | 69 | struct inode vfs_inode; |
65 | }; | 70 | }; |
66 | 71 | ||
67 | void proc_init_inodecache(void); | 72 | /* |
73 | * General functions | ||
74 | */ | ||
75 | static inline struct proc_inode *PROC_I(const struct inode *inode) | ||
76 | { | ||
77 | return container_of(inode, struct proc_inode, vfs_inode); | ||
78 | } | ||
79 | |||
80 | static inline struct proc_dir_entry *PDE(const struct inode *inode) | ||
81 | { | ||
82 | return PROC_I(inode)->pde; | ||
83 | } | ||
84 | |||
85 | static inline void *__PDE_DATA(const struct inode *inode) | ||
86 | { | ||
87 | return PDE(inode)->data; | ||
88 | } | ||
68 | 89 | ||
69 | static inline struct pid *proc_pid(struct inode *inode) | 90 | static inline struct pid *proc_pid(struct inode *inode) |
70 | { | 91 | { |
@@ -76,11 +97,6 @@ static inline struct task_struct *get_proc_task(struct inode *inode) | |||
76 | return get_pid_task(proc_pid(inode), PIDTYPE_PID); | 97 | return get_pid_task(proc_pid(inode), PIDTYPE_PID); |
77 | } | 98 | } |
78 | 99 | ||
79 | static inline int proc_fd(struct inode *inode) | ||
80 | { | ||
81 | return PROC_I(inode)->fd; | ||
82 | } | ||
83 | |||
84 | static inline int task_dumpable(struct task_struct *task) | 100 | static inline int task_dumpable(struct task_struct *task) |
85 | { | 101 | { |
86 | int dumpable = 0; | 102 | int dumpable = 0; |
@@ -96,15 +112,6 @@ static inline int task_dumpable(struct task_struct *task) | |||
96 | return 0; | 112 | return 0; |
97 | } | 113 | } |
98 | 114 | ||
99 | static inline int pid_delete_dentry(const struct dentry * dentry) | ||
100 | { | ||
101 | /* Is the task we represent dead? | ||
102 | * If so, then don't put the dentry on the lru list, | ||
103 | * kill it immediately. | ||
104 | */ | ||
105 | return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first; | ||
106 | } | ||
107 | |||
108 | static inline unsigned name_to_int(struct dentry *dentry) | 115 | static inline unsigned name_to_int(struct dentry *dentry) |
109 | { | 116 | { |
110 | const char *name = dentry->d_name.name; | 117 | const char *name = dentry->d_name.name; |
@@ -127,63 +134,165 @@ out: | |||
127 | return ~0U; | 134 | return ~0U; |
128 | } | 135 | } |
129 | 136 | ||
130 | struct dentry *proc_lookup_de(struct proc_dir_entry *de, struct inode *ino, | 137 | /* |
131 | struct dentry *dentry); | 138 | * Offset of the first process in the /proc root directory.. |
132 | int proc_readdir_de(struct proc_dir_entry *de, struct file *filp, void *dirent, | 139 | */ |
133 | filldir_t filldir); | 140 | #define FIRST_PROCESS_ENTRY 256 |
141 | |||
142 | /* Worst case buffer size needed for holding an integer. */ | ||
143 | #define PROC_NUMBUF 13 | ||
134 | 144 | ||
135 | struct pde_opener { | 145 | /* |
136 | struct inode *inode; | 146 | * array.c |
137 | struct file *file; | 147 | */ |
138 | int (*release)(struct inode *, struct file *); | 148 | extern const struct file_operations proc_tid_children_operations; |
139 | struct list_head lh; | ||
140 | }; | ||
141 | void pde_users_dec(struct proc_dir_entry *pde); | ||
142 | 149 | ||
150 | extern int proc_tid_stat(struct seq_file *, struct pid_namespace *, | ||
151 | struct pid *, struct task_struct *); | ||
152 | extern int proc_tgid_stat(struct seq_file *, struct pid_namespace *, | ||
153 | struct pid *, struct task_struct *); | ||
154 | extern int proc_pid_status(struct seq_file *, struct pid_namespace *, | ||
155 | struct pid *, struct task_struct *); | ||
156 | extern int proc_pid_statm(struct seq_file *, struct pid_namespace *, | ||
157 | struct pid *, struct task_struct *); | ||
158 | |||
159 | /* | ||
160 | * base.c | ||
161 | */ | ||
162 | extern const struct dentry_operations pid_dentry_operations; | ||
163 | extern int pid_getattr(struct vfsmount *, struct dentry *, struct kstat *); | ||
164 | extern int proc_setattr(struct dentry *, struct iattr *); | ||
165 | extern struct inode *proc_pid_make_inode(struct super_block *, struct task_struct *); | ||
166 | extern int pid_revalidate(struct dentry *, unsigned int); | ||
167 | extern int pid_delete_dentry(const struct dentry *); | ||
168 | extern int proc_pid_readdir(struct file *, void *, filldir_t); | ||
169 | extern struct dentry *proc_pid_lookup(struct inode *, struct dentry *, unsigned int); | ||
170 | extern loff_t mem_lseek(struct file *, loff_t, int); | ||
171 | |||
172 | /* Lookups */ | ||
173 | typedef struct dentry *instantiate_t(struct inode *, struct dentry *, | ||
174 | struct task_struct *, const void *); | ||
175 | extern int proc_fill_cache(struct file *, void *, filldir_t, const char *, int, | ||
176 | instantiate_t, struct task_struct *, const void *); | ||
177 | |||
178 | /* | ||
179 | * generic.c | ||
180 | */ | ||
143 | extern spinlock_t proc_subdir_lock; | 181 | extern spinlock_t proc_subdir_lock; |
144 | 182 | ||
145 | struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int); | 183 | extern struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); |
146 | int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); | 184 | extern struct dentry *proc_lookup_de(struct proc_dir_entry *, struct inode *, |
147 | unsigned long task_vsize(struct mm_struct *); | 185 | struct dentry *); |
148 | unsigned long task_statm(struct mm_struct *, | 186 | extern int proc_readdir(struct file *, void *, filldir_t); |
149 | unsigned long *, unsigned long *, unsigned long *, unsigned long *); | 187 | extern int proc_readdir_de(struct proc_dir_entry *, struct file *, void *, filldir_t); |
150 | void task_mem(struct seq_file *, struct mm_struct *); | ||
151 | 188 | ||
152 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) | 189 | static inline struct proc_dir_entry *pde_get(struct proc_dir_entry *pde) |
153 | { | 190 | { |
154 | atomic_inc(&pde->count); | 191 | atomic_inc(&pde->count); |
155 | return pde; | 192 | return pde; |
156 | } | 193 | } |
157 | void pde_put(struct proc_dir_entry *pde); | 194 | extern void pde_put(struct proc_dir_entry *); |
158 | |||
159 | int proc_fill_super(struct super_block *); | ||
160 | struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); | ||
161 | int proc_remount(struct super_block *sb, int *flags, char *data); | ||
162 | 195 | ||
163 | /* | 196 | /* |
164 | * These are generic /proc routines that use the internal | 197 | * inode.c |
165 | * "struct proc_dir_entry" tree to traverse the filesystem. | ||
166 | * | ||
167 | * The /proc root directory has extended versions to take care | ||
168 | * of the /proc/<pid> subdirectories. | ||
169 | */ | 198 | */ |
170 | int proc_readdir(struct file *, void *, filldir_t); | 199 | struct pde_opener { |
171 | struct dentry *proc_lookup(struct inode *, struct dentry *, unsigned int); | 200 | struct file *file; |
201 | struct list_head lh; | ||
202 | int closing; | ||
203 | struct completion *c; | ||
204 | }; | ||
172 | 205 | ||
206 | extern const struct inode_operations proc_pid_link_inode_operations; | ||
173 | 207 | ||
208 | extern void proc_init_inodecache(void); | ||
209 | extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); | ||
210 | extern int proc_fill_super(struct super_block *); | ||
211 | extern void proc_entry_rundown(struct proc_dir_entry *); | ||
174 | 212 | ||
175 | /* Lookups */ | 213 | /* |
176 | typedef struct dentry *instantiate_t(struct inode *, struct dentry *, | 214 | * proc_devtree.c |
177 | struct task_struct *, const void *); | 215 | */ |
178 | int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir, | 216 | #ifdef CONFIG_PROC_DEVICETREE |
179 | const char *name, int len, | 217 | extern void proc_device_tree_init(void); |
180 | instantiate_t instantiate, struct task_struct *task, const void *ptr); | 218 | #endif |
181 | int pid_revalidate(struct dentry *dentry, unsigned int flags); | ||
182 | struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task); | ||
183 | extern const struct dentry_operations pid_dentry_operations; | ||
184 | int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); | ||
185 | int proc_setattr(struct dentry *dentry, struct iattr *attr); | ||
186 | 219 | ||
220 | /* | ||
221 | * proc_namespaces.c | ||
222 | */ | ||
187 | extern const struct inode_operations proc_ns_dir_inode_operations; | 223 | extern const struct inode_operations proc_ns_dir_inode_operations; |
188 | extern const struct file_operations proc_ns_dir_operations; | 224 | extern const struct file_operations proc_ns_dir_operations; |
189 | 225 | ||
226 | /* | ||
227 | * proc_net.c | ||
228 | */ | ||
229 | extern const struct file_operations proc_net_operations; | ||
230 | extern const struct inode_operations proc_net_inode_operations; | ||
231 | |||
232 | #ifdef CONFIG_NET | ||
233 | extern int proc_net_init(void); | ||
234 | #else | ||
235 | static inline int proc_net_init(void) { return 0; } | ||
236 | #endif | ||
237 | |||
238 | /* | ||
239 | * proc_self.c | ||
240 | */ | ||
241 | extern int proc_setup_self(struct super_block *); | ||
242 | |||
243 | /* | ||
244 | * proc_sysctl.c | ||
245 | */ | ||
246 | #ifdef CONFIG_PROC_SYSCTL | ||
247 | extern int proc_sys_init(void); | ||
248 | extern void sysctl_head_put(struct ctl_table_header *); | ||
249 | #else | ||
250 | static inline void proc_sys_init(void) { } | ||
251 | static inline void sysctl_head_put(struct ctl_table_header *head) { } | ||
252 | #endif | ||
253 | |||
254 | /* | ||
255 | * proc_tty.c | ||
256 | */ | ||
257 | #ifdef CONFIG_TTY | ||
258 | extern void proc_tty_init(void); | ||
259 | #else | ||
260 | static inline void proc_tty_init(void) {} | ||
261 | #endif | ||
262 | |||
263 | /* | ||
264 | * root.c | ||
265 | */ | ||
266 | extern struct proc_dir_entry proc_root; | ||
267 | |||
268 | extern void proc_self_init(void); | ||
269 | extern int proc_remount(struct super_block *, int *, char *); | ||
270 | |||
271 | /* | ||
272 | * task_[no]mmu.c | ||
273 | */ | ||
274 | struct proc_maps_private { | ||
275 | struct pid *pid; | ||
276 | struct task_struct *task; | ||
277 | #ifdef CONFIG_MMU | ||
278 | struct vm_area_struct *tail_vma; | ||
279 | #endif | ||
280 | #ifdef CONFIG_NUMA | ||
281 | struct mempolicy *task_mempolicy; | ||
282 | #endif | ||
283 | }; | ||
284 | |||
285 | extern const struct file_operations proc_pid_maps_operations; | ||
286 | extern const struct file_operations proc_tid_maps_operations; | ||
287 | extern const struct file_operations proc_pid_numa_maps_operations; | ||
288 | extern const struct file_operations proc_tid_numa_maps_operations; | ||
289 | extern const struct file_operations proc_pid_smaps_operations; | ||
290 | extern const struct file_operations proc_tid_smaps_operations; | ||
291 | extern const struct file_operations proc_clear_refs_operations; | ||
292 | extern const struct file_operations proc_pagemap_operations; | ||
293 | |||
294 | extern unsigned long task_vsize(struct mm_struct *); | ||
295 | extern unsigned long task_statm(struct mm_struct *, | ||
296 | unsigned long *, unsigned long *, | ||
297 | unsigned long *, unsigned long *); | ||
298 | extern void task_mem(struct seq_file *, struct mm_struct *); | ||
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index f6a13f489e30..0a22194e5d58 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
14 | #include <linux/kcore.h> | ||
14 | #include <linux/user.h> | 15 | #include <linux/user.h> |
15 | #include <linux/capability.h> | 16 | #include <linux/capability.h> |
16 | #include <linux/elf.h> | 17 | #include <linux/elf.h> |
@@ -28,6 +29,7 @@ | |||
28 | #include <linux/ioport.h> | 29 | #include <linux/ioport.h> |
29 | #include <linux/memory.h> | 30 | #include <linux/memory.h> |
30 | #include <asm/sections.h> | 31 | #include <asm/sections.h> |
32 | #include "internal.h" | ||
31 | 33 | ||
32 | #define CORE_STR "CORE" | 34 | #define CORE_STR "CORE" |
33 | 35 | ||
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index 66b51c0383da..54bdc6701e9f 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c | |||
@@ -51,7 +51,7 @@ static int ns_delete_dentry(const struct dentry *dentry) | |||
51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) | 51 | static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) |
52 | { | 52 | { |
53 | struct inode *inode = dentry->d_inode; | 53 | struct inode *inode = dentry->d_inode; |
54 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; | 54 | const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns.ns_ops; |
55 | 55 | ||
56 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", | 56 | return dynamic_dname(dentry, buffer, buflen, "%s:[%lu]", |
57 | ns_ops->name, inode->i_ino); | 57 | ns_ops->name, inode->i_ino); |
@@ -95,8 +95,8 @@ static struct dentry *proc_ns_get_dentry(struct super_block *sb, | |||
95 | inode->i_op = &ns_inode_operations; | 95 | inode->i_op = &ns_inode_operations; |
96 | inode->i_mode = S_IFREG | S_IRUGO; | 96 | inode->i_mode = S_IFREG | S_IRUGO; |
97 | inode->i_fop = &ns_file_operations; | 97 | inode->i_fop = &ns_file_operations; |
98 | ei->ns_ops = ns_ops; | 98 | ei->ns.ns_ops = ns_ops; |
99 | ei->ns = ns; | 99 | ei->ns.ns = ns; |
100 | unlock_new_inode(inode); | 100 | unlock_new_inode(inode); |
101 | } else { | 101 | } else { |
102 | ns_ops->put(ns); | 102 | ns_ops->put(ns); |
@@ -128,7 +128,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
128 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) | 128 | if (!ptrace_may_access(task, PTRACE_MODE_READ)) |
129 | goto out_put_task; | 129 | goto out_put_task; |
130 | 130 | ||
131 | ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns_ops); | 131 | ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns.ns_ops); |
132 | if (IS_ERR(ns_path.dentry)) { | 132 | if (IS_ERR(ns_path.dentry)) { |
133 | error = ERR_CAST(ns_path.dentry); | 133 | error = ERR_CAST(ns_path.dentry); |
134 | goto out_put_task; | 134 | goto out_put_task; |
@@ -148,7 +148,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl | |||
148 | { | 148 | { |
149 | struct inode *inode = dentry->d_inode; | 149 | struct inode *inode = dentry->d_inode; |
150 | struct proc_inode *ei = PROC_I(inode); | 150 | struct proc_inode *ei = PROC_I(inode); |
151 | const struct proc_ns_operations *ns_ops = ei->ns_ops; | 151 | const struct proc_ns_operations *ns_ops = ei->ns.ns_ops; |
152 | struct task_struct *task; | 152 | struct task_struct *task; |
153 | void *ns; | 153 | void *ns; |
154 | char name[50]; | 154 | char name[50]; |
@@ -202,7 +202,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir, | |||
202 | ei = PROC_I(inode); | 202 | ei = PROC_I(inode); |
203 | inode->i_mode = S_IFLNK|S_IRWXUGO; | 203 | inode->i_mode = S_IFLNK|S_IRWXUGO; |
204 | inode->i_op = &proc_ns_link_inode_operations; | 204 | inode->i_op = &proc_ns_link_inode_operations; |
205 | ei->ns_ops = ns_ops; | 205 | ei->ns.ns_ops = ns_ops; |
206 | 206 | ||
207 | d_set_d_op(dentry, &pid_dentry_operations); | 207 | d_set_d_op(dentry, &pid_dentry_operations); |
208 | d_add(dentry, inode); | 208 | d_add(dentry, inode); |
@@ -337,6 +337,11 @@ out_invalid: | |||
337 | return ERR_PTR(-EINVAL); | 337 | return ERR_PTR(-EINVAL); |
338 | } | 338 | } |
339 | 339 | ||
340 | struct proc_ns *get_proc_ns(struct inode *inode) | ||
341 | { | ||
342 | return &PROC_I(inode)->ns; | ||
343 | } | ||
344 | |||
340 | bool proc_ns_inode(struct inode *inode) | 345 | bool proc_ns_inode(struct inode *inode) |
341 | { | 346 | { |
342 | return inode->i_fop == &ns_file_operations; | 347 | return inode->i_fop == &ns_file_operations; |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index 30b590f5bd35..505afc950e0a 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -41,7 +41,7 @@ static int property_proc_show(struct seq_file *m, void *v) | |||
41 | 41 | ||
42 | static int property_proc_open(struct inode *inode, struct file *file) | 42 | static int property_proc_open(struct inode *inode, struct file *file) |
43 | { | 43 | { |
44 | return single_open(file, property_proc_show, PDE(inode)->data); | 44 | return single_open(file, property_proc_show, __PDE_DATA(inode)); |
45 | } | 45 | } |
46 | 46 | ||
47 | static const struct file_operations property_proc_fops = { | 47 | static const struct file_operations property_proc_fops = { |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index b4ac6572474f..986e83220d56 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -26,6 +26,10 @@ | |||
26 | 26 | ||
27 | #include "internal.h" | 27 | #include "internal.h" |
28 | 28 | ||
29 | static inline struct net *PDE_NET(struct proc_dir_entry *pde) | ||
30 | { | ||
31 | return pde->parent->data; | ||
32 | } | ||
29 | 33 | ||
30 | static struct net *get_proc_net(const struct inode *inode) | 34 | static struct net *get_proc_net(const struct inode *inode) |
31 | { | 35 | { |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 9c7fab1d23f0..41a6ea93f486 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -141,6 +141,8 @@ static void proc_kill_sb(struct super_block *sb) | |||
141 | struct pid_namespace *ns; | 141 | struct pid_namespace *ns; |
142 | 142 | ||
143 | ns = (struct pid_namespace *)sb->s_fs_info; | 143 | ns = (struct pid_namespace *)sb->s_fs_info; |
144 | if (ns->proc_self) | ||
145 | dput(ns->proc_self); | ||
144 | kill_anon_super(sb); | 146 | kill_anon_super(sb); |
145 | put_pid_ns(ns); | 147 | put_pid_ns(ns); |
146 | } | 148 | } |
diff --git a/fs/proc/self.c b/fs/proc/self.c index aa5cc3bff140..6b6a993b5c25 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c | |||
@@ -1,6 +1,8 @@ | |||
1 | #include <linux/proc_fs.h> | ||
2 | #include <linux/sched.h> | 1 | #include <linux/sched.h> |
3 | #include <linux/namei.h> | 2 | #include <linux/namei.h> |
3 | #include <linux/slab.h> | ||
4 | #include <linux/pid_namespace.h> | ||
5 | #include "internal.h" | ||
4 | 6 | ||
5 | /* | 7 | /* |
6 | * /proc/self: | 8 | * /proc/self: |
@@ -48,12 +50,43 @@ static const struct inode_operations proc_self_inode_operations = { | |||
48 | .put_link = proc_self_put_link, | 50 | .put_link = proc_self_put_link, |
49 | }; | 51 | }; |
50 | 52 | ||
51 | void __init proc_self_init(void) | 53 | static unsigned self_inum; |
54 | |||
55 | int proc_setup_self(struct super_block *s) | ||
52 | { | 56 | { |
53 | struct proc_dir_entry *proc_self_symlink; | 57 | struct inode *root_inode = s->s_root->d_inode; |
54 | mode_t mode; | 58 | struct pid_namespace *ns = s->s_fs_info; |
59 | struct dentry *self; | ||
60 | |||
61 | mutex_lock(&root_inode->i_mutex); | ||
62 | self = d_alloc_name(s->s_root, "self"); | ||
63 | if (self) { | ||
64 | struct inode *inode = new_inode_pseudo(s); | ||
65 | if (inode) { | ||
66 | inode->i_ino = self_inum; | ||
67 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | ||
68 | inode->i_mode = S_IFLNK | S_IRWXUGO; | ||
69 | inode->i_uid = GLOBAL_ROOT_UID; | ||
70 | inode->i_gid = GLOBAL_ROOT_GID; | ||
71 | inode->i_op = &proc_self_inode_operations; | ||
72 | d_add(self, inode); | ||
73 | } else { | ||
74 | dput(self); | ||
75 | self = ERR_PTR(-ENOMEM); | ||
76 | } | ||
77 | } else { | ||
78 | self = ERR_PTR(-ENOMEM); | ||
79 | } | ||
80 | mutex_unlock(&root_inode->i_mutex); | ||
81 | if (IS_ERR(self)) { | ||
82 | pr_err("proc_fill_super: can't allocate /proc/self\n"); | ||
83 | return PTR_ERR(self); | ||
84 | } | ||
85 | ns->proc_self = self; | ||
86 | return 0; | ||
87 | } | ||
55 | 88 | ||
56 | mode = S_IFLNK | S_IRWXUGO; | 89 | void __init proc_self_init(void) |
57 | proc_self_symlink = proc_create("self", mode, NULL, NULL ); | 90 | { |
58 | proc_self_symlink->proc_iops = &proc_self_inode_operations; | 91 | proc_alloc_inum(&self_inum); |
59 | } | 92 | } |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index b870f740ab5a..17f7e080d7ff 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/proc_fs.h> | 11 | #include <linux/kcore.h> |
12 | #include <linux/user.h> | 12 | #include <linux/user.h> |
13 | #include <linux/elf.h> | 13 | #include <linux/elf.h> |
14 | #include <linux/elfcore.h> | 14 | #include <linux/elfcore.h> |
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include "internal.h" | ||
25 | 26 | ||
26 | /* List representing chunks of contiguous memory areas and their offsets in | 27 | /* List representing chunks of contiguous memory areas and their offsets in |
27 | * vmcore file. | 28 | * vmcore file. |
@@ -698,7 +699,7 @@ void vmcore_cleanup(void) | |||
698 | struct list_head *pos, *next; | 699 | struct list_head *pos, *next; |
699 | 700 | ||
700 | if (proc_vmcore) { | 701 | if (proc_vmcore) { |
701 | remove_proc_entry(proc_vmcore->name, proc_vmcore->parent); | 702 | proc_remove(proc_vmcore); |
702 | proc_vmcore = NULL; | 703 | proc_vmcore = NULL; |
703 | } | 704 | } |
704 | 705 | ||
diff --git a/fs/read_write.c b/fs/read_write.c index 8274a794253b..605dbbcb1973 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -459,6 +459,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
459 | ret = rw_verify_area(WRITE, file, pos, count); | 459 | ret = rw_verify_area(WRITE, file, pos, count); |
460 | if (ret >= 0) { | 460 | if (ret >= 0) { |
461 | count = ret; | 461 | count = ret; |
462 | file_start_write(file); | ||
462 | if (file->f_op->write) | 463 | if (file->f_op->write) |
463 | ret = file->f_op->write(file, buf, count, pos); | 464 | ret = file->f_op->write(file, buf, count, pos); |
464 | else | 465 | else |
@@ -468,6 +469,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
468 | add_wchar(current, ret); | 469 | add_wchar(current, ret); |
469 | } | 470 | } |
470 | inc_syscw(current); | 471 | inc_syscw(current); |
472 | file_end_write(file); | ||
471 | } | 473 | } |
472 | 474 | ||
473 | return ret; | 475 | return ret; |
@@ -576,7 +578,7 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to) | |||
576 | } | 578 | } |
577 | EXPORT_SYMBOL(iov_shorten); | 579 | EXPORT_SYMBOL(iov_shorten); |
578 | 580 | ||
579 | ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | 581 | static ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, |
580 | unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn) | 582 | unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn) |
581 | { | 583 | { |
582 | struct kiocb kiocb; | 584 | struct kiocb kiocb; |
@@ -601,7 +603,7 @@ ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | |||
601 | } | 603 | } |
602 | 604 | ||
603 | /* Do it by hand, with file-ops */ | 605 | /* Do it by hand, with file-ops */ |
604 | ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, | 606 | static ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, |
605 | unsigned long nr_segs, loff_t *ppos, io_fn_t fn) | 607 | unsigned long nr_segs, loff_t *ppos, io_fn_t fn) |
606 | { | 608 | { |
607 | struct iovec *vector = iov; | 609 | struct iovec *vector = iov; |
@@ -743,6 +745,7 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
743 | } else { | 745 | } else { |
744 | fn = (io_fn_t)file->f_op->write; | 746 | fn = (io_fn_t)file->f_op->write; |
745 | fnv = file->f_op->aio_write; | 747 | fnv = file->f_op->aio_write; |
748 | file_start_write(file); | ||
746 | } | 749 | } |
747 | 750 | ||
748 | if (fnv) | 751 | if (fnv) |
@@ -751,6 +754,9 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
751 | else | 754 | else |
752 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | 755 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
753 | 756 | ||
757 | if (type != READ) | ||
758 | file_end_write(file); | ||
759 | |||
754 | out: | 760 | out: |
755 | if (iov != iovstack) | 761 | if (iov != iovstack) |
756 | kfree(iov); | 762 | kfree(iov); |
@@ -881,6 +887,201 @@ SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec, | |||
881 | return ret; | 887 | return ret; |
882 | } | 888 | } |
883 | 889 | ||
890 | #ifdef CONFIG_COMPAT | ||
891 | |||
892 | static ssize_t compat_do_readv_writev(int type, struct file *file, | ||
893 | const struct compat_iovec __user *uvector, | ||
894 | unsigned long nr_segs, loff_t *pos) | ||
895 | { | ||
896 | compat_ssize_t tot_len; | ||
897 | struct iovec iovstack[UIO_FASTIOV]; | ||
898 | struct iovec *iov = iovstack; | ||
899 | ssize_t ret; | ||
900 | io_fn_t fn; | ||
901 | iov_fn_t fnv; | ||
902 | |||
903 | ret = -EINVAL; | ||
904 | if (!file->f_op) | ||
905 | goto out; | ||
906 | |||
907 | ret = -EFAULT; | ||
908 | if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
909 | goto out; | ||
910 | |||
911 | ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
912 | UIO_FASTIOV, iovstack, &iov); | ||
913 | if (ret <= 0) | ||
914 | goto out; | ||
915 | |||
916 | tot_len = ret; | ||
917 | ret = rw_verify_area(type, file, pos, tot_len); | ||
918 | if (ret < 0) | ||
919 | goto out; | ||
920 | |||
921 | fnv = NULL; | ||
922 | if (type == READ) { | ||
923 | fn = file->f_op->read; | ||
924 | fnv = file->f_op->aio_read; | ||
925 | } else { | ||
926 | fn = (io_fn_t)file->f_op->write; | ||
927 | fnv = file->f_op->aio_write; | ||
928 | file_start_write(file); | ||
929 | } | ||
930 | |||
931 | if (fnv) | ||
932 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | ||
933 | pos, fnv); | ||
934 | else | ||
935 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | ||
936 | |||
937 | if (type != READ) | ||
938 | file_end_write(file); | ||
939 | |||
940 | out: | ||
941 | if (iov != iovstack) | ||
942 | kfree(iov); | ||
943 | if ((ret + (type == READ)) > 0) { | ||
944 | if (type == READ) | ||
945 | fsnotify_access(file); | ||
946 | else | ||
947 | fsnotify_modify(file); | ||
948 | } | ||
949 | return ret; | ||
950 | } | ||
951 | |||
952 | static size_t compat_readv(struct file *file, | ||
953 | const struct compat_iovec __user *vec, | ||
954 | unsigned long vlen, loff_t *pos) | ||
955 | { | ||
956 | ssize_t ret = -EBADF; | ||
957 | |||
958 | if (!(file->f_mode & FMODE_READ)) | ||
959 | goto out; | ||
960 | |||
961 | ret = -EINVAL; | ||
962 | if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) | ||
963 | goto out; | ||
964 | |||
965 | ret = compat_do_readv_writev(READ, file, vec, vlen, pos); | ||
966 | |||
967 | out: | ||
968 | if (ret > 0) | ||
969 | add_rchar(current, ret); | ||
970 | inc_syscr(current); | ||
971 | return ret; | ||
972 | } | ||
973 | |||
974 | COMPAT_SYSCALL_DEFINE3(readv, unsigned long, fd, | ||
975 | const struct compat_iovec __user *,vec, | ||
976 | unsigned long, vlen) | ||
977 | { | ||
978 | struct fd f = fdget(fd); | ||
979 | ssize_t ret; | ||
980 | loff_t pos; | ||
981 | |||
982 | if (!f.file) | ||
983 | return -EBADF; | ||
984 | pos = f.file->f_pos; | ||
985 | ret = compat_readv(f.file, vec, vlen, &pos); | ||
986 | f.file->f_pos = pos; | ||
987 | fdput(f); | ||
988 | return ret; | ||
989 | } | ||
990 | |||
991 | COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd, | ||
992 | const struct compat_iovec __user *,vec, | ||
993 | unsigned long, vlen, loff_t, pos) | ||
994 | { | ||
995 | struct fd f; | ||
996 | ssize_t ret; | ||
997 | |||
998 | if (pos < 0) | ||
999 | return -EINVAL; | ||
1000 | f = fdget(fd); | ||
1001 | if (!f.file) | ||
1002 | return -EBADF; | ||
1003 | ret = -ESPIPE; | ||
1004 | if (f.file->f_mode & FMODE_PREAD) | ||
1005 | ret = compat_readv(f.file, vec, vlen, &pos); | ||
1006 | fdput(f); | ||
1007 | return ret; | ||
1008 | } | ||
1009 | |||
1010 | COMPAT_SYSCALL_DEFINE5(preadv, unsigned long, fd, | ||
1011 | const struct compat_iovec __user *,vec, | ||
1012 | unsigned long, vlen, u32, pos_low, u32, pos_high) | ||
1013 | { | ||
1014 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | ||
1015 | return compat_sys_preadv64(fd, vec, vlen, pos); | ||
1016 | } | ||
1017 | |||
1018 | static size_t compat_writev(struct file *file, | ||
1019 | const struct compat_iovec __user *vec, | ||
1020 | unsigned long vlen, loff_t *pos) | ||
1021 | { | ||
1022 | ssize_t ret = -EBADF; | ||
1023 | |||
1024 | if (!(file->f_mode & FMODE_WRITE)) | ||
1025 | goto out; | ||
1026 | |||
1027 | ret = -EINVAL; | ||
1028 | if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) | ||
1029 | goto out; | ||
1030 | |||
1031 | ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos); | ||
1032 | |||
1033 | out: | ||
1034 | if (ret > 0) | ||
1035 | add_wchar(current, ret); | ||
1036 | inc_syscw(current); | ||
1037 | return ret; | ||
1038 | } | ||
1039 | |||
1040 | COMPAT_SYSCALL_DEFINE3(writev, unsigned long, fd, | ||
1041 | const struct compat_iovec __user *, vec, | ||
1042 | unsigned long, vlen) | ||
1043 | { | ||
1044 | struct fd f = fdget(fd); | ||
1045 | ssize_t ret; | ||
1046 | loff_t pos; | ||
1047 | |||
1048 | if (!f.file) | ||
1049 | return -EBADF; | ||
1050 | pos = f.file->f_pos; | ||
1051 | ret = compat_writev(f.file, vec, vlen, &pos); | ||
1052 | f.file->f_pos = pos; | ||
1053 | fdput(f); | ||
1054 | return ret; | ||
1055 | } | ||
1056 | |||
1057 | COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd, | ||
1058 | const struct compat_iovec __user *,vec, | ||
1059 | unsigned long, vlen, loff_t, pos) | ||
1060 | { | ||
1061 | struct fd f; | ||
1062 | ssize_t ret; | ||
1063 | |||
1064 | if (pos < 0) | ||
1065 | return -EINVAL; | ||
1066 | f = fdget(fd); | ||
1067 | if (!f.file) | ||
1068 | return -EBADF; | ||
1069 | ret = -ESPIPE; | ||
1070 | if (f.file->f_mode & FMODE_PWRITE) | ||
1071 | ret = compat_writev(f.file, vec, vlen, &pos); | ||
1072 | fdput(f); | ||
1073 | return ret; | ||
1074 | } | ||
1075 | |||
1076 | COMPAT_SYSCALL_DEFINE5(pwritev, unsigned long, fd, | ||
1077 | const struct compat_iovec __user *,vec, | ||
1078 | unsigned long, vlen, u32, pos_low, u32, pos_high) | ||
1079 | { | ||
1080 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | ||
1081 | return compat_sys_pwritev64(fd, vec, vlen, pos); | ||
1082 | } | ||
1083 | #endif | ||
1084 | |||
884 | static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | 1085 | static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, |
885 | size_t count, loff_t max) | 1086 | size_t count, loff_t max) |
886 | { | 1087 | { |
diff --git a/fs/read_write.h b/fs/read_write.h index d07b954c6e0c..0ec530d9305b 100644 --- a/fs/read_write.h +++ b/fs/read_write.h | |||
@@ -7,8 +7,3 @@ | |||
7 | typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); | 7 | typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); |
8 | typedef ssize_t (*iov_fn_t)(struct kiocb *, const struct iovec *, | 8 | typedef ssize_t (*iov_fn_t)(struct kiocb *, const struct iovec *, |
9 | unsigned long, loff_t); | 9 | unsigned long, loff_t); |
10 | |||
11 | ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | ||
12 | unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn); | ||
13 | ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, | ||
14 | unsigned long nr_segs, loff_t *ppos, io_fn_t fn); | ||
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 6165bd4784f6..dcaafcfc23b0 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -234,68 +234,9 @@ int reiserfs_commit_page(struct inode *inode, struct page *page, | |||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Write @count bytes at position @ppos in a file indicated by @file | ||
238 | from the buffer @buf. | ||
239 | |||
240 | generic_file_write() is only appropriate for filesystems that are not seeking to optimize performance and want | ||
241 | something simple that works. It is not for serious use by general purpose filesystems, excepting the one that it was | ||
242 | written for (ext2/3). This is for several reasons: | ||
243 | |||
244 | * It has no understanding of any filesystem specific optimizations. | ||
245 | |||
246 | * It enters the filesystem repeatedly for each page that is written. | ||
247 | |||
248 | * It depends on reiserfs_get_block() function which if implemented by reiserfs performs costly search_by_key | ||
249 | * operation for each page it is supplied with. By contrast reiserfs_file_write() feeds as much as possible at a time | ||
250 | * to reiserfs which allows for fewer tree traversals. | ||
251 | |||
252 | * Each indirect pointer insertion takes a lot of cpu, because it involves memory moves inside of blocks. | ||
253 | |||
254 | * Asking the block allocation code for blocks one at a time is slightly less efficient. | ||
255 | |||
256 | All of these reasons for not using only generic file write were understood back when reiserfs was first miscoded to | ||
257 | use it, but we were in a hurry to make code freeze, and so it couldn't be revised then. This new code should make | ||
258 | things right finally. | ||
259 | |||
260 | Future Features: providing search_by_key with hints. | ||
261 | |||
262 | */ | ||
263 | static ssize_t reiserfs_file_write(struct file *file, /* the file we are going to write into */ | ||
264 | const char __user * buf, /* pointer to user supplied data | ||
265 | (in userspace) */ | ||
266 | size_t count, /* amount of bytes to write */ | ||
267 | loff_t * ppos /* pointer to position in file that we start writing at. Should be updated to | ||
268 | * new current position before returning. */ | ||
269 | ) | ||
270 | { | ||
271 | struct inode *inode = file_inode(file); // Inode of the file that we are writing to. | ||
272 | /* To simplify coding at this time, we store | ||
273 | locked pages in array for now */ | ||
274 | struct reiserfs_transaction_handle th; | ||
275 | th.t_trans_id = 0; | ||
276 | |||
277 | /* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items | ||
278 | * lying around (most of the disk, in fact). Despite the filesystem | ||
279 | * now being a v3.6 format, the old items still can't support large | ||
280 | * file sizes. Catch this case here, as the rest of the VFS layer is | ||
281 | * oblivious to the different limitations between old and new items. | ||
282 | * reiserfs_setattr catches this for truncates. This chunk is lifted | ||
283 | * from generic_write_checks. */ | ||
284 | if (get_inode_item_key_version (inode) == KEY_FORMAT_3_5 && | ||
285 | *ppos + count > MAX_NON_LFS) { | ||
286 | if (*ppos >= MAX_NON_LFS) { | ||
287 | return -EFBIG; | ||
288 | } | ||
289 | if (count > MAX_NON_LFS - (unsigned long)*ppos) | ||
290 | count = MAX_NON_LFS - (unsigned long)*ppos; | ||
291 | } | ||
292 | |||
293 | return do_sync_write(file, buf, count, ppos); | ||
294 | } | ||
295 | |||
296 | const struct file_operations reiserfs_file_operations = { | 237 | const struct file_operations reiserfs_file_operations = { |
297 | .read = do_sync_read, | 238 | .read = do_sync_read, |
298 | .write = reiserfs_file_write, | 239 | .write = do_sync_write, |
299 | .unlocked_ioctl = reiserfs_ioctl, | 240 | .unlocked_ioctl = reiserfs_ioctl, |
300 | #ifdef CONFIG_COMPAT | 241 | #ifdef CONFIG_COMPAT |
301 | .compat_ioctl = reiserfs_compat_ioctl, | 242 | .compat_ioctl = reiserfs_compat_ioctl, |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 9cc0740adffa..33532f79b4f7 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -394,20 +394,24 @@ static int set_sb(struct super_block *sb, void *data) | |||
394 | return -ENOENT; | 394 | return -ENOENT; |
395 | } | 395 | } |
396 | 396 | ||
397 | struct reiserfs_seq_private { | ||
398 | struct super_block *sb; | ||
399 | int (*show) (struct seq_file *, struct super_block *); | ||
400 | }; | ||
401 | |||
397 | static void *r_start(struct seq_file *m, loff_t * pos) | 402 | static void *r_start(struct seq_file *m, loff_t * pos) |
398 | { | 403 | { |
399 | struct proc_dir_entry *de = m->private; | 404 | struct reiserfs_seq_private *priv = m->private; |
400 | struct super_block *s = de->parent->data; | ||
401 | loff_t l = *pos; | 405 | loff_t l = *pos; |
402 | 406 | ||
403 | if (l) | 407 | if (l) |
404 | return NULL; | 408 | return NULL; |
405 | 409 | ||
406 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s))) | 410 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) |
407 | return NULL; | 411 | return NULL; |
408 | 412 | ||
409 | up_write(&s->s_umount); | 413 | up_write(&priv->sb->s_umount); |
410 | return s; | 414 | return priv->sb; |
411 | } | 415 | } |
412 | 416 | ||
413 | static void *r_next(struct seq_file *m, void *v, loff_t * pos) | 417 | static void *r_next(struct seq_file *m, void *v, loff_t * pos) |
@@ -426,9 +430,8 @@ static void r_stop(struct seq_file *m, void *v) | |||
426 | 430 | ||
427 | static int r_show(struct seq_file *m, void *v) | 431 | static int r_show(struct seq_file *m, void *v) |
428 | { | 432 | { |
429 | struct proc_dir_entry *de = m->private; | 433 | struct reiserfs_seq_private *priv = m->private; |
430 | int (*show) (struct seq_file *, struct super_block *) = de->data; | 434 | return priv->show(m, v); |
431 | return show(m, v); | ||
432 | } | 435 | } |
433 | 436 | ||
434 | static const struct seq_operations r_ops = { | 437 | static const struct seq_operations r_ops = { |
@@ -440,11 +443,15 @@ static const struct seq_operations r_ops = { | |||
440 | 443 | ||
441 | static int r_open(struct inode *inode, struct file *file) | 444 | static int r_open(struct inode *inode, struct file *file) |
442 | { | 445 | { |
443 | int ret = seq_open(file, &r_ops); | 446 | struct reiserfs_seq_private *priv; |
447 | int ret = seq_open_private(file, &r_ops, | ||
448 | sizeof(struct reiserfs_seq_private)); | ||
444 | 449 | ||
445 | if (!ret) { | 450 | if (!ret) { |
446 | struct seq_file *m = file->private_data; | 451 | struct seq_file *m = file->private_data; |
447 | m->private = PDE(inode); | 452 | priv = m->private; |
453 | priv->sb = proc_get_parent_data(inode); | ||
454 | priv->show = PDE_DATA(inode); | ||
448 | } | 455 | } |
449 | return ret; | 456 | return ret; |
450 | } | 457 | } |
@@ -453,7 +460,7 @@ static const struct file_operations r_file_operations = { | |||
453 | .open = r_open, | 460 | .open = r_open, |
454 | .read = seq_read, | 461 | .read = seq_read, |
455 | .llseek = seq_lseek, | 462 | .llseek = seq_lseek, |
456 | .release = seq_release, | 463 | .release = seq_release_private, |
457 | .owner = THIS_MODULE, | 464 | .owner = THIS_MODULE, |
458 | }; | 465 | }; |
459 | 466 | ||
@@ -479,9 +486,8 @@ int reiserfs_proc_info_init(struct super_block *sb) | |||
479 | *s = '!'; | 486 | *s = '!'; |
480 | 487 | ||
481 | spin_lock_init(&__PINFO(sb).lock); | 488 | spin_lock_init(&__PINFO(sb).lock); |
482 | REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root); | 489 | REISERFS_SB(sb)->procdir = proc_mkdir_data(b, 0, proc_info_root, sb); |
483 | if (REISERFS_SB(sb)->procdir) { | 490 | if (REISERFS_SB(sb)->procdir) { |
484 | REISERFS_SB(sb)->procdir->data = sb; | ||
485 | add_file(sb, "version", show_version); | 491 | add_file(sb, "version", show_version); |
486 | add_file(sb, "super", show_super); | 492 | add_file(sb, "super", show_super); |
487 | add_file(sb, "per-level", show_per_level); | 493 | add_file(sb, "per-level", show_per_level); |
@@ -499,29 +505,17 @@ int reiserfs_proc_info_init(struct super_block *sb) | |||
499 | int reiserfs_proc_info_done(struct super_block *sb) | 505 | int reiserfs_proc_info_done(struct super_block *sb) |
500 | { | 506 | { |
501 | struct proc_dir_entry *de = REISERFS_SB(sb)->procdir; | 507 | struct proc_dir_entry *de = REISERFS_SB(sb)->procdir; |
502 | char b[BDEVNAME_SIZE]; | 508 | if (de) { |
503 | char *s; | 509 | char b[BDEVNAME_SIZE]; |
510 | char *s; | ||
504 | 511 | ||
505 | /* Some block devices use /'s */ | 512 | /* Some block devices use /'s */ |
506 | strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE); | 513 | strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE); |
507 | s = strchr(b, '/'); | 514 | s = strchr(b, '/'); |
508 | if (s) | 515 | if (s) |
509 | *s = '!'; | 516 | *s = '!'; |
510 | 517 | ||
511 | if (de) { | 518 | remove_proc_subtree(b, proc_info_root); |
512 | remove_proc_entry("journal", de); | ||
513 | remove_proc_entry("oidmap", de); | ||
514 | remove_proc_entry("on-disk-super", de); | ||
515 | remove_proc_entry("bitmap", de); | ||
516 | remove_proc_entry("per-level", de); | ||
517 | remove_proc_entry("super", de); | ||
518 | remove_proc_entry("version", de); | ||
519 | } | ||
520 | spin_lock(&__PINFO(sb).lock); | ||
521 | __PINFO(sb).exiting = 1; | ||
522 | spin_unlock(&__PINFO(sb).lock); | ||
523 | if (proc_info_root) { | ||
524 | remove_proc_entry(b, proc_info_root); | ||
525 | REISERFS_SB(sb)->procdir = NULL; | 519 | REISERFS_SB(sb)->procdir = NULL; |
526 | } | 520 | } |
527 | return 0; | 521 | return 0; |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 38bb59f3f2ad..774c1eb7f1c9 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -599,6 +599,24 @@ int single_open(struct file *file, int (*show)(struct seq_file *, void *), | |||
599 | } | 599 | } |
600 | EXPORT_SYMBOL(single_open); | 600 | EXPORT_SYMBOL(single_open); |
601 | 601 | ||
602 | int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), | ||
603 | void *data, size_t size) | ||
604 | { | ||
605 | char *buf = kmalloc(size, GFP_KERNEL); | ||
606 | int ret; | ||
607 | if (!buf) | ||
608 | return -ENOMEM; | ||
609 | ret = single_open(file, show, data); | ||
610 | if (ret) { | ||
611 | kfree(buf); | ||
612 | return ret; | ||
613 | } | ||
614 | ((struct seq_file *)file->private_data)->buf = buf; | ||
615 | ((struct seq_file *)file->private_data)->size = size; | ||
616 | return 0; | ||
617 | } | ||
618 | EXPORT_SYMBOL(single_open_size); | ||
619 | |||
602 | int single_release(struct inode *inode, struct file *file) | 620 | int single_release(struct inode *inode, struct file *file) |
603 | { | 621 | { |
604 | const struct seq_operations *op = ((struct seq_file *)file->private_data)->op; | 622 | const struct seq_operations *op = ((struct seq_file *)file->private_data)->op; |
diff --git a/fs/splice.c b/fs/splice.c index 6b485b8753bd..e6b25598c8c4 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -219,7 +219,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe, | |||
219 | page_nr++; | 219 | page_nr++; |
220 | ret += buf->len; | 220 | ret += buf->len; |
221 | 221 | ||
222 | if (pipe->inode) | 222 | if (pipe->files) |
223 | do_wakeup = 1; | 223 | do_wakeup = 1; |
224 | 224 | ||
225 | if (!--spd->nr_pages) | 225 | if (!--spd->nr_pages) |
@@ -829,7 +829,7 @@ int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc *sd, | |||
829 | ops->release(pipe, buf); | 829 | ops->release(pipe, buf); |
830 | pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1); | 830 | pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1); |
831 | pipe->nrbufs--; | 831 | pipe->nrbufs--; |
832 | if (pipe->inode) | 832 | if (pipe->files) |
833 | sd->need_wakeup = true; | 833 | sd->need_wakeup = true; |
834 | } | 834 | } |
835 | 835 | ||
@@ -1001,8 +1001,6 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
1001 | }; | 1001 | }; |
1002 | ssize_t ret; | 1002 | ssize_t ret; |
1003 | 1003 | ||
1004 | sb_start_write(inode->i_sb); | ||
1005 | |||
1006 | pipe_lock(pipe); | 1004 | pipe_lock(pipe); |
1007 | 1005 | ||
1008 | splice_from_pipe_begin(&sd); | 1006 | splice_from_pipe_begin(&sd); |
@@ -1038,7 +1036,6 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
1038 | *ppos += ret; | 1036 | *ppos += ret; |
1039 | balance_dirty_pages_ratelimited(mapping); | 1037 | balance_dirty_pages_ratelimited(mapping); |
1040 | } | 1038 | } |
1041 | sb_end_write(inode->i_sb); | ||
1042 | 1039 | ||
1043 | return ret; | 1040 | return ret; |
1044 | } | 1041 | } |
@@ -1118,7 +1115,10 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, | |||
1118 | else | 1115 | else |
1119 | splice_write = default_file_splice_write; | 1116 | splice_write = default_file_splice_write; |
1120 | 1117 | ||
1121 | return splice_write(pipe, out, ppos, len, flags); | 1118 | file_start_write(out); |
1119 | ret = splice_write(pipe, out, ppos, len, flags); | ||
1120 | file_end_write(out); | ||
1121 | return ret; | ||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | /* | 1124 | /* |
@@ -1184,7 +1184,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1184 | */ | 1184 | */ |
1185 | pipe = current->splice_pipe; | 1185 | pipe = current->splice_pipe; |
1186 | if (unlikely(!pipe)) { | 1186 | if (unlikely(!pipe)) { |
1187 | pipe = alloc_pipe_info(NULL); | 1187 | pipe = alloc_pipe_info(); |
1188 | if (!pipe) | 1188 | if (!pipe) |
1189 | return -ENOMEM; | 1189 | return -ENOMEM; |
1190 | 1190 | ||
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index f03bf1a456fb..3800128d2171 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -775,8 +775,6 @@ xfs_file_aio_write( | |||
775 | if (ocount == 0) | 775 | if (ocount == 0) |
776 | return 0; | 776 | return 0; |
777 | 777 | ||
778 | sb_start_write(inode->i_sb); | ||
779 | |||
780 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 778 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { |
781 | ret = -EIO; | 779 | ret = -EIO; |
782 | goto out; | 780 | goto out; |
@@ -800,7 +798,6 @@ xfs_file_aio_write( | |||
800 | } | 798 | } |
801 | 799 | ||
802 | out: | 800 | out: |
803 | sb_end_write(inode->i_sb); | ||
804 | return ret; | 801 | return ret; |
805 | } | 802 | } |
806 | 803 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2d94d7413d71..60c33f14408f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1022,7 +1022,7 @@ struct drm_info_list { | |||
1022 | struct drm_info_node { | 1022 | struct drm_info_node { |
1023 | struct list_head list; | 1023 | struct list_head list; |
1024 | struct drm_minor *minor; | 1024 | struct drm_minor *minor; |
1025 | struct drm_info_list *info_ent; | 1025 | const struct drm_info_list *info_ent; |
1026 | struct dentry *dent; | 1026 | struct dentry *dent; |
1027 | }; | 1027 | }; |
1028 | 1028 | ||
@@ -1546,8 +1546,7 @@ extern struct idr drm_minors_idr; | |||
1546 | extern struct drm_local_map *drm_getsarea(struct drm_device *dev); | 1546 | extern struct drm_local_map *drm_getsarea(struct drm_device *dev); |
1547 | 1547 | ||
1548 | /* Proc support (drm_proc.h) */ | 1548 | /* Proc support (drm_proc.h) */ |
1549 | extern int drm_proc_init(struct drm_minor *minor, int minor_id, | 1549 | extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root); |
1550 | struct proc_dir_entry *root); | ||
1551 | extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); | 1550 | extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); |
1552 | 1551 | ||
1553 | /* Debugfs support */ | 1552 | /* Debugfs support */ |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index c3a09149f793..70cf138690e9 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
@@ -118,5 +118,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm); | |||
118 | extern void install_exec_creds(struct linux_binprm *bprm); | 118 | extern void install_exec_creds(struct linux_binprm *bprm); |
119 | extern void set_binfmt(struct linux_binfmt *new); | 119 | extern void set_binfmt(struct linux_binfmt *new); |
120 | extern void free_bprm(struct linux_binprm *); | 120 | extern void free_bprm(struct linux_binprm *); |
121 | extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); | ||
121 | 122 | ||
122 | #endif /* _LINUX_BINFMTS_H */ | 123 | #endif /* _LINUX_BINFMTS_H */ |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 646ab9d15e42..3bff9ce09cf7 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -39,7 +39,7 @@ extern int cgroupstats_build(struct cgroupstats *stats, | |||
39 | extern int cgroup_load_subsys(struct cgroup_subsys *ss); | 39 | extern int cgroup_load_subsys(struct cgroup_subsys *ss); |
40 | extern void cgroup_unload_subsys(struct cgroup_subsys *ss); | 40 | extern void cgroup_unload_subsys(struct cgroup_subsys *ss); |
41 | 41 | ||
42 | extern const struct file_operations proc_cgroup_operations; | 42 | extern int proc_cgroup_show(struct seq_file *, void *); |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Define the enumeration of all cgroup subsystems. | 45 | * Define the enumeration of all cgroup subsystems. |
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index ccd1de8ad822..cc1b01cf2035 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h | |||
@@ -63,10 +63,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, | |||
63 | extern int cpuset_memory_pressure_enabled; | 63 | extern int cpuset_memory_pressure_enabled; |
64 | extern void __cpuset_memory_pressure_bump(void); | 64 | extern void __cpuset_memory_pressure_bump(void); |
65 | 65 | ||
66 | extern const struct file_operations proc_cpuset_operations; | ||
67 | struct seq_file; | ||
68 | extern void cpuset_task_status_allowed(struct seq_file *m, | 66 | extern void cpuset_task_status_allowed(struct seq_file *m, |
69 | struct task_struct *task); | 67 | struct task_struct *task); |
68 | extern int proc_cpuset_show(struct seq_file *, void *); | ||
70 | 69 | ||
71 | extern int cpuset_mem_spread_node(void); | 70 | extern int cpuset_mem_spread_node(void); |
72 | extern int cpuset_slab_spread_node(void); | 71 | extern int cpuset_slab_spread_node(void); |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index fb7dacae0522..085197bd8812 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -27,7 +27,6 @@ struct fdtable { | |||
27 | unsigned long *close_on_exec; | 27 | unsigned long *close_on_exec; |
28 | unsigned long *open_fds; | 28 | unsigned long *open_fds; |
29 | struct rcu_head rcu; | 29 | struct rcu_head rcu; |
30 | struct fdtable *next; | ||
31 | }; | 30 | }; |
32 | 31 | ||
33 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) | 32 | static inline bool close_on_exec(int fd, const struct fdtable *fdt) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 17d8b1596215..e8cd6b839675 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2082,7 +2082,6 @@ extern int sync_filesystem(struct super_block *); | |||
2082 | extern const struct file_operations def_blk_fops; | 2082 | extern const struct file_operations def_blk_fops; |
2083 | extern const struct file_operations def_chr_fops; | 2083 | extern const struct file_operations def_chr_fops; |
2084 | extern const struct file_operations bad_sock_fops; | 2084 | extern const struct file_operations bad_sock_fops; |
2085 | extern const struct file_operations def_fifo_fops; | ||
2086 | #ifdef CONFIG_BLOCK | 2085 | #ifdef CONFIG_BLOCK |
2087 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); | 2086 | extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); |
2088 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); | 2087 | extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); |
@@ -2154,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t); | |||
2154 | extern void make_bad_inode(struct inode *); | 2153 | extern void make_bad_inode(struct inode *); |
2155 | extern int is_bad_inode(struct inode *); | 2154 | extern int is_bad_inode(struct inode *); |
2156 | 2155 | ||
2157 | extern const struct file_operations read_pipefifo_fops; | ||
2158 | extern const struct file_operations write_pipefifo_fops; | ||
2159 | extern const struct file_operations rdwr_pipefifo_fops; | ||
2160 | |||
2161 | #ifdef CONFIG_BLOCK | 2156 | #ifdef CONFIG_BLOCK |
2162 | /* | 2157 | /* |
2163 | * return READ, READA, or WRITE | 2158 | * return READ, READA, or WRITE |
@@ -2225,6 +2220,20 @@ static inline struct inode *file_inode(struct file *f) | |||
2225 | return f->f_inode; | 2220 | return f->f_inode; |
2226 | } | 2221 | } |
2227 | 2222 | ||
2223 | static inline void file_start_write(struct file *file) | ||
2224 | { | ||
2225 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
2226 | return; | ||
2227 | __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true); | ||
2228 | } | ||
2229 | |||
2230 | static inline void file_end_write(struct file *file) | ||
2231 | { | ||
2232 | if (!S_ISREG(file_inode(file)->i_mode)) | ||
2233 | return; | ||
2234 | __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE); | ||
2235 | } | ||
2236 | |||
2228 | /* | 2237 | /* |
2229 | * get_write_access() gets write permission for a file. | 2238 | * get_write_access() gets write permission for a file. |
2230 | * put_write_access() releases this write permission. | 2239 | * put_write_access() releases this write permission. |
diff --git a/include/linux/kcore.h b/include/linux/kcore.h new file mode 100644 index 000000000000..d92762286645 --- /dev/null +++ b/include/linux/kcore.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * /proc/kcore definitions | ||
3 | */ | ||
4 | #ifndef _LINUX_KCORE_H | ||
5 | #define _LINUX_KCORE_H | ||
6 | |||
7 | enum kcore_type { | ||
8 | KCORE_TEXT, | ||
9 | KCORE_VMALLOC, | ||
10 | KCORE_RAM, | ||
11 | KCORE_VMEMMAP, | ||
12 | KCORE_OTHER, | ||
13 | }; | ||
14 | |||
15 | struct kcore_list { | ||
16 | struct list_head list; | ||
17 | unsigned long addr; | ||
18 | size_t size; | ||
19 | int type; | ||
20 | }; | ||
21 | |||
22 | struct vmcore { | ||
23 | struct list_head list; | ||
24 | unsigned long long paddr; | ||
25 | unsigned long long size; | ||
26 | loff_t offset; | ||
27 | }; | ||
28 | |||
29 | #ifdef CONFIG_PROC_KCORE | ||
30 | extern void kclist_add(struct kcore_list *, void *, size_t, int type); | ||
31 | #else | ||
32 | static inline | ||
33 | void kclist_add(struct kcore_list *new, void *addr, size_t size, int type) | ||
34 | { | ||
35 | } | ||
36 | #endif | ||
37 | |||
38 | #endif /* _LINUX_KCORE_H */ | ||
diff --git a/include/linux/nubus.h b/include/linux/nubus.h index a8696bbdfbc4..b3740527571a 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h | |||
@@ -80,7 +80,11 @@ extern struct nubus_board* nubus_boards; | |||
80 | 80 | ||
81 | /* Generic NuBus interface functions, modelled after the PCI interface */ | 81 | /* Generic NuBus interface functions, modelled after the PCI interface */ |
82 | void nubus_scan_bus(void); | 82 | void nubus_scan_bus(void); |
83 | #ifdef CONFIG_PROC_FS | ||
83 | extern void nubus_proc_init(void); | 84 | extern void nubus_proc_init(void); |
85 | #else | ||
86 | static inline void nubus_proc_init(void) {} | ||
87 | #endif | ||
84 | int get_nubus_list(char *buf); | 88 | int get_nubus_list(char *buf); |
85 | int nubus_proc_attach_device(struct nubus_dev *dev); | 89 | int nubus_proc_attach_device(struct nubus_dev *dev); |
86 | int nubus_proc_detach_device(struct nubus_dev *dev); | 90 | int nubus_proc_detach_device(struct nubus_dev *dev); |
diff --git a/include/linux/of.h b/include/linux/of.h index a0f129284948..2d25ff8fe39a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -540,4 +540,14 @@ static inline int of_property_read_u32(const struct device_node *np, | |||
540 | return of_property_read_u32_array(np, propname, out_value, 1); | 540 | return of_property_read_u32_array(np, propname, out_value, 1); |
541 | } | 541 | } |
542 | 542 | ||
543 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) | ||
544 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | ||
545 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); | ||
546 | extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
547 | struct property *prop); | ||
548 | extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
549 | struct property *newprop, | ||
550 | struct property *oldprop); | ||
551 | #endif | ||
552 | |||
543 | #endif /* _LINUX_OF_H */ | 553 | #endif /* _LINUX_OF_H */ |
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 8ac32836690e..731e4ecee3bd 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h | |||
@@ -30,6 +30,7 @@ struct pid_namespace { | |||
30 | struct pid_namespace *parent; | 30 | struct pid_namespace *parent; |
31 | #ifdef CONFIG_PROC_FS | 31 | #ifdef CONFIG_PROC_FS |
32 | struct vfsmount *proc_mnt; | 32 | struct vfsmount *proc_mnt; |
33 | struct dentry *proc_self; | ||
33 | #endif | 34 | #endif |
34 | #ifdef CONFIG_BSD_PROCESS_ACCT | 35 | #ifdef CONFIG_BSD_PROCESS_ACCT |
35 | struct bsd_acct_struct *bacct; | 36 | struct bsd_acct_struct *bacct; |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index ad1a427b5267..b8809fef61f5 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -27,6 +27,7 @@ struct pipe_buffer { | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * struct pipe_inode_info - a linux kernel pipe | 29 | * struct pipe_inode_info - a linux kernel pipe |
30 | * @mutex: mutex protecting the whole thing | ||
30 | * @wait: reader/writer wait point in case of empty/full pipe | 31 | * @wait: reader/writer wait point in case of empty/full pipe |
31 | * @nrbufs: the number of non-empty pipe buffers in this pipe | 32 | * @nrbufs: the number of non-empty pipe buffers in this pipe |
32 | * @buffers: total number of buffers (should be a power of 2) | 33 | * @buffers: total number of buffers (should be a power of 2) |
@@ -34,26 +35,27 @@ struct pipe_buffer { | |||
34 | * @tmp_page: cached released page | 35 | * @tmp_page: cached released page |
35 | * @readers: number of current readers of this pipe | 36 | * @readers: number of current readers of this pipe |
36 | * @writers: number of current writers of this pipe | 37 | * @writers: number of current writers of this pipe |
38 | * @files: number of struct file refering this pipe (protected by ->i_lock) | ||
37 | * @waiting_writers: number of writers blocked waiting for room | 39 | * @waiting_writers: number of writers blocked waiting for room |
38 | * @r_counter: reader counter | 40 | * @r_counter: reader counter |
39 | * @w_counter: writer counter | 41 | * @w_counter: writer counter |
40 | * @fasync_readers: reader side fasync | 42 | * @fasync_readers: reader side fasync |
41 | * @fasync_writers: writer side fasync | 43 | * @fasync_writers: writer side fasync |
42 | * @inode: inode this pipe is attached to | ||
43 | * @bufs: the circular array of pipe buffers | 44 | * @bufs: the circular array of pipe buffers |
44 | **/ | 45 | **/ |
45 | struct pipe_inode_info { | 46 | struct pipe_inode_info { |
47 | struct mutex mutex; | ||
46 | wait_queue_head_t wait; | 48 | wait_queue_head_t wait; |
47 | unsigned int nrbufs, curbuf, buffers; | 49 | unsigned int nrbufs, curbuf, buffers; |
48 | unsigned int readers; | 50 | unsigned int readers; |
49 | unsigned int writers; | 51 | unsigned int writers; |
52 | unsigned int files; | ||
50 | unsigned int waiting_writers; | 53 | unsigned int waiting_writers; |
51 | unsigned int r_counter; | 54 | unsigned int r_counter; |
52 | unsigned int w_counter; | 55 | unsigned int w_counter; |
53 | struct page *tmp_page; | 56 | struct page *tmp_page; |
54 | struct fasync_struct *fasync_readers; | 57 | struct fasync_struct *fasync_readers; |
55 | struct fasync_struct *fasync_writers; | 58 | struct fasync_struct *fasync_writers; |
56 | struct inode *inode; | ||
57 | struct pipe_buffer *bufs; | 59 | struct pipe_buffer *bufs; |
58 | }; | 60 | }; |
59 | 61 | ||
@@ -144,9 +146,8 @@ int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *); | |||
144 | /* Drop the inode semaphore and wait for a pipe event, atomically */ | 146 | /* Drop the inode semaphore and wait for a pipe event, atomically */ |
145 | void pipe_wait(struct pipe_inode_info *pipe); | 147 | void pipe_wait(struct pipe_inode_info *pipe); |
146 | 148 | ||
147 | struct pipe_inode_info * alloc_pipe_info(struct inode * inode); | 149 | struct pipe_inode_info *alloc_pipe_info(void); |
148 | void free_pipe_info(struct inode * inode); | 150 | void free_pipe_info(struct pipe_inode_info *); |
149 | void __free_pipe_info(struct pipe_inode_info *); | ||
150 | 151 | ||
151 | /* Generic pipe buffer ops functions */ | 152 | /* Generic pipe buffer ops functions */ |
152 | void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); | 153 | void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 94dfb2aa5533..608e60a74c3c 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -1,318 +1,79 @@ | |||
1 | #ifndef _LINUX_PROC_FS_H | ||
2 | #define _LINUX_PROC_FS_H | ||
3 | |||
4 | #include <linux/slab.h> | ||
5 | #include <linux/fs.h> | ||
6 | #include <linux/spinlock.h> | ||
7 | #include <linux/magic.h> | ||
8 | #include <linux/atomic.h> | ||
9 | |||
10 | struct net; | ||
11 | struct completion; | ||
12 | struct mm_struct; | ||
13 | |||
14 | /* | 1 | /* |
15 | * The proc filesystem constants/structures | 2 | * The proc filesystem constants/structures |
16 | */ | 3 | */ |
4 | #ifndef _LINUX_PROC_FS_H | ||
5 | #define _LINUX_PROC_FS_H | ||
17 | 6 | ||
18 | /* | 7 | #include <linux/types.h> |
19 | * Offset of the first process in the /proc root directory.. | 8 | #include <linux/fs.h> |
20 | */ | ||
21 | #define FIRST_PROCESS_ENTRY 256 | ||
22 | |||
23 | /* Worst case buffer size needed for holding an integer. */ | ||
24 | #define PROC_NUMBUF 13 | ||
25 | |||
26 | /* | ||
27 | * We always define these enumerators | ||
28 | */ | ||
29 | |||
30 | enum { | ||
31 | PROC_ROOT_INO = 1, | ||
32 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
33 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
34 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
35 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * This is not completely implemented yet. The idea is to | ||
40 | * create an in-memory tree (like the actual /proc filesystem | ||
41 | * tree) of these proc_dir_entries, so that we can dynamically | ||
42 | * add new files to /proc. | ||
43 | * | ||
44 | * The "next" pointer creates a linked list of one /proc directory, | ||
45 | * while parent/subdir create the directory structure (every | ||
46 | * /proc file has a parent, but "subdir" is NULL for all | ||
47 | * non-directory entries). | ||
48 | */ | ||
49 | |||
50 | typedef int (read_proc_t)(char *page, char **start, off_t off, | ||
51 | int count, int *eof, void *data); | ||
52 | typedef int (write_proc_t)(struct file *file, const char __user *buffer, | ||
53 | unsigned long count, void *data); | ||
54 | |||
55 | struct proc_dir_entry { | ||
56 | unsigned int low_ino; | ||
57 | umode_t mode; | ||
58 | nlink_t nlink; | ||
59 | kuid_t uid; | ||
60 | kgid_t gid; | ||
61 | loff_t size; | ||
62 | const struct inode_operations *proc_iops; | ||
63 | /* | ||
64 | * NULL ->proc_fops means "PDE is going away RSN" or | ||
65 | * "PDE is just created". In either case, e.g. ->read_proc won't be | ||
66 | * called because it's too late or too early, respectively. | ||
67 | * | ||
68 | * If you're allocating ->proc_fops dynamically, save a pointer | ||
69 | * somewhere. | ||
70 | */ | ||
71 | const struct file_operations *proc_fops; | ||
72 | struct proc_dir_entry *next, *parent, *subdir; | ||
73 | void *data; | ||
74 | read_proc_t *read_proc; | ||
75 | write_proc_t *write_proc; | ||
76 | atomic_t count; /* use count */ | ||
77 | int pde_users; /* number of callers into module in progress */ | ||
78 | struct completion *pde_unload_completion; | ||
79 | struct list_head pde_openers; /* who did ->open, but not ->release */ | ||
80 | spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ | ||
81 | u8 namelen; | ||
82 | char name[]; | ||
83 | }; | ||
84 | |||
85 | enum kcore_type { | ||
86 | KCORE_TEXT, | ||
87 | KCORE_VMALLOC, | ||
88 | KCORE_RAM, | ||
89 | KCORE_VMEMMAP, | ||
90 | KCORE_OTHER, | ||
91 | }; | ||
92 | |||
93 | struct kcore_list { | ||
94 | struct list_head list; | ||
95 | unsigned long addr; | ||
96 | size_t size; | ||
97 | int type; | ||
98 | }; | ||
99 | 9 | ||
100 | struct vmcore { | 10 | struct proc_dir_entry; |
101 | struct list_head list; | ||
102 | unsigned long long paddr; | ||
103 | unsigned long long size; | ||
104 | loff_t offset; | ||
105 | }; | ||
106 | 11 | ||
107 | #ifdef CONFIG_PROC_FS | 12 | #ifdef CONFIG_PROC_FS |
108 | 13 | ||
109 | extern void proc_root_init(void); | 14 | extern void proc_root_init(void); |
110 | 15 | extern void proc_flush_task(struct task_struct *); | |
111 | void proc_flush_task(struct task_struct *task); | ||
112 | |||
113 | extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, | ||
114 | struct proc_dir_entry *parent); | ||
115 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, | ||
116 | struct proc_dir_entry *parent, | ||
117 | const struct file_operations *proc_fops, | ||
118 | void *data); | ||
119 | extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); | ||
120 | extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent); | ||
121 | |||
122 | struct pid_namespace; | ||
123 | |||
124 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
125 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
126 | |||
127 | /* | ||
128 | * proc_tty.c | ||
129 | */ | ||
130 | struct tty_driver; | ||
131 | #ifdef CONFIG_TTY | ||
132 | extern void proc_tty_init(void); | ||
133 | #else | ||
134 | static inline void proc_tty_init(void) | ||
135 | { } | ||
136 | #endif | ||
137 | extern void proc_tty_register_driver(struct tty_driver *driver); | ||
138 | extern void proc_tty_unregister_driver(struct tty_driver *driver); | ||
139 | |||
140 | /* | ||
141 | * proc_devtree.c | ||
142 | */ | ||
143 | #ifdef CONFIG_PROC_DEVICETREE | ||
144 | struct device_node; | ||
145 | struct property; | ||
146 | extern void proc_device_tree_init(void); | ||
147 | extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); | ||
148 | extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); | ||
149 | extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, | ||
150 | struct property *prop); | ||
151 | extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, | ||
152 | struct property *newprop, | ||
153 | struct property *oldprop); | ||
154 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
155 | 16 | ||
156 | extern struct proc_dir_entry *proc_symlink(const char *, | 17 | extern struct proc_dir_entry *proc_symlink(const char *, |
157 | struct proc_dir_entry *, const char *); | 18 | struct proc_dir_entry *, const char *); |
158 | extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); | 19 | extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); |
159 | extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, | 20 | extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, |
160 | struct proc_dir_entry *parent); | 21 | struct proc_dir_entry *, void *); |
161 | 22 | extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, | |
162 | static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, | 23 | struct proc_dir_entry *); |
163 | struct proc_dir_entry *parent, const struct file_operations *proc_fops) | 24 | |
25 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t, | ||
26 | struct proc_dir_entry *, | ||
27 | const struct file_operations *, | ||
28 | void *); | ||
29 | |||
30 | static inline struct proc_dir_entry *proc_create( | ||
31 | const char *name, umode_t mode, struct proc_dir_entry *parent, | ||
32 | const struct file_operations *proc_fops) | ||
164 | { | 33 | { |
165 | return proc_create_data(name, mode, parent, proc_fops, NULL); | 34 | return proc_create_data(name, mode, parent, proc_fops, NULL); |
166 | } | 35 | } |
167 | 36 | ||
168 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 37 | extern void proc_set_size(struct proc_dir_entry *, loff_t); |
169 | umode_t mode, struct proc_dir_entry *base, | 38 | extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); |
170 | read_proc_t *read_proc, void * data) | 39 | extern void *PDE_DATA(const struct inode *); |
171 | { | 40 | extern void *proc_get_parent_data(const struct inode *); |
172 | struct proc_dir_entry *res=create_proc_entry(name,mode,base); | 41 | extern void proc_remove(struct proc_dir_entry *); |
173 | if (res) { | 42 | extern void remove_proc_entry(const char *, struct proc_dir_entry *); |
174 | res->read_proc=read_proc; | 43 | extern int remove_proc_subtree(const char *, struct proc_dir_entry *); |
175 | res->data=data; | ||
176 | } | ||
177 | return res; | ||
178 | } | ||
179 | |||
180 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | ||
181 | struct proc_dir_entry *parent); | ||
182 | |||
183 | extern struct file *proc_ns_fget(int fd); | ||
184 | extern bool proc_ns_inode(struct inode *inode); | ||
185 | 44 | ||
186 | extern int proc_alloc_inum(unsigned int *pino); | 45 | #else /* CONFIG_PROC_FS */ |
187 | extern void proc_free_inum(unsigned int inum); | ||
188 | #else | ||
189 | 46 | ||
190 | static inline void proc_flush_task(struct task_struct *task) | 47 | static inline void proc_flush_task(struct task_struct *task) |
191 | { | 48 | { |
192 | } | 49 | } |
193 | 50 | ||
194 | static inline struct proc_dir_entry *create_proc_entry(const char *name, | ||
195 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | ||
196 | |||
197 | #define proc_create(name, mode, parent, fops) ({ (void)(mode), NULL; }) | ||
198 | |||
199 | static inline struct proc_dir_entry *proc_create_data(const char *name, | ||
200 | umode_t mode, struct proc_dir_entry *parent, | ||
201 | const struct file_operations *proc_fops, void *data) | ||
202 | { | ||
203 | return NULL; | ||
204 | } | ||
205 | #define remove_proc_entry(name, parent) do {} while (0) | ||
206 | #define remove_proc_subtree(name, parent) do {} while (0) | ||
207 | |||
208 | static inline struct proc_dir_entry *proc_symlink(const char *name, | 51 | static inline struct proc_dir_entry *proc_symlink(const char *name, |
209 | struct proc_dir_entry *parent,const char *dest) {return NULL;} | 52 | struct proc_dir_entry *parent,const char *dest) { return NULL;} |
210 | static inline struct proc_dir_entry *proc_mkdir(const char *name, | 53 | static inline struct proc_dir_entry *proc_mkdir(const char *name, |
211 | struct proc_dir_entry *parent) {return NULL;} | 54 | struct proc_dir_entry *parent) {return NULL;} |
55 | static inline struct proc_dir_entry *proc_mkdir_data(const char *name, | ||
56 | umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; } | ||
212 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, | 57 | static inline struct proc_dir_entry *proc_mkdir_mode(const char *name, |
213 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } | 58 | umode_t mode, struct proc_dir_entry *parent) { return NULL; } |
59 | #define proc_create(name, mode, parent, proc_fops) ({NULL;}) | ||
60 | #define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) | ||
214 | 61 | ||
215 | static inline struct proc_dir_entry *create_proc_read_entry(const char *name, | 62 | static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} |
216 | umode_t mode, struct proc_dir_entry *base, | 63 | static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} |
217 | read_proc_t *read_proc, void * data) { return NULL; } | 64 | static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} |
218 | 65 | static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } | |
219 | struct tty_driver; | ||
220 | static inline void proc_tty_register_driver(struct tty_driver *driver) {}; | ||
221 | static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; | ||
222 | 66 | ||
223 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) | 67 | static inline void proc_remove(struct proc_dir_entry *de) {} |
224 | { | 68 | #define remove_proc_entry(name, parent) do {} while (0) |
225 | return 0; | 69 | static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } |
226 | } | ||
227 | |||
228 | static inline void pid_ns_release_proc(struct pid_namespace *ns) | ||
229 | { | ||
230 | } | ||
231 | |||
232 | static inline struct file *proc_ns_fget(int fd) | ||
233 | { | ||
234 | return ERR_PTR(-EINVAL); | ||
235 | } | ||
236 | |||
237 | static inline bool proc_ns_inode(struct inode *inode) | ||
238 | { | ||
239 | return false; | ||
240 | } | ||
241 | 70 | ||
242 | static inline int proc_alloc_inum(unsigned int *inum) | ||
243 | { | ||
244 | *inum = 1; | ||
245 | return 0; | ||
246 | } | ||
247 | static inline void proc_free_inum(unsigned int inum) | ||
248 | { | ||
249 | } | ||
250 | #endif /* CONFIG_PROC_FS */ | 71 | #endif /* CONFIG_PROC_FS */ |
251 | 72 | ||
252 | #if !defined(CONFIG_PROC_KCORE) | 73 | static inline struct proc_dir_entry *proc_net_mkdir( |
253 | static inline void | 74 | struct net *net, const char *name, struct proc_dir_entry *parent) |
254 | kclist_add(struct kcore_list *new, void *addr, size_t size, int type) | ||
255 | { | 75 | { |
76 | return proc_mkdir_data(name, 0, parent, net); | ||
256 | } | 77 | } |
257 | #else | ||
258 | extern void kclist_add(struct kcore_list *, void *, size_t, int type); | ||
259 | #endif | ||
260 | |||
261 | struct nsproxy; | ||
262 | struct proc_ns_operations { | ||
263 | const char *name; | ||
264 | int type; | ||
265 | void *(*get)(struct task_struct *task); | ||
266 | void (*put)(void *ns); | ||
267 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
268 | unsigned int (*inum)(void *ns); | ||
269 | }; | ||
270 | extern const struct proc_ns_operations netns_operations; | ||
271 | extern const struct proc_ns_operations utsns_operations; | ||
272 | extern const struct proc_ns_operations ipcns_operations; | ||
273 | extern const struct proc_ns_operations pidns_operations; | ||
274 | extern const struct proc_ns_operations userns_operations; | ||
275 | extern const struct proc_ns_operations mntns_operations; | ||
276 | |||
277 | union proc_op { | ||
278 | int (*proc_get_link)(struct dentry *, struct path *); | ||
279 | int (*proc_read)(struct task_struct *task, char *page); | ||
280 | int (*proc_show)(struct seq_file *m, | ||
281 | struct pid_namespace *ns, struct pid *pid, | ||
282 | struct task_struct *task); | ||
283 | }; | ||
284 | |||
285 | struct ctl_table_header; | ||
286 | struct ctl_table; | ||
287 | |||
288 | struct proc_inode { | ||
289 | struct pid *pid; | ||
290 | int fd; | ||
291 | union proc_op op; | ||
292 | struct proc_dir_entry *pde; | ||
293 | struct ctl_table_header *sysctl; | ||
294 | struct ctl_table *sysctl_entry; | ||
295 | void *ns; | ||
296 | const struct proc_ns_operations *ns_ops; | ||
297 | struct inode vfs_inode; | ||
298 | }; | ||
299 | |||
300 | static inline struct proc_inode *PROC_I(const struct inode *inode) | ||
301 | { | ||
302 | return container_of(inode, struct proc_inode, vfs_inode); | ||
303 | } | ||
304 | |||
305 | static inline struct proc_dir_entry *PDE(const struct inode *inode) | ||
306 | { | ||
307 | return PROC_I(inode)->pde; | ||
308 | } | ||
309 | |||
310 | static inline struct net *PDE_NET(struct proc_dir_entry *pde) | ||
311 | { | ||
312 | return pde->parent->data; | ||
313 | } | ||
314 | |||
315 | #include <linux/signal.h> | ||
316 | 78 | ||
317 | void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set); | ||
318 | #endif /* _LINUX_PROC_FS_H */ | 79 | #endif /* _LINUX_PROC_FS_H */ |
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h new file mode 100644 index 000000000000..34a1e105bef4 --- /dev/null +++ b/include/linux/proc_ns.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * procfs namespace bits | ||
3 | */ | ||
4 | #ifndef _LINUX_PROC_NS_H | ||
5 | #define _LINUX_PROC_NS_H | ||
6 | |||
7 | struct pid_namespace; | ||
8 | struct nsproxy; | ||
9 | |||
10 | struct proc_ns_operations { | ||
11 | const char *name; | ||
12 | int type; | ||
13 | void *(*get)(struct task_struct *task); | ||
14 | void (*put)(void *ns); | ||
15 | int (*install)(struct nsproxy *nsproxy, void *ns); | ||
16 | unsigned int (*inum)(void *ns); | ||
17 | }; | ||
18 | |||
19 | struct proc_ns { | ||
20 | void *ns; | ||
21 | const struct proc_ns_operations *ns_ops; | ||
22 | }; | ||
23 | |||
24 | extern const struct proc_ns_operations netns_operations; | ||
25 | extern const struct proc_ns_operations utsns_operations; | ||
26 | extern const struct proc_ns_operations ipcns_operations; | ||
27 | extern const struct proc_ns_operations pidns_operations; | ||
28 | extern const struct proc_ns_operations userns_operations; | ||
29 | extern const struct proc_ns_operations mntns_operations; | ||
30 | |||
31 | /* | ||
32 | * We always define these enumerators | ||
33 | */ | ||
34 | enum { | ||
35 | PROC_ROOT_INO = 1, | ||
36 | PROC_IPC_INIT_INO = 0xEFFFFFFFU, | ||
37 | PROC_UTS_INIT_INO = 0xEFFFFFFEU, | ||
38 | PROC_USER_INIT_INO = 0xEFFFFFFDU, | ||
39 | PROC_PID_INIT_INO = 0xEFFFFFFCU, | ||
40 | }; | ||
41 | |||
42 | #ifdef CONFIG_PROC_FS | ||
43 | |||
44 | extern int pid_ns_prepare_proc(struct pid_namespace *ns); | ||
45 | extern void pid_ns_release_proc(struct pid_namespace *ns); | ||
46 | extern struct file *proc_ns_fget(int fd); | ||
47 | extern struct proc_ns *get_proc_ns(struct inode *); | ||
48 | extern int proc_alloc_inum(unsigned int *pino); | ||
49 | extern void proc_free_inum(unsigned int inum); | ||
50 | extern bool proc_ns_inode(struct inode *inode); | ||
51 | |||
52 | #else /* CONFIG_PROC_FS */ | ||
53 | |||
54 | static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } | ||
55 | static inline void pid_ns_release_proc(struct pid_namespace *ns) {} | ||
56 | |||
57 | static inline struct file *proc_ns_fget(int fd) | ||
58 | { | ||
59 | return ERR_PTR(-EINVAL); | ||
60 | } | ||
61 | |||
62 | static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; } | ||
63 | |||
64 | static inline int proc_alloc_inum(unsigned int *inum) | ||
65 | { | ||
66 | *inum = 1; | ||
67 | return 0; | ||
68 | } | ||
69 | static inline void proc_free_inum(unsigned int inum) {} | ||
70 | static inline bool proc_ns_inode(struct inode *inode) { return false; } | ||
71 | |||
72 | #endif /* CONFIG_PROC_FS */ | ||
73 | |||
74 | #endif /* _LINUX_PROC_NS_H */ | ||
diff --git a/include/linux/profile.h b/include/linux/profile.h index 21123902366d..aaad3861beb8 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h | |||
@@ -18,10 +18,10 @@ struct pt_regs; | |||
18 | struct notifier_block; | 18 | struct notifier_block; |
19 | 19 | ||
20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) | 20 | #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) |
21 | void create_prof_cpu_mask(struct proc_dir_entry *de); | 21 | void create_prof_cpu_mask(void); |
22 | int create_proc_profile(void); | 22 | int create_proc_profile(void); |
23 | #else | 23 | #else |
24 | static inline void create_prof_cpu_mask(struct proc_dir_entry *de) | 24 | static inline void create_prof_cpu_mask(void) |
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 68a04a343cad..2da29ac178fc 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -123,6 +123,7 @@ static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); | 125 | int single_open(struct file *, int (*)(struct seq_file *, void *), void *); |
126 | int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t); | ||
126 | int single_release(struct inode *, struct file *); | 127 | int single_release(struct inode *, struct file *); |
127 | void *__seq_open_private(struct file *, const struct seq_operations *, int); | 128 | void *__seq_open_private(struct file *, const struct seq_operations *, int); |
128 | int seq_open_private(struct file *, const struct seq_operations *, int); | 129 | int seq_open_private(struct file *, const struct seq_operations *, int); |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 9475c5cb28bc..d897484730c0 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -434,4 +434,9 @@ void signals_init(void); | |||
434 | int restore_altstack(const stack_t __user *); | 434 | int restore_altstack(const stack_t __user *); |
435 | int __save_altstack(stack_t __user *, unsigned long); | 435 | int __save_altstack(stack_t __user *, unsigned long); |
436 | 436 | ||
437 | #ifdef CONFIG_PROC_FS | ||
438 | struct seq_file; | ||
439 | extern void render_sigset_t(struct seq_file *, const char *, sigset_t *); | ||
440 | #endif | ||
441 | |||
437 | #endif /* _LINUX_SIGNAL_H */ | 442 | #endif /* _LINUX_SIGNAL_H */ |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 367a9dfc4ea2..7e92bd86a808 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -691,5 +691,12 @@ do { \ | |||
691 | finish_wait(&wq, &__wait); \ | 691 | finish_wait(&wq, &__wait); \ |
692 | } while (0) | 692 | } while (0) |
693 | 693 | ||
694 | #ifdef CONFIG_PROC_FS | ||
695 | extern void proc_tty_register_driver(struct tty_driver *); | ||
696 | extern void proc_tty_unregister_driver(struct tty_driver *); | ||
697 | #else | ||
698 | static inline void proc_tty_register_driver(struct tty_driver *d) {} | ||
699 | static inline void proc_tty_unregister_driver(struct tty_driver *d) {} | ||
700 | #endif | ||
694 | 701 | ||
695 | #endif | 702 | #endif |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 6912ef9a1881..10eb9b389014 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
@@ -226,7 +226,6 @@ struct bt_sock_list { | |||
226 | struct hlist_head head; | 226 | struct hlist_head head; |
227 | rwlock_t lock; | 227 | rwlock_t lock; |
228 | #ifdef CONFIG_PROC_FS | 228 | #ifdef CONFIG_PROC_FS |
229 | struct file_operations fops; | ||
230 | int (* custom_seq_show)(struct seq_file *, void *); | 229 | int (* custom_seq_show)(struct seq_file *, void *); |
231 | #endif | 230 | #endif |
232 | }; | 231 | }; |
@@ -330,7 +329,7 @@ extern void hci_sock_cleanup(void); | |||
330 | extern int bt_sysfs_init(void); | 329 | extern int bt_sysfs_init(void); |
331 | extern void bt_sysfs_cleanup(void); | 330 | extern void bt_sysfs_cleanup(void); |
332 | 331 | ||
333 | extern int bt_procfs_init(struct module* module, struct net *net, const char *name, | 332 | extern int bt_procfs_init(struct net *net, const char *name, |
334 | struct bt_sock_list* sk_list, | 333 | struct bt_sock_list* sk_list, |
335 | int (* seq_show)(struct seq_file *, void *)); | 334 | int (* seq_show)(struct seq_file *, void *)); |
336 | extern void bt_procfs_cleanup(struct net *net, const char *name); | 335 | extern void bt_procfs_cleanup(struct net *net, const char *name); |
diff --git a/include/net/lib80211.h b/include/net/lib80211.h index d178c26a5558..be95b9262801 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/skbuff.h> | 30 | #include <linux/skbuff.h> |
31 | #include <linux/ieee80211.h> | 31 | #include <linux/ieee80211.h> |
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/seq_file.h> | ||
34 | |||
33 | /* print_ssid() is intended to be used in debug (and possibly error) | 35 | /* print_ssid() is intended to be used in debug (and possibly error) |
34 | * messages. It should never be used for passing ssid to user space. */ | 36 | * messages. It should never be used for passing ssid to user space. */ |
35 | const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); | 37 | const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); |
@@ -75,7 +77,7 @@ struct lib80211_crypto_ops { | |||
75 | 77 | ||
76 | /* procfs handler for printing out key information and possible | 78 | /* procfs handler for printing out key information and possible |
77 | * statistics */ | 79 | * statistics */ |
78 | char *(*print_stats) (char *p, void *priv); | 80 | void (*print_stats) (struct seq_file *m, void *priv); |
79 | 81 | ||
80 | /* Crypto specific flag get/set for configuration settings */ | 82 | /* Crypto specific flag get/set for configuration settings */ |
81 | unsigned long (*get_flags) (void *priv); | 83 | unsigned long (*get_flags) (void *priv); |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 2b6956e9853d..755243572219 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/workqueue.h> | 7 | #include <linux/workqueue.h> |
8 | #include <linux/mutex.h> | 8 | #include <linux/mutex.h> |
9 | #include <linux/seq_file.h> | ||
9 | #include <scsi/scsi.h> | 10 | #include <scsi/scsi.h> |
10 | 11 | ||
11 | struct request_queue; | 12 | struct request_queue; |
@@ -340,7 +341,8 @@ struct scsi_host_template { | |||
340 | * | 341 | * |
341 | * Status: OBSOLETE | 342 | * Status: OBSOLETE |
342 | */ | 343 | */ |
343 | int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); | 344 | int (*show_info)(struct seq_file *, struct Scsi_Host *); |
345 | int (*write_info)(struct Scsi_Host *, char *, int); | ||
344 | 346 | ||
345 | /* | 347 | /* |
346 | * This is an optional routine that allows the transport to become | 348 | * This is an optional routine that allows the transport to become |
@@ -375,7 +377,7 @@ struct scsi_host_template { | |||
375 | 377 | ||
376 | /* | 378 | /* |
377 | * Used to store the procfs directory if a driver implements the | 379 | * Used to store the procfs directory if a driver implements the |
378 | * proc_info method. | 380 | * show_info method. |
379 | */ | 381 | */ |
380 | struct proc_dir_entry *proc_dir; | 382 | struct proc_dir_entry *proc_dir; |
381 | 383 | ||
diff --git a/init/version.c b/init/version.c index 58170f18912d..1a4718e500fe 100644 --- a/init/version.c +++ b/init/version.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/utsname.h> | 12 | #include <linux/utsname.h> |
13 | #include <generated/utsrelease.h> | 13 | #include <generated/utsrelease.h> |
14 | #include <linux/version.h> | 14 | #include <linux/version.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_ns.h> |
16 | 16 | ||
17 | #ifndef CONFIG_KALLSYMS | 17 | #ifndef CONFIG_KALLSYMS |
18 | #define version(a) Version_ ## a | 18 | #define version(a) Version_ ## a |
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index d43439e6eb47..491e71f2a1b8 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/msg.h> | 16 | #include <linux/msg.h> |
17 | #include <linux/ipc_namespace.h> | 17 | #include <linux/ipc_namespace.h> |
18 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_ns.h> |
20 | #include <linux/uaccess.h> | 20 | #include <linux/uaccess.h> |
21 | 21 | ||
22 | #include "util.h" | 22 | #include "util.h" |
diff --git a/ipc/namespace.c b/ipc/namespace.c index 7c1fa451b0b0..7ee61bf44933 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/mount.h> | 13 | #include <linux/mount.h> |
14 | #include <linux/user_namespace.h> | 14 | #include <linux/user_namespace.h> |
15 | #include <linux/proc_fs.h> | 15 | #include <linux/proc_ns.h> |
16 | 16 | ||
17 | #include "util.h" | 17 | #include "util.h" |
18 | 18 | ||
diff --git a/ipc/util.c b/ipc/util.c index 579201e4bc01..abfc13e8677f 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -1031,7 +1031,7 @@ static int sysvipc_proc_open(struct inode *inode, struct file *file) | |||
1031 | seq = file->private_data; | 1031 | seq = file->private_data; |
1032 | seq->private = iter; | 1032 | seq->private = iter; |
1033 | 1033 | ||
1034 | iter->iface = PDE(inode)->data; | 1034 | iter->iface = PDE_DATA(inode); |
1035 | iter->ns = get_ipc_ns(current->nsproxy->ipc_ns); | 1035 | iter->ns = get_ipc_ns(current->nsproxy->ipc_ns); |
1036 | out: | 1036 | out: |
1037 | return ret; | 1037 | return ret; |
diff --git a/kernel/acct.c b/kernel/acct.c index b9bd7f098ee5..85389fe2abd0 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -543,6 +543,7 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
543 | * Kernel segment override to datasegment and write it | 543 | * Kernel segment override to datasegment and write it |
544 | * to the accounting file. | 544 | * to the accounting file. |
545 | */ | 545 | */ |
546 | file_start_write(file); | ||
546 | fs = get_fs(); | 547 | fs = get_fs(); |
547 | set_fs(KERNEL_DS); | 548 | set_fs(KERNEL_DS); |
548 | /* | 549 | /* |
@@ -554,6 +555,7 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
554 | sizeof(acct_t), &file->f_pos); | 555 | sizeof(acct_t), &file->f_pos); |
555 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim; | 556 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim; |
556 | set_fs(fs); | 557 | set_fs(fs); |
558 | file_end_write(file); | ||
557 | out: | 559 | out: |
558 | revert_creds(orig_cred); | 560 | revert_creds(orig_cred); |
559 | } | 561 | } |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index d3abce2d6455..2a9926275f80 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -4678,7 +4678,7 @@ out: | |||
4678 | */ | 4678 | */ |
4679 | 4679 | ||
4680 | /* TODO: Use a proper seq_file iterator */ | 4680 | /* TODO: Use a proper seq_file iterator */ |
4681 | static int proc_cgroup_show(struct seq_file *m, void *v) | 4681 | int proc_cgroup_show(struct seq_file *m, void *v) |
4682 | { | 4682 | { |
4683 | struct pid *pid; | 4683 | struct pid *pid; |
4684 | struct task_struct *tsk; | 4684 | struct task_struct *tsk; |
@@ -4730,19 +4730,6 @@ out: | |||
4730 | return retval; | 4730 | return retval; |
4731 | } | 4731 | } |
4732 | 4732 | ||
4733 | static int cgroup_open(struct inode *inode, struct file *file) | ||
4734 | { | ||
4735 | struct pid *pid = PROC_I(inode)->pid; | ||
4736 | return single_open(file, proc_cgroup_show, pid); | ||
4737 | } | ||
4738 | |||
4739 | const struct file_operations proc_cgroup_operations = { | ||
4740 | .open = cgroup_open, | ||
4741 | .read = seq_read, | ||
4742 | .llseek = seq_lseek, | ||
4743 | .release = single_release, | ||
4744 | }; | ||
4745 | |||
4746 | /* Display information about each subsystem and each hierarchy */ | 4733 | /* Display information about each subsystem and each hierarchy */ |
4747 | static int proc_cgroupstats_show(struct seq_file *m, void *v) | 4734 | static int proc_cgroupstats_show(struct seq_file *m, void *v) |
4748 | { | 4735 | { |
diff --git a/kernel/configs.c b/kernel/configs.c index 42e8fa075eed..c18b1f1ae515 100644 --- a/kernel/configs.c +++ b/kernel/configs.c | |||
@@ -79,7 +79,7 @@ static int __init ikconfig_init(void) | |||
79 | if (!entry) | 79 | if (!entry) |
80 | return -ENOMEM; | 80 | return -ENOMEM; |
81 | 81 | ||
82 | entry->size = kernel_config_data_size; | 82 | proc_set_size(entry, kernel_config_data_size); |
83 | 83 | ||
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 12331120767c..64b3f791bbe5 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -2609,7 +2609,7 @@ void __cpuset_memory_pressure_bump(void) | |||
2609 | * and we take cpuset_mutex, keeping cpuset_attach() from changing it | 2609 | * and we take cpuset_mutex, keeping cpuset_attach() from changing it |
2610 | * anyway. | 2610 | * anyway. |
2611 | */ | 2611 | */ |
2612 | static int proc_cpuset_show(struct seq_file *m, void *unused_v) | 2612 | int proc_cpuset_show(struct seq_file *m, void *unused_v) |
2613 | { | 2613 | { |
2614 | struct pid *pid; | 2614 | struct pid *pid; |
2615 | struct task_struct *tsk; | 2615 | struct task_struct *tsk; |
@@ -2643,19 +2643,6 @@ out_free: | |||
2643 | out: | 2643 | out: |
2644 | return retval; | 2644 | return retval; |
2645 | } | 2645 | } |
2646 | |||
2647 | static int cpuset_open(struct inode *inode, struct file *file) | ||
2648 | { | ||
2649 | struct pid *pid = PROC_I(inode)->pid; | ||
2650 | return single_open(file, proc_cpuset_show, pid); | ||
2651 | } | ||
2652 | |||
2653 | const struct file_operations proc_cpuset_operations = { | ||
2654 | .open = cpuset_open, | ||
2655 | .read = seq_read, | ||
2656 | .llseek = seq_lseek, | ||
2657 | .release = single_release, | ||
2658 | }; | ||
2659 | #endif /* CONFIG_PROC_PID_CPUSET */ | 2646 | #endif /* CONFIG_PROC_PID_CPUSET */ |
2660 | 2647 | ||
2661 | /* Display task mems_allowed in /proc/<pid>/status file. */ | 2648 | /* Display task mems_allowed in /proc/<pid>/status file. */ |
diff --git a/kernel/exit.c b/kernel/exit.c index 6e3151ec900f..af2eb3cbd499 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -847,7 +847,7 @@ void do_exit(long code) | |||
847 | exit_io_context(tsk); | 847 | exit_io_context(tsk); |
848 | 848 | ||
849 | if (tsk->splice_pipe) | 849 | if (tsk->splice_pipe) |
850 | __free_pipe_info(tsk->splice_pipe); | 850 | free_pipe_info(tsk->splice_pipe); |
851 | 851 | ||
852 | if (tsk->task_frag.page) | 852 | if (tsk->task_frag.page) |
853 | put_page(tsk->task_frag.page); | 853 | put_page(tsk->task_frag.page); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 397db02209ed..19ed5c425c3b 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -76,7 +76,7 @@ static int irq_affinity_list_proc_show(struct seq_file *m, void *v) | |||
76 | static ssize_t write_irq_affinity(int type, struct file *file, | 76 | static ssize_t write_irq_affinity(int type, struct file *file, |
77 | const char __user *buffer, size_t count, loff_t *pos) | 77 | const char __user *buffer, size_t count, loff_t *pos) |
78 | { | 78 | { |
79 | unsigned int irq = (int)(long)PDE(file_inode(file))->data; | 79 | unsigned int irq = (int)(long)PDE_DATA(file_inode(file)); |
80 | cpumask_var_t new_value; | 80 | cpumask_var_t new_value; |
81 | int err; | 81 | int err; |
82 | 82 | ||
@@ -131,17 +131,17 @@ static ssize_t irq_affinity_list_proc_write(struct file *file, | |||
131 | 131 | ||
132 | static int irq_affinity_proc_open(struct inode *inode, struct file *file) | 132 | static int irq_affinity_proc_open(struct inode *inode, struct file *file) |
133 | { | 133 | { |
134 | return single_open(file, irq_affinity_proc_show, PDE(inode)->data); | 134 | return single_open(file, irq_affinity_proc_show, PDE_DATA(inode)); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int irq_affinity_list_proc_open(struct inode *inode, struct file *file) | 137 | static int irq_affinity_list_proc_open(struct inode *inode, struct file *file) |
138 | { | 138 | { |
139 | return single_open(file, irq_affinity_list_proc_show, PDE(inode)->data); | 139 | return single_open(file, irq_affinity_list_proc_show, PDE_DATA(inode)); |
140 | } | 140 | } |
141 | 141 | ||
142 | static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file) | 142 | static int irq_affinity_hint_proc_open(struct inode *inode, struct file *file) |
143 | { | 143 | { |
144 | return single_open(file, irq_affinity_hint_proc_show, PDE(inode)->data); | 144 | return single_open(file, irq_affinity_hint_proc_show, PDE_DATA(inode)); |
145 | } | 145 | } |
146 | 146 | ||
147 | static const struct file_operations irq_affinity_proc_fops = { | 147 | static const struct file_operations irq_affinity_proc_fops = { |
@@ -212,7 +212,7 @@ out: | |||
212 | 212 | ||
213 | static int default_affinity_open(struct inode *inode, struct file *file) | 213 | static int default_affinity_open(struct inode *inode, struct file *file) |
214 | { | 214 | { |
215 | return single_open(file, default_affinity_show, PDE(inode)->data); | 215 | return single_open(file, default_affinity_show, PDE_DATA(inode)); |
216 | } | 216 | } |
217 | 217 | ||
218 | static const struct file_operations default_affinity_proc_fops = { | 218 | static const struct file_operations default_affinity_proc_fops = { |
@@ -233,7 +233,7 @@ static int irq_node_proc_show(struct seq_file *m, void *v) | |||
233 | 233 | ||
234 | static int irq_node_proc_open(struct inode *inode, struct file *file) | 234 | static int irq_node_proc_open(struct inode *inode, struct file *file) |
235 | { | 235 | { |
236 | return single_open(file, irq_node_proc_show, PDE(inode)->data); | 236 | return single_open(file, irq_node_proc_show, PDE_DATA(inode)); |
237 | } | 237 | } |
238 | 238 | ||
239 | static const struct file_operations irq_node_proc_fops = { | 239 | static const struct file_operations irq_node_proc_fops = { |
@@ -256,7 +256,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v) | |||
256 | 256 | ||
257 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) | 257 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) |
258 | { | 258 | { |
259 | return single_open(file, irq_spurious_proc_show, PDE(inode)->data); | 259 | return single_open(file, irq_spurious_proc_show, PDE_DATA(inode)); |
260 | } | 260 | } |
261 | 261 | ||
262 | static const struct file_operations irq_spurious_proc_fops = { | 262 | static const struct file_operations irq_spurious_proc_fops = { |
@@ -366,11 +366,7 @@ void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) | |||
366 | 366 | ||
367 | void unregister_handler_proc(unsigned int irq, struct irqaction *action) | 367 | void unregister_handler_proc(unsigned int irq, struct irqaction *action) |
368 | { | 368 | { |
369 | if (action->dir) { | 369 | proc_remove(action->dir); |
370 | struct irq_desc *desc = irq_to_desc(irq); | ||
371 | |||
372 | remove_proc_entry(action->dir->name, desc->dir); | ||
373 | } | ||
374 | } | 370 | } |
375 | 371 | ||
376 | static void register_default_affinity_proc(void) | 372 | static void register_default_affinity_proc(void) |
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index afc0456f227a..364ceab15f0c 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/pid_namespace.h> | 22 | #include <linux/pid_namespace.h> |
23 | #include <net/net_namespace.h> | 23 | #include <net/net_namespace.h> |
24 | #include <linux/ipc_namespace.h> | 24 | #include <linux/ipc_namespace.h> |
25 | #include <linux/proc_fs.h> | 25 | #include <linux/proc_ns.h> |
26 | #include <linux/file.h> | 26 | #include <linux/file.h> |
27 | #include <linux/syscalls.h> | 27 | #include <linux/syscalls.h> |
28 | 28 | ||
@@ -241,7 +241,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
241 | const struct proc_ns_operations *ops; | 241 | const struct proc_ns_operations *ops; |
242 | struct task_struct *tsk = current; | 242 | struct task_struct *tsk = current; |
243 | struct nsproxy *new_nsproxy; | 243 | struct nsproxy *new_nsproxy; |
244 | struct proc_inode *ei; | 244 | struct proc_ns *ei; |
245 | struct file *file; | 245 | struct file *file; |
246 | int err; | 246 | int err; |
247 | 247 | ||
@@ -250,7 +250,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype) | |||
250 | return PTR_ERR(file); | 250 | return PTR_ERR(file); |
251 | 251 | ||
252 | err = -EINVAL; | 252 | err = -EINVAL; |
253 | ei = PROC_I(file_inode(file)); | 253 | ei = get_proc_ns(file_inode(file)); |
254 | ops = ei->ns_ops; | 254 | ops = ei->ns_ops; |
255 | if (nstype && (ops->type != nstype)) | 255 | if (nstype && (ops->type != nstype)) |
256 | goto out; | 256 | goto out; |
diff --git a/kernel/pid.c b/kernel/pid.c index 6283d6412aff..0db3e791a06d 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/pid_namespace.h> | 36 | #include <linux/pid_namespace.h> |
37 | #include <linux/init_task.h> | 37 | #include <linux/init_task.h> |
38 | #include <linux/syscalls.h> | 38 | #include <linux/syscalls.h> |
39 | #include <linux/proc_ns.h> | ||
39 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
40 | 41 | ||
41 | #define pid_hashfn(nr, ns) \ | 42 | #define pid_hashfn(nr, ns) \ |
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index 69473c4a653f..6917e8edb48e 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/acct.h> | 16 | #include <linux/acct.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_ns.h> |
19 | #include <linux/reboot.h> | 19 | #include <linux/reboot.h> |
20 | #include <linux/export.h> | 20 | #include <linux/export.h> |
21 | 21 | ||
diff --git a/kernel/profile.c b/kernel/profile.c index dc3384ee874e..0bf400737660 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
@@ -462,10 +462,10 @@ static const struct file_operations prof_cpu_mask_proc_fops = { | |||
462 | .write = prof_cpu_mask_proc_write, | 462 | .write = prof_cpu_mask_proc_write, |
463 | }; | 463 | }; |
464 | 464 | ||
465 | void create_prof_cpu_mask(struct proc_dir_entry *root_irq_dir) | 465 | void create_prof_cpu_mask(void) |
466 | { | 466 | { |
467 | /* create /proc/irq/prof_cpu_mask */ | 467 | /* create /proc/irq/prof_cpu_mask */ |
468 | proc_create("prof_cpu_mask", 0600, root_irq_dir, &prof_cpu_mask_proc_fops); | 468 | proc_create("irq/prof_cpu_mask", 0600, NULL, &prof_cpu_mask_proc_fops); |
469 | } | 469 | } |
470 | 470 | ||
471 | /* | 471 | /* |
@@ -600,7 +600,7 @@ int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */ | |||
600 | NULL, &proc_profile_operations); | 600 | NULL, &proc_profile_operations); |
601 | if (!entry) | 601 | if (!entry) |
602 | return 0; | 602 | return 0; |
603 | entry->size = (1+prof_len) * sizeof(atomic_t); | 603 | proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t)); |
604 | hotcpu_notifier(profile_cpu_callback, 0); | 604 | hotcpu_notifier(profile_cpu_callback, 0); |
605 | return 0; | 605 | return 0; |
606 | } | 606 | } |
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c index e036eda1a9c9..da98af347e8b 100644 --- a/kernel/sched/stats.c +++ b/kernel/sched/stats.c | |||
@@ -130,16 +130,11 @@ static int schedstat_open(struct inode *inode, struct file *file) | |||
130 | return seq_open(file, &schedstat_sops); | 130 | return seq_open(file, &schedstat_sops); |
131 | } | 131 | } |
132 | 132 | ||
133 | static int schedstat_release(struct inode *inode, struct file *file) | ||
134 | { | ||
135 | return 0; | ||
136 | }; | ||
137 | |||
138 | static const struct file_operations proc_schedstat_operations = { | 133 | static const struct file_operations proc_schedstat_operations = { |
139 | .open = schedstat_open, | 134 | .open = schedstat_open, |
140 | .read = seq_read, | 135 | .read = seq_read, |
141 | .llseek = seq_lseek, | 136 | .llseek = seq_lseek, |
142 | .release = schedstat_release, | 137 | .release = seq_release, |
143 | }; | 138 | }; |
144 | 139 | ||
145 | static int __init proc_schedstat_init(void) | 140 | static int __init proc_schedstat_init(void) |
diff --git a/kernel/user.c b/kernel/user.c index 8e635a18ab52..69b4c3d48cde 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/export.h> | 17 | #include <linux/export.h> |
18 | #include <linux/user_namespace.h> | 18 | #include <linux/user_namespace.h> |
19 | #include <linux/proc_fs.h> | 19 | #include <linux/proc_ns.h> |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * userns count is 1 for root user, 1 for init_uts_ns, | 22 | * userns count is 1 for root user, 1 for init_uts_ns, |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index e134d8f365dd..d8c30db06c5b 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/nsproxy.h> | 9 | #include <linux/nsproxy.h> |
10 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
11 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_ns.h> |
13 | #include <linux/highuid.h> | 13 | #include <linux/highuid.h> |
14 | #include <linux/cred.h> | 14 | #include <linux/cred.h> |
15 | #include <linux/securebits.h> | 15 | #include <linux/securebits.h> |
diff --git a/kernel/utsname.c b/kernel/utsname.c index a47fc5de3113..2fc8576efaa8 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/user_namespace.h> | 17 | #include <linux/user_namespace.h> |
18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_ns.h> |
19 | 19 | ||
20 | static struct uts_namespace *create_uts_ns(void) | 20 | static struct uts_namespace *create_uts_ns(void) |
21 | { | 21 | { |
diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c index 44b92cb6224f..eb4a04afea80 100644 --- a/lib/notifier-error-inject.c +++ b/lib/notifier-error-inject.c | |||
@@ -17,7 +17,7 @@ static int debugfs_errno_get(void *data, u64 *val) | |||
17 | DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set, | 17 | DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set, |
18 | "%lld\n"); | 18 | "%lld\n"); |
19 | 19 | ||
20 | static struct dentry *debugfs_create_errno(const char *name, mode_t mode, | 20 | static struct dentry *debugfs_create_errno(const char *name, umode_t mode, |
21 | struct dentry *parent, int *value) | 21 | struct dentry *parent, int *value) |
22 | { | 22 | { |
23 | return debugfs_create_file(name, mode, parent, value, &fops_errno); | 23 | return debugfs_create_file(name, mode, parent, value, &fops_errno); |
@@ -50,7 +50,7 @@ struct dentry *notifier_err_inject_init(const char *name, struct dentry *parent, | |||
50 | struct notifier_err_inject *err_inject, int priority) | 50 | struct notifier_err_inject *err_inject, int priority) |
51 | { | 51 | { |
52 | struct notifier_err_inject_action *action; | 52 | struct notifier_err_inject_action *action; |
53 | mode_t mode = S_IFREG | S_IRUSR | S_IWUSR; | 53 | umode_t mode = S_IFREG | S_IRUSR | S_IWUSR; |
54 | struct dentry *dir; | 54 | struct dentry *dir; |
55 | struct dentry *actions_dir; | 55 | struct dentry *actions_dir; |
56 | 56 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index e989fb1eaa72..7905fe721aa8 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2546,7 +2546,6 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2546 | 2546 | ||
2547 | BUG_ON(iocb->ki_pos != pos); | 2547 | BUG_ON(iocb->ki_pos != pos); |
2548 | 2548 | ||
2549 | sb_start_write(inode->i_sb); | ||
2550 | mutex_lock(&inode->i_mutex); | 2549 | mutex_lock(&inode->i_mutex); |
2551 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); | 2550 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); |
2552 | mutex_unlock(&inode->i_mutex); | 2551 | mutex_unlock(&inode->i_mutex); |
@@ -2558,7 +2557,6 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2558 | if (err < 0 && ret > 0) | 2557 | if (err < 0 && ret > 0) |
2559 | ret = err; | 2558 | ret = err; |
2560 | } | 2559 | } |
2561 | sb_end_write(inode->i_sb); | ||
2562 | return ret; | 2560 | return ret; |
2563 | } | 2561 | } |
2564 | EXPORT_SYMBOL(generic_file_aio_write); | 2562 | EXPORT_SYMBOL(generic_file_aio_write); |
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index a912da6ddfd4..28fe26b64f8a 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -404,8 +404,6 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
404 | loff_t pos; | 404 | loff_t pos; |
405 | ssize_t ret; | 405 | ssize_t ret; |
406 | 406 | ||
407 | sb_start_write(inode->i_sb); | ||
408 | |||
409 | mutex_lock(&inode->i_mutex); | 407 | mutex_lock(&inode->i_mutex); |
410 | 408 | ||
411 | if (!access_ok(VERIFY_READ, buf, len)) { | 409 | if (!access_ok(VERIFY_READ, buf, len)) { |
@@ -439,7 +437,6 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
439 | current->backing_dev_info = NULL; | 437 | current->backing_dev_info = NULL; |
440 | out_up: | 438 | out_up: |
441 | mutex_unlock(&inode->i_mutex); | 439 | mutex_unlock(&inode->i_mutex); |
442 | sb_end_write(inode->i_sb); | ||
443 | return ret; | 440 | return ret; |
444 | } | 441 | } |
445 | EXPORT_SYMBOL_GPL(xip_file_write); | 442 | EXPORT_SYMBOL_GPL(xip_file_write); |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 72043d6c88c0..b12fd8612604 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -27,10 +27,30 @@ | |||
27 | #include <linux/pfn.h> | 27 | #include <linux/pfn.h> |
28 | #include <linux/kmemleak.h> | 28 | #include <linux/kmemleak.h> |
29 | #include <linux/atomic.h> | 29 | #include <linux/atomic.h> |
30 | #include <linux/llist.h> | ||
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
31 | #include <asm/tlbflush.h> | 32 | #include <asm/tlbflush.h> |
32 | #include <asm/shmparam.h> | 33 | #include <asm/shmparam.h> |
33 | 34 | ||
35 | struct vfree_deferred { | ||
36 | struct llist_head list; | ||
37 | struct work_struct wq; | ||
38 | }; | ||
39 | static DEFINE_PER_CPU(struct vfree_deferred, vfree_deferred); | ||
40 | |||
41 | static void __vunmap(const void *, int); | ||
42 | |||
43 | static void free_work(struct work_struct *w) | ||
44 | { | ||
45 | struct vfree_deferred *p = container_of(w, struct vfree_deferred, wq); | ||
46 | struct llist_node *llnode = llist_del_all(&p->list); | ||
47 | while (llnode) { | ||
48 | void *p = llnode; | ||
49 | llnode = llist_next(llnode); | ||
50 | __vunmap(p, 1); | ||
51 | } | ||
52 | } | ||
53 | |||
34 | /*** Page table manipulation functions ***/ | 54 | /*** Page table manipulation functions ***/ |
35 | 55 | ||
36 | static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end) | 56 | static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end) |
@@ -1175,10 +1195,14 @@ void __init vmalloc_init(void) | |||
1175 | 1195 | ||
1176 | for_each_possible_cpu(i) { | 1196 | for_each_possible_cpu(i) { |
1177 | struct vmap_block_queue *vbq; | 1197 | struct vmap_block_queue *vbq; |
1198 | struct vfree_deferred *p; | ||
1178 | 1199 | ||
1179 | vbq = &per_cpu(vmap_block_queue, i); | 1200 | vbq = &per_cpu(vmap_block_queue, i); |
1180 | spin_lock_init(&vbq->lock); | 1201 | spin_lock_init(&vbq->lock); |
1181 | INIT_LIST_HEAD(&vbq->free); | 1202 | INIT_LIST_HEAD(&vbq->free); |
1203 | p = &per_cpu(vfree_deferred, i); | ||
1204 | init_llist_head(&p->list); | ||
1205 | INIT_WORK(&p->wq, free_work); | ||
1182 | } | 1206 | } |
1183 | 1207 | ||
1184 | /* Import existing vmlist entries. */ | 1208 | /* Import existing vmlist entries. */ |
@@ -1486,7 +1510,7 @@ static void __vunmap(const void *addr, int deallocate_pages) | |||
1486 | kfree(area); | 1510 | kfree(area); |
1487 | return; | 1511 | return; |
1488 | } | 1512 | } |
1489 | 1513 | ||
1490 | /** | 1514 | /** |
1491 | * vfree - release memory allocated by vmalloc() | 1515 | * vfree - release memory allocated by vmalloc() |
1492 | * @addr: memory base address | 1516 | * @addr: memory base address |
@@ -1495,15 +1519,25 @@ static void __vunmap(const void *addr, int deallocate_pages) | |||
1495 | * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If @addr is | 1519 | * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If @addr is |
1496 | * NULL, no operation is performed. | 1520 | * NULL, no operation is performed. |
1497 | * | 1521 | * |
1498 | * Must not be called in interrupt context. | 1522 | * Must not be called in NMI context (strictly speaking, only if we don't |
1523 | * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling | ||
1524 | * conventions for vfree() arch-depenedent would be a really bad idea) | ||
1525 | * | ||
1499 | */ | 1526 | */ |
1500 | void vfree(const void *addr) | 1527 | void vfree(const void *addr) |
1501 | { | 1528 | { |
1502 | BUG_ON(in_interrupt()); | 1529 | BUG_ON(in_nmi()); |
1503 | 1530 | ||
1504 | kmemleak_free(addr); | 1531 | kmemleak_free(addr); |
1505 | 1532 | ||
1506 | __vunmap(addr, 1); | 1533 | if (!addr) |
1534 | return; | ||
1535 | if (unlikely(in_interrupt())) { | ||
1536 | struct vfree_deferred *p = &__get_cpu_var(vfree_deferred); | ||
1537 | llist_add((struct llist_node *)addr, &p->list); | ||
1538 | schedule_work(&p->wq); | ||
1539 | } else | ||
1540 | __vunmap(addr, 1); | ||
1507 | } | 1541 | } |
1508 | EXPORT_SYMBOL(vfree); | 1542 | EXPORT_SYMBOL(vfree); |
1509 | 1543 | ||
@@ -1520,7 +1554,8 @@ void vunmap(const void *addr) | |||
1520 | { | 1554 | { |
1521 | BUG_ON(in_interrupt()); | 1555 | BUG_ON(in_interrupt()); |
1522 | might_sleep(); | 1556 | might_sleep(); |
1523 | __vunmap(addr, 0); | 1557 | if (addr) |
1558 | __vunmap(addr, 0); | ||
1524 | } | 1559 | } |
1525 | EXPORT_SYMBOL(vunmap); | 1560 | EXPORT_SYMBOL(vunmap); |
1526 | 1561 | ||
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index dc526ec965e4..1d0e89213a28 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -93,7 +93,7 @@ static const struct file_operations vlan_fops = { | |||
93 | 93 | ||
94 | static int vlandev_seq_open(struct inode *inode, struct file *file) | 94 | static int vlandev_seq_open(struct inode *inode, struct file *file) |
95 | { | 95 | { |
96 | return single_open(file, vlandev_seq_show, PDE(inode)->data); | 96 | return single_open(file, vlandev_seq_show, PDE_DATA(inode)); |
97 | } | 97 | } |
98 | 98 | ||
99 | static const struct file_operations vlandev_fops = { | 99 | static const struct file_operations vlandev_fops = { |
@@ -184,14 +184,9 @@ int vlan_proc_add_dev(struct net_device *vlandev) | |||
184 | */ | 184 | */ |
185 | int vlan_proc_rem_dev(struct net_device *vlandev) | 185 | int vlan_proc_rem_dev(struct net_device *vlandev) |
186 | { | 186 | { |
187 | struct vlan_net *vn = net_generic(dev_net(vlandev), vlan_net_id); | ||
188 | |||
189 | /** NOTE: This will consume the memory pointed to by dent, it seems. */ | 187 | /** NOTE: This will consume the memory pointed to by dent, it seems. */ |
190 | if (vlan_dev_priv(vlandev)->dent) { | 188 | proc_remove(vlan_dev_priv(vlandev)->dent); |
191 | remove_proc_entry(vlan_dev_priv(vlandev)->dent->name, | 189 | vlan_dev_priv(vlandev)->dent = NULL; |
192 | vn->proc_vlan_dir); | ||
193 | vlan_dev_priv(vlandev)->dent = NULL; | ||
194 | } | ||
195 | return 0; | 190 | return 0; |
196 | } | 191 | } |
197 | 192 | ||
diff --git a/net/atm/proc.c b/net/atm/proc.c index 6ac35ff0d6b9..bbb6461a4b7f 100644 --- a/net/atm/proc.c +++ b/net/atm/proc.c | |||
@@ -385,7 +385,7 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, | |||
385 | page = get_zeroed_page(GFP_KERNEL); | 385 | page = get_zeroed_page(GFP_KERNEL); |
386 | if (!page) | 386 | if (!page) |
387 | return -ENOMEM; | 387 | return -ENOMEM; |
388 | dev = PDE(file_inode(file))->data; | 388 | dev = PDE_DATA(file_inode(file)); |
389 | if (!dev->ops->proc_read) | 389 | if (!dev->ops->proc_read) |
390 | length = -EINVAL; | 390 | length = -EINVAL; |
391 | else { | 391 | else { |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index e5338f787d68..9096137c889c 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -609,7 +609,7 @@ static int bt_seq_open(struct inode *inode, struct file *file) | |||
609 | struct bt_sock_list *sk_list; | 609 | struct bt_sock_list *sk_list; |
610 | struct bt_seq_state *s; | 610 | struct bt_seq_state *s; |
611 | 611 | ||
612 | sk_list = PDE(inode)->data; | 612 | sk_list = PDE_DATA(inode); |
613 | s = __seq_open_private(file, &bt_seq_ops, | 613 | s = __seq_open_private(file, &bt_seq_ops, |
614 | sizeof(struct bt_seq_state)); | 614 | sizeof(struct bt_seq_state)); |
615 | if (!s) | 615 | if (!s) |
@@ -619,26 +619,21 @@ static int bt_seq_open(struct inode *inode, struct file *file) | |||
619 | return 0; | 619 | return 0; |
620 | } | 620 | } |
621 | 621 | ||
622 | int bt_procfs_init(struct module* module, struct net *net, const char *name, | 622 | static const struct file_operations bt_fops = { |
623 | .open = bt_seq_open, | ||
624 | .read = seq_read, | ||
625 | .llseek = seq_lseek, | ||
626 | .release = seq_release_private | ||
627 | }; | ||
628 | |||
629 | int bt_procfs_init(struct net *net, const char *name, | ||
623 | struct bt_sock_list* sk_list, | 630 | struct bt_sock_list* sk_list, |
624 | int (* seq_show)(struct seq_file *, void *)) | 631 | int (* seq_show)(struct seq_file *, void *)) |
625 | { | 632 | { |
626 | struct proc_dir_entry * pde; | ||
627 | |||
628 | sk_list->custom_seq_show = seq_show; | 633 | sk_list->custom_seq_show = seq_show; |
629 | 634 | ||
630 | sk_list->fops.owner = module; | 635 | if (!proc_create_data(name, 0, net->proc_net, &bt_fops, sk_list)) |
631 | sk_list->fops.open = bt_seq_open; | ||
632 | sk_list->fops.read = seq_read; | ||
633 | sk_list->fops.llseek = seq_lseek; | ||
634 | sk_list->fops.release = seq_release_private; | ||
635 | |||
636 | pde = proc_create(name, 0, net->proc_net, &sk_list->fops); | ||
637 | if (!pde) | ||
638 | return -ENOMEM; | 636 | return -ENOMEM; |
639 | |||
640 | pde->data = sk_list; | ||
641 | |||
642 | return 0; | 637 | return 0; |
643 | } | 638 | } |
644 | 639 | ||
@@ -647,7 +642,7 @@ void bt_procfs_cleanup(struct net *net, const char *name) | |||
647 | remove_proc_entry(name, net->proc_net); | 642 | remove_proc_entry(name, net->proc_net); |
648 | } | 643 | } |
649 | #else | 644 | #else |
650 | int bt_procfs_init(struct module* module, struct net *net, const char *name, | 645 | int bt_procfs_init(struct net *net, const char *name, |
651 | struct bt_sock_list* sk_list, | 646 | struct bt_sock_list* sk_list, |
652 | int (* seq_show)(struct seq_file *, void *)) | 647 | int (* seq_show)(struct seq_file *, void *)) |
653 | { | 648 | { |
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 5b1c04e28821..5f051290daba 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -234,7 +234,7 @@ int __init bnep_sock_init(void) | |||
234 | goto error; | 234 | goto error; |
235 | } | 235 | } |
236 | 236 | ||
237 | err = bt_procfs_init(THIS_MODULE, &init_net, "bnep", &bnep_sk_list, NULL); | 237 | err = bt_procfs_init(&init_net, "bnep", &bnep_sk_list, NULL); |
238 | if (err < 0) { | 238 | if (err < 0) { |
239 | BT_ERR("Failed to create BNEP proc file"); | 239 | BT_ERR("Failed to create BNEP proc file"); |
240 | bt_sock_unregister(BTPROTO_BNEP); | 240 | bt_sock_unregister(BTPROTO_BNEP); |
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c index a4a9d4b6816c..cd75e4d64b90 100644 --- a/net/bluetooth/cmtp/capi.c +++ b/net/bluetooth/cmtp/capi.c | |||
@@ -539,7 +539,7 @@ static int cmtp_proc_show(struct seq_file *m, void *v) | |||
539 | 539 | ||
540 | static int cmtp_proc_open(struct inode *inode, struct file *file) | 540 | static int cmtp_proc_open(struct inode *inode, struct file *file) |
541 | { | 541 | { |
542 | return single_open(file, cmtp_proc_show, PDE(inode)->data); | 542 | return single_open(file, cmtp_proc_show, PDE_DATA(inode)); |
543 | } | 543 | } |
544 | 544 | ||
545 | static const struct file_operations cmtp_proc_fops = { | 545 | static const struct file_operations cmtp_proc_fops = { |
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 58d9edebab4b..d82787d417bd 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -245,7 +245,7 @@ int cmtp_init_sockets(void) | |||
245 | goto error; | 245 | goto error; |
246 | } | 246 | } |
247 | 247 | ||
248 | err = bt_procfs_init(THIS_MODULE, &init_net, "cmtp", &cmtp_sk_list, NULL); | 248 | err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL); |
249 | if (err < 0) { | 249 | if (err < 0) { |
250 | BT_ERR("Failed to create CMTP proc file"); | 250 | BT_ERR("Failed to create CMTP proc file"); |
251 | bt_sock_unregister(BTPROTO_HIDP); | 251 | bt_sock_unregister(BTPROTO_HIDP); |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index aa4354fca77c..9bd7d959e384 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -1107,7 +1107,7 @@ int __init hci_sock_init(void) | |||
1107 | goto error; | 1107 | goto error; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | err = bt_procfs_init(THIS_MODULE, &init_net, "hci", &hci_sk_list, NULL); | 1110 | err = bt_procfs_init(&init_net, "hci", &hci_sk_list, NULL); |
1111 | if (err < 0) { | 1111 | if (err < 0) { |
1112 | BT_ERR("Failed to create HCI proc file"); | 1112 | BT_ERR("Failed to create HCI proc file"); |
1113 | bt_sock_unregister(BTPROTO_HCI); | 1113 | bt_sock_unregister(BTPROTO_HCI); |
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index 2f4cbb0865ca..cb3fdde1968a 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -275,7 +275,7 @@ int __init hidp_init_sockets(void) | |||
275 | goto error; | 275 | goto error; |
276 | } | 276 | } |
277 | 277 | ||
278 | err = bt_procfs_init(THIS_MODULE, &init_net, "hidp", &hidp_sk_list, NULL); | 278 | err = bt_procfs_init(&init_net, "hidp", &hidp_sk_list, NULL); |
279 | if (err < 0) { | 279 | if (err < 0) { |
280 | BT_ERR("Failed to create HIDP proc file"); | 280 | BT_ERR("Failed to create HIDP proc file"); |
281 | bt_sock_unregister(BTPROTO_HIDP); | 281 | bt_sock_unregister(BTPROTO_HIDP); |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 141e7b058b7e..36fed40c162c 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -1298,7 +1298,7 @@ int __init l2cap_init_sockets(void) | |||
1298 | goto error; | 1298 | goto error; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | err = bt_procfs_init(THIS_MODULE, &init_net, "l2cap", &l2cap_sk_list, | 1301 | err = bt_procfs_init(&init_net, "l2cap", &l2cap_sk_list, |
1302 | NULL); | 1302 | NULL); |
1303 | if (err < 0) { | 1303 | if (err < 0) { |
1304 | BT_ERR("Failed to create L2CAP proc file"); | 1304 | BT_ERR("Failed to create L2CAP proc file"); |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index a8638b58c4bf..30b3721dc6d7 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -1037,7 +1037,7 @@ int __init rfcomm_init_sockets(void) | |||
1037 | goto error; | 1037 | goto error; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | err = bt_procfs_init(THIS_MODULE, &init_net, "rfcomm", &rfcomm_sk_list, NULL); | 1040 | err = bt_procfs_init(&init_net, "rfcomm", &rfcomm_sk_list, NULL); |
1041 | if (err < 0) { | 1041 | if (err < 0) { |
1042 | BT_ERR("Failed to create RFCOMM proc file"); | 1042 | BT_ERR("Failed to create RFCOMM proc file"); |
1043 | bt_sock_unregister(BTPROTO_RFCOMM); | 1043 | bt_sock_unregister(BTPROTO_RFCOMM); |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 373d81e6e8f0..e7bd4eea575c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -1119,7 +1119,7 @@ int __init sco_init(void) | |||
1119 | goto error; | 1119 | goto error; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | err = bt_procfs_init(THIS_MODULE, &init_net, "sco", &sco_sk_list, NULL); | 1122 | err = bt_procfs_init(&init_net, "sco", &sco_sk_list, NULL); |
1123 | if (err < 0) { | 1123 | if (err < 0) { |
1124 | BT_ERR("Failed to create SCO proc file"); | 1124 | BT_ERR("Failed to create SCO proc file"); |
1125 | bt_sock_unregister(BTPROTO_SCO); | 1125 | bt_sock_unregister(BTPROTO_SCO); |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 5dcb20076f39..8f113e6ff327 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -226,7 +226,7 @@ static int bcm_proc_show(struct seq_file *m, void *v) | |||
226 | 226 | ||
227 | static int bcm_proc_open(struct inode *inode, struct file *file) | 227 | static int bcm_proc_open(struct inode *inode, struct file *file) |
228 | { | 228 | { |
229 | return single_open(file, bcm_proc_show, PDE(inode)->data); | 229 | return single_open(file, bcm_proc_show, PDE_DATA(inode)); |
230 | } | 230 | } |
231 | 231 | ||
232 | static const struct file_operations bcm_proc_fops = { | 232 | static const struct file_operations bcm_proc_fops = { |
diff --git a/net/can/proc.c b/net/can/proc.c index 1ab8c888f102..b543470c8f8b 100644 --- a/net/can/proc.c +++ b/net/can/proc.c | |||
@@ -378,7 +378,7 @@ static int can_rcvlist_proc_show(struct seq_file *m, void *v) | |||
378 | 378 | ||
379 | static int can_rcvlist_proc_open(struct inode *inode, struct file *file) | 379 | static int can_rcvlist_proc_open(struct inode *inode, struct file *file) |
380 | { | 380 | { |
381 | return single_open(file, can_rcvlist_proc_show, PDE(inode)->data); | 381 | return single_open(file, can_rcvlist_proc_show, PDE_DATA(inode)); |
382 | } | 382 | } |
383 | 383 | ||
384 | static const struct file_operations can_rcvlist_proc_fops = { | 384 | static const struct file_operations can_rcvlist_proc_fops = { |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 89a3a07d85fb..5c56b217b999 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2705,7 +2705,7 @@ static int neigh_stat_seq_open(struct inode *inode, struct file *file) | |||
2705 | 2705 | ||
2706 | if (!ret) { | 2706 | if (!ret) { |
2707 | struct seq_file *sf = file->private_data; | 2707 | struct seq_file *sf = file->private_data; |
2708 | sf->private = PDE(inode)->data; | 2708 | sf->private = PDE_DATA(inode); |
2709 | } | 2709 | } |
2710 | return ret; | 2710 | return ret; |
2711 | }; | 2711 | }; |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 80e271d9e64b..f97652036754 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -10,7 +10,8 @@ | |||
10 | #include <linux/idr.h> | 10 | #include <linux/idr.h> |
11 | #include <linux/rculist.h> | 11 | #include <linux/rculist.h> |
12 | #include <linux/nsproxy.h> | 12 | #include <linux/nsproxy.h> |
13 | #include <linux/proc_fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/proc_ns.h> | ||
14 | #include <linux/file.h> | 15 | #include <linux/file.h> |
15 | #include <linux/export.h> | 16 | #include <linux/export.h> |
16 | #include <linux/user_namespace.h> | 17 | #include <linux/user_namespace.h> |
@@ -336,7 +337,7 @@ EXPORT_SYMBOL_GPL(__put_net); | |||
336 | 337 | ||
337 | struct net *get_net_ns_by_fd(int fd) | 338 | struct net *get_net_ns_by_fd(int fd) |
338 | { | 339 | { |
339 | struct proc_inode *ei; | 340 | struct proc_ns *ei; |
340 | struct file *file; | 341 | struct file *file; |
341 | struct net *net; | 342 | struct net *net; |
342 | 343 | ||
@@ -344,7 +345,7 @@ struct net *get_net_ns_by_fd(int fd) | |||
344 | if (IS_ERR(file)) | 345 | if (IS_ERR(file)) |
345 | return ERR_CAST(file); | 346 | return ERR_CAST(file); |
346 | 347 | ||
347 | ei = PROC_I(file_inode(file)); | 348 | ei = get_proc_ns(file_inode(file)); |
348 | if (ei->ns_ops == &netns_operations) | 349 | if (ei->ns_ops == &netns_operations) |
349 | net = get_net(ei->ns); | 350 | net = get_net(ei->ns); |
350 | else | 351 | else |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 5c217427a669..11f2704c3810 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -508,7 +508,7 @@ out: | |||
508 | 508 | ||
509 | static int pgctrl_open(struct inode *inode, struct file *file) | 509 | static int pgctrl_open(struct inode *inode, struct file *file) |
510 | { | 510 | { |
511 | return single_open(file, pgctrl_show, PDE(inode)->data); | 511 | return single_open(file, pgctrl_show, PDE_DATA(inode)); |
512 | } | 512 | } |
513 | 513 | ||
514 | static const struct file_operations pktgen_fops = { | 514 | static const struct file_operations pktgen_fops = { |
@@ -1685,7 +1685,7 @@ static ssize_t pktgen_if_write(struct file *file, | |||
1685 | 1685 | ||
1686 | static int pktgen_if_open(struct inode *inode, struct file *file) | 1686 | static int pktgen_if_open(struct inode *inode, struct file *file) |
1687 | { | 1687 | { |
1688 | return single_open(file, pktgen_if_show, PDE(inode)->data); | 1688 | return single_open(file, pktgen_if_show, PDE_DATA(inode)); |
1689 | } | 1689 | } |
1690 | 1690 | ||
1691 | static const struct file_operations pktgen_if_fops = { | 1691 | static const struct file_operations pktgen_if_fops = { |
@@ -1823,7 +1823,7 @@ out: | |||
1823 | 1823 | ||
1824 | static int pktgen_thread_open(struct inode *inode, struct file *file) | 1824 | static int pktgen_thread_open(struct inode *inode, struct file *file) |
1825 | { | 1825 | { |
1826 | return single_open(file, pktgen_thread_show, PDE(inode)->data); | 1826 | return single_open(file, pktgen_thread_show, PDE_DATA(inode)); |
1827 | } | 1827 | } |
1828 | 1828 | ||
1829 | static const struct file_operations pktgen_thread_fops = { | 1829 | static const struct file_operations pktgen_thread_fops = { |
@@ -1904,7 +1904,7 @@ static void pktgen_change_name(const struct pktgen_net *pn, struct net_device *d | |||
1904 | if (pkt_dev->odev != dev) | 1904 | if (pkt_dev->odev != dev) |
1905 | continue; | 1905 | continue; |
1906 | 1906 | ||
1907 | remove_proc_entry(pkt_dev->entry->name, pn->proc_dir); | 1907 | proc_remove(pkt_dev->entry); |
1908 | 1908 | ||
1909 | pkt_dev->entry = proc_create_data(dev->name, 0600, | 1909 | pkt_dev->entry = proc_create_data(dev->name, 0600, |
1910 | pn->proc_dir, | 1910 | pn->proc_dir, |
@@ -3574,8 +3574,6 @@ static void _rem_dev_from_if_list(struct pktgen_thread *t, | |||
3574 | static int pktgen_remove_device(struct pktgen_thread *t, | 3574 | static int pktgen_remove_device(struct pktgen_thread *t, |
3575 | struct pktgen_dev *pkt_dev) | 3575 | struct pktgen_dev *pkt_dev) |
3576 | { | 3576 | { |
3577 | struct pktgen_net *pn = t->net; | ||
3578 | |||
3579 | pr_debug("remove_device pkt_dev=%p\n", pkt_dev); | 3577 | pr_debug("remove_device pkt_dev=%p\n", pkt_dev); |
3580 | 3578 | ||
3581 | if (pkt_dev->running) { | 3579 | if (pkt_dev->running) { |
@@ -3595,7 +3593,7 @@ static int pktgen_remove_device(struct pktgen_thread *t, | |||
3595 | _rem_dev_from_if_list(t, pkt_dev); | 3593 | _rem_dev_from_if_list(t, pkt_dev); |
3596 | 3594 | ||
3597 | if (pkt_dev->entry) | 3595 | if (pkt_dev->entry) |
3598 | remove_proc_entry(pkt_dev->entry->name, pn->proc_dir); | 3596 | proc_remove(pkt_dev->entry); |
3599 | 3597 | ||
3600 | #ifdef CONFIG_XFRM | 3598 | #ifdef CONFIG_XFRM |
3601 | free_SAs(pkt_dev); | 3599 | free_SAs(pkt_dev); |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 5852b249054f..0b732efd32e2 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -105,7 +105,7 @@ clusterip_config_entry_put(struct clusterip_config *c) | |||
105 | * functions are also incrementing the refcount on their own, | 105 | * functions are also incrementing the refcount on their own, |
106 | * so it's safe to remove the entry even if it's in use. */ | 106 | * so it's safe to remove the entry even if it's in use. */ |
107 | #ifdef CONFIG_PROC_FS | 107 | #ifdef CONFIG_PROC_FS |
108 | remove_proc_entry(c->pde->name, c->pde->parent); | 108 | proc_remove(c->pde); |
109 | #endif | 109 | #endif |
110 | return; | 110 | return; |
111 | } | 111 | } |
@@ -631,7 +631,7 @@ static int clusterip_proc_open(struct inode *inode, struct file *file) | |||
631 | 631 | ||
632 | if (!ret) { | 632 | if (!ret) { |
633 | struct seq_file *sf = file->private_data; | 633 | struct seq_file *sf = file->private_data; |
634 | struct clusterip_config *c = PDE(inode)->data; | 634 | struct clusterip_config *c = PDE_DATA(inode); |
635 | 635 | ||
636 | sf->private = c; | 636 | sf->private = c; |
637 | 637 | ||
@@ -643,7 +643,7 @@ static int clusterip_proc_open(struct inode *inode, struct file *file) | |||
643 | 643 | ||
644 | static int clusterip_proc_release(struct inode *inode, struct file *file) | 644 | static int clusterip_proc_release(struct inode *inode, struct file *file) |
645 | { | 645 | { |
646 | struct clusterip_config *c = PDE(inode)->data; | 646 | struct clusterip_config *c = PDE_DATA(inode); |
647 | int ret; | 647 | int ret; |
648 | 648 | ||
649 | ret = seq_release(inode, file); | 649 | ret = seq_release(inode, file); |
@@ -657,7 +657,7 @@ static int clusterip_proc_release(struct inode *inode, struct file *file) | |||
657 | static ssize_t clusterip_proc_write(struct file *file, const char __user *input, | 657 | static ssize_t clusterip_proc_write(struct file *file, const char __user *input, |
658 | size_t size, loff_t *ofs) | 658 | size_t size, loff_t *ofs) |
659 | { | 659 | { |
660 | struct clusterip_config *c = PDE(file_inode(file))->data; | 660 | struct clusterip_config *c = PDE_DATA(file_inode(file)); |
661 | #define PROC_WRITELEN 10 | 661 | #define PROC_WRITELEN 10 |
662 | char buffer[PROC_WRITELEN+1]; | 662 | char buffer[PROC_WRITELEN+1]; |
663 | unsigned long nodenum; | 663 | unsigned long nodenum; |
@@ -736,7 +736,7 @@ static void __exit clusterip_tg_exit(void) | |||
736 | { | 736 | { |
737 | pr_info("ClusterIP Version %s unloading\n", CLUSTERIP_VERSION); | 737 | pr_info("ClusterIP Version %s unloading\n", CLUSTERIP_VERSION); |
738 | #ifdef CONFIG_PROC_FS | 738 | #ifdef CONFIG_PROC_FS |
739 | remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent); | 739 | proc_remove(clusterip_procdir); |
740 | #endif | 740 | #endif |
741 | nf_unregister_hook(&cip_arp_ops); | 741 | nf_unregister_hook(&cip_arp_ops); |
742 | xt_unregister_target(&clusterip_tg_reg); | 742 | xt_unregister_target(&clusterip_tg_reg); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d979657b8a12..719652305a29 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2583,7 +2583,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v) | |||
2583 | 2583 | ||
2584 | int tcp_seq_open(struct inode *inode, struct file *file) | 2584 | int tcp_seq_open(struct inode *inode, struct file *file) |
2585 | { | 2585 | { |
2586 | struct tcp_seq_afinfo *afinfo = PDE(inode)->data; | 2586 | struct tcp_seq_afinfo *afinfo = PDE_DATA(inode); |
2587 | struct tcp_iter_state *s; | 2587 | struct tcp_iter_state *s; |
2588 | int err; | 2588 | int err; |
2589 | 2589 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 3159d16441d0..6abbe6455129 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -2100,7 +2100,7 @@ static void udp_seq_stop(struct seq_file *seq, void *v) | |||
2100 | 2100 | ||
2101 | int udp_seq_open(struct inode *inode, struct file *file) | 2101 | int udp_seq_open(struct inode *inode, struct file *file) |
2102 | { | 2102 | { |
2103 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; | 2103 | struct udp_seq_afinfo *afinfo = PDE_DATA(inode); |
2104 | struct udp_iter_state *s; | 2104 | struct udp_iter_state *s; |
2105 | int err; | 2105 | int err; |
2106 | 2106 | ||
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 115cc58898f5..f3c1ff4357ff 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -251,7 +251,7 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) | |||
251 | 251 | ||
252 | static int snmp6_dev_seq_open(struct inode *inode, struct file *file) | 252 | static int snmp6_dev_seq_open(struct inode *inode, struct file *file) |
253 | { | 253 | { |
254 | return single_open(file, snmp6_dev_seq_show, PDE(inode)->data); | 254 | return single_open(file, snmp6_dev_seq_show, PDE_DATA(inode)); |
255 | } | 255 | } |
256 | 256 | ||
257 | static const struct file_operations snmp6_dev_seq_fops = { | 257 | static const struct file_operations snmp6_dev_seq_fops = { |
@@ -291,8 +291,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev) | |||
291 | return -ENOENT; | 291 | return -ENOENT; |
292 | if (!idev->stats.proc_dir_entry) | 292 | if (!idev->stats.proc_dir_entry) |
293 | return -EINVAL; | 293 | return -EINVAL; |
294 | remove_proc_entry(idev->stats.proc_dir_entry->name, | 294 | proc_remove(idev->stats.proc_dir_entry); |
295 | net->mib.proc_net_devsnmp6); | ||
296 | idev->stats.proc_dir_entry = NULL; | 295 | idev->stats.proc_dir_entry = NULL; |
297 | return 0; | 296 | return 0; |
298 | } | 297 | } |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 1a73b18683b6..8b03028cca69 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -1000,7 +1000,7 @@ static int xt_table_open(struct inode *inode, struct file *file) | |||
1000 | sizeof(struct xt_names_priv)); | 1000 | sizeof(struct xt_names_priv)); |
1001 | if (!ret) { | 1001 | if (!ret) { |
1002 | priv = ((struct seq_file *)file->private_data)->private; | 1002 | priv = ((struct seq_file *)file->private_data)->private; |
1003 | priv->af = (unsigned long)PDE(inode)->data; | 1003 | priv->af = (unsigned long)PDE_DATA(inode); |
1004 | } | 1004 | } |
1005 | return ret; | 1005 | return ret; |
1006 | } | 1006 | } |
@@ -1148,7 +1148,7 @@ static int xt_match_open(struct inode *inode, struct file *file) | |||
1148 | 1148 | ||
1149 | seq = file->private_data; | 1149 | seq = file->private_data; |
1150 | seq->private = trav; | 1150 | seq->private = trav; |
1151 | trav->nfproto = (unsigned long)PDE(inode)->data; | 1151 | trav->nfproto = (unsigned long)PDE_DATA(inode); |
1152 | return 0; | 1152 | return 0; |
1153 | } | 1153 | } |
1154 | 1154 | ||
@@ -1212,7 +1212,7 @@ static int xt_target_open(struct inode *inode, struct file *file) | |||
1212 | 1212 | ||
1213 | seq = file->private_data; | 1213 | seq = file->private_data; |
1214 | seq->private = trav; | 1214 | seq->private = trav; |
1215 | trav->nfproto = (unsigned long)PDE(inode)->data; | 1215 | trav->nfproto = (unsigned long)PDE_DATA(inode); |
1216 | return 0; | 1216 | return 0; |
1217 | } | 1217 | } |
1218 | 1218 | ||
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 0199e7bb8f81..9ff035c71403 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c | |||
@@ -108,6 +108,7 @@ struct xt_hashlimit_htable { | |||
108 | 108 | ||
109 | /* seq_file stuff */ | 109 | /* seq_file stuff */ |
110 | struct proc_dir_entry *pde; | 110 | struct proc_dir_entry *pde; |
111 | const char *name; | ||
111 | struct net *net; | 112 | struct net *net; |
112 | 113 | ||
113 | struct hlist_head hash[0]; /* hashtable itself */ | 114 | struct hlist_head hash[0]; /* hashtable itself */ |
@@ -254,6 +255,11 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo, | |||
254 | hinfo->count = 0; | 255 | hinfo->count = 0; |
255 | hinfo->family = family; | 256 | hinfo->family = family; |
256 | hinfo->rnd_initialized = false; | 257 | hinfo->rnd_initialized = false; |
258 | hinfo->name = kstrdup(minfo->name, GFP_KERNEL); | ||
259 | if (!hinfo->name) { | ||
260 | vfree(hinfo); | ||
261 | return -ENOMEM; | ||
262 | } | ||
257 | spin_lock_init(&hinfo->lock); | 263 | spin_lock_init(&hinfo->lock); |
258 | 264 | ||
259 | hinfo->pde = proc_create_data(minfo->name, 0, | 265 | hinfo->pde = proc_create_data(minfo->name, 0, |
@@ -261,6 +267,7 @@ static int htable_create(struct net *net, struct xt_hashlimit_mtinfo1 *minfo, | |||
261 | hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit, | 267 | hashlimit_net->ipt_hashlimit : hashlimit_net->ip6t_hashlimit, |
262 | &dl_file_ops, hinfo); | 268 | &dl_file_ops, hinfo); |
263 | if (hinfo->pde == NULL) { | 269 | if (hinfo->pde == NULL) { |
270 | kfree(hinfo->name); | ||
264 | vfree(hinfo); | 271 | vfree(hinfo); |
265 | return -ENOMEM; | 272 | return -ENOMEM; |
266 | } | 273 | } |
@@ -331,9 +338,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo) | |||
331 | parent = hashlimit_net->ip6t_hashlimit; | 338 | parent = hashlimit_net->ip6t_hashlimit; |
332 | 339 | ||
333 | if(parent != NULL) | 340 | if(parent != NULL) |
334 | remove_proc_entry(hinfo->pde->name, parent); | 341 | remove_proc_entry(hinfo->name, parent); |
335 | 342 | ||
336 | htable_selective_cleanup(hinfo, select_all); | 343 | htable_selective_cleanup(hinfo, select_all); |
344 | kfree(hinfo->name); | ||
337 | vfree(hinfo); | 345 | vfree(hinfo); |
338 | } | 346 | } |
339 | 347 | ||
@@ -345,7 +353,7 @@ static struct xt_hashlimit_htable *htable_find_get(struct net *net, | |||
345 | struct xt_hashlimit_htable *hinfo; | 353 | struct xt_hashlimit_htable *hinfo; |
346 | 354 | ||
347 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) { | 355 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) { |
348 | if (!strcmp(name, hinfo->pde->name) && | 356 | if (!strcmp(name, hinfo->name) && |
349 | hinfo->family == family) { | 357 | hinfo->family == family) { |
350 | hinfo->use++; | 358 | hinfo->use++; |
351 | return hinfo; | 359 | return hinfo; |
@@ -842,7 +850,7 @@ static int dl_proc_open(struct inode *inode, struct file *file) | |||
842 | 850 | ||
843 | if (!ret) { | 851 | if (!ret) { |
844 | struct seq_file *sf = file->private_data; | 852 | struct seq_file *sf = file->private_data; |
845 | sf->private = PDE(inode)->data; | 853 | sf->private = PDE_DATA(inode); |
846 | } | 854 | } |
847 | return ret; | 855 | return ret; |
848 | } | 856 | } |
@@ -888,7 +896,7 @@ static void __net_exit hashlimit_proc_net_exit(struct net *net) | |||
888 | pde = hashlimit_net->ip6t_hashlimit; | 896 | pde = hashlimit_net->ip6t_hashlimit; |
889 | 897 | ||
890 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) | 898 | hlist_for_each_entry(hinfo, &hashlimit_net->htables, node) |
891 | remove_proc_entry(hinfo->pde->name, pde); | 899 | remove_proc_entry(hinfo->name, pde); |
892 | 900 | ||
893 | hashlimit_net->ipt_hashlimit = NULL; | 901 | hashlimit_net->ipt_hashlimit = NULL; |
894 | hashlimit_net->ip6t_hashlimit = NULL; | 902 | hashlimit_net->ip6t_hashlimit = NULL; |
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c index d9cad315229d..1e657cf715c4 100644 --- a/net/netfilter/xt_recent.c +++ b/net/netfilter/xt_recent.c | |||
@@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par, | |||
401 | ret = -ENOMEM; | 401 | ret = -ENOMEM; |
402 | goto out; | 402 | goto out; |
403 | } | 403 | } |
404 | pde->uid = uid; | 404 | proc_set_user(pde, uid, gid); |
405 | pde->gid = gid; | ||
406 | #endif | 405 | #endif |
407 | spin_lock_bh(&recent_lock); | 406 | spin_lock_bh(&recent_lock); |
408 | list_add_tail(&t->list, &recent_net->tables); | 407 | list_add_tail(&t->list, &recent_net->tables); |
@@ -525,14 +524,13 @@ static const struct seq_operations recent_seq_ops = { | |||
525 | 524 | ||
526 | static int recent_seq_open(struct inode *inode, struct file *file) | 525 | static int recent_seq_open(struct inode *inode, struct file *file) |
527 | { | 526 | { |
528 | struct proc_dir_entry *pde = PDE(inode); | ||
529 | struct recent_iter_state *st; | 527 | struct recent_iter_state *st; |
530 | 528 | ||
531 | st = __seq_open_private(file, &recent_seq_ops, sizeof(*st)); | 529 | st = __seq_open_private(file, &recent_seq_ops, sizeof(*st)); |
532 | if (st == NULL) | 530 | if (st == NULL) |
533 | return -ENOMEM; | 531 | return -ENOMEM; |
534 | 532 | ||
535 | st->table = pde->data; | 533 | st->table = PDE_DATA(inode); |
536 | return 0; | 534 | return 0; |
537 | } | 535 | } |
538 | 536 | ||
@@ -540,8 +538,7 @@ static ssize_t | |||
540 | recent_mt_proc_write(struct file *file, const char __user *input, | 538 | recent_mt_proc_write(struct file *file, const char __user *input, |
541 | size_t size, loff_t *loff) | 539 | size_t size, loff_t *loff) |
542 | { | 540 | { |
543 | const struct proc_dir_entry *pde = PDE(file_inode(file)); | 541 | struct recent_table *t = PDE_DATA(file_inode(file)); |
544 | struct recent_table *t = pde->data; | ||
545 | struct recent_entry *e; | 542 | struct recent_entry *e; |
546 | char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; | 543 | char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; |
547 | const char *c = buf; | 544 | const char *c = buf; |
diff --git a/net/socket.c b/net/socket.c index 280283f03ccc..b416093997da 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1160,15 +1160,6 @@ static int sock_mmap(struct file *file, struct vm_area_struct *vma) | |||
1160 | 1160 | ||
1161 | static int sock_close(struct inode *inode, struct file *filp) | 1161 | static int sock_close(struct inode *inode, struct file *filp) |
1162 | { | 1162 | { |
1163 | /* | ||
1164 | * It was possible the inode is NULL we were | ||
1165 | * closing an unfinished socket. | ||
1166 | */ | ||
1167 | |||
1168 | if (!inode) { | ||
1169 | printk(KERN_DEBUG "sock_close: NULL inode\n"); | ||
1170 | return 0; | ||
1171 | } | ||
1172 | sock_release(SOCKET_I(inode)); | 1163 | sock_release(SOCKET_I(inode)); |
1173 | return 0; | 1164 | return 0; |
1174 | } | 1165 | } |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index ce2d180d05a4..f1889be80912 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -1460,7 +1460,7 @@ static ssize_t write_flush(struct file *file, const char __user *buf, | |||
1460 | static ssize_t cache_read_procfs(struct file *filp, char __user *buf, | 1460 | static ssize_t cache_read_procfs(struct file *filp, char __user *buf, |
1461 | size_t count, loff_t *ppos) | 1461 | size_t count, loff_t *ppos) |
1462 | { | 1462 | { |
1463 | struct cache_detail *cd = PDE(file_inode(filp))->data; | 1463 | struct cache_detail *cd = PDE_DATA(file_inode(filp)); |
1464 | 1464 | ||
1465 | return cache_read(filp, buf, count, ppos, cd); | 1465 | return cache_read(filp, buf, count, ppos, cd); |
1466 | } | 1466 | } |
@@ -1468,14 +1468,14 @@ static ssize_t cache_read_procfs(struct file *filp, char __user *buf, | |||
1468 | static ssize_t cache_write_procfs(struct file *filp, const char __user *buf, | 1468 | static ssize_t cache_write_procfs(struct file *filp, const char __user *buf, |
1469 | size_t count, loff_t *ppos) | 1469 | size_t count, loff_t *ppos) |
1470 | { | 1470 | { |
1471 | struct cache_detail *cd = PDE(file_inode(filp))->data; | 1471 | struct cache_detail *cd = PDE_DATA(file_inode(filp)); |
1472 | 1472 | ||
1473 | return cache_write(filp, buf, count, ppos, cd); | 1473 | return cache_write(filp, buf, count, ppos, cd); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) | 1476 | static unsigned int cache_poll_procfs(struct file *filp, poll_table *wait) |
1477 | { | 1477 | { |
1478 | struct cache_detail *cd = PDE(file_inode(filp))->data; | 1478 | struct cache_detail *cd = PDE_DATA(file_inode(filp)); |
1479 | 1479 | ||
1480 | return cache_poll(filp, wait, cd); | 1480 | return cache_poll(filp, wait, cd); |
1481 | } | 1481 | } |
@@ -1484,21 +1484,21 @@ static long cache_ioctl_procfs(struct file *filp, | |||
1484 | unsigned int cmd, unsigned long arg) | 1484 | unsigned int cmd, unsigned long arg) |
1485 | { | 1485 | { |
1486 | struct inode *inode = file_inode(filp); | 1486 | struct inode *inode = file_inode(filp); |
1487 | struct cache_detail *cd = PDE(inode)->data; | 1487 | struct cache_detail *cd = PDE_DATA(inode); |
1488 | 1488 | ||
1489 | return cache_ioctl(inode, filp, cmd, arg, cd); | 1489 | return cache_ioctl(inode, filp, cmd, arg, cd); |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | static int cache_open_procfs(struct inode *inode, struct file *filp) | 1492 | static int cache_open_procfs(struct inode *inode, struct file *filp) |
1493 | { | 1493 | { |
1494 | struct cache_detail *cd = PDE(inode)->data; | 1494 | struct cache_detail *cd = PDE_DATA(inode); |
1495 | 1495 | ||
1496 | return cache_open(inode, filp, cd); | 1496 | return cache_open(inode, filp, cd); |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | static int cache_release_procfs(struct inode *inode, struct file *filp) | 1499 | static int cache_release_procfs(struct inode *inode, struct file *filp) |
1500 | { | 1500 | { |
1501 | struct cache_detail *cd = PDE(inode)->data; | 1501 | struct cache_detail *cd = PDE_DATA(inode); |
1502 | 1502 | ||
1503 | return cache_release(inode, filp, cd); | 1503 | return cache_release(inode, filp, cd); |
1504 | } | 1504 | } |
@@ -1516,14 +1516,14 @@ static const struct file_operations cache_file_operations_procfs = { | |||
1516 | 1516 | ||
1517 | static int content_open_procfs(struct inode *inode, struct file *filp) | 1517 | static int content_open_procfs(struct inode *inode, struct file *filp) |
1518 | { | 1518 | { |
1519 | struct cache_detail *cd = PDE(inode)->data; | 1519 | struct cache_detail *cd = PDE_DATA(inode); |
1520 | 1520 | ||
1521 | return content_open(inode, filp, cd); | 1521 | return content_open(inode, filp, cd); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | static int content_release_procfs(struct inode *inode, struct file *filp) | 1524 | static int content_release_procfs(struct inode *inode, struct file *filp) |
1525 | { | 1525 | { |
1526 | struct cache_detail *cd = PDE(inode)->data; | 1526 | struct cache_detail *cd = PDE_DATA(inode); |
1527 | 1527 | ||
1528 | return content_release(inode, filp, cd); | 1528 | return content_release(inode, filp, cd); |
1529 | } | 1529 | } |
@@ -1537,14 +1537,14 @@ static const struct file_operations content_file_operations_procfs = { | |||
1537 | 1537 | ||
1538 | static int open_flush_procfs(struct inode *inode, struct file *filp) | 1538 | static int open_flush_procfs(struct inode *inode, struct file *filp) |
1539 | { | 1539 | { |
1540 | struct cache_detail *cd = PDE(inode)->data; | 1540 | struct cache_detail *cd = PDE_DATA(inode); |
1541 | 1541 | ||
1542 | return open_flush(inode, filp, cd); | 1542 | return open_flush(inode, filp, cd); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | static int release_flush_procfs(struct inode *inode, struct file *filp) | 1545 | static int release_flush_procfs(struct inode *inode, struct file *filp) |
1546 | { | 1546 | { |
1547 | struct cache_detail *cd = PDE(inode)->data; | 1547 | struct cache_detail *cd = PDE_DATA(inode); |
1548 | 1548 | ||
1549 | return release_flush(inode, filp, cd); | 1549 | return release_flush(inode, filp, cd); |
1550 | } | 1550 | } |
@@ -1552,7 +1552,7 @@ static int release_flush_procfs(struct inode *inode, struct file *filp) | |||
1552 | static ssize_t read_flush_procfs(struct file *filp, char __user *buf, | 1552 | static ssize_t read_flush_procfs(struct file *filp, char __user *buf, |
1553 | size_t count, loff_t *ppos) | 1553 | size_t count, loff_t *ppos) |
1554 | { | 1554 | { |
1555 | struct cache_detail *cd = PDE(file_inode(filp))->data; | 1555 | struct cache_detail *cd = PDE_DATA(file_inode(filp)); |
1556 | 1556 | ||
1557 | return read_flush(filp, buf, count, ppos, cd); | 1557 | return read_flush(filp, buf, count, ppos, cd); |
1558 | } | 1558 | } |
@@ -1561,7 +1561,7 @@ static ssize_t write_flush_procfs(struct file *filp, | |||
1561 | const char __user *buf, | 1561 | const char __user *buf, |
1562 | size_t count, loff_t *ppos) | 1562 | size_t count, loff_t *ppos) |
1563 | { | 1563 | { |
1564 | struct cache_detail *cd = PDE(file_inode(filp))->data; | 1564 | struct cache_detail *cd = PDE_DATA(file_inode(filp)); |
1565 | 1565 | ||
1566 | return write_flush(filp, buf, count, ppos, cd); | 1566 | return write_flush(filp, buf, count, ppos, cd); |
1567 | } | 1567 | } |
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index bc2068ee795b..21b75cb08c03 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c | |||
@@ -64,7 +64,7 @@ static int rpc_proc_show(struct seq_file *seq, void *v) { | |||
64 | 64 | ||
65 | static int rpc_proc_open(struct inode *inode, struct file *file) | 65 | static int rpc_proc_open(struct inode *inode, struct file *file) |
66 | { | 66 | { |
67 | return single_open(file, rpc_proc_show, PDE(inode)->data); | 67 | return single_open(file, rpc_proc_show, PDE_DATA(inode)); |
68 | } | 68 | } |
69 | 69 | ||
70 | static const struct file_operations rpc_proc_fops = { | 70 | static const struct file_operations rpc_proc_fops = { |
diff --git a/net/wireless/lib80211_crypt_ccmp.c b/net/wireless/lib80211_crypt_ccmp.c index 1526c211db66..dc0e59e53dbf 100644 --- a/net/wireless/lib80211_crypt_ccmp.c +++ b/net/wireless/lib80211_crypt_ccmp.c | |||
@@ -430,24 +430,23 @@ static int lib80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv) | |||
430 | return CCMP_TK_LEN; | 430 | return CCMP_TK_LEN; |
431 | } | 431 | } |
432 | 432 | ||
433 | static char *lib80211_ccmp_print_stats(char *p, void *priv) | 433 | static void lib80211_ccmp_print_stats(struct seq_file *m, void *priv) |
434 | { | 434 | { |
435 | struct lib80211_ccmp_data *ccmp = priv; | 435 | struct lib80211_ccmp_data *ccmp = priv; |
436 | 436 | ||
437 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " | 437 | seq_printf(m, |
438 | "tx_pn=%02x%02x%02x%02x%02x%02x " | 438 | "key[%d] alg=CCMP key_set=%d " |
439 | "rx_pn=%02x%02x%02x%02x%02x%02x " | 439 | "tx_pn=%02x%02x%02x%02x%02x%02x " |
440 | "format_errors=%d replays=%d decrypt_errors=%d\n", | 440 | "rx_pn=%02x%02x%02x%02x%02x%02x " |
441 | ccmp->key_idx, ccmp->key_set, | 441 | "format_errors=%d replays=%d decrypt_errors=%d\n", |
442 | ccmp->tx_pn[0], ccmp->tx_pn[1], ccmp->tx_pn[2], | 442 | ccmp->key_idx, ccmp->key_set, |
443 | ccmp->tx_pn[3], ccmp->tx_pn[4], ccmp->tx_pn[5], | 443 | ccmp->tx_pn[0], ccmp->tx_pn[1], ccmp->tx_pn[2], |
444 | ccmp->rx_pn[0], ccmp->rx_pn[1], ccmp->rx_pn[2], | 444 | ccmp->tx_pn[3], ccmp->tx_pn[4], ccmp->tx_pn[5], |
445 | ccmp->rx_pn[3], ccmp->rx_pn[4], ccmp->rx_pn[5], | 445 | ccmp->rx_pn[0], ccmp->rx_pn[1], ccmp->rx_pn[2], |
446 | ccmp->dot11RSNAStatsCCMPFormatErrors, | 446 | ccmp->rx_pn[3], ccmp->rx_pn[4], ccmp->rx_pn[5], |
447 | ccmp->dot11RSNAStatsCCMPReplays, | 447 | ccmp->dot11RSNAStatsCCMPFormatErrors, |
448 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | 448 | ccmp->dot11RSNAStatsCCMPReplays, |
449 | 449 | ccmp->dot11RSNAStatsCCMPDecryptErrors); | |
450 | return p; | ||
451 | } | 450 | } |
452 | 451 | ||
453 | static struct lib80211_crypto_ops lib80211_crypt_ccmp = { | 452 | static struct lib80211_crypto_ops lib80211_crypt_ccmp = { |
diff --git a/net/wireless/lib80211_crypt_tkip.c b/net/wireless/lib80211_crypt_tkip.c index d475cfc8568f..8c90ba79e56e 100644 --- a/net/wireless/lib80211_crypt_tkip.c +++ b/net/wireless/lib80211_crypt_tkip.c | |||
@@ -703,30 +703,30 @@ static int lib80211_tkip_get_key(void *key, int len, u8 * seq, void *priv) | |||
703 | return TKIP_KEY_LEN; | 703 | return TKIP_KEY_LEN; |
704 | } | 704 | } |
705 | 705 | ||
706 | static char *lib80211_tkip_print_stats(char *p, void *priv) | 706 | static void lib80211_tkip_print_stats(struct seq_file *m, void *priv) |
707 | { | 707 | { |
708 | struct lib80211_tkip_data *tkip = priv; | 708 | struct lib80211_tkip_data *tkip = priv; |
709 | p += sprintf(p, "key[%d] alg=TKIP key_set=%d " | 709 | seq_printf(m, |
710 | "tx_pn=%02x%02x%02x%02x%02x%02x " | 710 | "key[%d] alg=TKIP key_set=%d " |
711 | "rx_pn=%02x%02x%02x%02x%02x%02x " | 711 | "tx_pn=%02x%02x%02x%02x%02x%02x " |
712 | "replays=%d icv_errors=%d local_mic_failures=%d\n", | 712 | "rx_pn=%02x%02x%02x%02x%02x%02x " |
713 | tkip->key_idx, tkip->key_set, | 713 | "replays=%d icv_errors=%d local_mic_failures=%d\n", |
714 | (tkip->tx_iv32 >> 24) & 0xff, | 714 | tkip->key_idx, tkip->key_set, |
715 | (tkip->tx_iv32 >> 16) & 0xff, | 715 | (tkip->tx_iv32 >> 24) & 0xff, |
716 | (tkip->tx_iv32 >> 8) & 0xff, | 716 | (tkip->tx_iv32 >> 16) & 0xff, |
717 | tkip->tx_iv32 & 0xff, | 717 | (tkip->tx_iv32 >> 8) & 0xff, |
718 | (tkip->tx_iv16 >> 8) & 0xff, | 718 | tkip->tx_iv32 & 0xff, |
719 | tkip->tx_iv16 & 0xff, | 719 | (tkip->tx_iv16 >> 8) & 0xff, |
720 | (tkip->rx_iv32 >> 24) & 0xff, | 720 | tkip->tx_iv16 & 0xff, |
721 | (tkip->rx_iv32 >> 16) & 0xff, | 721 | (tkip->rx_iv32 >> 24) & 0xff, |
722 | (tkip->rx_iv32 >> 8) & 0xff, | 722 | (tkip->rx_iv32 >> 16) & 0xff, |
723 | tkip->rx_iv32 & 0xff, | 723 | (tkip->rx_iv32 >> 8) & 0xff, |
724 | (tkip->rx_iv16 >> 8) & 0xff, | 724 | tkip->rx_iv32 & 0xff, |
725 | tkip->rx_iv16 & 0xff, | 725 | (tkip->rx_iv16 >> 8) & 0xff, |
726 | tkip->dot11RSNAStatsTKIPReplays, | 726 | tkip->rx_iv16 & 0xff, |
727 | tkip->dot11RSNAStatsTKIPICVErrors, | 727 | tkip->dot11RSNAStatsTKIPReplays, |
728 | tkip->dot11RSNAStatsTKIPLocalMICFailures); | 728 | tkip->dot11RSNAStatsTKIPICVErrors, |
729 | return p; | 729 | tkip->dot11RSNAStatsTKIPLocalMICFailures); |
730 | } | 730 | } |
731 | 731 | ||
732 | static struct lib80211_crypto_ops lib80211_crypt_tkip = { | 732 | static struct lib80211_crypto_ops lib80211_crypt_tkip = { |
diff --git a/net/wireless/lib80211_crypt_wep.c b/net/wireless/lib80211_crypt_wep.c index c1304018fc1c..1c292e4ea7b6 100644 --- a/net/wireless/lib80211_crypt_wep.c +++ b/net/wireless/lib80211_crypt_wep.c | |||
@@ -253,11 +253,10 @@ static int lib80211_wep_get_key(void *key, int len, u8 * seq, void *priv) | |||
253 | return wep->key_len; | 253 | return wep->key_len; |
254 | } | 254 | } |
255 | 255 | ||
256 | static char *lib80211_wep_print_stats(char *p, void *priv) | 256 | static void lib80211_wep_print_stats(struct seq_file *m, void *priv) |
257 | { | 257 | { |
258 | struct lib80211_wep_data *wep = priv; | 258 | struct lib80211_wep_data *wep = priv; |
259 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); | 259 | seq_printf(m, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); |
260 | return p; | ||
261 | } | 260 | } |
262 | 261 | ||
263 | static struct lib80211_crypto_ops lib80211_crypt_wep = { | 262 | static struct lib80211_crypto_ops lib80211_crypt_wep = { |
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c index 2ffde4631ae2..0917f047f2cf 100644 --- a/net/x25/x25_proc.c +++ b/net/x25/x25_proc.c | |||
@@ -187,7 +187,6 @@ static int x25_seq_forward_open(struct inode *inode, struct file *file) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | static const struct file_operations x25_seq_socket_fops = { | 189 | static const struct file_operations x25_seq_socket_fops = { |
190 | .owner = THIS_MODULE, | ||
191 | .open = x25_seq_socket_open, | 190 | .open = x25_seq_socket_open, |
192 | .read = seq_read, | 191 | .read = seq_read, |
193 | .llseek = seq_lseek, | 192 | .llseek = seq_lseek, |
@@ -195,7 +194,6 @@ static const struct file_operations x25_seq_socket_fops = { | |||
195 | }; | 194 | }; |
196 | 195 | ||
197 | static const struct file_operations x25_seq_route_fops = { | 196 | static const struct file_operations x25_seq_route_fops = { |
198 | .owner = THIS_MODULE, | ||
199 | .open = x25_seq_route_open, | 197 | .open = x25_seq_route_open, |
200 | .read = seq_read, | 198 | .read = seq_read, |
201 | .llseek = seq_lseek, | 199 | .llseek = seq_lseek, |
@@ -203,55 +201,38 @@ static const struct file_operations x25_seq_route_fops = { | |||
203 | }; | 201 | }; |
204 | 202 | ||
205 | static const struct file_operations x25_seq_forward_fops = { | 203 | static const struct file_operations x25_seq_forward_fops = { |
206 | .owner = THIS_MODULE, | ||
207 | .open = x25_seq_forward_open, | 204 | .open = x25_seq_forward_open, |
208 | .read = seq_read, | 205 | .read = seq_read, |
209 | .llseek = seq_lseek, | 206 | .llseek = seq_lseek, |
210 | .release = seq_release, | 207 | .release = seq_release, |
211 | }; | 208 | }; |
212 | 209 | ||
213 | static struct proc_dir_entry *x25_proc_dir; | ||
214 | |||
215 | int __init x25_proc_init(void) | 210 | int __init x25_proc_init(void) |
216 | { | 211 | { |
217 | struct proc_dir_entry *p; | 212 | if (!proc_mkdir("x25", init_net.proc_net)) |
218 | int rc = -ENOMEM; | 213 | return -ENOMEM; |
219 | 214 | ||
220 | x25_proc_dir = proc_mkdir("x25", init_net.proc_net); | 215 | if (!proc_create("x25/route", S_IRUGO, init_net.proc_net, |
221 | if (!x25_proc_dir) | 216 | &x25_seq_route_fops)) |
222 | goto out; | 217 | goto out; |
223 | 218 | ||
224 | p = proc_create("route", S_IRUGO, x25_proc_dir, &x25_seq_route_fops); | 219 | if (!proc_create("x25/socket", S_IRUGO, init_net.proc_net, |
225 | if (!p) | 220 | &x25_seq_socket_fops)) |
226 | goto out_route; | 221 | goto out; |
227 | |||
228 | p = proc_create("socket", S_IRUGO, x25_proc_dir, &x25_seq_socket_fops); | ||
229 | if (!p) | ||
230 | goto out_socket; | ||
231 | 222 | ||
232 | p = proc_create("forward", S_IRUGO, x25_proc_dir, | 223 | if (!proc_create("x25/forward", S_IRUGO, init_net.proc_net, |
233 | &x25_seq_forward_fops); | 224 | &x25_seq_forward_fops)) |
234 | if (!p) | 225 | goto out; |
235 | goto out_forward; | 226 | return 0; |
236 | rc = 0; | ||
237 | 227 | ||
238 | out: | 228 | out: |
239 | return rc; | 229 | remove_proc_subtree("x25", init_net.proc_net); |
240 | out_forward: | 230 | return -ENOMEM; |
241 | remove_proc_entry("socket", x25_proc_dir); | ||
242 | out_socket: | ||
243 | remove_proc_entry("route", x25_proc_dir); | ||
244 | out_route: | ||
245 | remove_proc_entry("x25", init_net.proc_net); | ||
246 | goto out; | ||
247 | } | 231 | } |
248 | 232 | ||
249 | void __exit x25_proc_exit(void) | 233 | void __exit x25_proc_exit(void) |
250 | { | 234 | { |
251 | remove_proc_entry("forward", x25_proc_dir); | 235 | remove_proc_subtree("x25", init_net.proc_net); |
252 | remove_proc_entry("route", x25_proc_dir); | ||
253 | remove_proc_entry("socket", x25_proc_dir); | ||
254 | remove_proc_entry("x25", init_net.proc_net); | ||
255 | } | 236 | } |
256 | 237 | ||
257 | #else /* CONFIG_PROC_FS */ | 238 | #else /* CONFIG_PROC_FS */ |
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index f89a0333b813..283862aebdc8 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
@@ -2681,10 +2681,8 @@ out: | |||
2681 | * tomoyo_close_control - close() for /sys/kernel/security/tomoyo/ interface. | 2681 | * tomoyo_close_control - close() for /sys/kernel/security/tomoyo/ interface. |
2682 | * | 2682 | * |
2683 | * @head: Pointer to "struct tomoyo_io_buffer". | 2683 | * @head: Pointer to "struct tomoyo_io_buffer". |
2684 | * | ||
2685 | * Returns 0. | ||
2686 | */ | 2684 | */ |
2687 | int tomoyo_close_control(struct tomoyo_io_buffer *head) | 2685 | void tomoyo_close_control(struct tomoyo_io_buffer *head) |
2688 | { | 2686 | { |
2689 | /* | 2687 | /* |
2690 | * If the file is /sys/kernel/security/tomoyo/query , decrement the | 2688 | * If the file is /sys/kernel/security/tomoyo/query , decrement the |
@@ -2694,7 +2692,6 @@ int tomoyo_close_control(struct tomoyo_io_buffer *head) | |||
2694 | atomic_dec_and_test(&tomoyo_query_observers)) | 2692 | atomic_dec_and_test(&tomoyo_query_observers)) |
2695 | wake_up_all(&tomoyo_answer_wait); | 2693 | wake_up_all(&tomoyo_answer_wait); |
2696 | tomoyo_notify_gc(head, false); | 2694 | tomoyo_notify_gc(head, false); |
2697 | return 0; | ||
2698 | } | 2695 | } |
2699 | 2696 | ||
2700 | /** | 2697 | /** |
diff --git a/security/tomoyo/common.h b/security/tomoyo/common.h index d4f166bc3508..b897d4862016 100644 --- a/security/tomoyo/common.h +++ b/security/tomoyo/common.h | |||
@@ -958,7 +958,7 @@ const struct tomoyo_path_info *tomoyo_path_matches_group | |||
958 | (const struct tomoyo_path_info *pathname, const struct tomoyo_group *group); | 958 | (const struct tomoyo_path_info *pathname, const struct tomoyo_group *group); |
959 | int tomoyo_check_open_permission(struct tomoyo_domain_info *domain, | 959 | int tomoyo_check_open_permission(struct tomoyo_domain_info *domain, |
960 | struct path *path, const int flag); | 960 | struct path *path, const int flag); |
961 | int tomoyo_close_control(struct tomoyo_io_buffer *head); | 961 | void tomoyo_close_control(struct tomoyo_io_buffer *head); |
962 | int tomoyo_env_perm(struct tomoyo_request_info *r, const char *env); | 962 | int tomoyo_env_perm(struct tomoyo_request_info *r, const char *env); |
963 | int tomoyo_execute_permission(struct tomoyo_request_info *r, | 963 | int tomoyo_execute_permission(struct tomoyo_request_info *r, |
964 | const struct tomoyo_path_info *filename); | 964 | const struct tomoyo_path_info *filename); |
diff --git a/security/tomoyo/securityfs_if.c b/security/tomoyo/securityfs_if.c index fcf32783b66b..179a955b319d 100644 --- a/security/tomoyo/securityfs_if.c +++ b/security/tomoyo/securityfs_if.c | |||
@@ -143,14 +143,13 @@ static int tomoyo_open(struct inode *inode, struct file *file) | |||
143 | /** | 143 | /** |
144 | * tomoyo_release - close() for /sys/kernel/security/tomoyo/ interface. | 144 | * tomoyo_release - close() for /sys/kernel/security/tomoyo/ interface. |
145 | * | 145 | * |
146 | * @inode: Pointer to "struct inode". | ||
147 | * @file: Pointer to "struct file". | 146 | * @file: Pointer to "struct file". |
148 | * | 147 | * |
149 | * Returns 0 on success, negative value otherwise. | ||
150 | */ | 148 | */ |
151 | static int tomoyo_release(struct inode *inode, struct file *file) | 149 | static int tomoyo_release(struct inode *inode, struct file *file) |
152 | { | 150 | { |
153 | return tomoyo_close_control(file->private_data); | 151 | tomoyo_close_control(file->private_data); |
152 | return 0; | ||
154 | } | 153 | } |
155 | 154 | ||
156 | /** | 155 | /** |
diff --git a/sound/core/info.c b/sound/core/info.c index 5bb97e7d325a..3c9bd6b10a96 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -153,13 +153,6 @@ EXPORT_SYMBOL(snd_seq_root); | |||
153 | struct snd_info_entry *snd_oss_root; | 153 | struct snd_info_entry *snd_oss_root; |
154 | #endif | 154 | #endif |
155 | 155 | ||
156 | static void snd_remove_proc_entry(struct proc_dir_entry *parent, | ||
157 | struct proc_dir_entry *de) | ||
158 | { | ||
159 | if (de) | ||
160 | remove_proc_entry(de->name, parent); | ||
161 | } | ||
162 | |||
163 | static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig) | 156 | static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig) |
164 | { | 157 | { |
165 | struct snd_info_private_data *data; | 158 | struct snd_info_private_data *data; |
@@ -310,12 +303,10 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) | |||
310 | struct snd_info_entry *entry; | 303 | struct snd_info_entry *entry; |
311 | struct snd_info_private_data *data; | 304 | struct snd_info_private_data *data; |
312 | struct snd_info_buffer *buffer; | 305 | struct snd_info_buffer *buffer; |
313 | struct proc_dir_entry *p; | ||
314 | int mode, err; | 306 | int mode, err; |
315 | 307 | ||
316 | mutex_lock(&info_mutex); | 308 | mutex_lock(&info_mutex); |
317 | p = PDE(inode); | 309 | entry = PDE_DATA(inode); |
318 | entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; | ||
319 | if (entry == NULL || ! entry->p) { | 310 | if (entry == NULL || ! entry->p) { |
320 | mutex_unlock(&info_mutex); | 311 | mutex_unlock(&info_mutex); |
321 | return -ENODEV; | 312 | return -ENODEV; |
@@ -582,7 +573,7 @@ int __exit snd_info_done(void) | |||
582 | #ifdef CONFIG_SND_OSSEMUL | 573 | #ifdef CONFIG_SND_OSSEMUL |
583 | snd_info_free_entry(snd_oss_root); | 574 | snd_info_free_entry(snd_oss_root); |
584 | #endif | 575 | #endif |
585 | snd_remove_proc_entry(NULL, snd_proc_root); | 576 | proc_remove(snd_proc_root); |
586 | } | 577 | } |
587 | return 0; | 578 | return 0; |
588 | } | 579 | } |
@@ -644,7 +635,7 @@ void snd_info_card_id_change(struct snd_card *card) | |||
644 | { | 635 | { |
645 | mutex_lock(&info_mutex); | 636 | mutex_lock(&info_mutex); |
646 | if (card->proc_root_link) { | 637 | if (card->proc_root_link) { |
647 | snd_remove_proc_entry(snd_proc_root, card->proc_root_link); | 638 | proc_remove(card->proc_root_link); |
648 | card->proc_root_link = NULL; | 639 | card->proc_root_link = NULL; |
649 | } | 640 | } |
650 | if (strcmp(card->id, card->proc_root->name)) | 641 | if (strcmp(card->id, card->proc_root->name)) |
@@ -663,10 +654,8 @@ void snd_info_card_disconnect(struct snd_card *card) | |||
663 | if (!card) | 654 | if (!card) |
664 | return; | 655 | return; |
665 | mutex_lock(&info_mutex); | 656 | mutex_lock(&info_mutex); |
666 | if (card->proc_root_link) { | 657 | proc_remove(card->proc_root_link); |
667 | snd_remove_proc_entry(snd_proc_root, card->proc_root_link); | 658 | card->proc_root_link = NULL; |
668 | card->proc_root_link = NULL; | ||
669 | } | ||
670 | if (card->proc_root) | 659 | if (card->proc_root) |
671 | snd_info_disconnect(card->proc_root); | 660 | snd_info_disconnect(card->proc_root); |
672 | mutex_unlock(&info_mutex); | 661 | mutex_unlock(&info_mutex); |
@@ -858,7 +847,7 @@ static void snd_info_disconnect(struct snd_info_entry *entry) | |||
858 | list_del_init(&entry->list); | 847 | list_del_init(&entry->list); |
859 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; | 848 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; |
860 | snd_BUG_ON(!root); | 849 | snd_BUG_ON(!root); |
861 | snd_remove_proc_entry(root, entry->p); | 850 | proc_remove(entry->p); |
862 | entry->p = NULL; | 851 | entry->p = NULL; |
863 | } | 852 | } |
864 | 853 | ||
@@ -959,15 +948,21 @@ int snd_info_register(struct snd_info_entry * entry) | |||
959 | return -ENXIO; | 948 | return -ENXIO; |
960 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; | 949 | root = entry->parent == NULL ? snd_proc_root : entry->parent->p; |
961 | mutex_lock(&info_mutex); | 950 | mutex_lock(&info_mutex); |
962 | p = create_proc_entry(entry->name, entry->mode, root); | 951 | if (S_ISDIR(entry->mode)) { |
963 | if (!p) { | 952 | p = proc_mkdir_mode(entry->name, entry->mode, root); |
964 | mutex_unlock(&info_mutex); | 953 | if (!p) { |
965 | return -ENOMEM; | 954 | mutex_unlock(&info_mutex); |
955 | return -ENOMEM; | ||
956 | } | ||
957 | } else { | ||
958 | p = proc_create_data(entry->name, entry->mode, root, | ||
959 | &snd_info_entry_operations, entry); | ||
960 | if (!p) { | ||
961 | mutex_unlock(&info_mutex); | ||
962 | return -ENOMEM; | ||
963 | } | ||
964 | proc_set_size(p, entry->size); | ||
966 | } | 965 | } |
967 | if (!S_ISDIR(entry->mode)) | ||
968 | p->proc_fops = &snd_info_entry_operations; | ||
969 | p->size = entry->size; | ||
970 | p->data = entry; | ||
971 | entry->p = p; | 966 | entry->p = p; |
972 | if (entry->parent) | 967 | if (entry->parent) |
973 | list_add_tail(&entry->list, &entry->parent->children); | 968 | list_add_tail(&entry->list, &entry->parent->children); |
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index c918313c2206..bac43b5b6e95 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -835,7 +835,7 @@ static void sq_reset(void) | |||
835 | shared_resources_initialised = 0 ; | 835 | shared_resources_initialised = 0 ; |
836 | } | 836 | } |
837 | 837 | ||
838 | static int sq_fsync(struct file *filp, struct dentry *dentry) | 838 | static int sq_fsync(void) |
839 | { | 839 | { |
840 | int rc = 0; | 840 | int rc = 0; |
841 | int timeout = 5; | 841 | int timeout = 5; |
@@ -874,7 +874,7 @@ static int sq_release(struct inode *inode, struct file *file) | |||
874 | 874 | ||
875 | if (file->f_mode & FMODE_WRITE) { | 875 | if (file->f_mode & FMODE_WRITE) { |
876 | if (write_sq.busy) | 876 | if (write_sq.busy) |
877 | rc = sq_fsync(file, file->f_path.dentry); | 877 | rc = sq_fsync(); |
878 | 878 | ||
879 | sq_reset_output() ; /* make sure dma is stopped and all is quiet */ | 879 | sq_reset_output() ; /* make sure dma is stopped and all is quiet */ |
880 | write_sq_release_buffers(); | 880 | write_sq_release_buffers(); |
@@ -1025,7 +1025,7 @@ static int sq_ioctl(struct file *file, u_int cmd, u_long arg) | |||
1025 | */ | 1025 | */ |
1026 | result = 0 ; | 1026 | result = 0 ; |
1027 | if (file->f_mode & FMODE_WRITE) { | 1027 | if (file->f_mode & FMODE_WRITE) { |
1028 | result = sq_fsync(file, file->f_path.dentry); | 1028 | result = sq_fsync(); |
1029 | sq_reset_output() ; | 1029 | sq_reset_output() ; |
1030 | } | 1030 | } |
1031 | /* if we are the shared resource owner then release them */ | 1031 | /* if we are the shared resource owner then release them */ |
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c index e14903468051..b155137ee312 100644 --- a/sound/sound_firmware.c +++ b/sound/sound_firmware.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/vmalloc.h> | 1 | #include <linux/vmalloc.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/fs.h> | 3 | #include <linux/fs.h> |
4 | #include <linux/file.h> | ||
4 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
5 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
6 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
@@ -23,14 +24,14 @@ static int do_mod_firmware_load(const char *fn, char **fp) | |||
23 | if (l <= 0 || l > 131072) | 24 | if (l <= 0 || l > 131072) |
24 | { | 25 | { |
25 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); | 26 | printk(KERN_INFO "Invalid firmware '%s'\n", fn); |
26 | filp_close(filp, NULL); | 27 | fput(filp); |
27 | return 0; | 28 | return 0; |
28 | } | 29 | } |
29 | dp = vmalloc(l); | 30 | dp = vmalloc(l); |
30 | if (dp == NULL) | 31 | if (dp == NULL) |
31 | { | 32 | { |
32 | printk(KERN_INFO "Out of memory loading '%s'.\n", fn); | 33 | printk(KERN_INFO "Out of memory loading '%s'.\n", fn); |
33 | filp_close(filp, NULL); | 34 | fput(filp); |
34 | return 0; | 35 | return 0; |
35 | } | 36 | } |
36 | pos = 0; | 37 | pos = 0; |
@@ -38,10 +39,10 @@ static int do_mod_firmware_load(const char *fn, char **fp) | |||
38 | { | 39 | { |
39 | printk(KERN_INFO "Failed to read '%s'.\n", fn); | 40 | printk(KERN_INFO "Failed to read '%s'.\n", fn); |
40 | vfree(dp); | 41 | vfree(dp); |
41 | filp_close(filp, NULL); | 42 | fput(filp); |
42 | return 0; | 43 | return 0; |
43 | } | 44 | } |
44 | filp_close(filp, NULL); | 45 | fput(filp); |
45 | *fp = dp; | 46 | *fp = dp; |
46 | return (int) l; | 47 | return (int) l; |
47 | } | 48 | } |