aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2012-07-30 17:41:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:16 -0400
commit9a601396e8681d9884a9f429cba7ceb2b2a4d21c (patch)
treec1903ab7e143f009fbfd22cb071346817348aac1
parent0121ad62c20ed779e38ad689071da2805f03249f (diff)
video/uvc: use memweight()
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> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c5
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 af26bbe6f76e..f7061a5ef1d2 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)
2083 /* Walk the entities list and instantiate controls */ 2083 /* Walk the entities list and instantiate controls */
2084 list_for_each_entry(entity, &dev->entities, list) { 2084 list_for_each_entry(entity, &dev->entities, list) {
2085 struct uvc_control *ctrl; 2085 struct uvc_control *ctrl;
2086 unsigned int bControlSize = 0, ncontrols = 0; 2086 unsigned int bControlSize = 0, ncontrols;
2087 __u8 *bmControls = NULL; 2087 __u8 *bmControls = NULL;
2088 2088
2089 if (UVC_ENTITY_TYPE(entity) == UVC_VC_EXTENSION_UNIT) { 2089 if (UVC_ENTITY_TYPE(entity) == UVC_VC_EXTENSION_UNIT) {
@@ -2101,8 +2101,7 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
2101 uvc_ctrl_prune_entity(dev, entity); 2101 uvc_ctrl_prune_entity(dev, entity);
2102 2102
2103 /* Count supported controls and allocate the controls array */ 2103 /* Count supported controls and allocate the controls array */
2104 for (i = 0; i < bControlSize; ++i) 2104 ncontrols = memweight(bmControls, bControlSize);
2105 ncontrols += hweight8(bmControls[i]);
2106 if (ncontrols == 0) 2105 if (ncontrols == 0)
2107 continue; 2106 continue;
2108 2107