From owner-svn-src-head@freebsd.org Fri Aug 23 22:52:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3DBDD04E2; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FcB33m8Xz4HsT; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 62A8023B0B; Fri, 23 Aug 2019 22:52:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7NMqxbh034761; Fri, 23 Aug 2019 22:52:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7NMqwLq034758; Fri, 23 Aug 2019 22:52:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201908232252.x7NMqwLq034758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Aug 2019 22:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351447 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 351447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 22:52:59 -0000 Author: imp Date: Fri Aug 23 22:52:58 2019 New Revision: 351447 URL: https://svnweb.freebsd.org/changeset/base/351447 Log: It turns out the duplication is only mostly harmless. While it worked with the kenrel, it wasn't working with the loader. It failed to handle dependencies correctly. The reason for that is that we never created a nvme module with the DRIVER_MODULE, but instead a nvme_pci and nvme_ahci module. Create a real nvme module that nvd can be dependent on so it can import the nvme symbols it needs from there. Arguably, nvd should just be a simple child of nvme, but transitioning to that (and winning that argument given why it was done this way) is beyond the scope of this change. Reviewed by: jhb@ Differential Revision: https://reviews.freebsd.org/D21382 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ahci.c head/sys/dev/nvme/nvme_pci.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme.c Fri Aug 23 22:52:58 2019 (r351447) @@ -364,3 +364,19 @@ nvme_completion_poll_cb(void *arg, const struct nvme_c memcpy(&status->cpl, cpl, sizeof(*cpl)); atomic_store_rel_int(&status->done, 1); } + +static int +nvme_modevent(module_t mod __unused, int type __unused, void *argp __unused) +{ + return (0); +} + +static moduledata_t nvme_mod = { + "nvme", + nvme_modevent, + 0 +}; + +DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(nvme, 1); +MODULE_DEPEND(nvme, cam, 1, 1, 1); Modified: head/sys/dev/nvme/nvme_ahci.c ============================================================================== --- head/sys/dev/nvme/nvme_ahci.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme_ahci.c Fri Aug 23 22:52:58 2019 (r351447) @@ -55,8 +55,6 @@ static driver_t nvme_ahci_driver = { }; DRIVER_MODULE(nvme, ahci, nvme_ahci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static int nvme_ahci_probe (device_t device) Modified: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- head/sys/dev/nvme/nvme_pci.c Fri Aug 23 22:41:16 2019 (r351446) +++ head/sys/dev/nvme/nvme_pci.c Fri Aug 23 22:52:58 2019 (r351447) @@ -62,8 +62,6 @@ static driver_t nvme_pci_driver = { }; DRIVER_MODULE(nvme, pci, nvme_pci_driver, nvme_devclass, NULL, 0); -MODULE_VERSION(nvme, 1); -MODULE_DEPEND(nvme, cam, 1, 1, 1); static struct _pcsid {