]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/staging/brcm80211/brcmfmac/bcmutils.c
Staging: brcm80211: s/uint32/u32/
[net-next-2.6.git] / drivers / staging / brcm80211 / brcmfmac / bcmutils.c
index 0f4b3f3200a539efa96fcfb10c0241edf9c775ef..4db3acc763b955a285f2ee11bb98f1c62992d4ad 100644 (file)
@@ -42,7 +42,7 @@
 #ifdef BCMDRIVER
 
 /* copy a pkt buffer chain into a buffer */
-uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar * buf)
+uint pktcopy(osl_t *osh, void *p, uint offset, int len, unsigned char * buf)
 {
        uint n, ret = 0;
 
@@ -73,7 +73,7 @@ uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar * buf)
 }
 
 /* copy a buffer into a pkt buffer chain */
-uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf)
+uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, unsigned char *buf)
 {
        uint n, ret = 0;
 
@@ -307,9 +307,9 @@ void pktq_init(struct pktq *pq, int num_prec, int max_len)
        bzero(pq,
              OFFSETOF(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec));
 
-       pq->num_prec = (uint16) num_prec;
+       pq->num_prec = (u16) num_prec;
 
-       pq->max = (uint16) max_len;
+       pq->max = (u16) max_len;
 
        for (prec = 0; prec < num_prec; prec++)
                pq->q[prec].max = pq->max;
@@ -530,9 +530,9 @@ const unsigned char bcm_ctype[] = {
        _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L  /* 240-255 */
 };
 
-ulong bcm_strtoul(char *cp, char **endp, uint base)
+unsigned long bcm_strtoul(char *cp, char **endp, uint base)
 {
-       ulong result, last_result = 0, value;
+       unsigned long result, last_result = 0, value;
        bool minus;
 
        minus = FALSE;
@@ -572,13 +572,13 @@ ulong bcm_strtoul(char *cp, char **endp, uint base)
                result = result * base + value;
                /* Detected overflow */
                if (result < last_result && !minus)
-                       return (ulong)-1;
+                       return (unsigned long)-1;
                last_result = result;
                cp++;
        }
 
        if (minus)
-               result = (ulong) (-(long)result);
+               result = (unsigned long) (-(long)result);
 
        if (endp)
                *endp = (char *)cp;
@@ -807,16 +807,16 @@ int bcm_ether_atoe(char *p, struct ether_addr *ea)
  * parameter order is like strncpy, but returns count
  * of bytes copied. Minimum bytes copied is null char(1)/wchar(2)
  */
-ulong wchar2ascii(char *abuf, ushort * wbuf, ushort wbuflen, ulong abuflen)
+unsigned long wchar2ascii(char *abuf, unsigned short * wbuf, unsigned short wbuflen, unsigned long abuflen)
 {
-       ulong copyct = 1;
-       ushort i;
+       unsigned long copyct = 1;
+       unsigned short i;
 
        if (abuflen == 0)
                return 0;
 
        /* wbuflen is in bytes */
-       wbuflen /= sizeof(ushort);
+       wbuflen /= sizeof(unsigned short);
 
        for (i = 0; i < wbuflen; ++i) {
                if (--abuflen == 0)
@@ -883,12 +883,12 @@ uint pktsetprio(void *pkt, bool update_vtag)
        int rc = 0;
 
        pktdata = (u8 *) PKTDATA(pkt);
-       ASSERT(ISALIGNED((uintptr) pktdata, sizeof(uint16)));
+       ASSERT(ISALIGNED((uintptr) pktdata, sizeof(u16)));
 
        eh = (struct ether_header *)pktdata;
 
        if (ntoh16(eh->ether_type) == ETHER_TYPE_8021Q) {
-               uint16 vlan_tag;
+               u16 vlan_tag;
                int vlan_prio, dscp_prio = 0;
 
                evh = (struct ethervlan_header *)eh;
@@ -920,7 +920,7 @@ uint pktsetprio(void *pkt, bool update_vtag)
                 */
                if (update_vtag && (priority != vlan_prio)) {
                        vlan_tag &= ~(VLAN_PRI_MASK << VLAN_PRI_SHIFT);
-                       vlan_tag |= (uint16) priority << VLAN_PRI_SHIFT;
+                       vlan_tag |= (u16) priority << VLAN_PRI_SHIFT;
                        evh->vlan_tag = hton16(vlan_tag);
                        rc |= PKTPRIO_UPD;
                }
@@ -1049,7 +1049,7 @@ int bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set)
  * ****************************************************************************
  */
 
-STATIC const u8 crc8_table[256] = {
+static const u8 crc8_table[256] = {
        0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B,
        0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21,
        0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF,
@@ -1085,7 +1085,7 @@ STATIC const u8 crc8_table[256] = {
 };
 
 #define CRC_INNER_LOOP(n, c, x) \
-       (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff]
+       ((c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff])
 
 u8 hndcrc8(u8 *pdata,  /* pointer to array of data to process */
              uint nbytes,      /* number of input data bytes to process */
@@ -1124,7 +1124,7 @@ u8 hndcrc8(u8 *pdata,     /* pointer to array of data to process */
  * ****************************************************************************
  */
 
-static const uint16 crc16_table[256] = {
+static const u16 crc16_table[256] = {
        0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
        0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
        0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
@@ -1159,9 +1159,9 @@ static const uint16 crc16_table[256] = {
        0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
 };
 
-uint16 hndcrc16(u8 *pdata,     /* pointer to array of data to process */
+u16 hndcrc16(u8 *pdata,        /* pointer to array of data to process */
                uint nbytes,    /* number of input data bytes to process */
-               uint16 crc      /* either CRC16_INIT_VALUE or previous
+               u16 crc /* either CRC16_INIT_VALUE or previous
                                 return value */
 )
 {
@@ -1170,7 +1170,7 @@ uint16 hndcrc16(u8 *pdata,        /* pointer to array of data to process */
        return crc;
 }
 
-STATIC const uint32 crc32_table[256] = {
+static const u32 crc32_table[256] = {
        0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
        0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
        0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
@@ -1237,16 +1237,16 @@ STATIC const uint32 crc32_table[256] = {
        0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
 };
 
-uint32 hndcrc32(u8 *pdata,     /* pointer to array of data to process */
+u32 hndcrc32(u8 *pdata,        /* pointer to array of data to process */
                uint nbytes,    /* number of input data bytes to process */
-               uint32 crc      /* either CRC32_INIT_VALUE or previous
+               u32 crc /* either CRC32_INIT_VALUE or previous
                                         return value */
 )
 {
        u8 *pend;
 #ifdef __mips__
        u8 tmp[4];
-       ulong *tptr = (ulong *) tmp;
+       unsigned long *tptr = (unsigned long *) tmp;
 
        /* in case the beginning of the buffer isn't aligned */
        pend = (u8 *) ((uint) (pdata + 3) & 0xfffffffc);
@@ -1257,8 +1257,8 @@ uint32 hndcrc32(u8 *pdata,        /* pointer to array of data to process */
        /* handle bulk of data as 32-bit words */
        pend = pdata + (nbytes & 0xfffffffc);
        while (pdata < pend) {
-               *tptr = *(ulong *) pdata;
-               pdata += sizeof(ulong *);
+               *tptr = *(unsigned long *) pdata;
+               pdata += sizeof(unsigned long *);
                CRC_INNER_LOOP(32, crc, tmp[0]);
                CRC_INNER_LOOP(32, crc, tmp[1]);
                CRC_INNER_LOOP(32, crc, tmp[2]);
@@ -1288,8 +1288,8 @@ void testcrc32(void)
        uint j, k, l;
        u8 *buf;
        uint len[CNBUFS];
-       uint32 crcr;
-       uint32 crc32tv[CNBUFS] = {
+       u32 crcr;
+       u32 crc32tv[CNBUFS] = {
                0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110};
 
        ASSERT((buf = MALLOC(CBUFSIZ * CNBUFS)) != NULL);
@@ -1408,13 +1408,13 @@ bcm_tlv_t *bcm_parse_ordered_tlvs(void *buf, int buflen, uint key)
 #if defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || defined(WLMSG_ASSOC) || \
        defined(DHD_DEBUG)
 int
-bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char *buf, int len)
+bcm_format_flags(const bcm_bit_desc_t *bd, u32 flags, char *buf, int len)
 {
        int i;
        char *p = buf;
        char hexstr[16];
        int slen = 0;
-       uint32 bit;
+       u32 bit;
        const char *name;
 
        if (len < 2 || !buf)
@@ -1473,7 +1473,7 @@ int bcm_format_hex(char *str, const void *bytes, int len)
 }
 
 /* pretty hex print a contiguous buffer */
-void prhex(const char *msg, uchar *buf, uint nbytes)
+void prhex(const char *msg, unsigned char *buf, uint nbytes)
 {
        char line[128], *p;
        uint i;
@@ -1500,7 +1500,7 @@ void prhex(const char *msg, uchar *buf, uint nbytes)
 #endif         /* defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) */
 
 /* Produce a human-readable string for boardrev */
-char *bcm_brev_str(uint32 brev, char *buf)
+char *bcm_brev_str(u32 brev, char *buf)
 {
        if (brev < 0x100)
                snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf);
@@ -1540,7 +1540,7 @@ void printbig(char *buf)
 /* routine to dump fields in a fileddesc structure */
 uint
 bcmdumpfields(bcmutl_rdreg_rtn read_rtn, void *arg0, uint arg1,
-             struct fielddesc *fielddesc_array, char *buf, uint32 bufsize)
+             struct fielddesc *fielddesc_array, char *buf, u32 bufsize)
 {
        uint filled_len;
        int len;
@@ -1555,7 +1555,7 @@ bcmdumpfields(bcmutl_rdreg_rtn read_rtn, void *arg0, uint arg1,
                len = snprintf(buf, bufsize, cur_ptr->nameandfmt,
                               read_rtn(arg0, arg1, cur_ptr->offset));
                /* check for snprintf overflow or error */
-               if (len < 0 || (uint32) len >= bufsize)
+               if (len < 0 || (u32) len >= bufsize)
                        len = bufsize - 1;
                buf += len;
                bufsize -= len;
@@ -1586,7 +1586,7 @@ uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen)
 /* Quarter dBm units to mW
  * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153
  * Table is offset so the last entry is largest mW value that fits in
- * a uint16.
+ * a u16.
  */
 
 #define QDBM_OFFSET 153                /* Offset for first entry */
@@ -1604,7 +1604,7 @@ uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen)
  */
 #define QDBM_TABLE_HIGH_BOUND 64938    /* High bound */
 
-static const uint16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
+static const u16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
 /* qdBm:       +0      +1      +2      +3      +4      +5      +6      +7 */
 /* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000,
 /* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849,
@@ -1613,13 +1613,13 @@ static const uint16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = {
 /* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096
 };
 
-uint16 bcm_qdbm_to_mw(u8 qdbm)
+u16 bcm_qdbm_to_mw(u8 qdbm)
 {
        uint factor = 1;
        int idx = qdbm - QDBM_OFFSET;
 
        if (idx >= QDBM_TABLE_LEN) {
-               /* clamp to max uint16 mW value */
+               /* clamp to max u16 mW value */
                return 0xFFFF;
        }
 
@@ -1637,7 +1637,7 @@ uint16 bcm_qdbm_to_mw(u8 qdbm)
        return (nqdBm_to_mW_map[idx] + factor / 2) / factor;
 }
 
-u8 bcm_mw_to_qdbm(uint16 mw)
+u8 bcm_mw_to_qdbm(u16 mw)
 {
        u8 qdbm;
        int offset;
@@ -1716,7 +1716,7 @@ int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...)
        return r;
 }
 
-void bcm_inc_bytes(uchar *num, int num_bytes, u8 amount)
+void bcm_inc_bytes(unsigned char *num, int num_bytes, u8 amount)
 {
        int i;
 
@@ -1728,7 +1728,7 @@ void bcm_inc_bytes(uchar *num, int num_bytes, u8 amount)
        }
 }
 
-int bcm_cmp_bytes(uchar *arg1, uchar *arg2, u8 nbytes)
+int bcm_cmp_bytes(unsigned char *arg1, unsigned char *arg2, u8 nbytes)
 {
        int i;
 
@@ -1739,7 +1739,7 @@ int bcm_cmp_bytes(uchar *arg1, uchar *arg2, u8 nbytes)
        return 0;
 }
 
-void bcm_print_bytes(char *name, const uchar *data, int len)
+void bcm_print_bytes(char *name, const unsigned char *data, int len)
 {
        int i;
        int per_line = 0;
@@ -1782,7 +1782,7 @@ char *getvar(char *vars, const char *name)
 
 #if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \
        defined(WLMSG_PRPKT) || defined(WLMSG_WSEC)
-int bcm_format_ssid(char *buf, const uchar ssid[], uint ssid_len)
+int bcm_format_ssid(char *buf, const unsigned char ssid[], uint ssid_len)
 {
        uint i, c;
        char *p = buf;
@@ -1796,7 +1796,7 @@ int bcm_format_ssid(char *buf, const uchar ssid[], uint ssid_len)
                if (c == '\\') {
                        *p++ = '\\';
                        *p++ = '\\';
-               } else if (bcm_isprint((uchar) c)) {
+               } else if (bcm_isprint((unsigned char) c)) {
                        *p++ = (char)c;
                } else {
                        p += snprintf(p, (endp - p), "\\x%02X", c);