Skip to content

Commit

Permalink
Staging: brcm80211: remove uintptr typedef usage
Browse files Browse the repository at this point in the history
Use a unsigned long, that is the proper type for this type of thing on
Linux.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Nohee Ko <noheek@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Greg Kroah-Hartman committed Oct 21, 2010
1 parent 8ee48db commit f024c48
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 82 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
SDLX_MSG(("%s: Cannot enable PCI device\n", __func__));
goto err;
}
sdh = bcmsdh_attach(osh, (void *)(uintptr) pci_resource_start(pdev, 0),
sdh = bcmsdh_attach(osh, (void *)(unsigned long)pci_resource_start(pdev, 0),
(void **)&regs, pdev->irq);
if (!sdh) {
SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__));
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ int dhd_prot_attach(dhd_pub_t *dhd)
}

/* ensure that the msg buf directly follows the cdc msg struct */
if ((uintptr) (&cdc->msg + 1) != (uintptr) cdc->buf) {
if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) {
DHD_ERROR(("dhd_prot_t is not correctly defined\n"));
goto fail;
}
Expand Down
15 changes: 6 additions & 9 deletions drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ int dhd_iscan_print_cache(iscan_buf_t *iscan_skip)
bi->BSSID.octet[2], bi->BSSID.octet[3],
bi->BSSID.octet[4], bi->BSSID.octet[5]));

bi = (wl_bss_info_t *) ((uintptr) bi +
bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length));
}
iscan_cur = iscan_cur->next;
Expand Down Expand Up @@ -1541,7 +1541,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
bi->BSSID.octet[5]));

bi_new = bi;
bi = (wl_bss_info_t *) ((uintptr) bi +
bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32
(bi->length));
/*
Expand All @@ -1567,17 +1567,14 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
bi->BSSID.octet[5]));

bi_next =
(wl_bss_info_t
*) ((uintptr) bi +
(wl_bss_info_t *)((unsigned long)bi +
dtoh32
(bi->length));
bcopy(bi, bi_new,
dtoh32
(bi->length));
bi_new =
(wl_bss_info_t
*) ((uintptr)
bi_new +
(wl_bss_info_t *)((unsigned long)bi_new +
dtoh32
(bi_new->
length));
Expand All @@ -1594,7 +1591,7 @@ int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip)
}
break;
}
bi = (wl_bss_info_t *) ((uintptr) bi +
bi = (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length));
}
}
Expand Down Expand Up @@ -1649,7 +1646,7 @@ int dhd_iscan_remove_duplicates(void *dhdp, iscan_buf_t *iscan_cur)

dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur);

bi = (wl_bss_info_t *) ((uintptr) bi + dtoh32(bi->length));
bi = (wl_bss_info_t *)((unsigned long)bi + dtoh32(bi->length));
}

done:
Expand Down
32 changes: 16 additions & 16 deletions drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable);
#define PKTALIGN(osh, p, len, align) \
do { \
uint datalign; \
datalign = (uintptr)PKTDATA((p)); \
datalign = (unsigned long)PKTDATA((p)); \
datalign = roundup(datalign, (align)) - datalign; \
ASSERT(datalign < (align)); \
ASSERT(PKTLEN((p)) >= ((len) + datalign)); \
Expand Down Expand Up @@ -924,7 +924,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
frame = (u8 *) PKTDATA(pkt);

/* Add alignment padding, allocate new packet if needed */
pad = ((uintptr) frame % DHD_SDALIGN);
pad = ((unsigned long)frame % DHD_SDALIGN);
if (pad) {
if (PKTHEADROOM(pkt) < pad) {
DHD_INFO(("%s: insufficient headroom %d for %d pad\n",
Expand All @@ -947,7 +947,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, void *pkt, uint chan, bool free_pkt)
free_pkt = true;
pkt = new;
frame = (u8 *) PKTDATA(pkt);
ASSERT(((uintptr) frame % DHD_SDALIGN) == 0);
ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0);
pad = 0;
} else {
PKTPUSH(pkt, pad);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, void *pkt)

/* Add space for the header */
PKTPUSH(pkt, SDPCM_HDRLEN);
ASSERT(IS_ALIGNED((uintptr) PKTDATA(pkt), 2));
ASSERT(IS_ALIGNED((unsigned long)PKTDATA(pkt), 2));

prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK));

