Date: Fri, 29 Jul 2016 05:58:24 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303472 - head/sys/dev/hyperv/vmbus Message-ID: <201607290558.u6T5wO06030027@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Fri Jul 29 05:58:24 2016 New Revision: 303472 URL: https://svnweb.freebsd.org/changeset/base/303472 Log: hyperv/vmbus: Move driver glue to the beginning of the files Just as most of other drivers do. And move sysinit function close to its SYSINIT. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7347 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_et.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 29 05:49:12 2016 (r303471) +++ head/sys/dev/hyperv/vmbus/vmbus.c Fri Jul 29 05:58:24 2016 (r303472) @@ -142,6 +142,40 @@ vmbus_chanmsg_handlers[VMBUS_CHANMSG_TYP VMBUS_CHANMSG_PROC_WAKEUP(CONNECT_RESP) }; +static device_method_t vmbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_probe), + DEVMETHOD(device_attach, vmbus_attach), + DEVMETHOD(device_detach, vmbus_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_read_ivar, vmbus_read_ivar), + DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + + /* Vmbus interface */ + DEVMETHOD(vmbus_get_version, vmbus_get_version_method), + DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), + + DEVMETHOD_END +}; + +static driver_t vmbus_driver = { + "vmbus", + vmbus_methods, + sizeof(struct vmbus_softc) +}; + +static devclass_t vmbus_devclass; + +DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); +MODULE_DEPEND(vmbus, acpi, 1, 1, 1); +MODULE_VERSION(vmbus, 1); + static struct vmbus_msghc * vmbus_msghc_alloc(bus_dma_tag_t parent_dtag) { @@ -1248,26 +1282,6 @@ vmbus_attach(device_t dev) return (0); } -static void -vmbus_sysinit(void *arg __unused) -{ - struct vmbus_softc *sc = vmbus_get_softc(); - - if (vm_guest != VM_GUEST_HV || sc == NULL) - return; - -#ifndef EARLY_AP_STARTUP - /* - * If the system has already booted and thread - * scheduling is possible, as indicated by the - * global cold set to zero, we just call the driver - * initialization directly. - */ - if (!cold) -#endif - vmbus_doattach(sc); -} - static int vmbus_detach(device_t dev) { @@ -1297,45 +1311,30 @@ vmbus_detach(device_t dev) return (0); } -static device_method_t vmbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, vmbus_probe), - DEVMETHOD(device_attach, vmbus_attach), - DEVMETHOD(device_detach, vmbus_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_add_child, bus_generic_add_child), - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, vmbus_read_ivar), - DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), - - /* Vmbus interface */ - DEVMETHOD(vmbus_get_version, vmbus_get_version_method), - DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), - - DEVMETHOD_END -}; - -static driver_t vmbus_driver = { - "vmbus", - vmbus_methods, - sizeof(struct vmbus_softc) -}; +#ifndef EARLY_AP_STARTUP -static devclass_t vmbus_devclass; +static void +vmbus_sysinit(void *arg __unused) +{ + struct vmbus_softc *sc = vmbus_get_softc(); -DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); -MODULE_DEPEND(vmbus, acpi, 1, 1, 1); -MODULE_VERSION(vmbus, 1); + if (vm_guest != VM_GUEST_HV || sc == NULL) + return; -#ifndef EARLY_AP_STARTUP + /* + * If the system has already booted and thread + * scheduling is possible, as indicated by the + * global cold set to zero, we just call the driver + * initialization directly. + */ + if (!cold) + vmbus_doattach(sc); +} /* * NOTE: * We have to start as the last step of SI_SUB_SMP, i.e. after SMP is * initialized. */ SYSINIT(vmbus_initialize, SI_SUB_SMP, SI_ORDER_ANY, vmbus_sysinit, NULL); -#endif + +#endif /* !EARLY_AP_STARTUP */ Modified: head/sys/dev/hyperv/vmbus/vmbus_et.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_et.c Fri Jul 29 05:49:12 2016 (r303471) +++ head/sys/dev/hyperv/vmbus/vmbus_et.c Fri Jul 29 05:58:24 2016 (r303472) @@ -65,6 +65,26 @@ static int vmbus_et_start(struct event static struct eventtimer vmbus_et; +static device_method_t vmbus_et_methods[] = { + DEVMETHOD(device_identify, vmbus_et_identify), + DEVMETHOD(device_probe, vmbus_et_probe), + DEVMETHOD(device_attach, vmbus_et_attach), + DEVMETHOD(device_detach, vmbus_et_detach), + + DEVMETHOD_END +}; + +static driver_t vmbus_et_driver = { + VMBUS_ET_NAME, + vmbus_et_methods, + 0 +}; + +static devclass_t vmbus_et_devclass; + +DRIVER_MODULE(hv_et, vmbus, vmbus_et_driver, vmbus_et_devclass, NULL, NULL); +MODULE_VERSION(hv_et, 1); + static __inline uint64_t hyperv_sbintime2count(sbintime_t time) { @@ -181,22 +201,3 @@ vmbus_et_detach(device_t dev) { return (et_deregister(&vmbus_et)); } - -static device_method_t vmbus_et_methods[] = { - DEVMETHOD(device_identify, vmbus_et_identify), - DEVMETHOD(device_probe, vmbus_et_probe), - DEVMETHOD(device_attach, vmbus_et_attach), - DEVMETHOD(device_detach, vmbus_et_detach), - - DEVMETHOD_END -}; - -static driver_t vmbus_et_driver = { - VMBUS_ET_NAME, - vmbus_et_methods, - 0 -}; - -static devclass_t vmbus_et_devclass; -DRIVER_MODULE(hv_et, vmbus, vmbus_et_driver, vmbus_et_devclass, NULL, NULL); -MODULE_VERSION(hv_et, 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607290558.u6T5wO06030027>