]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: brcm80211: cleanup declaration in osl.h
authorArend van Spriel <arend@broadcom.com>
Wed, 2 Mar 2011 20:18:44 +0000 (21:18 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 3 Mar 2011 00:48:04 +0000 (19:48 -0500)
Several declarations and macro definitions in osl.h are still needed
and therefore moved to bcmutils.h or hnddma.h. The osl_assert function
is moved to bcmutils.c accordingly.

Reviewed-by: Brett Rudley <brudley@broadcom.com>
Reviewed-by: Henry Ptasinski <henryp@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
drivers/staging/brcm80211/include/bcmutils.h
drivers/staging/brcm80211/include/hnddma.h
drivers/staging/brcm80211/include/osl.h
drivers/staging/brcm80211/util/bcmutils.c
drivers/staging/brcm80211/util/linux_osl.c

index 1d2d79080eb3496ac42a9dfdf21440e891cbf0f3..6292f4f843d7f5d9ccce11252417440dded4b3ef 100644 (file)
 #include <pcicfg.h>
 #include <bcmdefs.h>
 #include <bcmdevs.h>
+#include <bcmutils.h>
 
 #if defined(OOB_INTR_ONLY)
 #include <linux/irq.h>
 extern void dhdsdio_isr(void *args);
-#include <bcmutils.h>
 #include <dngl_stats.h>
 #include <dhd.h>
 #endif                         /* defined(OOB_INTR_ONLY) */
index 358bbbf27e01722301c43337982354e33e9a9592..0aa7c6f32a033a77c45ebc6ea971aaf86a0ec4e1 100644 (file)
@@ -359,7 +359,137 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
 #define REG_MAP(pa, size)       (void *)(0)
 #endif
 
-/* Register operations */
+extern u32 g_assert_type;
+
+#if defined(BCMDBG_ASSERT)
+#define ASSERT(exp) \
+         do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
+extern void osl_assert(char *exp, char *file, int line);
+#else
+#define ASSERT(exp)    do {} while (0)
+#endif  /* defined(BCMDBG_ASSERT) */
+
+/* register access macros */
+#if defined(BCMSDIO)
+#ifdef BRCM_FULLMAC
+#include <bcmsdh.h>
+#endif
+#define OSL_WRITE_REG(r, v) \
+               (bcmsdh_reg_write(NULL, (unsigned long)(r), sizeof(*(r)), (v)))
+#define OSL_READ_REG(r) \
+               (bcmsdh_reg_read(NULL, (unsigned long)(r), sizeof(*(r))))
+#endif
+
+#if defined(BCMSDIO)
+#define SELECT_BUS_WRITE(mmap_op, bus_op) bus_op
+#define SELECT_BUS_READ(mmap_op, bus_op) bus_op
+#else
+#define SELECT_BUS_WRITE(mmap_op, bus_op) mmap_op
+#define SELECT_BUS_READ(mmap_op, bus_op) mmap_op
+#endif
+
+/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
+#define        PKTBUFSZ        2048
+
+#define OSL_SYSUPTIME()                ((u32)jiffies * (1000 / HZ))
+#ifdef BRCM_FULLMAC
+#include <linux/kernel.h>      /* for vsn/printf's */
+#include <linux/string.h>      /* for mem*, str* */
+#endif
+/* bcopy's: Linux kernel doesn't provide these (anymore) */
+#define        bcopy(src, dst, len)    memcpy((dst), (src), (len))
+
+/* register access macros */
+#ifndef IL_BIGENDIAN
+#ifndef __mips__
+#define R_REG(r) (\
+       SELECT_BUS_READ(sizeof(*(r)) == sizeof(u8) ? \
+       readb((volatile u8*)(r)) : \
+       sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
+       readl((volatile u32*)(r)), OSL_READ_REG(r)) \
+)
+#else                          /* __mips__ */
+#define R_REG(r) (\
+       SELECT_BUS_READ( \
+               ({ \
+                       __typeof(*(r)) __osl_v; \
+                       __asm__ __volatile__("sync"); \
+                       switch (sizeof(*(r))) { \
+                       case sizeof(u8): \
+                               __osl_v = readb((volatile u8*)(r)); \
+                               break; \
+                       case sizeof(u16): \
+                               __osl_v = readw((volatile u16*)(r)); \
+                               break; \
+                       case sizeof(u32): \
+                               __osl_v = \
+                               readl((volatile u32*)(r)); \
+                               break; \
+                       } \
+                       __asm__ __volatile__("sync"); \
+                       __osl_v; \
+               }), \
+               ({ \
+                       __typeof(*(r)) __osl_v; \
+                       __asm__ __volatile__("sync"); \
+                       __osl_v = OSL_READ_REG(r); \
+                       __asm__ __volatile__("sync"); \
+                       __osl_v; \
+               })) \
+)
+#endif                         /* __mips__ */
+
+#define W_REG(r, v) do { \
+       SELECT_BUS_WRITE( \
+               switch (sizeof(*(r))) { \
+               case sizeof(u8): \
+                       writeb((u8)(v), (volatile u8*)(r)); break; \
+               case sizeof(u16): \
+                       writew((u16)(v), (volatile u16*)(r)); break; \
+               case sizeof(u32): \
+                       writel((u32)(v), (volatile u32*)(r)); break; \
+               }, \
+               (OSL_WRITE_REG(r, v))); \
+       } while (0)
+#else                          /* IL_BIGENDIAN */
+#define R_REG(r) (\
+       SELECT_BUS_READ( \
+               ({ \
+                       __typeof(*(r)) __osl_v; \
+                       switch (sizeof(*(r))) { \
+                       case sizeof(u8): \
+                               __osl_v = \
+                               readb((volatile u8*)((r)^3)); \
+                               break; \
+                       case sizeof(u16): \
+                               __osl_v = \
+                               readw((volatile u16*)((r)^2)); \
+                               break; \
+                       case sizeof(u32): \
+                               __osl_v = readl((volatile u32*)(r)); \
+                               break; \
+                       } \
+                       __osl_v; \
+               }), \
+               OSL_READ_REG(r)) \
+)
+#define W_REG(r, v) do { \
+       SELECT_BUS_WRITE( \
+               switch (sizeof(*(r))) { \
+               case sizeof(u8):        \
+                       writeb((u8)(v), \
+                       (volatile u8*)((r)^3)); break; \
+               case sizeof(u16):       \
+                       writew((u16)(v), \
+                       (volatile u16*)((r)^2)); break; \
+               case sizeof(u32):       \
+                       writel((u32)(v), \
+                       (volatile u32*)(r)); break; \
+               }, \
+               (OSL_WRITE_REG(r, v))); \
+       } while (0)
+#endif                         /* IL_BIGENDIAN */
+
 #define AND_REG(r, v)  W_REG((r), R_REG(r) & (v))
 #define OR_REG(r, v)   W_REG((r), R_REG(r) | (v))
 
