]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/brcm80211/util/linux_osl.c
2f76aaf7357002973239e926981c49a6db4dc629
[karo-tx-linux.git] / drivers / staging / brcm80211 / util / linux_osl.c
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #include <linux/delay.h>
18 #include <linux/fs.h>
19 #ifdef mips
20 #include <asm/paccess.h>
21 #endif                          /* mips */
22 #include <linux/module.h>
23 #include <linux/pci.h>
24 #include <linux/netdevice.h>
25 #include <linux/sched.h>
26 #include <bcmdefs.h>
27 #include <osl.h>
28 #include <bcmutils.h>
29 #include <pcicfg.h>
30
31
32 #define OS_HANDLE_MAGIC         0x1234abcd      /* Magic # to recognise osh */
33 #define BCM_MEM_FILENAME_LEN    24      /* Mem. filename length */
34
35 struct osl_info *osl_attach(void *pdev, uint bustype)
36 {
37         struct osl_info *osh;
38
39         osh = kmalloc(sizeof(struct osl_info), GFP_ATOMIC);
40         ASSERT(osh);
41
42         memset(osh, 0, sizeof(struct osl_info));
43         osh->magic = OS_HANDLE_MAGIC;
44         return osh;
45 }
46
47 void osl_detach(struct osl_info *osh)
48 {
49         if (osh == NULL)
50                 return;
51
52         ASSERT(osh->magic == OS_HANDLE_MAGIC);
53         kfree(osh);
54 }