[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/NUMA: cleanup



commit db34a096b3aabfea3093867a54c442e41509c8ed
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Oct 14 12:47:08 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Oct 14 12:47:08 2015 +0200

    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>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/srat.c     |    6 +++---
 xen/drivers/acpi/numa.c |   19 ++++++++++---------
 xen/include/xen/acpi.h  |    6 +++---
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 909c6f7..d86783e 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -205,7 +205,7 @@ void __init acpi_numa_slit_init(struct acpi_table_slit 
*slit)
 
 /* 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;
@@ -239,7 +239,7 @@ acpi_numa_x2apic_affinity_init(struct 
acpi_srat_x2apic_cpu_affinity *pa)
 
 /* 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;
@@ -272,7 +272,7 @@ acpi_numa_processor_affinity_init(struct 
acpi_srat_cpu_affinity *pa)
 
 /* 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;
diff --git a/xen/drivers/acpi/numa.c b/xen/drivers/acpi/numa.c
index c1fd753..50bf9f8 100644
--- 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_subtable_header 
*header,
 }
 
 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 acpi_subtable_header 
* header,
 }
 
 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);
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index f26658f..0f1077d 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -76,9 +76,9 @@ void acpi_table_print_srat_entry (struct acpi_subtable_header 
*srat);
 
 /* 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
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.