]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
video/uvc: use memweight()
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 21 Jul 2012 00:54:52 +0000 (10:54 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Jul 2012 03:53:18 +0000 (13:53 +1000)
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>
drivers/media/video/uvc/uvc_ctrl.c

index af26bbe6f76ecba9726dc01983bda49f36b22c9a..f7061a5ef1d2a1c424c78f486d4348fc96b9b8ff 100644 (file)
@@ -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;