From nobody Fri Jan 19 16:37:49 2024 X-Original-To: dev-commits-src-branches@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 4TGlf54d8Kz56rnl; Fri, 19 Jan 2024 16:37:49 +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 4TGlf51hq3z46Fx; Fri, 19 Jan 2024 16:37:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705682269; 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=xQQq5sS5IH4Ma0PJSHsRZ6dq/nzbiT6lZ8EJMiHUukQ=; b=vhTKvc/8hJbX6l7x/Qb15+l3kyfl3FWHVs9p+tn60YJzsU7AxdToyTIzuv/rJr5zdayOzp j8SB5IvsDhBHik9wHDaMo1E6/nUI1Mtn/fxKf16x7jb0+lQw6KW/uKATHegbTlsFPMURny ji38gzkTXZ3vz21/1LPHolRsN39qnQHPV+XKBiteqwDeaUuq7JC+pwCFFcKZbQ2JV4bt2j Jmsas8GM//IeFwJ27aXknOBaq6QgpxonBV8WPqbmGtuOosTSirz0Shzp2LLqt1cHHLy9WV yo9D5wn4T0lTJty1nzFkTY0ch4br/SqSJqLVDYBI2jHFAOzoFrMOSzzirT2f+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705682269; 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=xQQq5sS5IH4Ma0PJSHsRZ6dq/nzbiT6lZ8EJMiHUukQ=; b=gKYHYGhjRNyUZ2GjLipQIePtKit9p3shYW5birS8q9CnLCz6Yaf9bi+les5P/xkLg3z5Ok NZegewM+zXaDUP8guVuXXi4QyE6mvcc5MoUaIu559CTwZI4vE6F53e1NmRENCBihhB7+Q0 3bhew9yOhplvUbpkN3aaEUzmn0TGIMwPCewML0g43oDT9mKfBMceAQ96rK6JF9Jr+4pnU1 jb64IXc/YxTzynXsGnn5QunDbjXkAzRQQOfaziGdisOH5lwK4SThQfHKkJTHsSRQ8sVqxh 2ip9thyWw2H7pTaZUrE8UXduOVfAiy1B0OQ3QshtG/rZLwleANIDJm3psWZpcw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705682269; a=rsa-sha256; cv=none; b=cuCLWmEuXA9h5RQJUesRZ9Ti1xglEdBS3NWwdFLAlYBTq2c2xO8OAqQp7MI0wnwt32MVQ4 fK9vFXxIyfcqf9AICkvnFu/CeULHIL1KLuitJEgBjZ98LZ+3owpZ8ZoyB+uT2gnxgJ0S3W r1VIlLavthvY7Z9uQ/3KnG2zaIUgggdZcn1oHziwyQh6/ePY5hzFwypkODBnO8Sr/BQRpC uPaTVeXE1f3689YXMnC/h6Q9sVBfQOPMOH2X8ExzXIYS7ZiZlLxzpKHkarsa/cPnFVFIna WqNtDLIpeR8Y00ljvywYTsq9odJ9nb79hu4/dHqk+v3ev5tyXvmBMOQoirUOTw== 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 4TGlf50p3qzyb1; Fri, 19 Jan 2024 16:37:49 +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 40JGbnNN027029; Fri, 19 Jan 2024 16:37:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40JGbnqq027026; Fri, 19 Jan 2024 16:37:49 GMT (envelope-from git) Date: Fri, 19 Jan 2024 16:37:49 GMT Message-Id: <202401191637.40JGbnqq027026@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: 799f2c8cb054 - stable/14 - iichid(4): Unify two taskqueue tasks List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 799f2c8cb05407e2ca64f41b0b18438901b3d0ff Auto-Submitted: auto-generated The branch stable/14 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=799f2c8cb05407e2ca64f41b0b18438901b3d0ff commit 799f2c8cb05407e2ca64f41b0b18438901b3d0ff Author: Alexander Motin AuthorDate: 2023-12-27 00:28:56 +0000 Commit: Alexander Motin CommitDate: 2024-01-19 16:34:58 +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 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;