index 17fa166f3968064a716e738c9debf44989a77d29..363898359d08db7d587a05ac529a236ce29d265d 100644 (file)
 struct hnddma_pub;
 #endif                         /* _hnddma_pub_ */
 
+/* map/unmap direction */
+#define        DMA_TX  1               /* TX direction for DMA */
+#define        DMA_RX  2               /* RX direction for DMA */
+#define BUS_SWAP32(v)          (v)
+
 /* range param for dma_getnexttxp() and dma_txreclaim */
 typedef enum txd_range {
        HNDDMA_RANGE_ALL = 1,
index 02faf30372a3efe0c4fe9a962d437a9942daaf5b..e48c7ba9af126efbe4916c45128b3c6e6cba462d 100644 (file)
@@ -29,146 +29,4 @@ typedef struct osl_dmainfo osldma_t;
 extern struct osl_info *osl_attach(void *pdev, uint bustype);
 extern void osl_detach(struct osl_info *osh);
 
-extern u32 g_assert_type;
-
-#if defined(BCMDBG_ASSERT)
-#define ASSERT(exp) \
-         do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0)
-extern void osl_assert(char *exp, char *file, int line);
-#else
-#define ASSERT(exp)    do {} while (0)
-#endif  /* defined(BCMDBG_ASSERT) */
-
-/* PCI device bus # and slot # */
-#define OSL_PCI_BUS(osh)       osl_pci_bus(osh)
-#define OSL_PCI_SLOT(osh)      osl_pci_slot(osh)
-extern uint osl_pci_bus(struct osl_info *osh);
-extern uint osl_pci_slot(struct osl_info *osh);
-
-#define BUS_SWAP32(v)          (v)
-
-/* map/unmap direction */
-#define        DMA_TX  1               /* TX direction for DMA */
-#define        DMA_RX  2               /* RX direction for DMA */
-
-/* register access macros */
-#if defined(BCMSDIO)
-#ifdef BRCM_FULLMAC
-#include <bcmsdh.h>
-#endif
-#define OSL_WRITE_REG(r, v) \
-               (bcmsdh_reg_write(NULL, (unsigned long)(r), sizeof(*(r)), (v)))
-#define OSL_READ_REG(r) \
-               (bcmsdh_reg_read(NULL, (unsigned long)(r), sizeof(*(r))))
-#endif
-
-#if defined(BCMSDIO)
-#define SELECT_BUS_WRITE(mmap_op, bus_op) bus_op
-#define SELECT_BUS_READ(mmap_op, bus_op) bus_op
-#else
-#define SELECT_BUS_WRITE(mmap_op, bus_op) mmap_op
-#define SELECT_BUS_READ(mmap_op, bus_op) mmap_op
-#endif
-
-/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
-#define        PKTBUFSZ        2048
-
-#define OSL_SYSUPTIME()                ((u32)jiffies * (1000 / HZ))
-#ifdef BRCM_FULLMAC
-#include <linux/kernel.h>      /* for vsn/printf's */
-#include <linux/string.h>      /* for mem*, str* */
-#endif
-
-/* register access macros */
-#ifndef IL_BIGENDIAN
-#ifndef __mips__
-#define R_REG(r) (\
-       SELECT_BUS_READ(sizeof(*(r)) == sizeof(u8) ? \
-       readb((volatile u8*)(r)) : \
-       sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
-       readl((volatile u32*)(r)), OSL_READ_REG(r)) \
-)
-#else                          /* __mips__ */
-#define R_REG(r) (\
-       SELECT_BUS_READ( \
-               ({ \
-                       __typeof(*(r)) __osl_v; \
-                       __asm__ __volatile__("sync"); \
-                       switch (sizeof(*(r))) { \
-                       case sizeof(u8): \
-                               __osl_v = readb((volatile u8*)(r)); \
-                               break; \
-                       case sizeof(u16): \
-                               __osl_v = readw((volatile u16*)(r)); \
-                               break; \
-                       case sizeof(u32): \
-                               __osl_v = \
-                               readl((volatile u32*)(r)); \
-                               break; \
-                       } \
-                       __asm__ __volatile__("sync"); \
-                       __osl_v; \
-               }), \
-               ({ \
-                       __typeof(*(r)) __osl_v; \
-                       __asm__ __volatile__("sync"); \
-                       __osl_v = OSL_READ_REG(r); \
-                       __asm__ __volatile__("sync"); \
-                       __osl_v; \
-               })) \
-)
-#endif                         /* __mips__ */
-
-#define W_REG(r, v) do { \
-       SELECT_BUS_WRITE( \
-               switch (sizeof(*(r))) { \
-               case sizeof(u8): \
-                       writeb((u8)(v), (volatile u8*)(r)); break; \
-               case sizeof(u16): \
-                       writew((u16)(v), (volatile u16*)(r)); break; \
-               case sizeof(u32): \
-                       writel((u32)(v), (volatile u32*)(r)); break; \
-               }, \
-               (OSL_WRITE_REG(r, v))); \
-       } while (0)
-#else                          /* IL_BIGENDIAN */
-#define R_REG(r) (\
-       SELECT_BUS_READ( \
-               ({ \
-                       __typeof(*(r)) __osl_v; \
-                       switch (sizeof(*(r))) { \
-                       case sizeof(u8): \
-                               __osl_v = \
-                               readb((volatile u8*)((r)^3)); \
-                               break; \
-                       case sizeof(u16): \
-                               __osl_v = \
-                               readw((volatile u16*)((r)^2)); \
-                               break; \
-                       case sizeof(u32): \
-                               __osl_v = readl((volatile u32*)(r)); \
-                               break; \
-                       } \
-                       __osl_v; \
-               }), \
-               OSL_READ_REG(r)) \
-)
-#define W_REG(r, v) do { \
-       SELECT_BUS_WRITE( \
-               switch (sizeof(*(r))) { \
-               case sizeof(u8):        \
-                       writeb((u8)(v), \
-                       (volatile u8*)((r)^3)); break; \
-               case sizeof(u16):       \
-                       writew((u16)(v), \
-                       (volatile u16*)((r)^2)); break; \
-               case sizeof(u32):       \
-                       writel((u32)(v), \
-                       (volatile u32*)(r)); break; \
-               }, \
-               (OSL_WRITE_REG(r, v))); \
-       } while (0)
-#endif                         /* IL_BIGENDIAN */
-
-
 #endif /* _osl_h_ */
