commit b7e3495dc0f9a83566bd4bae96af0590944557ea Author: Jiri Slaby Date: Sun Jun 17 10:17:36 2007 +0200 ah_osdep cleanup diff --git a/openhal/ah_osdep.c b/openhal/ah_osdep.c index 0d87d48..1b83167 100644 --- a/openhal/ah_osdep.c +++ b/openhal/ah_osdep.c @@ -9,85 +9,52 @@ * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * $Id$ */ -#include "ah.h" - -/*Definitions for module loading/unloading - *combatible with 2.4 and 2.6 kernels*/ - -#ifndef __MOD_INC_USE_COUNT -#define AH_MOD_INC_USE_COUNT(_m) \ - if (!try_module_get(_m)) { \ - printk(KERN_WARNING "try_module_get failed\n"); \ - return NULL; \ - } -#define AH_MOD_DEC_USE_COUNT(_m) module_put(_m) -#else -#define AH_MOD_INC_USE_COUNT(_m) MOD_INC_USE_COUNT -#define AH_MOD_DEC_USE_COUNT(_m) MOD_DEC_USE_COUNT -#endif - -static char *dev_info = "ath_hal"; - -MODULE_AUTHOR("Nick Kossifidis"); -MODULE_DESCRIPTION("OpenHAL"); -MODULE_SUPPORTED_DEVICE("Atheros AR5xxx WLAN cards"); -#ifdef MODULE_LICENSE -MODULE_LICENSE("Dual BSD/GPL"); -#endif +#include "ath5k.h" -/*Attach/Dettach to HAL*/ +static char dev_info[] = "ath_hal"; -struct ath_hal * -_ath_hal_attach(u_int16_t devid, AR5K_SOFTC sc, - AR5K_BUS_TAG t, AR5K_BUS_HANDLE h, void* s) +struct ath_hal *_ath_hal_attach(u_int16_t devid, AR5K_SOFTC sc, + AR5K_BUS_TAG t, AR5K_BUS_HANDLE h, void *s) { - AR5K_STATUS status; - struct ath_hal *ah = ath5k_hw_init(devid, sc, t, h, &status); + AR5K_STATUS status; + struct ath_hal *ah = ath5k_hw_init(devid, sc, t, h, &status); + + *(AR5K_STATUS *)s = status; + if (ah && !try_module_get(THIS_MODULE)) { + printk(KERN_WARNING "try_module_get failed\n"); + kfree(ah); + return NULL; + } - *(AR5K_STATUS *)s = status; - if (ah) - AH_MOD_INC_USE_COUNT(THIS_MODULE); - return ah; + return ah; } +EXPORT_SYMBOL(_ath_hal_attach); -void -ath_hal_detach(struct ath_hal *ah) +void ath_hal_detach(struct ath_hal *ah) { - (*ah->ah_detach)(ah); - AH_MOD_DEC_USE_COUNT(THIS_MODULE); + ah->ah_detach(ah); + module_put(THIS_MODULE); } - -EXPORT_SYMBOL(ath_hal_probe); -EXPORT_SYMBOL(_ath_hal_attach); EXPORT_SYMBOL(ath_hal_detach); -EXPORT_SYMBOL(ath_hal_init_channels); -EXPORT_SYMBOL(ath_hal_getwirelessmodes); -EXPORT_SYMBOL(ath_hal_computetxtime); -EXPORT_SYMBOL(ath_hal_mhz2ieee); -EXPORT_SYMBOL(ath_hal_ieee2mhz); -static int __init -init_ath_hal(void) +static int __init ath_hal_init(void) { - printk(KERN_INFO "%s: OpenHAL loaded (AR5210, AR5211, AR5212, RF5110/1/2)\n", dev_info); - return (0); + printk(KERN_INFO "%s: OpenHAL loaded (AR5210, AR5211, AR5212, " + "RF5110/1/2)\n", dev_info); + return 0; } -module_init(init_ath_hal); -static void __exit -exit_ath_hal(void) +static void __exit ath_hal_exit(void) { printk(KERN_INFO "%s: driver unloaded\n", dev_info); } -module_exit(exit_ath_hal); + +module_init(ath_hal_init); +module_exit(ath_hal_exit); + +MODULE_AUTHOR("Nick Kossifidis"); +MODULE_DESCRIPTION("OpenHAL"); +MODULE_SUPPORTED_DEVICE("Atheros AR5xxx WLAN cards"); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/openhal/ath5k_hw.c b/openhal/ath5k_hw.c index 5ceb363..ee9ba92 100644 --- a/openhal/ath5k_hw.c +++ b/openhal/ath5k_hw.c @@ -156,6 +156,7 @@ ath_hal_probe(u_int16_t vendor, u_int16_t device) return (NULL); } +EXPORT_SYMBOL(ath_hal_probe); /* * Calculate transmition time of a frame @@ -222,6 +223,7 @@ ath_hal_computetxtime(struct ath_hal *hal, const AR5K_RATE_TABLE *rates, return (value); } +EXPORT_SYMBOL(ath_hal_computetxtime); /* * Return the supported 802.11 operation modes @@ -239,6 +241,7 @@ ath_hal_getwirelessmodes(struct ath_hal *hal, AR5K_CTRY_CODE country) return(AR5K_MODE_11A); } } +EXPORT_SYMBOL(ath_hal_getwirelessmodes); /* * Functions used internaly @@ -4734,6 +4737,7 @@ ath_hal_mhz2ieee(u_int freq, u_int flags) /* something is fishy, don't do anything */ return 0; } +EXPORT_SYMBOL(ath_hal_mhz2ieee); /* * Convert IEEE channel number to MHz frequency. @@ -4760,6 +4764,7 @@ ath_hal_ieee2mhz(u_int chan, u_int flags) return 5000 + (chan * 5); } } +EXPORT_SYMBOL(ath_hal_ieee2mhz); /* * Check if a channel is supported @@ -4920,6 +4925,7 @@ for loop starts from 1 and all channels are marked as 5GHz M.F.*/ kfree(all_channels); return (TRUE); } +EXPORT_SYMBOL(ath_hal_init_channels); /* * Regdomain stuff, these also don't belong here etc