acpi/pcib: Use DEFINE_CLASS_1 to define acpi_pcib driver
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 2 Sep 2011 11:48:11 +0000 (19:48 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 2 Sep 2011 11:59:14 +0000 (19:59 +0800)
This avoids code duplication and maintenance headache

sys/dev/acpica5/acpi_pcib_pci.c

index 2768a8c..568c25d 100644 (file)
@@ -71,39 +71,21 @@ static device_method_t acpi_pcib_pci_methods[] = {
     /* Device interface */
     DEVMETHOD(device_probe,            acpi_pcib_pci_probe),
     DEVMETHOD(device_attach,           acpi_pcib_pci_attach),
-    DEVMETHOD(device_shutdown,         bus_generic_shutdown),
-    DEVMETHOD(device_suspend,          bus_generic_suspend),
     DEVMETHOD(device_resume,           acpi_pcib_pci_resume),
 
     /* Bus interface */
-    DEVMETHOD(bus_print_child,         bus_generic_print_child),
     DEVMETHOD(bus_read_ivar,           acpi_pcib_read_ivar),
-    DEVMETHOD(bus_write_ivar,          pcib_write_ivar),
-    DEVMETHOD(bus_alloc_resource,      pcib_alloc_resource),
-    DEVMETHOD(bus_release_resource,    bus_generic_release_resource),
-    DEVMETHOD(bus_activate_resource,   bus_generic_activate_resource),
-    DEVMETHOD(bus_deactivate_resource,         bus_generic_deactivate_resource),
-    DEVMETHOD(bus_setup_intr,          bus_generic_setup_intr),
-    DEVMETHOD(bus_teardown_intr,       bus_generic_teardown_intr),
 
     /* pcib interface */
-    DEVMETHOD(pcib_maxslots,           pcib_maxslots),
-    DEVMETHOD(pcib_read_config,                pcib_read_config),
-    DEVMETHOD(pcib_write_config,       pcib_write_config),
     DEVMETHOD(pcib_route_interrupt,    acpi_pcib_pci_route_interrupt),
-#ifdef MSI
-    DEVMETHOD(pcib_alloc_msi,          pcib_alloc_msi),
-    DEVMETHOD(pcib_release_msi,                pcib_release_msi),
-    DEVMETHOD(pcib_alloc_msix,         pcib_alloc_msix),
-    DEVMETHOD(pcib_release_msix,       pcib_release_msix),
-    DEVMETHOD(pcib_map_msi,            pcib_map_msi),
-#endif
+
     {0, 0}
 };
 
 static devclass_t pcib_devclass;
-DEFINE_CLASS_0(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
-    sizeof(struct acpi_pcib_softc));
+
+DEFINE_CLASS_1(pcib, acpi_pcib_pci_driver, acpi_pcib_pci_methods,
+    sizeof(struct acpi_pcib_softc), pcib_driver);
 DRIVER_MODULE(acpi_pcib, pci, acpi_pcib_pci_driver, pcib_devclass, NULL, NULL);
 MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1);