From 4c13d4d136949d87b8343d2e202cea8252058d1c Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Sat, 17 Apr 2010 16:20:02 +0200 Subject: [PATCH 2/2] ath - Fix module loading. This registers the modules ath_hal and ath_rate, so they are properly handled. Also both are now a dependency for if_ath so they get automatically loaded when loading if_ath and thus avoiding the missing symbols error upon kldload. Also 'if_ath_load=YES' on /boot/loader.conf is fixed with this commit. --- sys/dev/netif/ath/ath/if_ath_pci.c | 5 ++++- sys/dev/netif/ath/hal/ah_osdep.c | 26 ++++++++++++++++++++++++++ sys/dev/netif/ath/rate_sample/sample.c | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletions(-) diff --git a/sys/dev/netif/ath/ath/if_ath_pci.c b/sys/dev/netif/ath/ath/if_ath_pci.c index 669b2b8..fbefeab 100644 --- a/sys/dev/netif/ath/ath/if_ath_pci.c +++ b/sys/dev/netif/ath/ath/if_ath_pci.c @@ -249,4 +249,7 @@ static driver_t ath_pci_driver = { static devclass_t ath_devclass; DRIVER_MODULE(ath, pci, ath_pci_driver, ath_devclass, 0, 0); MODULE_VERSION(ath, 1); -MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */ + +MODULE_DEPEND(ath, ath_hal, 1, 1, 1); /* Atheros HAL */ +MODULE_DEPEND(ath, ath_rate, 1, 1, 1); /* rate control algorithm */ +MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */ diff --git a/sys/dev/netif/ath/hal/ah_osdep.c b/sys/dev/netif/ath/hal/ah_osdep.c index fe4f420..1ca3409 100644 --- a/sys/dev/netif/ath/hal/ah_osdep.c +++ b/sys/dev/netif/ath/hal/ah_osdep.c @@ -356,3 +356,29 @@ ath_hal_assert_failed(const char* filename, int lineno, const char *msg) panic("ath_hal_assert"); } #endif /* AH_ASSERT */ + +/* + * Module glue. + */ +static int +ath_hal_modevent(module_t mod, int type, void *unused) +{ + switch (type) { + case MOD_LOAD: + kprintf("ath_hal loaded\n"); + return 0; + case MOD_UNLOAD: + return 0; + } + + return EINVAL; +} + +static moduledata_t ath_hal_mod = { + "ath_hal", + ath_hal_modevent, + 0 +}; + +DECLARE_MODULE(ath_hal, ath_hal_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); +MODULE_VERSION(ath_hal, 1); diff --git a/sys/dev/netif/ath/rate_sample/sample.c b/sys/dev/netif/ath/rate_sample/sample.c index 465ac72..a1047cd 100644 --- a/sys/dev/netif/ath/rate_sample/sample.c +++ b/sys/dev/netif/ath/rate_sample/sample.c @@ -998,3 +998,30 @@ ath_rate_detach(struct ath_ratectrl *arc) kfree(ssc, M_DEVBUF); } + +/* + * Module glue. + */ +static int +sample_modevent(module_t mod, int type, void *unused) +{ + switch (type) { + case MOD_LOAD: + if (bootverbose) + kprintf("ath_rate: \n"); + return 0; + case MOD_UNLOAD: + return 0; + } + return EINVAL; +} + +static moduledata_t sample_mod = { + "ath_rate", + sample_modevent, + 0 +}; +DECLARE_MODULE(ath_rate, sample_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +MODULE_VERSION(ath_rate, 1); +MODULE_DEPEND(ath_rate, ath_hal, 1, 1, 1); /* Atheros HAL */ +MODULE_DEPEND(ath_rate, wlan, 1, 1, 1); -- 1.6.6.2