Expand Down Expand Up @@ -1241,7 +1241,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)

/* Add alignment padding (optional for ctl frames) */
if (dhd_alignctl) {
doff = ((uintptr) frame % DHD_SDALIGN);
doff = ((unsigned long)frame % DHD_SDALIGN);
if (doff) {
frame -= doff;
len += doff;
Expand All @@ -1265,7 +1265,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
if (forcealign && (len & (ALIGNMENT - 1)))
len = roundup(len, ALIGNMENT);

ASSERT(IS_ALIGNED((uintptr) frame, 2));
ASSERT(IS_ALIGNED((unsigned long)frame, 2));

/* Need to lock here to protect txseq and SDIO tx calls */
dhd_os_sdlock(bus->dhd);
Expand Down Expand Up @@ -2336,7 +2336,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,

sd_ptr = (sdreg_t *) params;

addr = (uintptr) bus->regs + sd_ptr->offset;
addr = (unsigned long)bus->regs + sd_ptr->offset;
size = sd_ptr->func;
int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
if (bcmsdh_regfail(bus->sdh))
Expand All @@ -2352,7 +2352,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,

sd_ptr = (sdreg_t *) params;

addr = (uintptr) bus->regs + sd_ptr->offset;
addr = (unsigned long)bus->regs + sd_ptr->offset;
size = sd_ptr->func;
bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value);
if (bcmsdh_regfail(bus->sdh))
Expand Down Expand Up @@ -3086,7 +3086,7 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
bus->rxctl = bus->rxbuf;
if (dhd_alignctl) {
bus->rxctl += firstread;
pad = ((uintptr) bus->rxctl % DHD_SDALIGN);
pad = ((unsigned long)bus->rxctl % DHD_SDALIGN);
if (pad)
bus->rxctl += (DHD_SDALIGN - pad);
bus->rxctl -= firstread;
Expand Down Expand Up @@ -3681,7 +3681,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
bus->rxctl = bus->rxbuf;
if (dhd_alignctl) {
bus->rxctl += firstread;
pad = ((uintptr) bus->rxctl %
pad = ((unsigned long)bus->rxctl %
DHD_SDALIGN);
if (pad)
bus->rxctl +=
Expand Down Expand Up @@ -5091,7 +5091,7 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
DHD_INFO(("%s: venid 0x%04x devid 0x%04x\n", __func__, venid, devid));

/* We make assumptions about address window mappings */
ASSERT((uintptr) regsva == SI_ENUM_BASE);
ASSERT((unsigned long)regsva == SI_ENUM_BASE);

/* BCMSDH passes venid and devid based on CIS parsing -- but
* low-power start
Expand Down Expand Up @@ -5363,7 +5363,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
pktq_init(&bus->txq, (PRIOMASK + 1), QLEN);

/* Locate an appropriately-aligned portion of hdrbuf */
bus->rxhdr = (u8 *) roundup((uintptr)&bus->hdrbuf[0], DHD_SDALIGN);
bus->rxhdr = (u8 *) roundup((unsigned long)&bus->hdrbuf[0], DHD_SDALIGN);

/* Set the poll and/or interrupt flags */
bus->intr = (bool) dhd_intr;
Expand Down Expand Up @@ -5405,10 +5405,10 @@ static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh)
}

/* Align the buffer */
if ((uintptr) bus->databuf % DHD_SDALIGN)
if ((unsigned long)bus->databuf % DHD_SDALIGN)
bus->dataptr =
bus->databuf + (DHD_SDALIGN -
((uintptr) bus->databuf % DHD_SDALIGN));
((unsigned long)bus->databuf % DHD_SDALIGN));
else
bus->dataptr = bus->databuf;

Expand Down Expand Up @@ -5739,9 +5739,9 @@ static int dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path)
__func__, MEMBLOCK));
goto err;
}
if ((u32) (uintptr) memblock % DHD_SDALIGN)
if ((u32)(unsigned long)memblock % DHD_SDALIGN)
memptr +=
(DHD_SDALIGN - ((u32) (uintptr) memblock % DHD_SDALIGN));
(DHD_SDALIGN - ((u32)(unsigned long)memblock % DHD_SDALIGN));

