Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a601396 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds
Browse files

video/uvc: use memweight()



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

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0121ad62
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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;