Commit 33f00f41 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman
Browse files

usb: gadget: hid: Convert to use list_count()



The list API now provides the list_count() to help with counting
existing nodes in the list. Utilise it.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221123144901.40493-2-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a9efc04c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -133,14 +133,11 @@ static struct usb_configuration config_driver = {
static int hid_bind(struct usb_composite_dev *cdev)
{
	struct usb_gadget *gadget = cdev->gadget;
	struct list_head *tmp;
	struct hidg_func_node *n = NULL, *m, *iter_n;
	struct f_hid_opts *hid_opts;
	int status, funcs = 0;

	list_for_each(tmp, &hidg_func_list)
		funcs++;
	int status, funcs;

	funcs = list_count(&hidg_func_list);
	if (!funcs)
		return -ENODEV;