index e31151b9dbeb81ae4b2487030aebe0266fcdf44e..d066ed7d373ff6f03920647c5dfff57334fe9fcb 100644 (file)
 #include <linux/ctype.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
-#include <bcmdefs.h>
-#include <stdarg.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
+#include <linux/sched.h>
+#include <bcmdefs.h>
+#include <stdarg.h>
 #include <osl.h>
 #include <bcmutils.h>
 #include <siutils.h>
@@ -29,6 +30,9 @@
 #include <bcmdevs.h>
 #include <proto/802.11.h>
 
+/* Global ASSERT type flag */
+u32 g_assert_type;
+
 struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len)
 {
        struct sk_buff *skb;
@@ -1091,3 +1095,49 @@ int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...)
        return r;
 }
 
+#if defined(BCMDBG_ASSERT)
+void osl_assert(char *exp, char *file, int line)
+{
+       char tempbuf[256];
+       char *basename;
+
+       basename = strrchr(file, '/');
+       /* skip the '/' */
+       if (basename)
+               basename++;
+
+       if (!basename)
+               basename = file;
+
+       snprintf(tempbuf, 256,
+                "assertion \"%s\" failed: file \"%s\", line %d\n", exp,
+                basename, line);
+
+       /*
+        * Print assert message and give it time to
+        * be written to /var/log/messages
+        */
+       if (!in_interrupt()) {
+               const int delay = 3;
+               printk(KERN_ERR "%s", tempbuf);
+               printk(KERN_ERR "panic in %d seconds\n", delay);
+               set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(delay * HZ);
+       }
+
+       switch (g_assert_type) {
+       case 0:
+               panic(KERN_ERR "%s", tempbuf);
+               break;
+       case 1:
+               printk(KERN_ERR "%s", tempbuf);
+               BUG();
+               break;
+       case 2:
+               printk(KERN_ERR "%s", tempbuf);
+               break;
+       default:
+               break;
+       }
+}
+#endif                         /* defined(BCMDBG_ASSERT) */
index 70c35e9d31a8ec5050f4dc5ff5151dbc3132d660..2f76aaf7357002973239e926981c49a6db4dc629 100644 (file)
@@ -32,9 +32,6 @@
 #define OS_HANDLE_MAGIC                0x1234abcd      /* Magic # to recognise osh */
 #define BCM_MEM_FILENAME_LEN   24      /* Mem. filename length */
 
