mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>, linux-media@vger.kernel.org
Subject: [PATCH v3 5/9] video/uvc: use memweight()
Date: Sat,  9 Jun 2012 09:50:34 +0900	[thread overview]
Message-ID: <1339203038-13069-5-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1339203038-13069-1-git-send-email-akinobu.mita@gmail.com>

Use memweight() to count the total number of bits set in memory area.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org
---
No changes from v1

 drivers/media/video/uvc/uvc_ctrl.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index af26bbe..f7061a5 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -2083,7 +2083,7 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
 	/* Walk the entities list and instantiate controls */
 	list_for_each_entry(entity, &dev->entities, list) {
 		struct uvc_control *ctrl;
-		unsigned int bControlSize = 0, ncontrols = 0;
+		unsigned int bControlSize = 0, ncontrols;
 		__u8 *bmControls = NULL;
 
 		if (UVC_ENTITY_TYPE(entity) == UVC_VC_EXTENSION_UNIT) {
@@ -2101,8 +2101,7 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
 		uvc_ctrl_prune_entity(dev, entity);
 
 		/* Count supported controls and allocate the controls array */
-		for (i = 0; i < bControlSize; ++i)
-			ncontrols += hweight8(bmControls[i]);
+		ncontrols = memweight(bmControls, bControlSize);
 		if (ncontrols == 0)
 			continue;
 
-- 
1.7.7.6


  parent reply	other threads:[~2012-06-09  0:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-09  0:50 [PATCH v3 1/9] string: introduce memweight Akinobu Mita
2012-06-09  0:50 ` [PATCH v3 2/9] qnx4fs: use memweight() Akinobu Mita
2012-06-09  0:50 ` [PATCH v3 3/9] dm: " Akinobu Mita
2012-06-09  0:50 ` [PATCH v3 4/9] affs: " Akinobu Mita
2012-06-09  0:50 ` Akinobu Mita [this message]
2012-06-18 23:06   ` [PATCH v3 5/9] video/uvc: " Mauro Carvalho Chehab
2012-06-09  0:50 ` [PATCH v3 6/9] ocfs2: " Akinobu Mita
2012-06-09  0:50 ` [PATCH v3 7/9] ext2: " Akinobu Mita
2012-06-12  9:14   ` Jan Kara
2012-06-09  0:50 ` [PATCH v3 8/9] ext3: " Akinobu Mita
2012-06-12  9:14   ` Jan Kara
2012-06-09  0:50 ` [PATCH v3 9/9] ext4: " Akinobu Mita
2012-06-11 23:17 ` [PATCH v3 1/9] string: introduce memweight Andrew Morton
2012-06-20 23:12 ` Tony Luck
2012-06-21  9:07   ` Akinobu Mita

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=1339203038-13069-5-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /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

Powered by JetHome