diff options
| -rw-r--r-- | arch/s390/kernel/processor.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index 647128d5b983..90a418d5c280 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c | |||
| @@ -84,7 +84,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 84 | seq_puts(m, "\n"); | 84 | seq_puts(m, "\n"); |
| 85 | show_cacheinfo(m); | 85 | show_cacheinfo(m); |
| 86 | } | 86 | } |
| 87 | get_online_cpus(); | ||
| 88 | if (cpu_online(n)) { | 87 | if (cpu_online(n)) { |
| 89 | struct cpuid *id = &per_cpu(cpu_id, n); | 88 | struct cpuid *id = &per_cpu(cpu_id, n); |
| 90 | seq_printf(m, "processor %li: " | 89 | seq_printf(m, "processor %li: " |
| @@ -93,23 +92,31 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 93 | "machine = %04X\n", | 92 | "machine = %04X\n", |
| 94 | n, id->version, id->ident, id->machine); | 93 | n, id->version, id->ident, id->machine); |
| 95 | } | 94 | } |
| 96 | put_online_cpus(); | ||
| 97 | return 0; | 95 | return 0; |
| 98 | } | 96 | } |
| 99 | 97 | ||
| 98 | static inline void *c_update(loff_t *pos) | ||
| 99 | { | ||
| 100 | if (*pos) | ||
| 101 | *pos = cpumask_next(*pos - 1, cpu_online_mask); | ||
| 102 | return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL; | ||
| 103 | } | ||
| 104 | |||
| 100 | static void *c_start(struct seq_file *m, loff_t *pos) | 105 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 101 | { | 106 | { |
| 102 | return *pos < nr_cpu_ids ? (void *)((unsigned long) *pos + 1) : NULL; | 107 | get_online_cpus(); |
| 108 | return c_update(pos); | ||
| 103 | } | 109 | } |
| 104 | 110 | ||
| 105 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 111 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
| 106 | { | 112 | { |
| 107 | ++*pos; | 113 | ++*pos; |
| 108 | return c_start(m, pos); | 114 | return c_update(pos); |
| 109 | } | 115 | } |
| 110 | 116 | ||
| 111 | static void c_stop(struct seq_file *m, void *v) | 117 | static void c_stop(struct seq_file *m, void *v) |
| 112 | { | 118 | { |
| 119 | put_online_cpus(); | ||
| 113 | } | 120 | } |
| 114 | 121 | ||
| 115 | const struct seq_operations cpuinfo_op = { | 122 | const struct seq_operations cpuinfo_op = { |
