Re: [PATCH] cris: convert old cpumask API into new one

From: Thiago Farina
Date: Thu Apr 28 2011 - 11:10:09 EST


On Thu, Apr 28, 2011 at 12:04 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> Adapt new API.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> Cc: Mikael Starvik <starvik@xxxxxxxx>
> Cc: Jesper Nilsson <jesper.nilsson@xxxxxxxx>
> Cc: linux-cris-kernel@xxxxxxxx
>
> ---
> Âarch/cris/arch-v32/kernel/irq.c | Â Â4 ++--
> Âarch/cris/arch-v32/kernel/smp.c | Â 33 ++++++++++++++++++---------------
> Â2 files changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
> index 68a1a59..5ebe6e8 100644
> --- a/arch/cris/arch-v32/kernel/irq.c
> +++ b/arch/cris/arch-v32/kernel/irq.c
> @@ -266,11 +266,11 @@ static int irq_cpu(int irq)
>
>
> Â Â Â Â/* Let the interrupt stay if possible */
> - Â Â Â if (cpu_isset(cpu, irq_allocations[irq - FIRST_IRQ].mask))
> + Â Â Â if (cpumask_test_cpu(cpu, &irq_allocations[irq - FIRST_IRQ].mask))
> Â Â Â Â Â Â Â Âgoto out;
>
> Â Â Â Â/* IRQ must be moved to another CPU. */
> - Â Â Â cpu = first_cpu(irq_allocations[irq - FIRST_IRQ].mask);
> + Â Â Â cpu = cpumask_first(&irq_allocations[irq - FIRST_IRQ].mask);
> Â Â Â Âirq_allocations[irq - FIRST_IRQ].cpu = cpu;
> Âout:
> Â Â Â Âspin_unlock_irqrestore(&irq_lock, flags);
> diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
> index 66cc756..54467ec 100644
> --- a/arch/cris/arch-v32/kernel/smp.c
> +++ b/arch/cris/arch-v32/kernel/smp.c
> @@ -81,7 +81,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>
> Â Â Â Â/* Mark all possible CPUs as present */
> Â Â Â Âfor (i = 0; i < max_cpus; i++)
> - Â Â Â Â Â cpu_set(i, phys_cpu_present_map);
> + Â Â Â Â Â cpumask_set_cpu(i, &phys_cpu_present_map);
> Â}
>
> Âvoid __devinit smp_prepare_boot_cpu(void)
> @@ -98,7 +98,7 @@ void __devinit smp_prepare_boot_cpu(void)
> Â Â Â ÂSUPP_REG_WR(RW_MM_TLB_PGD, pgd);
>
> Â Â Â Âset_cpu_online(0, true);
> - Â Â Â cpu_set(0, phys_cpu_present_map);
> + Â Â Â cpumask_set_cpu(0, &phys_cpu_present_map);
> Â Â Â Âset_cpu_possible(0, true);
> Â}
>
> @@ -112,8 +112,9 @@ smp_boot_one_cpu(int cpuid)
> Â{
> Â Â Â Âunsigned timeout;
> Â Â Â Âstruct task_struct *idle;
> - Â Â Â cpumask_t cpu_mask = CPU_MASK_NONE;
> + Â Â Â cpumask_t cpu_mask;
>
> + Â Â Â cpumask_clear(&cpu_mask);
> Â Â Â Âidle = fork_idle(cpuid);
> Â Â Â Âif (IS_ERR(idle))
> Â Â Â Â Â Â Â Âpanic("SMP: fork failed for CPU:%d", cpuid);
> @@ -125,10 +126,10 @@ smp_boot_one_cpu(int cpuid)
> Â Â Â Âcpu_now_booting = cpuid;
>
> Â Â Â Â/* Kick it */
> - Â Â Â cpu_set(cpuid, cpu_online_map);
> - Â Â Â cpu_set(cpuid, cpu_mask);
> + Â Â Â set_cpu_online(cpuid, true);
> + Â Â Â cpumask_set_cpu(cpuid, &cpu_mask);
> Â Â Â Âsend_ipi(IPI_BOOT, 0, cpu_mask);
> - Â Â Â cpu_clear(cpuid, cpu_online_map);
> + Â Â Â set_cpu_online(cpuid, false);
>
> Â Â Â Â/* Wait for CPU to come online */
> Â Â Â Âfor (timeout = 0; timeout < 10000; timeout++) {
> @@ -176,7 +177,7 @@ void __init smp_callin(void)
> Â Â Â Ânotify_cpu_starting(cpu);
> Â Â Â Âlocal_irq_enable();
>
> - Â Â Â cpu_set(cpu, cpu_online_map);
> + Â Â Â set_cpu_online(cpu, true);
> Â Â Â Âcpu_idle();
> Â}
>
> @@ -214,8 +215,9 @@ int __cpuinit __cpu_up(unsigned int cpu)
>
> Âvoid smp_send_reschedule(int cpu)
> Â{
> - Â Â Â cpumask_t cpu_mask = CPU_MASK_NONE;
> - Â Â Â cpu_set(cpu, cpu_mask);
> + Â Â Â cpumask_t cpu_mask;
> + Â Â Â cpumask_clear(&cpu_mask);
> + Â Â Â cpumask_set_cpu(cpu, &cpu_mask);
> Â Â Â Âsend_ipi(IPI_SCHEDULE, 0, cpu_mask);
> Â}
>
> @@ -232,7 +234,7 @@ void flush_tlb_common(struct mm_struct* mm, struct vm_area_struct* vma, unsigned
>
> Â Â Â Âspin_lock_irqsave(&tlbstate_lock, flags);
> Â Â Â Âcpu_mask = (mm == FLUSH_ALL ? cpu_all_mask : *mm_cpumask(mm));
> - Â Â Â cpu_clear(smp_processor_id(), cpu_mask);
> + Â Â Â cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
> Â Â Â Âflush_mm = mm;
> Â Â Â Âflush_vma = vma;
> Â Â Â Âflush_addr = addr;
> @@ -277,10 +279,10 @@ int send_ipi(int vector, int wait, cpumask_t cpu_mask)
> Â Â Â Âint ret = 0;
>
> Â Â Â Â/* Calculate CPUs to send to. */
> - Â Â Â cpus_and(cpu_mask, cpu_mask, cpu_online_map);
> + Â Â Â cpumask_and(&cpu_mask, &cpu_mask, cpu_online_mask);
>
> Â Â Â Â/* Send the IPI. */
> - Â Â Â for_each_cpu_mask(i, cpu_mask)
> + Â Â Â for_each_cpu(i,&cpu_mask)

please, could you add a space between i,&cpu_mask?

> Â Â Â Â{
> Â Â Â Â Â Â Â Âipi.vector |= vector;
> Â Â Â Â Â Â Â ÂREG_WR(intr_vect, irq_regs[i], rw_ipi, ipi);
> @@ -288,7 +290,7 @@ int send_ipi(int vector, int wait, cpumask_t cpu_mask)
>
> Â Â Â Â/* Wait for IPI to finish on other CPUS */
> Â Â Â Âif (wait) {
> - Â Â Â Â Â Â Â for_each_cpu_mask(i, cpu_mask) {
> + Â Â Â Â Â Â Â for_each_cpu(i,&cpu_mask) {

please, could you add a space between i,&cpu_mask?

> Â Â Â Â Â Â Â Â Â Â Â Â int j;
> Â Â Â Â Â Â Â Â Â Â Â Â for (j = 0 ; j < 1000; j++) {
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âipi = REG_RD(intr_vect, irq_regs[i], rw_ipi);
> @@ -314,11 +316,12 @@ int send_ipi(int vector, int wait, cpumask_t cpu_mask)
> Â*/
> Âint smp_call_function(void (*func)(void *info), void *info, int wait)
> Â{
> - Â Â Â cpumask_t cpu_mask = CPU_MASK_ALL;
> + Â Â Â cpumask_t cpu_mask;
> Â Â Â Âstruct call_data_struct data;
> Â Â Â Âint ret;
>
> - Â Â Â cpu_clear(smp_processor_id(), cpu_mask);
> + Â Â Â cpumask_setall(&cpu_mask);
> + Â Â Â cpumask_clear_cpu(smp_processor_id(), &cpu_mask);
>
> Â Â Â ÂWARN_ON(irqs_disabled());
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/