Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390: replace deprecated CPU-hotplug functions

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-5-bigeasy@linutronix.de
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Sebastian Andrzej Siewior and committed by
Heiko Carstens
a73de293 de5012b4

+21 -21
+5 -5
arch/s390/hypfs/hypfs_diag0c.c
··· 33 33 unsigned int cpu_count, cpu, i; 34 34 void **cpu_vec; 35 35 36 - get_online_cpus(); 36 + cpus_read_lock(); 37 37 cpu_count = num_online_cpus(); 38 38 cpu_vec = kmalloc_array(num_possible_cpus(), sizeof(*cpu_vec), 39 39 GFP_KERNEL); 40 40 if (!cpu_vec) 41 - goto fail_put_online_cpus; 41 + goto fail_unlock_cpus; 42 42 /* Note: Diag 0c needs 8 byte alignment and real storage */ 43 43 diag0c_data = kzalloc(struct_size(diag0c_data, entry, cpu_count), 44 44 GFP_KERNEL | GFP_DMA); ··· 54 54 on_each_cpu(diag0c_fn, cpu_vec, 1); 55 55 *count = cpu_count; 56 56 kfree(cpu_vec); 57 - put_online_cpus(); 57 + cpus_read_unlock(); 58 58 return diag0c_data; 59 59 60 60 fail_kfree_cpu_vec: 61 61 kfree(cpu_vec); 62 - fail_put_online_cpus: 63 - put_online_cpus(); 62 + fail_unlock_cpus: 63 + cpus_read_unlock(); 64 64 return ERR_PTR(-ENOMEM); 65 65 } 66 66
+2 -2
arch/s390/kernel/diag.c
··· 68 68 unsigned long n = (unsigned long) v - 1; 69 69 int cpu, prec, tmp; 70 70 71 - get_online_cpus(); 71 + cpus_read_lock(); 72 72 if (n == 0) { 73 73 seq_puts(m, " "); 74 74 ··· 87 87 } 88 88 seq_printf(m, " %s\n", diag_map[n-1].name); 89 89 } 90 - put_online_cpus(); 90 + cpus_read_unlock(); 91 91 return 0; 92 92 } 93 93
+2 -2
arch/s390/kernel/irq.c
··· 228 228 int index = *(loff_t *) v; 229 229 int cpu, irq; 230 230 231 - get_online_cpus(); 231 + cpus_read_lock(); 232 232 if (index == 0) { 233 233 seq_puts(p, " "); 234 234 for_each_online_cpu(cpu) ··· 258 258 seq_putc(p, '\n'); 259 259 } 260 260 out: 261 - put_online_cpus(); 261 + cpus_read_unlock(); 262 262 return 0; 263 263 } 264 264
+2 -2
arch/s390/kernel/perf_cpum_cf.c
··· 1138 1138 { 1139 1139 int ret; 1140 1140 1141 - get_online_cpus(); 1141 + cpus_read_lock(); 1142 1142 mutex_lock(&cfset_ctrset_mutex); 1143 1143 switch (cmd) { 1144 1144 case S390_HWCTR_START: ··· 1155 1155 break; 1156 1156 } 1157 1157 mutex_unlock(&cfset_ctrset_mutex); 1158 - put_online_cpus(); 1158 + cpus_read_unlock(); 1159 1159 return ret; 1160 1160 } 1161 1161
+2 -2
arch/s390/kernel/processor.c
··· 365 365 366 366 static void *c_start(struct seq_file *m, loff_t *pos) 367 367 { 368 - get_online_cpus(); 368 + cpus_read_lock(); 369 369 return c_update(pos); 370 370 } 371 371 ··· 377 377 378 378 static void c_stop(struct seq_file *m, void *v) 379 379 { 380 - put_online_cpus(); 380 + cpus_read_unlock(); 381 381 } 382 382 383 383 const struct seq_operations cpuinfo_op = {
+4 -4
arch/s390/kernel/smp.c
··· 793 793 u16 core_id; 794 794 int nr, i; 795 795 796 - get_online_cpus(); 796 + cpus_read_lock(); 797 797 mutex_lock(&smp_cpu_state_mutex); 798 798 nr = 0; 799 799 cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); ··· 816 816 nr += smp_add_core(&info->core[i], &avail, configured, early); 817 817 } 818 818 mutex_unlock(&smp_cpu_state_mutex); 819 - put_online_cpus(); 819 + cpus_read_unlock(); 820 820 return nr; 821 821 } 822 822 ··· 1055 1055 return -EINVAL; 1056 1056 if (val != 0 && val != 1) 1057 1057 return -EINVAL; 1058 - get_online_cpus(); 1058 + cpus_read_lock(); 1059 1059 mutex_lock(&smp_cpu_state_mutex); 1060 1060 rc = -EBUSY; 1061 1061 /* disallow configuration changes of online cpus and cpu 0 */ ··· 1104 1104 } 1105 1105 out: 1106 1106 mutex_unlock(&smp_cpu_state_mutex); 1107 - put_online_cpus(); 1107 + cpus_read_unlock(); 1108 1108 return rc ? rc : count; 1109 1109 } 1110 1110 static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
+2 -2
arch/s390/kernel/topology.c
··· 406 406 if (val != 0 && val != 1) 407 407 return -EINVAL; 408 408 rc = 0; 409 - get_online_cpus(); 409 + cpus_read_lock(); 410 410 mutex_lock(&smp_cpu_state_mutex); 411 411 if (cpu_management == val) 412 412 goto out; ··· 417 417 topology_expect_change(); 418 418 out: 419 419 mutex_unlock(&smp_cpu_state_mutex); 420 - put_online_cpus(); 420 + cpus_read_unlock(); 421 421 return rc ? rc : count; 422 422 } 423 423 static DEVICE_ATTR_RW(dispatching);
+2 -2
arch/s390/mm/maccess.c
··· 228 228 void *bounce = (void *) addr; 229 229 unsigned long size; 230 230 231 - get_online_cpus(); 231 + cpus_read_lock(); 232 232 preempt_disable(); 233 233 if (is_swapped(addr)) { 234 234 size = PAGE_SIZE - (addr & ~PAGE_MASK); ··· 237 237 memcpy_absolute(bounce, (void *) addr, size); 238 238 } 239 239 preempt_enable(); 240 - put_online_cpus(); 240 + cpus_read_unlock(); 241 241 return bounce; 242 242 } 243 243