[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/NUMA: cleanup
- constification - prefer container_of() over casts - check original pointer against NULL instead of the container_of() result Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -205,7 +205,7 @@ void __init acpi_numa_slit_init(struct a /* Callback for Proximity Domain -> x2APIC mapping */ void __init -acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) +acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *pa) { unsigned pxm; nodeid_t node; @@ -241,7 +241,7 @@ acpi_numa_x2apic_affinity_init(struct ac /* Callback for Proximity Domain -> LAPIC mapping */ void __init -acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) +acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *pa) { unsigned pxm; nodeid_t node; @@ -276,7 +276,7 @@ acpi_numa_processor_affinity_init(struct /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ void __init -acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) +acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) { u64 start, end; unsigned pxm; --- a/xen/drivers/acpi/numa.c +++ b/xen/drivers/acpi/numa.c @@ -124,10 +124,11 @@ static int __init acpi_parse_x2apic_affinity(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_srat_x2apic_cpu_affinity *processor_affinity; + const struct acpi_srat_x2apic_cpu_affinity *processor_affinity + = container_of(header, struct acpi_srat_x2apic_cpu_affinity, + header); - processor_affinity = (struct acpi_srat_x2apic_cpu_affinity *)header; - if (!processor_affinity) + if (!header) return -EINVAL; acpi_table_print_srat_entry(header); @@ -139,13 +140,13 @@ acpi_parse_x2apic_affinity(struct acpi_s } static int __init -acpi_parse_processor_affinity(struct acpi_subtable_header * header, +acpi_parse_processor_affinity(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_srat_cpu_affinity *processor_affinity + const struct acpi_srat_cpu_affinity *processor_affinity = container_of(header, struct acpi_srat_cpu_affinity, header); - if (!processor_affinity) + if (!header) return -EINVAL; acpi_table_print_srat_entry(header); @@ -157,13 +158,13 @@ acpi_parse_processor_affinity(struct acp } static int __init -acpi_parse_memory_affinity(struct acpi_subtable_header * header, +acpi_parse_memory_affinity(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_srat_mem_affinity *memory_affinity + const struct acpi_srat_mem_affinity *memory_affinity = container_of(header, struct acpi_srat_mem_affinity, header); - if (!memory_affinity) + if (!header) return -EINVAL; acpi_table_print_srat_entry(header); --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -76,9 +76,9 @@ void acpi_table_print_srat_entry (struct /* the following four functions are architecture-dependent */ void acpi_numa_slit_init (struct acpi_table_slit *slit); -void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); -void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); -void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); +void acpi_numa_processor_affinity_init(const struct acpi_srat_cpu_affinity *); +void acpi_numa_x2apic_affinity_init(const struct acpi_srat_x2apic_cpu_affinity *); +void acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *); void acpi_numa_arch_fixup(void); #ifdef CONFIG_ACPI_HOTPLUG_CPU Attachment:
x86-SRAT-cleanup.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |