From nobody Fri Jan 19 17:09:54 2024 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 4TGmM650h0z56wlW; Fri, 19 Jan 2024 17:09:54 +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 4TGmM62gyMz4K8C; Fri, 19 Jan 2024 17:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705684194; 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=8SX9M2HjjAxoeOzKf+8xas7mfcBOM8wduGX5nbKnC78=; b=I+OhN30E31q/sKZ9nCCgZiuSMi+YkLvxcyHpVs1v8PJ5ZN3D3WKuPJ1OL3rS0+465FUoy0 q3YK5fmmJUXDmRX68BNbj93rdhfioPNGPjPL8PtN8cQiPuCNCYz38lt/QdWoLrEBPCDuBi osuI3QqSZ6gLpcj2idx1WWFOvWdrkOGvY1DEvXvutu0iRJw8eYQ+dbKeFJ68mLzCWkHx/B GsW3xgZ7jioT2orY2rKeAVEE+mhtXQPAlwyAPZ3vkqgwvRNK6aasoDR0D9Ka0Drx949nnV 1TOfnLf9xSvl8W29OpU7v8WI7GjMXIRSHwJQtmlsXsMUR6dI2qUgF/2HrXnIYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705684194; 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=8SX9M2HjjAxoeOzKf+8xas7mfcBOM8wduGX5nbKnC78=; b=bEqVXazEN8ZtuOHAGjDjeNRMGPAYJYUn5NZ9nND09ZJ5nFofwHY5jRf0GHBid00gFNJDNu SBIhUxFGXGxMYx+rFoUDFHf8/jIcq7mZkAWEsskJzl+xXKibsnp6TzT8bsdylUph9f9OVR CnLxk52+0pG0J/2dQm/mjhY/7N/wwGiY5cyXoDPiN+IOlEs+Sra/92bTcmsBTkLiereAg4 4VCUBc7s3EspHhOXqF4JfOQ7gwGCd8w9pwdqyTxdclcN5F+3JA+WxNtiGOqT6PdTb6IkYH eWMSMYIMI9LcOEb/Xq7n6qx8sPrx90BN8THzhdSzUCjG3k807ajdsCvDDH68vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705684194; a=rsa-sha256; cv=none; b=d/QCKVGPVkYwvK1OwOpVLRuVfFe8AlVzf6OTE1Z2MpRzkVwsybJLnDDx9W7y2cmQPcxu93 x0QhwVpM19ZNYT4t0BjwEIbss7nI03v/CqeEyL4FBeAvBtm40+E78uzdqzpVqNZuKxty3L OLwdQeWd9VtVo1wTliaLvHMmxRy8nxhOQarPWs/UuXN0YzDNDZBoVzpNcoFE1C8y7vYkew m/v06Hx7Vi4nVngw5UakyESnNxOtrUe1vynWCNjvI854QSOAL5Z5gF9DKKGdmStcL3sZfx dvq/a7wzFPkVku9ZcQyyn/XTC4dnkIVCt8kIAmaGbBIua0q3bJ5skFCnbsR5BQ== 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 4TGmM61FFBz10C2; Fri, 19 Jan 2024 17:09:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40JH9s5B079712; Fri, 19 Jan 2024 17:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40JH9sCL079709; Fri, 19 Jan 2024 17:09:54 GMT (envelope-from git) Date: Fri, 19 Jan 2024 17:09:54 GMT Message-Id: <202401191709.40JH9sCL079709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 870bcb954ee3 - stable/13 - iichid(4): Unify two taskqueue tasks 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 870bcb954ee3db3c6670949638883a4b6b7d362c Auto-Submitted: auto-generated The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=870bcb954ee3db3c6670949638883a4b6b7d362c commit 870bcb954ee3db3c6670949638883a4b6b7d362c Author: Alexander Motin AuthorDate: 2023-12-27 00:28:56 +0000 Commit: Alexander Motin CommitDate: 2024-01-19 17:08:14 +0000 iichid(4): Unify two taskqueue tasks taskqueue_enqueue_timeout(0) is equivalent to taskqueue_enqueue(), so no need to create a separate periodic_task and event_task to run exactly the same handler. MFC after: 1 month (cherry picked from commit a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1) --- sys/dev/iicbus/iichid.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 99ec402c3590..a0e11b8500b6 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -182,8 +182,7 @@ struct iichid_softc { bool callout_setup; /* iicbus lock */ uint8_t *dup_buf; struct taskqueue *taskqueue; - struct timeout_task periodic_task; /* iicbus lock */ - struct task event_task; + struct timeout_task sampling_task; /* iicbus lock */ #endif struct task suspend_task; @@ -520,7 +519,7 @@ iichid_cmd_set_report(struct iichid_softc* sc, const void *buf, #ifdef IICHID_SAMPLING static void -iichid_event_task(void *context, int pending) +iichid_sampling_task(void *context, int pending) { struct iichid_softc *sc; device_t parent; @@ -566,7 +565,7 @@ rearm: rate = sc->sampling_rate_slow; else rate = sc->sampling_rate_fast; - taskqueue_enqueue_timeout_sbt(sc->taskqueue, &sc->periodic_task, + taskqueue_enqueue_timeout_sbt(sc->taskqueue, &sc->sampling_task, SBT_1S / MAX(rate, 1), 0, C_PREL(2)); } out: @@ -742,7 +741,7 @@ iichid_reset_callout(struct iichid_softc *sc) sc->missing_samples = sc->sampling_hysteresis; sc->dup_samples = 0; sc->dup_size = 0; - taskqueue_enqueue(sc->taskqueue, &sc->event_task); + taskqueue_enqueue_timeout(sc->taskqueue, &sc->sampling_task, 0); return (0); } @@ -752,7 +751,7 @@ iichid_teardown_callout(struct iichid_softc *sc) { sc->callout_setup = false; - taskqueue_cancel_timeout(sc->taskqueue, &sc->periodic_task, NULL); + taskqueue_cancel_timeout(sc->taskqueue, &sc->sampling_task, NULL); DPRINTF(sc, "tore callout down\n"); } @@ -1130,12 +1129,10 @@ iichid_attach(device_t dev) TASK_INIT(&sc->suspend_task, 0, iichid_suspend_task, sc); #ifdef IICHID_SAMPLING - TASK_INIT(&sc->event_task, 0, iichid_event_task, sc); - /* taskqueue_create can't fail with M_WAITOK mflag passed. */ sc->taskqueue = taskqueue_create("iichid_tq", M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &sc->taskqueue); - TIMEOUT_TASK_INIT(sc->taskqueue, &sc->periodic_task, 0, - iichid_event_task, sc); + TIMEOUT_TASK_INIT(sc->taskqueue, &sc->sampling_task, 0, + iichid_sampling_task, sc); sc->sampling_rate_slow = -1; sc->sampling_rate_fast = IICHID_SAMPLING_RATE_FAST;