lkml.org 
[lkml]   [2008]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 6/8] x86: use-cpumask_var_t-in-acpi_boot_c
    Impact: reduce stack size, use new API.

    Replace cpumask_t with cpumask_var_t.

    Signed-off-by: Mike Travis <travis@sgi.com>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Dave Jones <davej@redhat.com>
    Cc: Len Brown <lenb@kernel.org>
    ---
    arch/x86/kernel/acpi/boot.c | 31 ++++++++++++++++++++++++-------
    1 file changed, 24 insertions(+), 7 deletions(-)

    --- linux-2.6-for-ingo.orig/arch/x86/kernel/acpi/boot.c
    +++ linux-2.6-for-ingo/arch/x86/kernel/acpi/boot.c
    @@ -538,9 +538,10 @@ static int __cpuinit _acpi_map_lsapic(ac
    struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
    union acpi_object *obj;
    struct acpi_madt_local_apic *lapic;
    - cpumask_t tmp_map, new_map;
    + cpumask_var_t tmp_map, new_map;
    u8 physid;
    int cpu;
    + int retval = -ENOMEM;

    if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
    return -EINVAL;
    @@ -569,23 +570,39 @@ static int __cpuinit _acpi_map_lsapic(ac
    buffer.length = ACPI_ALLOCATE_BUFFER;
    buffer.pointer = NULL;

    - tmp_map = cpu_present_map;
    + if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
    + goto free_buffer_pointer;
    +
    + if (!alloc_cpumask_var(&new_map, GFP_KERNEL))
    + goto free_tmp_map;
    +
    + cpumask_copy(tmp_map, cpu_present_mask);
    acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);

    /*
    * If mp_register_lapic successfully generates a new logical cpu
    * number, then the following will get us exactly what was mapped
    */
    - cpus_andnot(new_map, cpu_present_map, tmp_map);
    - if (cpus_empty(new_map)) {
    + cpumask_andnot(new_map, cpu_present_mask, tmp_map);
    + if (cpumask_empty(new_map)) {
    printk ("Unable to map lapic to logical cpu number\n");
    - return -EINVAL;
    + retval = -EINVAL;
    + goto free_new_map;
    }

    - cpu = first_cpu(new_map);
    + cpu = cpumask_first(new_map);

    *pcpu = cpu;
    - return 0;
    + retval = 0;
    +
    +free_new_map:
    + free_cpumask_var(new_map);
    +free_tmp_map:
    + free_cpumask_var(tmp_map);
    +free_buffer_pointer:
    + kfree(buffer.pointer);
    +
    + return retval;
    }

    /* wrapper to silence section mismatch warning */
    --


    \
     
     \ /
      Last update: 2008-12-19 01:03    [W:0.040 / U:150.104 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site