Skip to contentSkip to conversation

Patch to arch/mips/sibyte/sb1250/irq.c

PATCH Mark Mason 1 participant 1 message Aug 24, 2005 MIPS

lore
Share & tools
lore

Mark Mason

author
#0 lore raw

Hello all,

Attached is a patch to the sb1250 version of irq.c to fix compilation warnings (and make the code more correct).

Change sb1250_set_affinity() to use the proper datatype and access macros for the cpu mask.

Thanks,
Mark

Index: arch/mips/sibyte/sb1250/irq.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/sibyte/sb1250/irq.c,v retrieving revision 1.34

mips/sibyte/sb1250/irq.c +7 -14
diff -u -p -r1.34 irq.c
@@ -53,7 +53,7 @@ static void disable_sb1250_irq(unsigned 
 static unsigned int startup_sb1250_irq(unsigned int irq);
 static void ack_sb1250_irq(unsigned int irq);
 #ifdef CONFIG_SMP
-static void sb1250_set_affinity(unsigned int irq, unsigned long mask);
+static void sb1250_set_affinity(unsigned int irq, cpumask_t mask);
 #endif
 
 #ifdef CONFIG_SIBYTE_HAS_LDT
@@ -117,26 +117,19 @@ void sb1250_unmask_irq(int cpu, int irq)
 }
 
 #ifdef CONFIG_SMP
-static void sb1250_set_affinity(unsigned int irq, unsigned long mask)
+static void sb1250_set_affinity(unsigned int irq, cpumask_t mask)
 {
-	int i = 0, old_cpu, cpu, int_on;
+	int i = 0, old_cpu, cpu, int_on, weight;
 	u64 cur_ints;
 	irq_desc_t *desc = irq_desc + irq;
 	unsigned long flags;
 
-	while (mask) {
-		if (mask & 1) {
-			mask >>= 1;
-			break;
-		}
-		mask >>= 1;
-		i++;
-	}
-
-	if (mask) {
+	weight = cpus_weight(mask);
+	if (weight > 1) {
 		printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
 		return;
-	}
+	} else if (weight != 0)
+		i = first_cpu(mask);
 
 	/* Convert logical CPU to physical CPU */
 	cpu = cpu_logical_map(i);