linux-kernel.vger.kernel.org archive mirror
 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>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Subject: [PATCH 06/10] video/uvc: use memweight()
Date: Sun, 20 May 2012 22:23:19 +0900	[thread overview]
Message-ID: <1337520203-29147-6-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1337520203-29147-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>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org
---
 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 0efd3b1..8683be0 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -1851,7 +1851,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) {
@@ -1869,8 +1869,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-05-20 13:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-20 13:23 [PATCH 01/10] string: introduce memweight Akinobu Mita
2012-05-20 13:23 ` [PATCH 02/10] minixfs: use memweight() Akinobu Mita
2012-05-20 13:23 ` [PATCH 03/10] qnx4fs: " Akinobu Mita
2012-05-20 15:34   ` Anders Larsen
2012-05-21 11:59     ` Akinobu Mita
2012-05-20 13:23 ` [PATCH 04/10] dm-log: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 05/10] affs: " Akinobu Mita
2012-05-20 13:23 ` Akinobu Mita [this message]
2012-05-20 20:46   ` [PATCH 06/10] video/uvc: " Laurent Pinchart
2012-05-21 12:03     ` Akinobu Mita
2012-05-21 12:18       ` Laurent Pinchart
2012-05-20 13:23 ` [PATCH 07/10] ocfs2: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 08/10] ext2: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 09/10] ext3: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 10/10] ext4: " Akinobu Mita
2012-05-23  9:21 ` [PATCH 01/10] string: introduce memweight Jan Kara
2012-05-23 12:12   ` Akinobu Mita
2012-05-23 12:29     ` Jan Kara
2012-05-23 13:16     ` Matthew Wilcox
2012-05-24 11:54       ` 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=1337520203-29147-6-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --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;
as well as URLs for NNTP newsgroup(s).