From nobody Thu Aug 04 13:18:31 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lz8S73WXtz4XpD2; Thu, 4 Aug 2022 13:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lz8S72qbfz4JSn; Thu, 4 Aug 2022 13:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659619111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HfW0PB6q8gKoJ0IRaAfh+dA8zqUYzRa+vHOmT6zRegQ=; b=A1QlfelLbXHZaS1z1n6Ga1cClpaa576rdlhCRT1JrEY+2NvOz6C3WRYqCl7eyXQs40e9tu nF8n1fi5Rl4IwMXWL5ib8GxAe2hQ76ODOkKhOI7TZm5uX7yUt5+WLfkAId/+2VvDQYwu8R ooimC8oVuj86zo1l0iCWJjczi+Z7uhUVIyfLBka69weyGiQ/7zS1zXFu92+MRws2Io7NzR 4XifphonTSlwVkUj7PaROFrvG+BMzZ8sWbJekBFRLf+qb+oi9mtKM7ndOPqymusBnhtmCM 9ZzYW4Z9XW5ZGYEd43tK6pVvt0vsxf65wAHSHHBW3VyN/2l3T1l7IlbWFkT8LQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lz8S71dVczGQg; Thu, 4 Aug 2022 13:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 274DIVib002731; Thu, 4 Aug 2022 13:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 274DIVTw002730; Thu, 4 Aug 2022 13:18:31 GMT (envelope-from git) Date: Thu, 4 Aug 2022 13:18:31 GMT Message-Id: <202208041318.274DIVTw002730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 2817d3ac2a0a - stable/13 - hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2817d3ac2a0a6163272ae5f30a9dc5705a977c26 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659619111; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HfW0PB6q8gKoJ0IRaAfh+dA8zqUYzRa+vHOmT6zRegQ=; b=fUKjpRTSKq2DJuGsNnaYQ8SUYPAYW3MxJrRcFQb4fjM/x8i7XFTQFKDvIY5SeLciUWqLdK 9RUiLMOVsaBWKsKPAn8gAPTaWKJPmakXaGsqhsPq+85Uwz/cdSkrtHg48Q7vI0zjySLOGB PKtQtBqIJjWiCc+kSP2gB7PFVy9cOJoUKvwlVH534gFFSmDQBHXBuW2W1+XxxILTUJf42v TqGg1eYnlHzp1DQpngD3riaL17qHN+nOxfNcLKTUOuUFgZjG//V0M1mxBNuXFg6/ggsJ0s Hw907IZIglN4mekzsTedgBNAg5pWf2YuV/7d3oGbAMSqXyjRuSY2ptH26r0taA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659619111; a=rsa-sha256; cv=none; b=kv8n9/+rcd51jr9aZNLiCka/gDMghX2B/LqpHrzv9WNzq13WB3k2VswjLveoMjcvTO0cX4 6XN/A4dGptcXuuvHHwiPb2w1xpSAoodKQB3v3lWlU4r7R0SXhvh1l/QMClooXVKxVAF8Kk rnfzn/Km7mtqVrUus3+l+aA4wZxvseL5WCyfIsKup8g7dh6RR1KkE4lGECqQCSVubk0bFm FRBicbyYdUQm60jQzgcWMddfdZv/H19FUoZeN0F+Xd8M7aK+kPU3I+8Gf35DuNzE08Xwyf rpasXAnagF1fTcGdfYK6dqSvVwzkHdfGyycbyudHG8Q4iXQySfitYd+a+CDLwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=2817d3ac2a0a6163272ae5f30a9dc5705a977c26 commit 2817d3ac2a0a6163272ae5f30a9dc5705a977c26 Author: Hans Petter Selasky AuthorDate: 2022-06-23 13:44:25 +0000 Commit: Hans Petter Selasky CommitDate: 2022-08-04 13:17:56 +0000 hidbus(4): Align refcount checks for hidbus_intr_start() and hidbus_intr_stop(). No functional change intended. Discussed with: wulf @ Sponsored by: NVIDIA Networking (cherry picked from commit c019a1690b85062729c775e2c820716edf5c37ea) --- sys/dev/hid/hidbus.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 0de0a9bc1114..8ae7ff4fec9c 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -611,20 +611,20 @@ hidbus_intr_start(device_t child) struct hidbus_softc *sc = device_get_softc(bus); struct hidbus_ivars *ivar = device_get_ivars(child); struct hidbus_ivars *tlc; - int refcnt = 0; + bool refcnted = false; int error; if (sx_xlock_sig(&sc->sx) != 0) return (EINTR); CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) { - refcnt += tlc->refcnt; + refcnted |= (tlc->refcnt != 0); if (tlc == ivar) { mtx_lock(tlc->mtx); ++tlc->refcnt; mtx_unlock(tlc->mtx); } } - error = refcnt != 0 ? 0 : HID_INTR_START(device_get_parent(bus)); + error = refcnted ? 0 : HID_INTR_START(device_get_parent(bus)); sx_unlock(&sc->sx); return (error); @@ -637,7 +637,7 @@ hidbus_intr_stop(device_t child) struct hidbus_softc *sc = device_get_softc(bus); struct hidbus_ivars *ivar = device_get_ivars(child); struct hidbus_ivars *tlc; - bool refcnt = 0; + bool refcnted = false; int error; if (sx_xlock_sig(&sc->sx) != 0) @@ -649,9 +649,9 @@ hidbus_intr_stop(device_t child) --tlc->refcnt; mtx_unlock(tlc->mtx); } - refcnt += tlc->refcnt; + refcnted |= (tlc->refcnt != 0); } - error = refcnt != 0 ? 0 : HID_INTR_STOP(device_get_parent(bus)); + error = refcnted ? 0 : HID_INTR_STOP(device_get_parent(bus)); sx_unlock(&sc->sx); return (error);