Skip to contentSkip to conversation

ieee1394: Use hweight32

PATCH New Stefan Richter 1 participant 1 message Nov 13, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ieee1394: Use hweight32

From: Akinobu Mita <[email protected]>

Use hweight32 instead of counting for each bit

---

You forgot to include <linux/bitops.h>, probably also in some of the other hweight patches which you sent today or yesterday.

 drivers/ieee1394/ohci1394.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/ieee1394/ohci1394.c +2 -6
Index: linux-2.6.31.4/drivers/ieee1394/ohci1394.c
===================================================================
@@ -82,6 +82,7 @@
  *
  */
 
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/slab.h>
@@ -434,7 +435,6 @@ static void initialize_dma_trm_ctx(struc
 /* Count the number of available iso contexts */
 static int get_nb_iso_ctx(struct ti_ohci *ohci, int reg)
 {
-	int i,ctx=0;
 	u32 tmp;
 
 	reg_write(ohci, reg, 0xffffffff);
@@ -443,11 +443,7 @@ static int get_nb_iso_ctx(struct ti_ohci
 	DBGMSG("Iso contexts reg: %08x implemented: %08x", reg, tmp);
 
 	/* Count the number of contexts */
-	for (i=0; i<32; i++) {
-	    	if (tmp & 1) ctx++;
-		tmp >>= 1;
-	}
-	return ctx;
+	return hweight32(tmp);
 }
 
 /* Global initialization */
Signature · 3 lines
Stefan Richter
-=====-==--= =-== -==-=
http://arcgraph.de/sr/