diff options
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/include/asm/core_t2.h | 34 | ||||
-rw-r--r-- | arch/alpha/include/asm/elf.h | 1 | ||||
-rw-r--r-- | arch/alpha/include/asm/spinlock.h | 38 | ||||
-rw-r--r-- | arch/alpha/include/asm/spinlock_types.h | 8 | ||||
-rw-r--r-- | arch/alpha/kernel/core_t2.c | 2 | ||||
-rw-r--r-- | arch/alpha/kernel/irq.c | 4 | ||||
-rw-r--r-- | arch/alpha/kernel/srm_env.c | 65 |
7 files changed, 76 insertions, 76 deletions
diff --git a/arch/alpha/include/asm/core_t2.h b/arch/alpha/include/asm/core_t2.h index 46bfff58f670..471c07292e0b 100644 --- a/arch/alpha/include/asm/core_t2.h +++ b/arch/alpha/include/asm/core_t2.h | |||
@@ -435,7 +435,7 @@ extern inline void t2_outl(u32 b, unsigned long addr) | |||
435 | set_hae(msb); \ | 435 | set_hae(msb); \ |
436 | } | 436 | } |
437 | 437 | ||
438 | extern spinlock_t t2_hae_lock; | 438 | extern raw_spinlock_t t2_hae_lock; |
439 | 439 | ||
440 | /* | 440 | /* |
441 | * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since | 441 | * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since |
@@ -448,12 +448,12 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) | |||
448 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 448 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
449 | unsigned long result, msb; | 449 | unsigned long result, msb; |
450 | unsigned long flags; | 450 | unsigned long flags; |
451 | spin_lock_irqsave(&t2_hae_lock, flags); | 451 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
452 | 452 | ||
453 | t2_set_hae; | 453 | t2_set_hae; |
454 | 454 | ||
455 | result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00); | 455 | result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00); |
456 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 456 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
457 | return __kernel_extbl(result, addr & 3); | 457 | return __kernel_extbl(result, addr & 3); |
458 | } | 458 | } |
459 | 459 | ||
@@ -462,12 +462,12 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) | |||
462 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 462 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
463 | unsigned long result, msb; | 463 | unsigned long result, msb; |
464 | unsigned long flags; | 464 | unsigned long flags; |
465 | spin_lock_irqsave(&t2_hae_lock, flags); | 465 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
466 | 466 | ||
467 | t2_set_hae; | 467 | t2_set_hae; |
468 | 468 | ||
469 | result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08); | 469 | result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08); |
470 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 470 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
471 | return __kernel_extwl(result, addr & 3); | 471 | return __kernel_extwl(result, addr & 3); |
472 | } | 472 | } |
473 | 473 | ||
@@ -480,12 +480,12 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) | |||
480 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 480 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
481 | unsigned long result, msb; | 481 | unsigned long result, msb; |
482 | unsigned long flags; | 482 | unsigned long flags; |
483 | spin_lock_irqsave(&t2_hae_lock, flags); | 483 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
484 | 484 | ||
485 | t2_set_hae; | 485 | t2_set_hae; |
486 | 486 | ||
487 | result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18); | 487 | result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18); |
488 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 488 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
489 | return result & 0xffffffffUL; | 489 | return result & 0xffffffffUL; |
490 | } | 490 | } |
491 | 491 | ||
@@ -494,14 +494,14 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) | |||
494 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 494 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
495 | unsigned long r0, r1, work, msb; | 495 | unsigned long r0, r1, work, msb; |
496 | unsigned long flags; | 496 | unsigned long flags; |
497 | spin_lock_irqsave(&t2_hae_lock, flags); | 497 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
498 | 498 | ||
499 | t2_set_hae; | 499 | t2_set_hae; |
500 | 500 | ||
501 | work = (addr << 5) + T2_SPARSE_MEM + 0x18; | 501 | work = (addr << 5) + T2_SPARSE_MEM + 0x18; |
502 | r0 = *(vuip)(work); | 502 | r0 = *(vuip)(work); |
503 | r1 = *(vuip)(work + (4 << 5)); | 503 | r1 = *(vuip)(work + (4 << 5)); |
504 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 504 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
505 | return r1 << 32 | r0; | 505 | return r1 << 32 | r0; |
506 | } | 506 | } |
507 | 507 | ||
@@ -510,13 +510,13 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) | |||
510 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 510 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
511 | unsigned long msb, w; | 511 | unsigned long msb, w; |
512 | unsigned long flags; | 512 | unsigned long flags; |
513 | spin_lock_irqsave(&t2_hae_lock, flags); | 513 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
514 | 514 | ||
515 | t2_set_hae; | 515 | t2_set_hae; |
516 | 516 | ||
517 | w = __kernel_insbl(b, addr & 3); | 517 | w = __kernel_insbl(b, addr & 3); |
518 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w; | 518 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w; |
519 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 519 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
520 | } | 520 | } |
521 | 521 | ||
522 | __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) | 522 | __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) |
@@ -524,13 +524,13 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) | |||
524 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 524 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
525 | unsigned long msb, w; | 525 | unsigned long msb, w; |
526 | unsigned long flags; | 526 | unsigned long flags; |
527 | spin_lock_irqsave(&t2_hae_lock, flags); | 527 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
528 | 528 | ||
529 | t2_set_hae; | 529 | t2_set_hae; |
530 | 530 | ||
531 | w = __kernel_inswl(b, addr & 3); | 531 | w = __kernel_inswl(b, addr & 3); |
532 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w; | 532 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w; |
533 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 533 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
534 | } | 534 | } |
535 | 535 | ||
536 | /* | 536 | /* |
@@ -542,12 +542,12 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) | |||
542 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 542 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
543 | unsigned long msb; | 543 | unsigned long msb; |
544 | unsigned long flags; | 544 | unsigned long flags; |
545 | spin_lock_irqsave(&t2_hae_lock, flags); | 545 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
546 | 546 | ||
547 | t2_set_hae; | 547 | t2_set_hae; |
548 | 548 | ||
549 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b; | 549 | *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b; |
550 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 550 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
551 | } | 551 | } |
552 | 552 | ||
553 | __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) | 553 | __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) |
@@ -555,14 +555,14 @@ __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) | |||
555 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; | 555 | unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM; |
556 | unsigned long msb, work; | 556 | unsigned long msb, work; |
557 | unsigned long flags; | 557 | unsigned long flags; |
558 | spin_lock_irqsave(&t2_hae_lock, flags); | 558 | raw_spin_lock_irqsave(&t2_hae_lock, flags); |
559 | 559 | ||
560 | t2_set_hae; | 560 | t2_set_hae; |
561 | 561 | ||
562 | work = (addr << 5) + T2_SPARSE_MEM + 0x18; | 562 | work = (addr << 5) + T2_SPARSE_MEM + 0x18; |
563 | *(vuip)work = b; | 563 | *(vuip)work = b; |
564 | *(vuip)(work + (4 << 5)) = b >> 32; | 564 | *(vuip)(work + (4 << 5)) = b >> 32; |
565 | spin_unlock_irqrestore(&t2_hae_lock, flags); | 565 | raw_spin_unlock_irqrestore(&t2_hae_lock, flags); |
566 | } | 566 | } |
567 | 567 | ||
568 | __EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr) | 568 | __EXTERN_INLINE void __iomem *t2_ioportmap(unsigned long addr) |
diff --git a/arch/alpha/include/asm/elf.h b/arch/alpha/include/asm/elf.h index 5c75c1b2352a..9baae8afe8a3 100644 --- a/arch/alpha/include/asm/elf.h +++ b/arch/alpha/include/asm/elf.h | |||
@@ -81,7 +81,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | |||
81 | #define ELF_DATA ELFDATA2LSB | 81 | #define ELF_DATA ELFDATA2LSB |
82 | #define ELF_ARCH EM_ALPHA | 82 | #define ELF_ARCH EM_ALPHA |
83 | 83 | ||
84 | #define USE_ELF_CORE_DUMP | ||
85 | #define ELF_EXEC_PAGESIZE 8192 | 84 | #define ELF_EXEC_PAGESIZE 8192 |
86 | 85 | ||
87 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical | 86 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical |
diff --git a/arch/alpha/include/asm/spinlock.h b/arch/alpha/include/asm/spinlock.h index e38fb95cb335..d0faca1e992d 100644 --- a/arch/alpha/include/asm/spinlock.h +++ b/arch/alpha/include/asm/spinlock.h | |||
@@ -12,18 +12,18 @@ | |||
12 | * We make no fairness assumptions. They have a cost. | 12 | * We make no fairness assumptions. They have a cost. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) | 15 | #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) |
16 | #define __raw_spin_is_locked(x) ((x)->lock != 0) | 16 | #define arch_spin_is_locked(x) ((x)->lock != 0) |
17 | #define __raw_spin_unlock_wait(x) \ | 17 | #define arch_spin_unlock_wait(x) \ |
18 | do { cpu_relax(); } while ((x)->lock) | 18 | do { cpu_relax(); } while ((x)->lock) |
19 | 19 | ||
20 | static inline void __raw_spin_unlock(raw_spinlock_t * lock) | 20 | static inline void arch_spin_unlock(arch_spinlock_t * lock) |
21 | { | 21 | { |
22 | mb(); | 22 | mb(); |
23 | lock->lock = 0; | 23 | lock->lock = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline void __raw_spin_lock(raw_spinlock_t * lock) | 26 | static inline void arch_spin_lock(arch_spinlock_t * lock) |
27 | { | 27 | { |
28 | long tmp; | 28 | long tmp; |
29 | 29 | ||
@@ -43,24 +43,24 @@ static inline void __raw_spin_lock(raw_spinlock_t * lock) | |||
43 | : "m"(lock->lock) : "memory"); | 43 | : "m"(lock->lock) : "memory"); |
44 | } | 44 | } |
45 | 45 | ||
46 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 46 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
47 | { | 47 | { |
48 | return !test_and_set_bit(0, &lock->lock); | 48 | return !test_and_set_bit(0, &lock->lock); |
49 | } | 49 | } |
50 | 50 | ||
51 | /***********************************************************/ | 51 | /***********************************************************/ |
52 | 52 | ||
53 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) | 53 | static inline int arch_read_can_lock(arch_rwlock_t *lock) |
54 | { | 54 | { |
55 | return (lock->lock & 1) == 0; | 55 | return (lock->lock & 1) == 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) | 58 | static inline int arch_write_can_lock(arch_rwlock_t *lock) |
59 | { | 59 | { |
60 | return lock->lock == 0; | 60 | return lock->lock == 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline void __raw_read_lock(raw_rwlock_t *lock) | 63 | static inline void arch_read_lock(arch_rwlock_t *lock) |
64 | { | 64 | { |
65 | long regx; | 65 | long regx; |
66 | 66 | ||
@@ -80,7 +80,7 @@ static inline void __raw_read_lock(raw_rwlock_t *lock) | |||
80 | : "m" (*lock) : "memory"); | 80 | : "m" (*lock) : "memory"); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline void __raw_write_lock(raw_rwlock_t *lock) | 83 | static inline void arch_write_lock(arch_rwlock_t *lock) |
84 | { | 84 | { |
85 | long regx; | 85 | long regx; |
86 | 86 | ||
@@ -100,7 +100,7 @@ static inline void __raw_write_lock(raw_rwlock_t *lock) | |||
100 | : "m" (*lock) : "memory"); | 100 | : "m" (*lock) : "memory"); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline int __raw_read_trylock(raw_rwlock_t * lock) | 103 | static inline int arch_read_trylock(arch_rwlock_t * lock) |
104 | { | 104 | { |
105 | long regx; | 105 | long regx; |
106 | int success; | 106 | int success; |
@@ -122,7 +122,7 @@ static inline int __raw_read_trylock(raw_rwlock_t * lock) | |||
122 | return success; | 122 | return success; |
123 | } | 123 | } |
124 | 124 | ||
125 | static inline int __raw_write_trylock(raw_rwlock_t * lock) | 125 | static inline int arch_write_trylock(arch_rwlock_t * lock) |
126 | { | 126 | { |
127 | long regx; | 127 | long regx; |
128 | int success; | 128 | int success; |
@@ -144,7 +144,7 @@ static inline int __raw_write_trylock(raw_rwlock_t * lock) | |||
144 | return success; | 144 | return success; |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline void __raw_read_unlock(raw_rwlock_t * lock) | 147 | static inline void arch_read_unlock(arch_rwlock_t * lock) |
148 | { | 148 | { |
149 | long regx; | 149 | long regx; |
150 | __asm__ __volatile__( | 150 | __asm__ __volatile__( |
@@ -160,17 +160,17 @@ static inline void __raw_read_unlock(raw_rwlock_t * lock) | |||
160 | : "m" (*lock) : "memory"); | 160 | : "m" (*lock) : "memory"); |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void __raw_write_unlock(raw_rwlock_t * lock) | 163 | static inline void arch_write_unlock(arch_rwlock_t * lock) |
164 | { | 164 | { |
165 | mb(); | 165 | mb(); |
166 | lock->lock = 0; | 166 | lock->lock = 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | #define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock) | 169 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) |
170 | #define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock) | 170 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) |
171 | 171 | ||
172 | #define _raw_spin_relax(lock) cpu_relax() | 172 | #define arch_spin_relax(lock) cpu_relax() |
173 | #define _raw_read_relax(lock) cpu_relax() | 173 | #define arch_read_relax(lock) cpu_relax() |
174 | #define _raw_write_relax(lock) cpu_relax() | 174 | #define arch_write_relax(lock) cpu_relax() |
175 | 175 | ||
176 | #endif /* _ALPHA_SPINLOCK_H */ | 176 | #endif /* _ALPHA_SPINLOCK_H */ |
diff --git a/arch/alpha/include/asm/spinlock_types.h b/arch/alpha/include/asm/spinlock_types.h index 8141eb5ebf0d..54c2afce0a1d 100644 --- a/arch/alpha/include/asm/spinlock_types.h +++ b/arch/alpha/include/asm/spinlock_types.h | |||
@@ -7,14 +7,14 @@ | |||
7 | 7 | ||
8 | typedef struct { | 8 | typedef struct { |
9 | volatile unsigned int lock; | 9 | volatile unsigned int lock; |
10 | } raw_spinlock_t; | 10 | } arch_spinlock_t; |
11 | 11 | ||
12 | #define __RAW_SPIN_LOCK_UNLOCKED { 0 } | 12 | #define __ARCH_SPIN_LOCK_UNLOCKED { 0 } |
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/alpha/kernel/core_t2.c b/arch/alpha/kernel/core_t2.c index d9980d47ab81..e6d90568b65d 100644 --- a/arch/alpha/kernel/core_t2.c +++ b/arch/alpha/kernel/core_t2.c | |||
@@ -74,7 +74,7 @@ | |||
74 | # define DBG(args) | 74 | # define DBG(args) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | DEFINE_SPINLOCK(t2_hae_lock); | 77 | DEFINE_RAW_SPINLOCK(t2_hae_lock); |
78 | 78 | ||
79 | static volatile unsigned int t2_mcheck_any_expected; | 79 | static volatile unsigned int t2_mcheck_any_expected; |
80 | static volatile unsigned int t2_mcheck_last_taken; | 80 | static volatile unsigned int t2_mcheck_last_taken; |
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index c0de072b8305..5f2cf23c4648 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c | |||
@@ -81,7 +81,7 @@ show_interrupts(struct seq_file *p, void *v) | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | if (irq < ACTUAL_NR_IRQS) { | 83 | if (irq < ACTUAL_NR_IRQS) { |
84 | spin_lock_irqsave(&irq_desc[irq].lock, flags); | 84 | raw_spin_lock_irqsave(&irq_desc[irq].lock, flags); |
85 | action = irq_desc[irq].action; | 85 | action = irq_desc[irq].action; |
86 | if (!action) | 86 | if (!action) |
87 | goto unlock; | 87 | goto unlock; |
@@ -105,7 +105,7 @@ show_interrupts(struct seq_file *p, void *v) | |||
105 | 105 | ||
106 | seq_putc(p, '\n'); | 106 | seq_putc(p, '\n'); |
107 | unlock: | 107 | unlock: |
108 | spin_unlock_irqrestore(&irq_desc[irq].lock, flags); | 108 | raw_spin_unlock_irqrestore(&irq_desc[irq].lock, flags); |
109 | } else if (irq == ACTUAL_NR_IRQS) { | 109 | } else if (irq == ACTUAL_NR_IRQS) { |
110 | #ifdef CONFIG_SMP | 110 | #ifdef CONFIG_SMP |
111 | seq_puts(p, "IPI: "); | 111 | seq_puts(p, "IPI: "); |
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index d12af472e1c0..dbbf04f9230e 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | ||
36 | #include <asm/console.h> | 37 | #include <asm/console.h> |
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
38 | #include <asm/machvec.h> | 39 | #include <asm/machvec.h> |
@@ -79,42 +80,41 @@ static srm_env_t srm_named_entries[] = { | |||
79 | static srm_env_t srm_numbered_entries[256]; | 80 | static srm_env_t srm_numbered_entries[256]; |
80 | 81 | ||
81 | 82 | ||
82 | static int | 83 | static int srm_env_proc_show(struct seq_file *m, void *v) |
83 | srm_env_read(char *page, char **start, off_t off, int count, int *eof, | ||
84 | void *data) | ||
85 | { | 84 | { |
86 | int nbytes; | ||
87 | unsigned long ret; | 85 | unsigned long ret; |
88 | srm_env_t *entry; | 86 | srm_env_t *entry; |
87 | char *page; | ||
89 | 88 | ||
90 | if (off != 0) { | 89 | entry = (srm_env_t *)m->private; |
91 | *eof = 1; | 90 | page = (char *)__get_free_page(GFP_USER); |
92 | return 0; | 91 | if (!page) |
93 | } | 92 | return -ENOMEM; |
94 | 93 | ||
95 | entry = (srm_env_t *) data; | 94 | ret = callback_getenv(entry->id, page, PAGE_SIZE); |
96 | ret = callback_getenv(entry->id, page, count); | ||
97 | 95 | ||
98 | if ((ret >> 61) == 0) { | 96 | if ((ret >> 61) == 0) { |
99 | nbytes = (int) ret; | 97 | seq_write(m, page, ret); |
100 | *eof = 1; | 98 | ret = 0; |
101 | } else | 99 | } else |
102 | nbytes = -EFAULT; | 100 | ret = -EFAULT; |
101 | free_page((unsigned long)page); | ||
102 | return ret; | ||
103 | } | ||
103 | 104 | ||
104 | return nbytes; | 105 | static int srm_env_proc_open(struct inode *inode, struct file *file) |
106 | { | ||
107 | return single_open(file, srm_env_proc_show, PDE(inode)->data); | ||
105 | } | 108 | } |
106 | 109 | ||
107 | static int | 110 | static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer, |
108 | srm_env_write(struct file *file, const char __user *buffer, unsigned long count, | 111 | size_t count, loff_t *pos) |
109 | void *data) | ||
110 | { | 112 | { |
111 | int res; | 113 | int res; |
112 | srm_env_t *entry; | 114 | srm_env_t *entry = PDE(file->f_path.dentry->d_inode)->data; |
113 | char *buf = (char *) __get_free_page(GFP_USER); | 115 | char *buf = (char *) __get_free_page(GFP_USER); |
114 | unsigned long ret1, ret2; | 116 | unsigned long ret1, ret2; |
115 | 117 | ||
116 | entry = (srm_env_t *) data; | ||
117 | |||
118 | if (!buf) | 118 | if (!buf) |
119 | return -ENOMEM; | 119 | return -ENOMEM; |
120 | 120 | ||
@@ -140,6 +140,15 @@ srm_env_write(struct file *file, const char __user *buffer, unsigned long count, | |||
140 | return res; | 140 | return res; |
141 | } | 141 | } |
142 | 142 | ||
143 | static const struct file_operations srm_env_proc_fops = { | ||
144 | .owner = THIS_MODULE, | ||
145 | .open = srm_env_proc_open, | ||
146 | .read = seq_read, | ||
147 | .llseek = seq_lseek, | ||
148 | .release = single_release, | ||
149 | .write = srm_env_proc_write, | ||
150 | }; | ||
151 | |||
143 | static void | 152 | static void |
144 | srm_env_cleanup(void) | 153 | srm_env_cleanup(void) |
145 | { | 154 | { |
@@ -245,15 +254,10 @@ srm_env_init(void) | |||
245 | */ | 254 | */ |
246 | entry = srm_named_entries; | 255 | entry = srm_named_entries; |
247 | while (entry->name && entry->id) { | 256 | while (entry->name && entry->id) { |
248 | entry->proc_entry = create_proc_entry(entry->name, | 257 | entry->proc_entry = proc_create_data(entry->name, 0644, named_dir, |
249 | 0644, named_dir); | 258 | &srm_env_proc_fops, entry); |
250 | if (!entry->proc_entry) | 259 | if (!entry->proc_entry) |
251 | goto cleanup; | 260 | goto cleanup; |
252 | |||
253 | entry->proc_entry->data = (void *) entry; | ||
254 | entry->proc_entry->read_proc = srm_env_read; | ||
255 | entry->proc_entry->write_proc = srm_env_write; | ||
256 | |||
257 | entry++; | 261 | entry++; |
258 | } | 262 | } |
259 | 263 | ||
@@ -264,15 +268,12 @@ srm_env_init(void) | |||
264 | entry = &srm_numbered_entries[var_num]; | 268 | entry = &srm_numbered_entries[var_num]; |
265 | entry->name = number[var_num]; | 269 | entry->name = number[var_num]; |
266 | 270 | ||
267 | entry->proc_entry = create_proc_entry(entry->name, | 271 | entry->proc_entry = proc_create_data(entry->name, 0644, numbered_dir, |
268 | 0644, numbered_dir); | 272 | &srm_env_proc_fops, entry); |
269 | if (!entry->proc_entry) | 273 | if (!entry->proc_entry) |
270 | goto cleanup; | 274 | goto cleanup; |
271 | 275 | ||
272 | entry->id = var_num; | 276 | entry->id = var_num; |
273 | entry->proc_entry->data = (void *) entry; | ||
274 | entry->proc_entry->read_proc = srm_env_read; | ||
275 | entry->proc_entry->write_proc = srm_env_write; | ||
276 | } | 277 | } |
277 | 278 | ||
278 | printk(KERN_INFO "%s: version %s loaded successfully\n", NAME, | 279 | printk(KERN_INFO "%s: version %s loaded successfully\n", NAME, |