staging: brcm80211: remove OSL_DELAY
[pandora-kernel.git] / drivers / staging / brcm80211 / util / linux_osl.c
index 8ad97d4..6616174 100644 (file)
@@ -43,7 +43,7 @@ typedef struct bcm_static_buf {
        unsigned char buf_use[MAX_STATIC_BUF_NUM];
 } bcm_static_buf_t;
 
-static bcm_static_buf_t *bcm_static_buf = 0;
+static bcm_static_buf_t *bcm_static_buf;
 
 #define MAX_STATIC_PKT_NUM 8
 typedef struct bcm_static_pkt {
@@ -52,15 +52,8 @@ typedef struct bcm_static_pkt {
        struct semaphore osl_pkt_sem;
        unsigned char pkt_use[MAX_STATIC_PKT_NUM * 2];
 } bcm_static_pkt_t;
-static bcm_static_pkt_t *bcm_static_skb = 0;
+static bcm_static_pkt_t *bcm_static_skb;
 #endif                         /* DHD_USE_STATIC_BUF */
-typedef struct bcm_mem_link {
-       struct bcm_mem_link *prev;
-       struct bcm_mem_link *next;
-       uint size;
-       int line;
-       char file[BCM_MEM_FILENAME_LEN];
-} bcm_mem_link_t;
 
 struct osl_info {
        osl_pubinfo_t pub;
@@ -69,7 +62,6 @@ struct osl_info {
        uint malloced;
        uint failed;
        uint bustype;
-       bcm_mem_link_t *dbgmem_list;
 };
 
 /* Global ASSERT type flag */
@@ -154,13 +146,12 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
 
 #ifdef BRCM_FULLMAC
        /* Check that error map has the right number of entries in it */
-       ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(linuxbcmerrormap) - 1));
+       ASSERT(ABS(BCME_LAST) == (ARRAY_SIZE(linuxbcmerrormap) - 1));
 #endif /* BRCM_FULLMAC */
 
        osh->magic = OS_HANDLE_MAGIC;
        osh->malloced = 0;
        osh->failed = 0;
-       osh->dbgmem_list = NULL;
        osh->pdev = pdev;
        osh->pub.pkttag = pkttag;
        osh->bustype = bustype;
@@ -169,25 +160,25 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
        case PCI_BUS:
        case SI_BUS:
        case PCMCIA_BUS:
-               osh->pub.mmbus = TRUE;
+               osh->pub.mmbus = true;
                break;
        case JTAG_BUS:
        case SDIO_BUS:
        case USB_BUS:
        case SPI_BUS:
        case RPC_BUS:
-               osh->pub.mmbus = FALSE;
+               osh->pub.mmbus = false;
                break;
        default:
-               ASSERT(FALSE);
+               ASSERT(false);
                break;
        }
 
 #if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
        if (!bcm_static_buf) {
-               if (!(bcm_static_buf =
-                    (bcm_static_buf_t *) dhd_os_prealloc(3,
-                         STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) {
+               bcm_static_buf = (bcm_static_buf_t *) dhd_os_prealloc(3,
+                                       STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN);
+               if (!bcm_static_buf) {
                        printk(KERN_ERR "can not alloc static buf!\n");
                } else
                        printk(KERN_ERR "alloc static buf at %x!\n",
@@ -514,27 +505,19 @@ uint osl_dma_consistent_align(void)
        return PAGE_SIZE;
 }
 
-#ifdef BRCM_FULLMAC
-void *osl_dma_alloc_consistent(osl_t *osh, uint size, unsigned long *pap)
-{
-       ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
-
-       return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap);
-}
-#else /* !BRCM_FULLMAC */
 void *osl_dma_alloc_consistent(osl_t *osh, uint size, u16 align_bits,
                               uint *alloced, unsigned long *pap)
 {
-       u16 align = (1 << align_bits);
        ASSERT((osh && (osh->magic == OS_HANDLE_MAGIC)));
 
-       if (!ISALIGNED(DMA_CONSISTENT_ALIGN, align))
-               size += align;
-       *alloced = size;
-
+       if (align_bits) {
+               u16 align = (1 << align_bits);
+               if (!IS_ALIGNED(DMA_CONSISTENT_ALIGN, align))
+                       size += align;
+               *alloced = size;
+       }
        return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap);
 }
-#endif /* BRCM_FULLMAC */
 
 void osl_dma_free_consistent(osl_t *osh, void *va, uint size, unsigned long pa)
 {
@@ -608,17 +591,6 @@ void osl_assert(char *exp, char *file, int line)
 }
 #endif                         /* defined(BCMDBG_ASSERT) */
 
-void osl_delay(uint usec)
-{
-       uint d;
-
-       while (usec > 0) {
-               d = MIN(usec, 1000);
-               udelay(d);
-               usec -= d;
-       }
-}
-
 #if defined(BCMSDIO) && !defined(BRCM_FULLMAC)
 u8 osl_readb(osl_t *osh, volatile u8 *r)
 {