diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2009-11-13 12:53:08 +0100 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-11-18 20:30:35 +0100 |
commit | af0940dac37545b1e7900b19c464fb6367d3f82f (patch) | |
tree | 415f074a5e06b6f68c30de8b887fe0766d16a58b /drivers/ieee1394/ohci1394.c | |
parent | firewire: cdev: reduce stack usage by ioctl_dispatch (diff) | |
download | linux-af0940dac37545b1e7900b19c464fb6367d3f82f.tar.xz linux-af0940dac37545b1e7900b19c464fb6367d3f82f.zip |
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)
Diffstat (limited to 'drivers/ieee1394/ohci1394.c')
-rw-r--r-- | drivers/ieee1394/ohci1394.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 65c1429e4129..d0dc1db80b29 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/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(struct dma_trm_ctx *d) /* 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 *ohci, int reg) 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 */ |