mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux1394-devel@lists.sourceforge.net,
	Ben Collins <ben.collins@ubuntu.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH update] ieee1394: Use hweight32
Date: Fri, 13 Nov 2009 12:53:08 +0100 (CET)	[thread overview]
Message-ID: <tkrat.057b967e5b8e4c33@s5r6.in-berlin.de> (raw)
In-Reply-To: <1258095851-13301-1-git-send-email-akinobu.mita@gmail.com>

From: Akinobu Mita <akinobu.mita@gmail.com>

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)
---

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(-)

Index: linux-2.6.31.4/drivers/ieee1394/ohci1394.c
===================================================================
--- linux-2.6.31.4.orig/drivers/ieee1394/ohci1394.c
+++ 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 */

-- 
Stefan Richter
-=====-==--= =-== -==-=
http://arcgraph.de/sr/


           reply	other threads:[~2009-11-13 11:53 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1258095851-13301-1-git-send-email-akinobu.mita@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tkrat.057b967e5b8e4c33@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=akinobu.mita@gmail.com \
    --cc=ben.collins@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®