git: d5a7306c75d2 - main - ata: Remove ata_devclass from DRIVER_MODULE invocations.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 06 May 2022 22:36:17 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5a7306c75d2f9bddf7e264cbd61c83eee67f071

commit d5a7306c75d2f9bddf7e264cbd61c83eee67f071
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-05-06 22:36:10 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-06 22:36:10 +0000

    ata: Remove ata_devclass from DRIVER_MODULE invocations.
    
    Keep the global variable for its uses in ata-pci.c and
    chipsets/ata-fsl.c but initialize it in the existing
    ata_module_event_handler.  Move the module event handler a bit earlier
    to ensure the variable is set before any devices are attached.
---
 sys/dev/ata/ata-all.c            | 3 ++-
 sys/dev/ata/ata-isa.c            | 2 +-
 sys/dev/ata/ata-pci.c            | 2 +-
 sys/powerpc/powermac/ata_kauai.c | 2 +-
 sys/powerpc/powermac/ata_macio.c | 2 +-
 sys/powerpc/psim/ata_iobus.c     | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 220b3a614906..2a749712c551 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -1214,6 +1214,7 @@ ata_module_event_handler(module_t mod, int what, void *arg)
 
     switch (what) {
     case MOD_LOAD:
+	ata_devclass = devclass_find("ata");
 	return 0;
 
     case MOD_UNLOAD:
@@ -1225,6 +1226,6 @@ ata_module_event_handler(module_t mod, int what, void *arg)
 }
 
 static moduledata_t ata_moduledata = { "ata", ata_module_event_handler, NULL };
-DECLARE_MODULE(ata, ata_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND);
+DECLARE_MODULE(ata, ata_moduledata, SI_SUB_DRIVERS, SI_ORDER_ANY);
 MODULE_VERSION(ata, 1);
 MODULE_DEPEND(ata, cam, 1, 1, 1);
diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c
index 0c2b0acf0c96..281e8b0d0deb 100644
--- a/sys/dev/ata/ata-isa.c
+++ b/sys/dev/ata/ata-isa.c
@@ -204,6 +204,6 @@ static driver_t ata_isa_driver = {
     sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, isa, ata_isa_driver, ata_devclass, NULL, NULL);
+DRIVER_MODULE(ata, isa, ata_isa_driver, NULL, NULL);
 MODULE_DEPEND(ata, ata, 1, 1, 1);
 ISA_PNP_INFO(ata_ids);
diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c
index d8f97158709b..86072519c1e5 100644
--- a/sys/dev/ata/ata-pci.c
+++ b/sys/dev/ata/ata-pci.c
@@ -767,7 +767,7 @@ driver_t ata_pcichannel_driver = {
     sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, ata_devclass, NULL, NULL);
+DRIVER_MODULE(ata, atapci, ata_pcichannel_driver, NULL, NULL);
 
 /*
  * misc support fucntions
diff --git a/sys/powerpc/powermac/ata_kauai.c b/sys/powerpc/powermac/ata_kauai.c
index 75e676eadd81..80fa61e74623 100644
--- a/sys/powerpc/powermac/ata_kauai.c
+++ b/sys/powerpc/powermac/ata_kauai.c
@@ -121,7 +121,7 @@ static driver_t ata_kauai_driver = {
 	sizeof(struct ata_kauai_softc),
 };
 
-DRIVER_MODULE(ata, pci, ata_kauai_driver, ata_devclass, NULL, NULL);
+DRIVER_MODULE(ata, pci, ata_kauai_driver, NULL, NULL);
 MODULE_DEPEND(ata, ata, 1, 1, 1);
 
 /*
diff --git a/sys/powerpc/powermac/ata_macio.c b/sys/powerpc/powermac/ata_macio.c
index 0d19a2a2233b..bb0f90f99dec 100644
--- a/sys/powerpc/powermac/ata_macio.c
+++ b/sys/powerpc/powermac/ata_macio.c
@@ -149,7 +149,7 @@ static driver_t ata_macio_driver = {
 	sizeof(struct ata_macio_softc),
 };
 
-DRIVER_MODULE(ata, macio, ata_macio_driver, ata_devclass, NULL, NULL);
+DRIVER_MODULE(ata, macio, ata_macio_driver, NULL, NULL);
 MODULE_DEPEND(ata, ata, 1, 1, 1);
 
 static int
diff --git a/sys/powerpc/psim/ata_iobus.c b/sys/powerpc/psim/ata_iobus.c
index 645e92792655..95d916df3b64 100644
--- a/sys/powerpc/psim/ata_iobus.c
+++ b/sys/powerpc/psim/ata_iobus.c
@@ -230,7 +230,7 @@ static driver_t ata_iobus_sub_driver = {
 	sizeof(struct ata_channel),
 };
 
-DRIVER_MODULE(ata, ataiobus, ata_iobus_sub_driver, ata_devclass, NULL, NULL);
+DRIVER_MODULE(ata, ataiobus, ata_iobus_sub_driver, NULL, NULL);
 
 static int
 ata_iobus_sub_probe(device_t dev)