summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-11-23 16:48:59 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-29 08:56:09 +0100
commit33f00f41d963c86176dba2f9faff9b428a542e60 (patch)
tree9cd6c974bbe0f54cc8eef8f84ef659512fdde7d0 /drivers/usb/gadget
parenta9efc04cfd05690e91279f41c2325c46335c43ef (diff)
downloadlinux-33f00f41d963c86176dba2f9faff9b428a542e60.tar.bz2
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221123144901.40493-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/legacy/hid.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/usb/gadget/legacy/hid.c b/drivers/usb/gadget/legacy/hid.c
index 1187ee4f316a..6196c3456e0b 100644
--- a/drivers/usb/gadget/legacy/hid.c
+++ b/drivers/usb/gadget/legacy/hid.c
@@ -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;