From nobody Wed Dec 27 00:45:31 2023 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 4T0Cbv6N8Nz54fqm; Wed, 27 Dec 2023 00:45: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 4T0Cbv4Bldz4Nj8; Wed, 27 Dec 2023 00:45:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703637931; 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=EPX+6xErmXpDncnKyZokPlOsP3Zm+y9ihVO7hY2wsWw=; b=L2wXtP78qN+ehNLCYzcDQ0sEVX6RWfOKVJ919qglqIYiXFSHrYBxIZnh5H7gw+JORPT6sE NZ3CLM9CFYZoO7tm27OR73ycLYhtUoZ69eO2fEPNJoT/zdLxdiIa+N3DxmhONt+Et1RKWI zbKZ79DPHY3KraZc9ydc/9T7uOYM5uiO1V+hJOTb0W7XS36dzf0Hy1Bcj8SH6L9Brj87Dc miPh0WgSf5i2drjK5TkCEqbXB0vxPXc9s2z8DAPwieyAdYxOnf1YhkA2jsHiRgLXO2A30x 9TxnG0by2LZyIt9OWLazQCWgZy3il2Gxbc75LqcLVvoaiRQw4Zy9of/6IUqvaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703637931; a=rsa-sha256; cv=none; b=P2mCjcmbEvW/imZdrYdNfMqGhK3n9QOkHJFrUZQ9Xr0wEjJJBB2TgcpSTsXzEquPuPorc5 rg3cP40bhdYgCVt2Z6cPBvs4nhJ527jxUvmKHBnxff4uUdWgSUBJkjdJMYngevNVN1YBgs 5CYWbRx9sHUrmbEMeLN8KhqXbj8fiHwetA2RK1RVslpJ9dhZw7YgRpThRCkfOSh1YgiNGs 9/N4wvZvpJvgF6ivi+V6a7qiCWqEVw1blOwxoDpuZM+BayiRG5EMyFgxWxJZj8QW/BR7I+ wnvZnABn3V/TMtQkigdDfZi+NKqxJUWWzQEvLxS/WQgCWPWdNV/iupwEC5gKaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703637931; 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=EPX+6xErmXpDncnKyZokPlOsP3Zm+y9ihVO7hY2wsWw=; b=jFOlioKg+Qx4PO9WbmHUe7juwxH8CZIYj55CVlZOPS5d9wbkChLxez2t2BATlf6jP/USxH vX+qjygpKju6sH6BZQGcNgavGJAU/hEwfaC5lHTooU72ybgHkcnKQuW9jL4Kqgpj9Yn86y T79QLYu+kadA+C9rhZtOl/OAsJ9LMkJmLj2BhvFdesY5skp+eAClMuh0sHnidcYb4VAAU3 ll+f+U07NtRYCG+BKytur5K0XtBy38te7QZrwxhkGO/Tb2q1Ed677xoTbWjSdyGZ4saiBc ubSOXHQQ/CJr+kjBLKQ/fE1Mllxp+KYVkxVqngnsukBfO3K46PxDHDVzf9AxzQ== 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 4T0Cbv2tkFz30V; Wed, 27 Dec 2023 00:45:31 +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 3BR0jVWh085611; Wed, 27 Dec 2023 00:45:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BR0jVrt085608; Wed, 27 Dec 2023 00:45:31 GMT (envelope-from git) Date: Wed, 27 Dec 2023 00:45:31 GMT Message-Id: <202312270045.3BR0jVrt085608@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: a8f80c0c16c7 - main - 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/main X-Git-Reftype: branch X-Git-Commit: a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1 commit a8f80c0c16c7fb38c46ddccd7e1b06dc46c407b1 Author: Alexander Motin AuthorDate: 2023-12-27 00:28:56 +0000 Commit: Alexander Motin CommitDate: 2023-12-27 00:28:56 +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 --- 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 84f624f9bb09..0752521f3884 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"); } @@ -1135,12 +1134,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;