Message ID | 20221123144901.40493-2-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2835601wrr; Wed, 23 Nov 2022 06:52:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ZFANBZA1ouRwWeevi9rfDHd/CCSA4fI1AFvjSgC3pui6UoXngBVouTR2DPpBAHa4BIpJD X-Received: by 2002:a05:6a00:4287:b0:56c:1251:8718 with SMTP id bx7-20020a056a00428700b0056c12518718mr9775759pfb.62.1669215126009; Wed, 23 Nov 2022 06:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669215126; cv=none; d=google.com; s=arc-20160816; b=n3o7O12DDre5sK9R+rkJA5sIm0w58afUojos37xIGjmt6JSypKrJdGWxNYj4OAYYoB 01HEivFAVcz7y66bU35EBwDNeLtHYUTEabhG6PHJZYEpavGGxYOpio9lVqqaG9lfwgAC 7fpnn8WnF1FfRFnJtXU8goAXy0ztO0aenPqqXfrGm94pKYdHI4ujnpZ/jVDK8LpcpJy0 K3JHrdrTh5QyScUYmG0Sf7yfEVlIkOMtJ1j5Z4gCvbghI9NTOaHFvHCofZ3ahIcaBs32 AEBLkhF9xz9Net0GJ+hwgEVCSowCsmHBvse7exQ5C3E2j7yX7yUb1ddb1T3DhRFLTxmu 0wdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wuk5z95m1tY0YQdeA9+MlMCmiiAyLgEeZIaKkiM25zI=; b=JCXujo2I1IOyACrDHNGLv7j2a0/F2CIS0pVcOpOoSXVMETvL6pfQTsQInRBM0xVFX5 53MGmxK5sS+Z96+loJfoOUYohI+pMWIBN8MLt4OZs5AARQryUeNfUkCRymkQZA5mM2KM EXNIllFCHo/YUz9Hns/VfbcceGAQ5cdI10Plvexg4wWWrgj/xAzhPa/V83NAh9Vrmg5H N2O/TguZBuXkIL5mR4DdZfGswCj4iGBnJx7Tee0NcmCqKPsi18Iul60fmccOvLLtRuCx W3AKjQIo1Oht3Wum+bdABbTKbhNYzrk41ebmCoLle6HNX7JGMBYjvXxuZx1a+M0QYAjK 3jmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b94MSyV6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a6566d4000000b00476ea7b91ddsi16178487pgw.51.2022.11.23.06.51.51; Wed, 23 Nov 2022 06:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b94MSyV6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237497AbiKWOtU (ORCPT <rfc822;fengqi706@gmail.com> + 99 others); Wed, 23 Nov 2022 09:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237484AbiKWOtO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 23 Nov 2022 09:49:14 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 093AF74A83; Wed, 23 Nov 2022 06:49:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669214951; x=1700750951; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PZw/qx/VCBuHt8kLTtD2kAjtrp/ndgtSgsymsuc6HUA=; b=b94MSyV6Z3VbT8k4JYhSSkUqY7+WLa3Fth1u8DJFhCIB0Yl1ZDtJgzl7 vkoosvAr/k4/0X7DTa0S7fnBy9s/PHtIwmyNu2u3mJfmh/ceN+GrFBN53 84iq5BOEk4Cr/a/Do5s+wcVe6NwjddSUZ3YiREmiUR6oaaUB5LXi9WHfL hussW35TGAucXEty9DXmJvGJXux6q30N5BaOYpRooWycO5bI0XhKzUceP pXJhimV92n7JQbRbBBTW/gpyVImGvVMJfxLq4wm2V7s5tZt/ffaEVms5p C6JQ55osYLQZ1LAKnEmA09FIlYe3SsYcJVnIeTq9a7G5ZenIqFGYxPCaj g==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="376225198" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="376225198" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 06:48:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="635936969" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="635936969" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 23 Nov 2022 06:48:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9096CB7; Wed, 23 Nov 2022 16:49:03 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Jakob Koschel <jakobkoschel@gmail.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Mathias Nyman <mathias.nyman@linux.intel.com>, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Kevin Cernekee <cernekee@gmail.com>, Mathias Nyman <mathias.nyman@intel.com>, Hans de Goede <hdegoede@redhat.com> Subject: [PATCH v4 2/4] usb: gadget: hid: Convert to use list_count() Date: Wed, 23 Nov 2022 16:48:59 +0200 Message-Id: <20221123144901.40493-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221123144901.40493-1-andriy.shevchenko@linux.intel.com> References: <20221123144901.40493-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750298919473120682?= X-GMAIL-MSGID: =?utf-8?q?1750298919473120682?= |
Series |
[v4,1/4] i915: Move list_count() to list.h for broader use
|
|
Commit Message
Andy Shevchenko
Nov. 23, 2022, 2:48 p.m. UTC
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>
---
v4: no change
v3: fixed typo in the commit message (Fabio)
v2: no change
drivers/usb/gadget/legacy/hid.c | 7 ++-----
1 file 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;