-/* Global ASSERT type flag */
-u32 g_assert_type;
-
 struct osl_info *osl_attach(void *pdev, uint bustype)
 {
        struct osl_info *osh;
@@ -55,51 +52,3 @@ void osl_detach(struct osl_info *osh)
        ASSERT(osh->magic == OS_HANDLE_MAGIC);
        kfree(osh);
 }
-
-#if defined(BCMDBG_ASSERT)
-void osl_assert(char *exp, char *file, int line)
-{
-       char tempbuf[256];
-       char *basename;
-
-       basename = strrchr(file, '/');
-       /* skip the '/' */
-       if (basename)
-               basename++;
-
-       if (!basename)
-               basename = file;
-
-#ifdef BCMDBG_ASSERT
-       snprintf(tempbuf, 256,
-                "assertion \"%s\" failed: file \"%s\", line %d\n", exp,
-                basename, line);
-
-       /* Print assert message and give it time to be written to /var/log/messages */
-       if (!in_interrupt()) {
-               const int delay = 3;
-               printk(KERN_ERR "%s", tempbuf);
-               printk(KERN_ERR "panic in %d seconds\n", delay);
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(delay * HZ);
-       }
-
-       switch (g_assert_type) {
-       case 0:
-               panic(KERN_ERR "%s", tempbuf);
-               break;
-       case 1:
-               printk(KERN_ERR "%s", tempbuf);
-               BUG();
-               break;
-       case 2:
-               printk(KERN_ERR "%s", tempbuf);
-               break;
-       default:
-               break;
-       }
-#endif                         /* BCMDBG_ASSERT */
-
-}
-#endif                         /* defined(BCMDBG_ASSERT) */
-