/* Download image */
while ((len =
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static inline struct wl_bss_info *next_bss(struct wl_scan_results *list,
struct wl_bss_info *bss)
{
return bss = bss ?
(struct wl_bss_info *)((uintptr) bss +
(struct wl_bss_info *)((unsigned long)bss +
dtoh32(bss->length)) : list->bss_info;
}

Expand Down
22 changes: 11 additions & 11 deletions drivers/staging/brcm80211/brcmfmac/wl_iw.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,11 @@ wl_iw_get_aplist(struct net_device *dev,

for (i = 0, dwrq->length = 0;
i < list->count && dwrq->length < IW_MAX_AP; i++) {
bi = bi ? (wl_bss_info_t *) ((uintptr) bi +
bi = bi ? (wl_bss_info_t *) ((unsigned long)bi +
dtoh32(bi->length)) : list->
bss_info;
ASSERT(((uintptr) bi + dtoh32(bi->length)) <=
((uintptr) list + buflen));
ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
((unsigned long)list + buflen));

if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
Expand Down Expand Up @@ -976,11 +976,11 @@ wl_iw_iscan_get_aplist(struct net_device *dev,
bi = NULL;
for (i = 0, dwrq->length = 0;
i < list->count && dwrq->length < IW_MAX_AP; i++) {
bi = bi ? (wl_bss_info_t *) ((uintptr) bi +
bi = bi ? (wl_bss_info_t *) ((unsigned long)bi +
dtoh32(bi->length)) :
list->bss_info;
ASSERT(((uintptr) bi + dtoh32(bi->length)) <=
((uintptr) list + WLC_IW_ISCAN_MAXLEN));
ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
((unsigned long)list + WLC_IW_ISCAN_MAXLEN));

if (!(dtoh16(bi->capability) & DOT11_CAP_ESS))
continue;
Expand Down Expand Up @@ -1508,7 +1508,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,
return ret;
}

bi = bi ? (wl_bss_info_t *) ((uintptr) bi +
bi = bi ? (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length)) : list->
bss_info;

Expand Down Expand Up @@ -1568,7 +1568,7 @@ wl_iw_get_scan_prep(wl_scan_results_t *list,

if (bi->rateset.count) {
if (((event - extra) +
IW_EV_LCP_LEN) <= (uintptr) end) {
IW_EV_LCP_LEN) <= (unsigned long)end) {
value = event + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled =
Expand Down Expand Up @@ -1774,11 +1774,11 @@ wl_iw_iscan_get_scan(struct net_device *dev,
bi = NULL;
for (ii = 0; ii < list->count && apcnt < IW_MAX_AP;
apcnt++, ii++) {
bi = bi ? (wl_bss_info_t *) ((uintptr) bi +
bi = bi ? (wl_bss_info_t *)((unsigned long)bi +
dtoh32(bi->length)) :
list->bss_info;
ASSERT(((uintptr) bi + dtoh32(bi->length)) <=
((uintptr) list + WLC_IW_ISCAN_MAXLEN));
ASSERT(((unsigned long)bi + dtoh32(bi->length)) <=
((unsigned long)list + WLC_IW_ISCAN_MAXLEN));

if (event + ETHER_ADDR_LEN + bi->SSID_len +
IW_EV_UINT_LEN + IW_EV_FREQ_LEN + IW_EV_QUAL_LEN >=
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/include/bcmutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
#ifdef __i386__
1 ||
#endif
(((uintptr) src1 | (uintptr) src2 | (uintptr) dst) &
(((unsigned long) src1 | (unsigned long) src2 | (unsigned long) dst) &
3) == 0) {
/* ARM CM3 rel time: 1229 (727 if alignment check could be omitted) */
/* x86 supports unaligned. This version runs 6x-9x faster on x86. */
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/include/hnddma.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ typedef void *(*di_rx_t) (hnddma_t *dmah);
typedef bool(*di_rxfill_t) (hnddma_t *dmah);
typedef void (*di_txreclaim_t) (hnddma_t *dmah, txd_range_t range);
typedef void (*di_rxreclaim_t) (hnddma_t *dmah);
typedef uintptr(*di_getvar_t) (hnddma_t *dmah, const char *name);
typedef unsigned long (*di_getvar_t) (hnddma_t *dmah, const char *name);
typedef void *(*di_getnexttxp_t) (hnddma_t *dmah, txd_range_t range);
typedef void *(*di_getnextrxp_t) (hnddma_t *dmah, bool forceall);
typedef void *(*di_peeknexttxp_t) (hnddma_t *dmah);
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/brcm80211/include/linux_osl.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ extern void osl_dma_unmap(osl_t *osh, uint pa, uint size, int direction);
#ifdef BRCM_FULLMAC
#include <bcmsdh.h>
#endif
#define OSL_WRITE_REG(osh, r, v) (bcmsdh_reg_write(NULL, (uintptr)(r), sizeof(*(r)), (v)))
#define OSL_READ_REG(osh, r) (bcmsdh_reg_read(NULL, (uintptr)(r), sizeof(*(r))))
#define OSL_WRITE_REG(osh, r, v) (bcmsdh_reg_write(NULL, (unsigned long)(r), sizeof(*(r)), (v)))
#define OSL_READ_REG(osh, r) (bcmsdh_reg_read(NULL, (unsigned long)(r), sizeof(*(r))))
#endif

#if defined(BCMSDIO)
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/include/siutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ typedef struct si_info {

#define GOODCOREADDR(x, b) (((x) >= (b)) && ((x) < ((b) + SI_MAXCORES * SI_CORE_SIZE)) && \
IS_ALIGNED((x), SI_CORE_SIZE))
#define GOODREGS(regs) ((regs) != NULL && IS_ALIGNED((uintptr)(regs), SI_CORE_SIZE))
#define GOODREGS(regs) ((regs) != NULL && IS_ALIGNED((unsigned long)(regs), SI_CORE_SIZE))
#define BADCOREADDR 0
#define GOODIDX(idx) (((uint)idx) < SI_MAXCORES)
#define NOREV -1 /* Invalid rev */
Expand Down
11 changes: 0 additions & 11 deletions drivers/staging/brcm80211/include/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@

#include <linux/types.h>

#if defined(__x86_64__)
#define TYPEDEF_UINTPTR
typedef unsigned long long int uintptr;
#endif

#ifndef TYPEDEF_UINTPTR
typedef unsigned int uintptr;
#endif

#undef TYPEDEF_UINTPTR

#ifndef OFF
#define OFF 0
#endif
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/brcm80211/sys/wlc_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid)

for (i = 1; i < MAXBANDS; i++) {
wlc->hw->bandstate[i] = (wlc_hwband_t *)
((uintptr) wlc->hw->bandstate[0] +
((unsigned long)wlc->hw->bandstate[0] +
(sizeof(wlc_hwband_t) * i));
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid)
int i;
for (i = 1; i < WLC_DEFAULT_KEYS; i++) {
wlc->wsec_def_keys[i] = (wsec_key_t *)
((uintptr) wlc->wsec_def_keys[0] +
((unsigned long)wlc->wsec_def_keys[0] +
(sizeof(wsec_key_t) * i));
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ wlc_info_t *wlc_attach_malloc(osl_t *osh, uint unit, uint *err, uint devid)

for (i = 1; i < MAXBANDS; i++) {
wlc->bandstate[i] =
(wlcband_t *) ((uintptr) wlc->bandstate[0] +
(wlcband_t *) ((unsigned long)wlc->bandstate[0] +
(sizeof(wlcband_t) * i));
}
}
Expand Down
Loading

0 comments on commit f024c48

Please sign in to comment.