From nobody Thu May 05 23:42:25 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 40C5B1AC1476; Thu, 5 May 2022 23:42:26 +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 4KvVc173sPz4Y7V; Thu, 5 May 2022 23:42:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651794146; 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=qF+LSZLyFB0vsxENNJYUbIMzs5NTpUWQrk9/JJI0ndg=; b=fDUXmOf89Oo/HIjLc0As5azQN2yhQY9c6KdXtuztp6BS7aVwY9UrMxukBj6PbgE8gEZ6wl 53dODg8z9/BeG6Ku0ZkeoP1B8xM8xJj9e3eS76fVb9MwJI2jrVZadQV8hWviOjTDRpzB1x TQl5DjqOaxgAJ8znyz49CQfOVNplPT9G/tvVNE0vAE986s8Rxx4ZFz8TNSyUXhw9gnUakI hdC6at7brZfGdNSk+7HESIDR50VRWxFzLc+AQ7M5IjlR2Mnj4D8jIiXAbaiwZJYRG4EjFd QBVBRMJobieFZxdJYv61dsG2D79TOtSqlsdBszJddN2IsFWXUoUnJ8SmRI2AsQ== 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 B55A011495; Thu, 5 May 2022 23:42:25 +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 245NgPNp055606; Thu, 5 May 2022 23:42:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 245NgPnd055605; Thu, 5 May 2022 23:42:25 GMT (envelope-from git) Date: Thu, 5 May 2022 23:42:25 GMT Message-Id: <202205052342.245NgPnd055605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5ad42f80559c - main - smapi: Use devclass_find to lookup smapi devclass in unload handler. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5ad42f80559cd37fbd2897df4f6462fb43330608 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651794146; 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=qF+LSZLyFB0vsxENNJYUbIMzs5NTpUWQrk9/JJI0ndg=; b=axEGGWXeCbN6LYZWgRFBB2HBmjS3Ojx11ot0QZOj9emzetMzj39jrI523zYhOjNjOLYbEt 11Z0eZZbZ83lbl5APaFIMxxeV3fM8R+4eywZLZUq7vxqRdeW1gaGce57VVfXoUEz7qJUio OCr/g/iK87ObKlfS9BKU0K1fM4UAuTSiKM74lth5vq3CgP1KzvzCqwfB1r2ouYEMlAyWc6 mC7tl3CLzG7zzZ6WCOKRnRLR3DuF+xbcx1YXQCiSdt74APfynj/r6BVL8vB5ThxiWBA38K 4oH8wM0miGLtEJT5HL7rqZUeGwDfTw8Drzja5KBADjG1dm88dWa2aQZbIYMamw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651794146; a=rsa-sha256; cv=none; b=VfN1dZU9RNtUMxCWLZvV+N4MUqC8RxD2dt89tuY8/G4JnAaumVfYzTHySb33vRt/oEHQHH mS3vf4gAVBqFzct5seCzqC6TooiUDdjSvdJxuwPTVbZz5+0YgeZcJccj+qnvn6RBH6E4sO UNLVoyN+PpKD9f4A8LnABsPWklYkkZTay7vnJXLKyUiKNWmuoLCr9N4XuBODKGAI0I8Pju ctgJ4HxVFdpKi/Y8nFXO+FTg0BztZForn/m59guKf7fxvHdkZN/5ZMVWuNjyBBRt1wR2UK N+a/KOB+G2s4287gdUstukeUZpsw8sKgdN5FnaoKshI71XQef9pJVQJHY9tYlg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5ad42f80559cd37fbd2897df4f6462fb43330608 commit 5ad42f80559cd37fbd2897df4f6462fb43330608 Author: John Baldwin AuthorDate: 2022-05-05 23:35:40 +0000 Commit: John Baldwin CommitDate: 2022-05-05 23:35:40 +0000 smapi: Use devclass_find to lookup smapi devclass in unload handler. Move smapi_modevent below the declaration of smapi_driver so that smapi_driver's name member can be used rather than hardcoding the device class name. Differential Revision: https://reviews.freebsd.org/D35064 --- sys/i386/bios/smapi.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index 653399e1ca58..719d9b9558dc 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -278,6 +278,21 @@ smapi_detach (device_t dev) return (0); } +static device_method_t smapi_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, smapi_identify), + DEVMETHOD(device_probe, smapi_probe), + DEVMETHOD(device_attach, smapi_attach), + DEVMETHOD(device_detach, smapi_detach), + { 0, 0 } +}; + +static driver_t smapi_driver = { + "smapi", + smapi_methods, + sizeof(struct smapi_softc), +}; + static int smapi_modevent (module_t mod, int what, void *arg) { @@ -289,7 +304,8 @@ smapi_modevent (module_t mod, int what, void *arg) case MOD_LOAD: break; case MOD_UNLOAD: - devclass_get_devices(smapi_devclass, &devs, &count); + devclass_get_devices(devclass_find(smapi_driver.name), &devs, + &count); for (i = 0; i < count; i++) { device_delete_child(device_get_parent(devs[i]), devs[i]); } @@ -302,20 +318,5 @@ smapi_modevent (module_t mod, int what, void *arg) return (0); } -static device_method_t smapi_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, smapi_identify), - DEVMETHOD(device_probe, smapi_probe), - DEVMETHOD(device_attach, smapi_attach), - DEVMETHOD(device_detach, smapi_detach), - { 0, 0 } -}; - -static driver_t smapi_driver = { - "smapi", - smapi_methods, - sizeof(struct smapi_softc), -}; - DRIVER_MODULE(smapi, nexus, smapi_driver, smapi_devclass, smapi_modevent, 0); MODULE_VERSION(smapi, 1);