Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2019 22:52:58 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351447 - head/sys/dev/nvme
Message-ID:  <201908232252.x7NMqwLq034758@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908232252.x7NMqwLq034758>