From nobody Wed Jan 25 21:39:05 2023 X-Original-To: dev-commits-src-main@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 4P2HKQ26zcz3bW1F; Wed, 25 Jan 2023 21:39:06 +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 4P2HKQ1f9Mz41Cy; Wed, 25 Jan 2023 21:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674682746; 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=QnXSdC+ma1dJbFbgIcscpD0WxiojLYNyKaBXOvy/bNU=; b=pgVd8Gj/KNBb+9pK3Ade/HV+ajGcbEK0caPawntMyKIrIqlJ4nIKCrZBzSGCymX7s88XeH +FKvNDeaOO5AGJPhgCdsXA0+LPZzSrEMWXijvZhZKP1Qku/RzEiI0+KbzMjSNxqMa+QQNp ZPDKfJ7bt2qPmCQhSBi1BQGzaSUIEpDiusH3e46UfEj4WJAVYkBUbV5BqUEWfPuqMlQgmk LI13J+rh/fzNtYSePmIRJnVGcoVgvH5VATgNJ73A99kONGDvFTP1F/s0p3YDfggWyxlCuQ 8UJUEKudjZq5Z1OWM7/CZLD9+KKDUZWTyDIrRJeQYDpbCJPC0m/U4TXm8XDTcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674682746; 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=QnXSdC+ma1dJbFbgIcscpD0WxiojLYNyKaBXOvy/bNU=; b=XvND6ToaV4yHOLhi39RUyUv7BZT6joiD9mQjxeibFcqRDyfwaIB+puD0UFV8r8qX1h7acE dBWK+0OyibNaADIAz+dz2515+E1ox5Dtds/L2eJ2pSRVWnFCIGEazmai6YWWtzSr/XaIYy EAPp2wCZWQRGCO2TT4mhssH6MXacYUH4prOgmUycLR3i7g8ZcAWE3CUN+l9EtnMw/l09Cw 0xRCjxSmO5Ai/twtba14MWJYOYpGDvWbe/c97mvfhS/lelzZY+LJLLX7oDITidFHvaAQVb ZwwmvwUB9Cgg9ObHS709CBXkfcCkxnWBYaWKideeGzU75NEifw05/A7ldXca7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674682746; a=rsa-sha256; cv=none; b=OwLkmnpnOSQV0iQPGY1YMiJSLdmmjJuOM5sa4aRqSxBXCDt8Rf7Hm046BdTC7LE4SqXrMW 2zQUi4572HKDTpQAY7P3f0enc8wtC5O2+oPxhmwdhGndVEbraeRhwgcroBf8H3Pz2NrvPX RmCAIWnK6NCEr7LbngdnvmehqBbYLyT0oGmzAU28PfcrOgz5ZTUwycgueyxLI2XTw+t+1W Zl//LsB6fwbvEDrRqg1FS+CC/zXelo0u6mtQrAGO9zzFsJjsUC/fee5x6zWZTAHRTBZl20 5QI3QHeqfErE7jcjrXdspAQ+KsxmBWnIBhDjhRhsbp3aXA3zf0W8wmJqJ6m3dQ== 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 4P2HKQ0jSMz14SY; Wed, 25 Jan 2023 21:39: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 30PLd6pa007686; Wed, 25 Jan 2023 21:39:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30PLd5x1007685; Wed, 25 Jan 2023 21:39:05 GMT (envelope-from git) Date: Wed, 25 Jan 2023 21:39:05 GMT Message-Id: <202301252139.30PLd5x1007685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Subject: git: 29ab19455484 - main - vt(4): Return errors from `vt_{,de}allocate()` List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29ab19455484be96150fa5e87bd38aefb85c888a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dumbbell (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=29ab19455484be96150fa5e87bd38aefb85c888a commit 29ab19455484be96150fa5e87bd38aefb85c888a Author: Jean-Sébastien Pédron AuthorDate: 2023-01-14 18:22:56 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2023-01-25 21:26:57 +0000 vt(4): Return errors from `vt_{,de}allocate()` This is useful to the DRM drivers to let them know if a device is effectively used by the console. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38089 --- sys/dev/vt/hw/fb/vt_fb.c | 10 ++++++---- sys/dev/vt/vt.h | 4 ++-- sys/dev/vt/vt_core.c | 16 ++++++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/sys/dev/vt/hw/fb/vt_fb.c b/sys/dev/vt/hw/fb/vt_fb.c index 093bf35ac6ba..8e0d6c035f9a 100644 --- a/sys/dev/vt/hw/fb/vt_fb.c +++ b/sys/dev/vt/hw/fb/vt_fb.c @@ -517,19 +517,21 @@ vt_fb_fini(struct vt_device *vd, void *softc) int vt_fb_attach(struct fb_info *info) { + int ret; - vt_allocate(&vt_fb_driver, info); + ret = vt_allocate(&vt_fb_driver, info); - return (0); + return (ret); } int vt_fb_detach(struct fb_info *info) { + int ret; - vt_deallocate(&vt_fb_driver, info); + ret = vt_deallocate(&vt_fb_driver, info); - return (0); + return (ret); } void diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h index 977372f04a7d..764d612ed060 100644 --- a/sys/dev/vt/vt.h +++ b/sys/dev/vt/vt.h @@ -91,8 +91,8 @@ SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, &vt_##_name, 0, _descr) struct vt_driver; -void vt_allocate(const struct vt_driver *, void *); -void vt_deallocate(const struct vt_driver *, void *); +int vt_allocate(const struct vt_driver *, void *); +int vt_deallocate(const struct vt_driver *, void *); typedef unsigned int vt_axis_t; diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 213b11bee8f5..2827cc1c85a8 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -3137,12 +3137,12 @@ vt_resume_handler(void *priv) vd->vd_flags &= ~VDF_SUSPENDED; } -void +int vt_allocate(const struct vt_driver *drv, void *softc) { if (!vty_enabled(VTY_VT)) - return; + return (EINVAL); if (main_vd->vd_driver == NULL) { main_vd->vd_driver = drv; @@ -3156,31 +3156,35 @@ vt_allocate(const struct vt_driver *drv, void *softc) if (drv->vd_priority <= main_vd->vd_driver->vd_priority) { printf("VT: Driver priority %d too low. Current %d\n ", drv->vd_priority, main_vd->vd_driver->vd_priority); - return; + return (EEXIST); } printf("VT: Replacing driver \"%s\" with new \"%s\".\n", main_vd->vd_driver->vd_name, drv->vd_name); } vt_replace_backend(drv, softc); + + return (0); } -void +int vt_deallocate(const struct vt_driver *drv, void *softc) { if (!vty_enabled(VTY_VT)) - return; + return (EINVAL); if (main_vd->vd_prev_driver == NULL || main_vd->vd_driver != drv || main_vd->vd_softc != softc) - return; + return (EPERM); printf("VT: Switching back from \"%s\" to \"%s\".\n", main_vd->vd_driver->vd_name, main_vd->vd_prev_driver->vd_name); vt_replace_backend(NULL, NULL); + + return (0); } void