diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-03-02 04:53:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-02 05:20:33 -0500 |
commit | c2b20cbd057b97e2f440fa3bc90b3df51de324fe (patch) | |
tree | dd57f0fbffea6e463efc712cac0a0284fafb517e /arch/x86/kernel/apic/es7000_32.c | |
parent | 9694cd6c17582cd6c29bf4a4e4aa767862ff4f4c (diff) |
x86_32: apic/es7000_32, cpu_mask_to_apicid cleanup
Remove es7000_cpu_mask_to_apicid_cluster completely, because it's
almost the same as es7000_cpu_mask_to_apicid except 2 code paths.
One of them is about to be removed soon, the another should be
BAD_APICID (it's a fail path).
The _cluster one was not invoked on apic->cpu_mask_to_apicid_and
anyway, since there was no _cluster_and variant.
Also use newer cpumask functions.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic/es7000_32.c')
-rw-r--r-- | arch/x86/kernel/apic/es7000_32.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index da37e2c59fe1..9b9e86f3cfd9 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c | |||
@@ -575,25 +575,21 @@ static int es7000_check_phys_apicid_present(int cpu_physical_apicid) | |||
575 | return 1; | 575 | return 1; |
576 | } | 576 | } |
577 | 577 | ||
578 | static unsigned int | 578 | static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) |
579 | es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | ||
580 | { | 579 | { |
581 | int cpus_found = 0; | 580 | unsigned int cpu, num_bits_set, cpus_found = 0; |
582 | int num_bits_set; | ||
583 | int apicid; | 581 | int apicid; |
584 | int cpu; | ||
585 | 582 | ||
586 | num_bits_set = cpumask_weight(cpumask); | 583 | num_bits_set = cpumask_weight(cpumask); |
587 | /* Return id to all */ | 584 | /* Return id to all */ |
588 | if (num_bits_set == nr_cpu_ids) | 585 | if (num_bits_set == nr_cpu_ids) |
589 | return 0xFF; | 586 | return es7000_cpu_to_logical_apicid(0); |
590 | /* | 587 | /* |
591 | * The cpus in the mask must all be on the apic cluster. If are not | 588 | * The cpus in the mask must all be on the apic cluster. If are not |
592 | * on the same apicid cluster return default value of target_cpus(): | 589 | * on the same apicid cluster return default value of target_cpus(): |
593 | */ | 590 | */ |
594 | cpu = cpumask_first(cpumask); | 591 | cpu = cpumask_first(cpumask); |
595 | apicid = es7000_cpu_to_logical_apicid(cpu); | 592 | apicid = es7000_cpu_to_logical_apicid(cpu); |
596 | |||
597 | while (cpus_found < num_bits_set) { | 593 | while (cpus_found < num_bits_set) { |
598 | if (cpumask_test_cpu(cpu, cpumask)) { | 594 | if (cpumask_test_cpu(cpu, cpumask)) { |
599 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | 595 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); |
@@ -601,40 +597,6 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask) | |||
601 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | 597 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { |
602 | WARN(1, "Not a valid mask!"); | 598 | WARN(1, "Not a valid mask!"); |
603 | 599 | ||
604 | return 0xFF; | ||
605 | } | ||
606 | apicid = new_apicid; | ||
607 | cpus_found++; | ||
608 | } | ||
609 | cpu++; | ||
610 | } | ||
611 | return apicid; | ||
612 | } | ||
613 | |||
614 | static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask) | ||
615 | { | ||
616 | int cpus_found = 0; | ||
617 | int num_bits_set; | ||
618 | int apicid; | ||
619 | int cpu; | ||
620 | |||
621 | num_bits_set = cpus_weight(*cpumask); | ||
622 | /* Return id to all */ | ||
623 | if (num_bits_set == nr_cpu_ids) | ||
624 | return es7000_cpu_to_logical_apicid(0); | ||
625 | /* | ||
626 | * The cpus in the mask must all be on the apic cluster. If are not | ||
627 | * on the same apicid cluster return default value of target_cpus(): | ||
628 | */ | ||
629 | cpu = first_cpu(*cpumask); | ||
630 | apicid = es7000_cpu_to_logical_apicid(cpu); | ||
631 | while (cpus_found < num_bits_set) { | ||
632 | if (cpu_isset(cpu, *cpumask)) { | ||
633 | int new_apicid = es7000_cpu_to_logical_apicid(cpu); | ||
634 | |||
635 | if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) { | ||
636 | printk("%s: Not a valid mask!\n", __func__); | ||
637 | |||
638 | return es7000_cpu_to_logical_apicid(0); | 600 | return es7000_cpu_to_logical_apicid(0); |
639 | } | 601 | } |
640 | apicid = new_apicid; | 602 | apicid = new_apicid; |
@@ -739,7 +701,7 @@ struct apic apic_es7000_cluster = { | |||
739 | .set_apic_id = NULL, | 701 | .set_apic_id = NULL, |
740 | .apic_id_mask = 0xFF << 24, | 702 | .apic_id_mask = 0xFF << 24, |
741 | 703 | ||
742 | .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid_cluster, | 704 | .cpu_mask_to_apicid = es7000_cpu_mask_to_apicid, |
743 | .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and, | 705 | .cpu_mask_to_apicid_and = es7000_cpu_mask_to_apicid_and, |
744 | 706 | ||
745 | .send_IPI_mask = es7000_send_IPI_mask, | 707 | .send_IPI_mask = es7000_send_IPI_mask, |