00001 /*- 00002 * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting 00003 * Copyright (c) 2004 Atheros Communications, Inc. 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer, 00011 * without modification. 00012 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 00013 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 00014 * redistribution must be conditioned upon including a substantially 00015 * similar Disclaimer requirement for further binary redistribution. 00016 * 3. Neither the names of the above-listed copyright holders nor the names 00017 * of any contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * Alternatively, this software may be distributed under the terms of the 00021 * GNU General Public License ("GPL") version 2 as published by the Free 00022 * Software Foundation. 00023 * 00024 * NO WARRANTY 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 00028 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 00029 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 00030 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00031 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00033 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00034 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 00035 * THE POSSIBILITY OF SUCH DAMAGES. 00036 * 00037 * $Id: if_ath_bus.c,v 1.2 2004/06/04 20:27:13 jbicket Exp $ 00038 */ 00039 #include "opt_ah.h" 00040 00041 #ifndef EXPORT_SYMTAB 00042 #define EXPORT_SYMTAB 00043 #endif 00044 00045 #include <linux/config.h> 00046 #include <linux/version.h> 00047 #include <linux/module.h> 00048 #include <linux/init.h> 00049 #include <linux/if.h> 00050 #include <linux/netdevice.h> 00051 #include <linux/cache.h> 00052 00053 #include "if_athvar.h" 00054 #include "if_ath_bus.h" 00055 00056 /* 00057 * Bus independent probe (attach) function. 00058 * 00059 * pdev is a device structure pointer (for pci, this is a struct pci_dev). 00060 */ 00061 struct ath_bus_softc * 00062 ath_bus_getsc(void) 00063 { 00064 struct ath_bus_softc *sc; 00065 struct net_device *dev; 00066 00067 sc = kmalloc(sizeof(struct ath_bus_softc), GFP_KERNEL); 00068 if (sc == NULL) { 00069 printk(KERN_ERR "ath_dev_probe: no memory for device state\n"); 00070 return (NULL); 00071 } 00072 memset(sc, 0, sizeof(struct ath_bus_softc)); 00073 sc->aps_sc.sc_invalid = 1; 00074 dev = &sc->aps_sc.dev; /* XXX blech, violate layering */ 00075 memcpy(dev->name, "ath%d", sizeof("ath%d")); 00076 dev->priv = sc; 00077 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,41) 00078 dev->owner = THIS_MODULE; 00079 #else 00080 SET_MODULE_OWNER(dev); 00081 #endif 00082 return (sc); 00083 } 00084 00085 void 00086 ath_bus_freesc(struct ath_bus_softc *sc) 00087 { 00088 kfree(sc); 00089 }