Commit af0940dac37545b1e7900b19c464fb6367d3f82f

Authored by Akinobu Mita
Committed by Stefan Richter
1 parent b2c0a2ac3e

ieee1394: Use hweight32

Use hweight32 instead of counting for each bit

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (add required include)

Showing 1 changed file with 2 additions and 6 deletions Side-by-side Diff

drivers/ieee1394/ohci1394.c
... ... @@ -82,6 +82,7 @@
82 82 *
83 83 */
84 84  
  85 +#include <linux/bitops.h>
85 86 #include <linux/kernel.h>
86 87 #include <linux/list.h>
87 88 #include <linux/slab.h>
... ... @@ -434,7 +435,6 @@
434 435 /* Count the number of available iso contexts */
435 436 static int get_nb_iso_ctx(struct ti_ohci *ohci, int reg)
436 437 {
437   - int i,ctx=0;
438 438 u32 tmp;
439 439  
440 440 reg_write(ohci, reg, 0xffffffff);
... ... @@ -443,11 +443,7 @@
443 443 DBGMSG("Iso contexts reg: %08x implemented: %08x", reg, tmp);
444 444  
445 445 /* Count the number of contexts */
446   - for (i=0; i<32; i++) {
447   - if (tmp & 1) ctx++;
448   - tmp >>= 1;
449   - }
450   - return ctx;
  446 + return hweight32(tmp);
451 447 }
452 448  
453 449 /* Global initialization */