diff options
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/Kconfig | 4 | ||||
-rw-r--r-- | arch/ia64/ia32/binfmt_elf32.c | 13 | ||||
-rw-r--r-- | arch/ia64/ia32/ia32_entry.S | 2 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 68 | ||||
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/traps.c | 30 | ||||
-rw-r--r-- | arch/ia64/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/ia64/mm/contig.c | 4 | ||||
-rw-r--r-- | arch/ia64/mm/discontig.c | 6 | ||||
-rw-r--r-- | arch/ia64/mm/init.c | 8 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/sn2/sn_proc_fs.c | 105 |
11 files changed, 86 insertions, 159 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index f1d2899e9a62..db185f34e341 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -24,6 +24,10 @@ config 64BIT | |||
24 | bool | 24 | bool |
25 | default y | 25 | default y |
26 | 26 | ||
27 | config ZONE_DMA | ||
28 | def_bool y | ||
29 | depends on !IA64_SGI_SN2 | ||
30 | |||
27 | config MMU | 31 | config MMU |
28 | bool | 32 | bool |
29 | default y | 33 | default y |
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c index 578737ec7629..c05bda662364 100644 --- a/arch/ia64/ia32/binfmt_elf32.c +++ b/arch/ia64/ia32/binfmt_elf32.c | |||
@@ -91,9 +91,8 @@ ia64_elf32_init (struct pt_regs *regs) | |||
91 | * it with privilege level 3 because the IVE uses non-privileged accesses to these | 91 | * it with privilege level 3 because the IVE uses non-privileged accesses to these |
92 | * tables. IA-32 segmentation is used to protect against IA-32 accesses to them. | 92 | * tables. IA-32 segmentation is used to protect against IA-32 accesses to them. |
93 | */ | 93 | */ |
94 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 94 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
95 | if (vma) { | 95 | if (vma) { |
96 | memset(vma, 0, sizeof(*vma)); | ||
97 | vma->vm_mm = current->mm; | 96 | vma->vm_mm = current->mm; |
98 | vma->vm_start = IA32_GDT_OFFSET; | 97 | vma->vm_start = IA32_GDT_OFFSET; |
99 | vma->vm_end = vma->vm_start + PAGE_SIZE; | 98 | vma->vm_end = vma->vm_start + PAGE_SIZE; |
@@ -117,9 +116,8 @@ ia64_elf32_init (struct pt_regs *regs) | |||
117 | * code is locked in specific gate page, which is pointed by pretcode | 116 | * code is locked in specific gate page, which is pointed by pretcode |
118 | * when setup_frame_ia32 | 117 | * when setup_frame_ia32 |
119 | */ | 118 | */ |
120 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 119 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
121 | if (vma) { | 120 | if (vma) { |
122 | memset(vma, 0, sizeof(*vma)); | ||
123 | vma->vm_mm = current->mm; | 121 | vma->vm_mm = current->mm; |
124 | vma->vm_start = IA32_GATE_OFFSET; | 122 | vma->vm_start = IA32_GATE_OFFSET; |
125 | vma->vm_end = vma->vm_start + PAGE_SIZE; | 123 | vma->vm_end = vma->vm_start + PAGE_SIZE; |
@@ -142,9 +140,8 @@ ia64_elf32_init (struct pt_regs *regs) | |||
142 | * Install LDT as anonymous memory. This gives us all-zero segment descriptors | 140 | * Install LDT as anonymous memory. This gives us all-zero segment descriptors |
143 | * until a task modifies them via modify_ldt(). | 141 | * until a task modifies them via modify_ldt(). |
144 | */ | 142 | */ |
145 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 143 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
146 | if (vma) { | 144 | if (vma) { |
147 | memset(vma, 0, sizeof(*vma)); | ||
148 | vma->vm_mm = current->mm; | 145 | vma->vm_mm = current->mm; |
149 | vma->vm_start = IA32_LDT_OFFSET; | 146 | vma->vm_start = IA32_LDT_OFFSET; |
150 | vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE); | 147 | vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE); |
@@ -214,12 +211,10 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack) | |||
214 | bprm->loader += stack_base; | 211 | bprm->loader += stack_base; |
215 | bprm->exec += stack_base; | 212 | bprm->exec += stack_base; |
216 | 213 | ||
217 | mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 214 | mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
218 | if (!mpnt) | 215 | if (!mpnt) |
219 | return -ENOMEM; | 216 | return -ENOMEM; |
220 | 217 | ||
221 | memset(mpnt, 0, sizeof(*mpnt)); | ||
222 | |||
223 | down_write(¤t->mm->mmap_sem); | 218 | down_write(¤t->mm->mmap_sem); |
224 | { | 219 | { |
225 | mpnt->vm_mm = current->mm; | 220 | mpnt->vm_mm = current->mm; |
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index a32cd59b81ed..687e5fdc9683 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S | |||
@@ -326,7 +326,7 @@ ia32_syscall_table: | |||
326 | data8 sys_ni_syscall | 326 | data8 sys_ni_syscall |
327 | data8 compat_sys_wait4 | 327 | data8 compat_sys_wait4 |
328 | data8 sys_swapoff /* 115 */ | 328 | data8 sys_swapoff /* 115 */ |
329 | data8 sys32_sysinfo | 329 | data8 compat_sys_sysinfo |
330 | data8 sys32_ipc | 330 | data8 sys32_ipc |
331 | data8 sys_fsync | 331 | data8 sys_fsync |
332 | data8 sys32_sigreturn | 332 | data8 sys32_sigreturn |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 957681c39ad9..d430d36ae49d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -2209,74 +2209,6 @@ sys32_fstat64 (unsigned int fd, struct stat64 __user *statbuf) | |||
2209 | return ret; | 2209 | return ret; |
2210 | } | 2210 | } |
2211 | 2211 | ||
2212 | struct sysinfo32 { | ||
2213 | s32 uptime; | ||
2214 | u32 loads[3]; | ||
2215 | u32 totalram; | ||
2216 | u32 freeram; | ||
2217 | u32 sharedram; | ||
2218 | u32 bufferram; | ||
2219 | u32 totalswap; | ||
2220 | u32 freeswap; | ||
2221 | u16 procs; | ||
2222 | u16 pad; | ||
2223 | u32 totalhigh; | ||
2224 | u32 freehigh; | ||
2225 | u32 mem_unit; | ||
2226 | char _f[8]; | ||
2227 | }; | ||
2228 | |||
2229 | asmlinkage long | ||
2230 | sys32_sysinfo (struct sysinfo32 __user *info) | ||
2231 | { | ||
2232 | struct sysinfo s; | ||
2233 | long ret, err; | ||
2234 | int bitcount = 0; | ||
2235 | mm_segment_t old_fs = get_fs(); | ||
2236 | |||
2237 | set_fs(KERNEL_DS); | ||
2238 | ret = sys_sysinfo((struct sysinfo __user *) &s); | ||
2239 | set_fs(old_fs); | ||
2240 | /* Check to see if any memory value is too large for 32-bit and | ||
2241 | * scale down if needed. | ||
2242 | */ | ||
2243 | if ((s.totalram >> 32) || (s.totalswap >> 32)) { | ||
2244 | while (s.mem_unit < PAGE_SIZE) { | ||
2245 | s.mem_unit <<= 1; | ||
2246 | bitcount++; | ||
2247 | } | ||
2248 | s.totalram >>= bitcount; | ||
2249 | s.freeram >>= bitcount; | ||
2250 | s.sharedram >>= bitcount; | ||
2251 | s.bufferram >>= bitcount; | ||
2252 | s.totalswap >>= bitcount; | ||
2253 | s.freeswap >>= bitcount; | ||
2254 | s.totalhigh >>= bitcount; | ||
2255 | s.freehigh >>= bitcount; | ||
2256 | } | ||
2257 | |||
2258 | if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) | ||
2259 | return -EFAULT; | ||
2260 | |||
2261 | err = __put_user(s.uptime, &info->uptime); | ||
2262 | err |= __put_user(s.loads[0], &info->loads[0]); | ||
2263 | err |= __put_user(s.loads[1], &info->loads[1]); | ||
2264 | err |= __put_user(s.loads[2], &info->loads[2]); | ||
2265 | err |= __put_user(s.totalram, &info->totalram); | ||
2266 | err |= __put_user(s.freeram, &info->freeram); | ||
2267 | err |= __put_user(s.sharedram, &info->sharedram); | ||
2268 | err |= __put_user(s.bufferram, &info->bufferram); | ||
2269 | err |= __put_user(s.totalswap, &info->totalswap); | ||
2270 | err |= __put_user(s.freeswap, &info->freeswap); | ||
2271 | err |= __put_user(s.procs, &info->procs); | ||
2272 | err |= __put_user (s.totalhigh, &info->totalhigh); | ||
2273 | err |= __put_user (s.freehigh, &info->freehigh); | ||
2274 | err |= __put_user (s.mem_unit, &info->mem_unit); | ||
2275 | if (err) | ||
2276 | return -EFAULT; | ||
2277 | return ret; | ||
2278 | } | ||
2279 | |||
2280 | asmlinkage long | 2212 | asmlinkage long |
2281 | sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec __user *interval) | 2213 | sys32_sched_rr_get_interval (pid_t pid, struct compat_timespec __user *interval) |
2282 | { | 2214 | { |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index aa94f60fa8e7..86e144f321ff 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2301,12 +2301,11 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon | |||
2301 | DPRINT(("smpl_buf @%p\n", smpl_buf)); | 2301 | DPRINT(("smpl_buf @%p\n", smpl_buf)); |
2302 | 2302 | ||
2303 | /* allocate vma */ | 2303 | /* allocate vma */ |
2304 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 2304 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
2305 | if (!vma) { | 2305 | if (!vma) { |
2306 | DPRINT(("Cannot allocate vma\n")); | 2306 | DPRINT(("Cannot allocate vma\n")); |
2307 | goto error_kmem; | 2307 | goto error_kmem; |
2308 | } | 2308 | } |
2309 | memset(vma, 0, sizeof(*vma)); | ||
2310 | 2309 | ||
2311 | /* | 2310 | /* |
2312 | * partially initialize the vma for the sampling buffer | 2311 | * partially initialize the vma for the sampling buffer |
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index ab684747036f..765cbe5ba6ae 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -24,8 +24,6 @@ | |||
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include <asm/kdebug.h> | 25 | #include <asm/kdebug.h> |
26 | 26 | ||
27 | extern spinlock_t timerlist_lock; | ||
28 | |||
29 | fpswa_interface_t *fpswa_interface; | 27 | fpswa_interface_t *fpswa_interface; |
30 | EXPORT_SYMBOL(fpswa_interface); | 28 | EXPORT_SYMBOL(fpswa_interface); |
31 | 29 | ||
@@ -53,34 +51,6 @@ trap_init (void) | |||
53 | fpswa_interface = __va(ia64_boot_param->fpswa); | 51 | fpswa_interface = __va(ia64_boot_param->fpswa); |
54 | } | 52 | } |
55 | 53 | ||
56 | /* | ||
57 | * Unlock any spinlocks which will prevent us from getting the message out (timerlist_lock | ||
58 | * is acquired through the console unblank code) | ||
59 | */ | ||
60 | void | ||
61 | bust_spinlocks (int yes) | ||
62 | { | ||
63 | int loglevel_save = console_loglevel; | ||
64 | |||
65 | if (yes) { | ||
66 | oops_in_progress = 1; | ||
67 | return; | ||
68 | } | ||
69 | |||
70 | #ifdef CONFIG_VT | ||
71 | unblank_screen(); | ||
72 | #endif | ||
73 | oops_in_progress = 0; | ||
74 | /* | ||
75 | * OK, the message is on the console. Now we call printk() without | ||
76 | * oops_in_progress set so that printk will give klogd a poke. Hold onto | ||
77 | * your hats... | ||
78 | */ | ||
79 | console_loglevel = 15; /* NMI oopser may have shut the console up */ | ||
80 | printk(" "); | ||
81 | console_loglevel = loglevel_save; | ||
82 | } | ||
83 | |||
84 | void | 54 | void |
85 | die (const char *str, struct pt_regs *regs, long err) | 55 | die (const char *str, struct pt_regs *regs, long err) |
86 | { | 56 | { |
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 8f3d0066f446..25dd55e4db24 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S | |||
@@ -111,12 +111,14 @@ SECTIONS | |||
111 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) | 111 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) |
112 | { *(.init.data) } | 112 | { *(.init.data) } |
113 | 113 | ||
114 | #ifdef CONFIG_BLK_DEV_INITRD | ||
114 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) | 115 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) |
115 | { | 116 | { |
116 | __initramfs_start = .; | 117 | __initramfs_start = .; |
117 | *(.init.ramfs) | 118 | *(.init.ramfs) |
118 | __initramfs_end = .; | 119 | __initramfs_end = .; |
119 | } | 120 | } |
121 | #endif | ||
120 | 122 | ||
121 | . = ALIGN(16); | 123 | . = ALIGN(16); |
122 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) | 124 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) |
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c index 63e6d49c5813..ca4d41e5f177 100644 --- a/arch/ia64/mm/contig.c +++ b/arch/ia64/mm/contig.c | |||
@@ -259,9 +259,11 @@ paging_init (void) | |||
259 | num_physpages = 0; | 259 | num_physpages = 0; |
260 | efi_memmap_walk(count_pages, &num_physpages); | 260 | efi_memmap_walk(count_pages, &num_physpages); |
261 | 261 | ||
262 | max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; | ||
263 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 262 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
263 | #ifdef CONFIG_ZONE_DMA | ||
264 | max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; | ||
264 | max_zone_pfns[ZONE_DMA] = max_dma; | 265 | max_zone_pfns[ZONE_DMA] = max_dma; |
266 | #endif | ||
265 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | 267 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
266 | 268 | ||
267 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 269 | #ifdef CONFIG_VIRTUAL_MEM_MAP |
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index 6eae596c509d..16835108bb5b 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c | |||
@@ -37,7 +37,9 @@ struct early_node_data { | |||
37 | unsigned long pernode_size; | 37 | unsigned long pernode_size; |
38 | struct bootmem_data bootmem_data; | 38 | struct bootmem_data bootmem_data; |
39 | unsigned long num_physpages; | 39 | unsigned long num_physpages; |
40 | #ifdef CONFIG_ZONE_DMA | ||
40 | unsigned long num_dma_physpages; | 41 | unsigned long num_dma_physpages; |
42 | #endif | ||
41 | unsigned long min_pfn; | 43 | unsigned long min_pfn; |
42 | unsigned long max_pfn; | 44 | unsigned long max_pfn; |
43 | }; | 45 | }; |
@@ -633,9 +635,11 @@ static __init int count_node_pages(unsigned long start, unsigned long len, int n | |||
633 | unsigned long end = start + len; | 635 | unsigned long end = start + len; |
634 | 636 | ||
635 | mem_data[node].num_physpages += len >> PAGE_SHIFT; | 637 | mem_data[node].num_physpages += len >> PAGE_SHIFT; |
638 | #ifdef CONFIG_ZONE_DMA | ||
636 | if (start <= __pa(MAX_DMA_ADDRESS)) | 639 | if (start <= __pa(MAX_DMA_ADDRESS)) |
637 | mem_data[node].num_dma_physpages += | 640 | mem_data[node].num_dma_physpages += |
638 | (min(end, __pa(MAX_DMA_ADDRESS)) - start) >>PAGE_SHIFT; | 641 | (min(end, __pa(MAX_DMA_ADDRESS)) - start) >>PAGE_SHIFT; |
642 | #endif | ||
639 | start = GRANULEROUNDDOWN(start); | 643 | start = GRANULEROUNDDOWN(start); |
640 | start = ORDERROUNDDOWN(start); | 644 | start = ORDERROUNDDOWN(start); |
641 | end = GRANULEROUNDUP(end); | 645 | end = GRANULEROUNDUP(end); |
@@ -688,7 +692,9 @@ void __init paging_init(void) | |||
688 | } | 692 | } |
689 | 693 | ||
690 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | 694 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
695 | #ifdef CONFIG_ZONE_DMA | ||
691 | max_zone_pfns[ZONE_DMA] = max_dma; | 696 | max_zone_pfns[ZONE_DMA] = max_dma; |
697 | #endif | ||
692 | max_zone_pfns[ZONE_NORMAL] = max_pfn; | 698 | max_zone_pfns[ZONE_NORMAL] = max_pfn; |
693 | free_area_init_nodes(max_zone_pfns); | 699 | free_area_init_nodes(max_zone_pfns); |
694 | 700 | ||
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index faaca21a3718..f225dd72968b 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -68,7 +68,7 @@ max_pgt_pages(void) | |||
68 | #ifndef CONFIG_NUMA | 68 | #ifndef CONFIG_NUMA |
69 | node_free_pages = nr_free_pages(); | 69 | node_free_pages = nr_free_pages(); |
70 | #else | 70 | #else |
71 | node_free_pages = nr_free_pages_pgdat(NODE_DATA(numa_node_id())); | 71 | node_free_pages = node_page_state(numa_node_id(), NR_FREE_PAGES); |
72 | #endif | 72 | #endif |
73 | max_pgt_pages = node_free_pages / PGT_FRACTION_OF_NODE_MEM; | 73 | max_pgt_pages = node_free_pages / PGT_FRACTION_OF_NODE_MEM; |
74 | max_pgt_pages = max(max_pgt_pages, MIN_PGT_PAGES); | 74 | max_pgt_pages = max(max_pgt_pages, MIN_PGT_PAGES); |
@@ -176,9 +176,8 @@ ia64_init_addr_space (void) | |||
176 | * the problem. When the process attempts to write to the register backing store | 176 | * the problem. When the process attempts to write to the register backing store |
177 | * for the first time, it will get a SEGFAULT in this case. | 177 | * for the first time, it will get a SEGFAULT in this case. |
178 | */ | 178 | */ |
179 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 179 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
180 | if (vma) { | 180 | if (vma) { |
181 | memset(vma, 0, sizeof(*vma)); | ||
182 | vma->vm_mm = current->mm; | 181 | vma->vm_mm = current->mm; |
183 | vma->vm_start = current->thread.rbs_bot & PAGE_MASK; | 182 | vma->vm_start = current->thread.rbs_bot & PAGE_MASK; |
184 | vma->vm_end = vma->vm_start + PAGE_SIZE; | 183 | vma->vm_end = vma->vm_start + PAGE_SIZE; |
@@ -195,9 +194,8 @@ ia64_init_addr_space (void) | |||
195 | 194 | ||
196 | /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */ | 195 | /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */ |
197 | if (!(current->personality & MMAP_PAGE_ZERO)) { | 196 | if (!(current->personality & MMAP_PAGE_ZERO)) { |
198 | vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); | 197 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
199 | if (vma) { | 198 | if (vma) { |
200 | memset(vma, 0, sizeof(*vma)); | ||
201 | vma->vm_mm = current->mm; | 199 | vma->vm_mm = current->mm; |
202 | vma->vm_end = PAGE_SIZE; | 200 | vma->vm_end = PAGE_SIZE; |
203 | vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); | 201 | vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); |
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c index 43ddc2eccb96..62b3e9a496ac 100644 --- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c +++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c | |||
@@ -89,61 +89,80 @@ static int coherence_id_open(struct inode *inode, struct file *file) | |||
89 | return single_open(file, coherence_id_show, NULL); | 89 | return single_open(file, coherence_id_show, NULL); |
90 | } | 90 | } |
91 | 91 | ||
92 | static struct proc_dir_entry | ||
93 | *sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, | ||
94 | int (*openfunc)(struct inode *, struct file *), | ||
95 | int (*releasefunc)(struct inode *, struct file *), | ||
96 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *)) | ||
97 | { | ||
98 | struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); | ||
99 | |||
100 | if (e) { | ||
101 | struct file_operations *f; | ||
102 | |||
103 | f = kzalloc(sizeof(*f), GFP_KERNEL); | ||
104 | if (f) { | ||
105 | f->open = openfunc; | ||
106 | f->read = seq_read; | ||
107 | f->llseek = seq_lseek; | ||
108 | f->release = releasefunc; | ||
109 | f->write = write; | ||
110 | e->proc_fops = f; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | return e; | ||
115 | } | ||
116 | |||
117 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ | 92 | /* /proc/sgi_sn/sn_topology uses seq_file, see sn_hwperf.c */ |
118 | extern int sn_topology_open(struct inode *, struct file *); | 93 | extern int sn_topology_open(struct inode *, struct file *); |
119 | extern int sn_topology_release(struct inode *, struct file *); | 94 | extern int sn_topology_release(struct inode *, struct file *); |
120 | 95 | ||
96 | static const struct file_operations proc_partition_id_fops = { | ||
97 | .open = partition_id_open, | ||
98 | .read = seq_read, | ||
99 | .llseek = seq_lseek, | ||
100 | .release = single_release, | ||
101 | }; | ||
102 | |||
103 | static const struct file_operations proc_system_sn_fops = { | ||
104 | .open = system_serial_number_open, | ||
105 | .read = seq_read, | ||
106 | .llseek = seq_lseek, | ||
107 | .release = single_release, | ||
108 | }; | ||
109 | |||
110 | static const struct file_operations proc_license_id_fops = { | ||
111 | .open = licenseID_open, | ||
112 | .read = seq_read, | ||
113 | .llseek = seq_lseek, | ||
114 | .release = single_release, | ||
115 | }; | ||
116 | |||
117 | static const struct file_operations proc_sn_force_intr_fops = { | ||
118 | .open = sn_force_interrupt_open, | ||
119 | .read = seq_read, | ||
120 | .write = sn_force_interrupt_write_proc, | ||
121 | .llseek = seq_lseek, | ||
122 | .release = single_release, | ||
123 | }; | ||
124 | |||
125 | static const struct file_operations proc_coherence_id_fops = { | ||
126 | .open = coherence_id_open, | ||
127 | .read = seq_read, | ||
128 | .llseek = seq_lseek, | ||
129 | .release = single_release, | ||
130 | }; | ||
131 | |||
132 | static const struct file_operations proc_sn_topo_fops = { | ||
133 | .open = sn_topology_open, | ||
134 | .read = seq_read, | ||
135 | .llseek = seq_lseek, | ||
136 | .release = sn_topology_release, | ||
137 | }; | ||
138 | |||
121 | void register_sn_procfs(void) | 139 | void register_sn_procfs(void) |
122 | { | 140 | { |
123 | static struct proc_dir_entry *sgi_proc_dir = NULL; | 141 | static struct proc_dir_entry *sgi_proc_dir = NULL; |
142 | struct proc_dir_entry *pde; | ||
124 | 143 | ||
125 | BUG_ON(sgi_proc_dir != NULL); | 144 | BUG_ON(sgi_proc_dir != NULL); |
126 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) | 145 | if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) |
127 | return; | 146 | return; |
128 | 147 | ||
129 | sn_procfs_create_entry("partition_id", sgi_proc_dir, | 148 | pde = create_proc_entry("partition_id", 0444, sgi_proc_dir); |
130 | partition_id_open, single_release, NULL); | 149 | if (pde) |
131 | 150 | pde->proc_fops = &proc_partition_id_fops; | |
132 | sn_procfs_create_entry("system_serial_number", sgi_proc_dir, | 151 | pde = create_proc_entry("system_serial_number", 0444, sgi_proc_dir); |
133 | system_serial_number_open, single_release, NULL); | 152 | if (pde) |
134 | 153 | pde->proc_fops = &proc_system_sn_fops; | |
135 | sn_procfs_create_entry("licenseID", sgi_proc_dir, | 154 | pde = create_proc_entry("licenseID", 0444, sgi_proc_dir); |
136 | licenseID_open, single_release, NULL); | 155 | if (pde) |
137 | 156 | pde->proc_fops = &proc_license_id_fops; | |
138 | sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, | 157 | pde = create_proc_entry("sn_force_interrupt", 0644, sgi_proc_dir); |
139 | sn_force_interrupt_open, single_release, | 158 | if (pde) |
140 | sn_force_interrupt_write_proc); | 159 | pde->proc_fops = &proc_sn_force_intr_fops; |
141 | 160 | pde = create_proc_entry("coherence_id", 0444, sgi_proc_dir); | |
142 | sn_procfs_create_entry("coherence_id", sgi_proc_dir, | 161 | if (pde) |
143 | coherence_id_open, single_release, NULL); | 162 | pde->proc_fops = &proc_coherence_id_fops; |
144 | 163 | pde = create_proc_entry("sn_topology", 0444, sgi_proc_dir); | |
145 | sn_procfs_create_entry("sn_topology", sgi_proc_dir, | 164 | if (pde) |
146 | sn_topology_open, sn_topology_release, NULL); | 165 | pde->proc_fops = &proc_sn_topo_fops; |
147 | } | 166 | } |
148 | 167 | ||
149 | #endif /* CONFIG_PROC_FS */ | 168 | #endif /* CONFIG_PROC_FS */ |