ACPI: processor: Replace deprecated CPU-hotplug functions

The functions cpu_hotplug_begin, cpu_hotplug_done, get_online_cpus() and
put_online_cpus() have been deprecated during the CPU hotplug rework. They map
directly to cpus_write_lock(), cpus_write_unlock, 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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Sebastian Andrzej Siewior 2021-08-03 16:16:12 +02:00 коммит произвёл Rafael J. Wysocki
Родитель c500bee1c5
Коммит 95ac706744
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -249,12 +249,12 @@ static void set_power_saving_task_num(unsigned int num)
static void acpi_pad_idle_cpus(unsigned int num_cpus) static void acpi_pad_idle_cpus(unsigned int num_cpus)
{ {
get_online_cpus(); cpus_read_lock();
num_cpus = min_t(unsigned int, num_cpus, num_online_cpus()); num_cpus = min_t(unsigned int, num_cpus, num_online_cpus());
set_power_saving_task_num(num_cpus); set_power_saving_task_num(num_cpus);
put_online_cpus(); cpus_read_unlock();
} }
static uint32_t acpi_pad_idle_cpus_num(void) static uint32_t acpi_pad_idle_cpus_num(void)

Просмотреть файл

@ -182,7 +182,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
return -ENODEV; return -ENODEV;
cpu_maps_update_begin(); cpu_maps_update_begin();
cpu_hotplug_begin(); cpus_write_lock();
ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id); ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
if (ret) if (ret)
@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
pr->flags.need_hotplug_init = 1; pr->flags.need_hotplug_init = 1;
out: out:
cpu_hotplug_done(); cpus_write_unlock();
cpu_maps_update_done(); cpu_maps_update_done();
return ret; return ret;
} }
@ -454,13 +454,13 @@ static void acpi_processor_remove(struct acpi_device *device)
per_cpu(processors, pr->id) = NULL; per_cpu(processors, pr->id) = NULL;
cpu_maps_update_begin(); cpu_maps_update_begin();
cpu_hotplug_begin(); cpus_write_lock();
/* Remove the CPU. */ /* Remove the CPU. */
arch_unregister_cpu(pr->id); arch_unregister_cpu(pr->id);
acpi_unmap_cpu(pr->id); acpi_unmap_cpu(pr->id);
cpu_hotplug_done(); cpus_write_unlock();
cpu_maps_update_done(); cpu_maps_update_done();
try_offline_node(cpu_to_node(pr->id)); try_offline_node(cpu_to_node(pr->id));

Просмотреть файл

@ -1301,7 +1301,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
/* Protect against cpu-hotplug */ /* Protect against cpu-hotplug */
get_online_cpus(); cpus_read_lock();
cpuidle_pause_and_lock(); cpuidle_pause_and_lock();
/* Disable all cpuidle devices */ /* Disable all cpuidle devices */
@ -1330,7 +1330,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
} }
} }
cpuidle_resume_and_unlock(); cpuidle_resume_and_unlock();
put_online_cpus(); cpus_read_unlock();
} }
return 0; return 0;