mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 16:01:44 -04:00
LoongArch: Add acpi_get_cpu_uid() for unified ACPI CPU UID retrieval
As a step towards unifying the interface for retrieving ACPI CPU UID across architectures, introduce a new function acpi_get_cpu_uid() for loongarch. While at it, add input validation to make the code more robust. Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20260401081640.26875-3-fengchengwen@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
7cd5f5659a
commit
d78ef9d2e1
@@ -44,6 +44,7 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
|
||||
{
|
||||
return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
|
||||
}
|
||||
int acpi_get_cpu_uid(unsigned int cpu, u32 *uid);
|
||||
|
||||
#endif /* !CONFIG_ACPI */
|
||||
|
||||
|
||||
@@ -385,3 +385,12 @@ int acpi_unmap_cpu(int cpu)
|
||||
EXPORT_SYMBOL(acpi_unmap_cpu);
|
||||
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
int acpi_get_cpu_uid(unsigned int cpu, u32 *uid)
|
||||
{
|
||||
if (cpu >= nr_cpu_ids)
|
||||
return -EINVAL;
|
||||
*uid = acpi_core_pic[cpu_logical_map(cpu)].processor_id;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(acpi_get_cpu_uid);
|
||||
|
||||
Reference in New Issue
Block a user