From nobody Sat Oct 15 18:52:06 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 4MqXRq10kKz4fTqH; Sat, 15 Oct 2022 18:52:07 +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 4MqXRp4Pr0z49cP; Sat, 15 Oct 2022 18:52:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665859926; 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=CUD1srGdDFvRvMb9q/YUz2eUKbwVCRHgEdWlF+0Cm5U=; b=vPZlkIbn9HEJn9W2tI3ucYH6pEaGc0C/LJP6rWq1Jf21ZCZUA6SOIRueXASWC0y75ASdxJ RQw0cjOumCZmyhJhBGUUeKlOMxQ8z76FN9CRUywQngVZ/gmU4RUuwIdLEDHKj2I39ZAF6l FLlT0lU2OZpEm/3HWcZJT7nwopZD5RgofKvmZWPVHYtw9yJFKsQR/UF2lnFldNjYlRhCb2 oBwKb3/O7Vr9UIey//CsuqdRb8CCLxED2kIIiGKahEzUkg7LBaQltwNVlYlvXqtPtfVHVY yKy7d/iiAeknFW5SyEPc0yokCL6z+Ifjug0GK5Ds1z3tBlLk4CKWFXLuuU//hw== 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 4MqXRp33fMz1CZf; Sat, 15 Oct 2022 18:52:06 +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 29FIq6wW060129; Sat, 15 Oct 2022 18:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29FIq6UG060128; Sat, 15 Oct 2022 18:52:06 GMT (envelope-from git) Date: Sat, 15 Oct 2022 18:52:06 GMT Message-Id: <202210151852.29FIq6UG060128@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 0cec1648b43e - main - intr_event(9): update the example of swi_add() 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cec1648b43e176b5b3f1be580bf11e41e79f835 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665859926; 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=CUD1srGdDFvRvMb9q/YUz2eUKbwVCRHgEdWlF+0Cm5U=; b=LcJ4gi4Ypq4lRS6q5u+m0HfEQ+txsjSLhJpiGpekYR/QKckllzCJbCRoNe1752Tz946g+T 4XaUGnFvHjdazMYC1YMnzsKjad91AKf7/aJ4G1IrUhH1YgZ+vzVrYGGjXeHgRONMzrNRvX ydOjNZRC0wa54FM8xd8xQb1wvZx0zy9t0L9A3glBcnu5DmnrYBafbI+Hw/O4ugBHpHd2/R LkQtZE2vQYwWgxKej7qBLmcxd+WJJk4cKX43JkheZA4+TBHtgB35db2agGCjO/j8sW2DIb GnCeH44W5CCTEHopkAdElNyt0i5ndOirlRQmUwWUdy7Jq2BkrW/n5eqct2tyRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665859926; a=rsa-sha256; cv=none; b=oTTvjETvLTkTZz+PDhBn+SLNNfEmA1XdLgIltXHKN99fP0fZm/kvJzBpO/c+kphMGfkwC+ 69NP8Jb1BpcEsc5XiDt8En8LdWxSd2P9NBKBkmptFkGaxYtCNVaGFKXRxQqrYuuHur9k2a Wi1prZXjElmjFrFLomtX2dZG/Tl9k5SewYrt63VY1xesTAXdiWWjtS35IVhxzrEDMk+4Gy z6ilZXc4AH2PxXCtec76ksbVU8G56h1sPx7VOVMCar5y/+Zy1xajAIul3dQLSW7qGDb0Nc UMFOVcW6ejX30rGjX/FoqguM7JeFBfpZdRWKlMK7ccETm27yV1gFWDCRv8oAmA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0cec1648b43e176b5b3f1be580bf11e41e79f835 commit 0cec1648b43e176b5b3f1be580bf11e41e79f835 Author: Mitchell Horne AuthorDate: 2022-10-15 18:34:44 +0000 Commit: Mitchell Horne CommitDate: 2022-10-15 18:50:25 +0000 intr_event(9): update the example of swi_add() Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33476 --- share/man/man9/intr_event.9 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/share/man/man9/intr_event.9 b/share/man/man9/intr_event.9 index b735da931f64..621a02e3967b 100644 --- a/share/man/man9/intr_event.9 +++ b/share/man/man9/intr_event.9 @@ -200,39 +200,40 @@ function returns a process priority corresponding to the passed in interrupt flags. .Sh EXAMPLES The -.Fn swi_add +.Xr swi_add 9 function demonstrates the use of .Fn intr_event_create and .Fn intr_event_add_handler . .Bd -literal -offset indent int -swi_add(struct ithd **ithdp, const char *name, driver_intr_t handler, - void *arg, int pri, enum intr_type flags, void **cookiep) +swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, + void *arg, int pri, enum intr_type flags, void **cookiep) { - struct proc *p; - struct ithd *ithd; - int error; + struct intr_event *ie; + int error = 0; if (flags & INTR_ENTROPY) return (EINVAL); - ithd = (ithdp != NULL) ? *ithdp : NULL; + ie = (eventp != NULL) ? *eventp : NULL; - if (ithd != NULL) { - if ((ithd->it_flags & IT_SOFT) == 0) - return(EINVAL); + if (ie != NULL) { + if (!(ie->ie_flags & IE_SOFT)) + return (EINVAL); } else { - error = ithread_create(&ithd, pri, IT_SOFT, NULL, NULL, - "swi%d:", pri); + error = intr_event_create(&ie, NULL, IE_SOFT, 0, + NULL, NULL, NULL, swi_assign_cpu, "swi%d:", pri); if (error) return (error); - - if (ithdp != NULL) - *ithdp = ithd; + if (eventp != NULL) + *eventp = ie; + } + if (handler != NULL) { + error = intr_event_add_handler(ie, name, NULL, handler, arg, + PI_SWI(pri), flags, cookiep); } - return (ithread_add_handler(ithd, name, handler, arg, pri + PI_SOFT, - flags, cookiep)); + return (error); } .Ed .Sh ERRORS