提交 b7ef2a95 编写于 作者: R Roland Vossen 提交者: Greg Kroah-Hartman

staging: brcm80211: made error codes in bcmutils.h positive

Code cleanup. Bringing driver more inline with Linux code style.
Does not introduce behavioral changes.

Cc: devel@linuxdriverproject.org
Cc: linux-wireless@vger.kernel.org
Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 745492c2
...@@ -126,7 +126,7 @@ int bcmsdh_intr_enable(void *sdh) ...@@ -126,7 +126,7 @@ int bcmsdh_intr_enable(void *sdh)
ASSERT(bcmsdh); ASSERT(bcmsdh);
status = sdioh_interrupt_set(bcmsdh->sdioh, true); status = sdioh_interrupt_set(bcmsdh->sdioh, true);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
int bcmsdh_intr_disable(void *sdh) int bcmsdh_intr_disable(void *sdh)
...@@ -136,7 +136,7 @@ int bcmsdh_intr_disable(void *sdh) ...@@ -136,7 +136,7 @@ int bcmsdh_intr_disable(void *sdh)
ASSERT(bcmsdh); ASSERT(bcmsdh);
status = sdioh_interrupt_set(bcmsdh->sdioh, false); status = sdioh_interrupt_set(bcmsdh->sdioh, false);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
...@@ -146,7 +146,7 @@ int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) ...@@ -146,7 +146,7 @@ int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
ASSERT(bcmsdh); ASSERT(bcmsdh);
status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh); status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
int bcmsdh_intr_dereg(void *sdh) int bcmsdh_intr_dereg(void *sdh)
...@@ -156,7 +156,7 @@ int bcmsdh_intr_dereg(void *sdh) ...@@ -156,7 +156,7 @@ int bcmsdh_intr_dereg(void *sdh)
ASSERT(bcmsdh); ASSERT(bcmsdh);
status = sdioh_interrupt_deregister(bcmsdh->sdioh); status = sdioh_interrupt_deregister(bcmsdh->sdioh);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
#if defined(DHD_DEBUG) #if defined(DHD_DEBUG)
...@@ -174,7 +174,7 @@ int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) ...@@ -174,7 +174,7 @@ int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
ASSERT(sdh); ASSERT(sdh);
/* don't support yet */ /* don't support yet */
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
} }
u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err) u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err)
...@@ -204,7 +204,7 @@ u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err) ...@@ -204,7 +204,7 @@ u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err)
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
#endif #endif
if (err) if (err)
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); *err = (SDIOH_API_SUCCESS(status) ? 0 : -BCME_SDIO_ERROR);
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
...@@ -239,7 +239,7 @@ bcmsdh_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err) ...@@ -239,7 +239,7 @@ bcmsdh_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err)
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
#endif #endif
if (err) if (err)
*err = SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR; *err = SDIOH_API_SUCCESS(status) ? 0 : -BCME_SDIO_ERROR;
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
...@@ -261,7 +261,7 @@ u32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err) ...@@ -261,7 +261,7 @@ u32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err)
fnc_num, addr, &data, 4); fnc_num, addr, &data, 4);
if (err) if (err)
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); *err = (SDIOH_API_SUCCESS(status) ? 0 : -BCME_SDIO_ERROR);
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
...@@ -286,7 +286,7 @@ bcmsdh_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data, ...@@ -286,7 +286,7 @@ bcmsdh_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data,
SDIOH_WRITE, fnc_num, addr, &data, 4); SDIOH_WRITE, fnc_num, addr, &data, 4);
if (err) if (err)
*err = (SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR); *err = (SDIOH_API_SUCCESS(status) ? 0 : -BCME_SDIO_ERROR);
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
__func__, fnc_num, addr, data)); __func__, fnc_num, addr, data));
...@@ -317,7 +317,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) ...@@ -317,7 +317,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)
tmp_buf = kmalloc(length, GFP_ATOMIC); tmp_buf = kmalloc(length, GFP_ATOMIC);
if (tmp_buf == NULL) { if (tmp_buf == NULL) {
BCMSDH_ERROR(("%s: out of memory\n", __func__)); BCMSDH_ERROR(("%s: out of memory\n", __func__));
return BCME_NOMEM; return -BCME_NOMEM;
} }
memcpy(tmp_buf, cis, length); memcpy(tmp_buf, cis, length);
for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4); for (tmp_ptr = tmp_buf, ptr = cis; ptr < (cis + length - 4);
...@@ -329,7 +329,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) ...@@ -329,7 +329,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)
kfree(tmp_buf); kfree(tmp_buf);
} }
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
static int bcmsdhsdio_set_sbaddr_window(void *sdh, u32 address) static int bcmsdhsdio_set_sbaddr_window(void *sdh, u32 address)
...@@ -467,7 +467,7 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, ...@@ -467,7 +467,7 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags,
/* Async not implemented yet */ /* Async not implemented yet */
ASSERT(!(flags & SDIO_REQ_ASYNC)); ASSERT(!(flags & SDIO_REQ_ASYNC));
if (flags & SDIO_REQ_ASYNC) if (flags & SDIO_REQ_ASYNC)
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
if (bar0 != bcmsdh->sbwad) { if (bar0 != bcmsdh->sbwad) {
err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0); err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);
...@@ -488,7 +488,7 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, ...@@ -488,7 +488,7 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags,
SDIOH_READ, fn, addr, width, nbytes, buf, SDIOH_READ, fn, addr, width, nbytes, buf,
pkt); pkt);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_SDIO_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_SDIO_ERROR;
} }
int int
...@@ -512,7 +512,7 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, ...@@ -512,7 +512,7 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags,
/* Async not implemented yet */ /* Async not implemented yet */
ASSERT(!(flags & SDIO_REQ_ASYNC)); ASSERT(!(flags & SDIO_REQ_ASYNC));
if (flags & SDIO_REQ_ASYNC) if (flags & SDIO_REQ_ASYNC)
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
if (bar0 != bcmsdh->sbwad) { if (bar0 != bcmsdh->sbwad) {
err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0); err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0);
...@@ -533,7 +533,7 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, ...@@ -533,7 +533,7 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags,
SDIOH_WRITE, fn, addr, width, nbytes, buf, SDIOH_WRITE, fn, addr, width, nbytes, buf,
pkt); pkt);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes) int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
...@@ -553,7 +553,7 @@ int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes) ...@@ -553,7 +553,7 @@ int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
(rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
addr, 4, nbytes, buf, NULL); addr, 4, nbytes, buf, NULL);
return SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR; return SDIOH_API_SUCCESS(status) ? 0 : -BCME_ERROR;
} }
int bcmsdh_abort(void *sdh, uint fn) int bcmsdh_abort(void *sdh, uint fn)
......
...@@ -423,7 +423,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -423,7 +423,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
vi = bcm_iovar_lookup(sdioh_iovars, name); vi = bcm_iovar_lookup(sdioh_iovars, name);
if (vi == NULL) { if (vi == NULL) {
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
goto exit; goto exit;
} }
...@@ -472,7 +472,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -472,7 +472,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
case IOV_GVAL(IOV_BLOCKSIZE): case IOV_GVAL(IOV_BLOCKSIZE):
if ((u32) int_val > si->num_funcs) { if ((u32) int_val > si->num_funcs) {
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
int_val = (s32) si->client_block_size[int_val]; int_val = (s32) si->client_block_size[int_val];
...@@ -486,7 +486,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -486,7 +486,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
uint maxsize; uint maxsize;
if (func > si->num_funcs) { if (func > si->num_funcs) {
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
...@@ -504,7 +504,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -504,7 +504,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
maxsize = 0; maxsize = 0;
} }
if (blksize > maxsize) { if (blksize > maxsize) {
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
if (!blksize) if (!blksize)
...@@ -607,7 +607,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -607,7 +607,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
|| sd_ptr->offset > SD_MaxCurCap) { || sd_ptr->offset > SD_MaxCurCap) {
sd_err(("%s: bad offset 0x%x\n", __func__, sd_err(("%s: bad offset 0x%x\n", __func__,
sd_ptr->offset)); sd_ptr->offset));
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
...@@ -637,7 +637,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -637,7 +637,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
|| sd_ptr->offset > SD_MaxCurCap) { || sd_ptr->offset > SD_MaxCurCap) {
sd_err(("%s: bad offset 0x%x\n", __func__, sd_err(("%s: bad offset 0x%x\n", __func__,
sd_ptr->offset)); sd_ptr->offset));
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
...@@ -656,7 +656,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -656,7 +656,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
if (sdioh_cfg_read if (sdioh_cfg_read
(si, sd_ptr->func, sd_ptr->offset, &data)) { (si, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
break; break;
} }
...@@ -672,14 +672,14 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, ...@@ -672,14 +672,14 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
if (sdioh_cfg_write if (sdioh_cfg_write
(si, sd_ptr->func, sd_ptr->offset, &data)) { (si, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
break; break;
} }
break; break;
} }
default: default:
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
break; break;
} }
exit: exit:
......
...@@ -151,7 +151,7 @@ int sdioh_sdmmc_osinit(sdioh_info_t *sd) ...@@ -151,7 +151,7 @@ int sdioh_sdmmc_osinit(sdioh_info_t *sd)
sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC); sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC);
sd->sdos_info = (void *)sdos; sd->sdos_info = (void *)sdos;
if (sdos == NULL) if (sdos == NULL)
return BCME_NOMEM; return -BCME_NOMEM;
sdos->sd = sd; sdos->sd = sd;
spin_lock_init(&sdos->lock); spin_lock_init(&sdos->lock);
......
...@@ -309,7 +309,7 @@ int ...@@ -309,7 +309,7 @@ int
dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name,
void *params, int plen, void *arg, int len, bool set) void *params, int plen, void *arg, int len, bool set)
{ {
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
} }
void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
...@@ -357,7 +357,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -357,7 +357,7 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
if (pktbuf->len < BDC_HEADER_LEN) { if (pktbuf->len < BDC_HEADER_LEN) {
DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__, DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__,
pktbuf->len, BDC_HEADER_LEN)); pktbuf->len, BDC_HEADER_LEN));
return BCME_ERROR; return -BCME_ERROR;
} }
h = (struct bdc_header *)(pktbuf->data); h = (struct bdc_header *)(pktbuf->data);
...@@ -366,14 +366,14 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) ...@@ -366,14 +366,14 @@ int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf)
if (*ifidx >= DHD_MAX_IFS) { if (*ifidx >= DHD_MAX_IFS) {
DHD_ERROR(("%s: rx data ifnum out of range (%d)\n", DHD_ERROR(("%s: rx data ifnum out of range (%d)\n",
__func__, *ifidx)); __func__, *ifidx));
return BCME_ERROR; return -BCME_ERROR;
} }
if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) !=
BDC_PROTO_VER) { BDC_PROTO_VER) {
DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n", DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n",
dhd_ifname(dhd, *ifidx), h->flags)); dhd_ifname(dhd, *ifidx), h->flags));
return BCME_ERROR; return -BCME_ERROR;
} }
if (h->flags & BDC_FLAG_SUM_GOOD) { if (h->flags & BDC_FLAG_SUM_GOOD) {
...@@ -416,7 +416,7 @@ int dhd_prot_attach(dhd_pub_t *dhd) ...@@ -416,7 +416,7 @@ int dhd_prot_attach(dhd_pub_t *dhd)
fail: fail:
kfree(cdc); kfree(cdc);
return BCME_NOMEM; return -BCME_NOMEM;
} }
/* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */ /* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */
......
...@@ -189,7 +189,7 @@ static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen) ...@@ -189,7 +189,7 @@ static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)
/* Add any bus info */ /* Add any bus info */
dhd_bus_dump(dhdp, strbuf); dhd_bus_dump(dhdp, strbuf);
return !strbuf->size ? BCME_BUFTOOSHORT : 0; return !strbuf->size ? -BCME_BUFTOOSHORT : 0;
} }
static int static int
...@@ -242,7 +242,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, ...@@ -242,7 +242,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
case IOV_SVAL(IOV_WDTICK): case IOV_SVAL(IOV_WDTICK):
if (!dhd_pub->up) { if (!dhd_pub->up) {
bcmerror = BCME_NOTUP; bcmerror = -BCME_NOTUP;
break; break;
} }
dhd_os_wd_timer(dhd_pub, (uint) int_val); dhd_os_wd_timer(dhd_pub, (uint) int_val);
...@@ -289,7 +289,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, ...@@ -289,7 +289,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
case IOV_SVAL(IOV_IOCTLTIMEOUT):{ case IOV_SVAL(IOV_IOCTLTIMEOUT):{
if (int_val <= 0) if (int_val <= 0)
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
else else
dhd_os_set_ioctl_resp_timeout((unsigned int) dhd_os_set_ioctl_resp_timeout((unsigned int)
int_val); int_val);
...@@ -297,7 +297,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, ...@@ -297,7 +297,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid,
} }
default: default:
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
break; break;
} }
...@@ -381,7 +381,7 @@ dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name, ...@@ -381,7 +381,7 @@ dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name,
vi = bcm_iovar_lookup(dhd_iovars, name); vi = bcm_iovar_lookup(dhd_iovars, name);
if (vi == NULL) { if (vi == NULL) {
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
goto exit; goto exit;
} }
...@@ -420,19 +420,19 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) ...@@ -420,19 +420,19 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
if (!buf) if (!buf)
return BCME_BADARG; return -BCME_BADARG;
switch (ioc->cmd) { switch (ioc->cmd) {
case DHD_GET_MAGIC: case DHD_GET_MAGIC:
if (buflen < sizeof(int)) if (buflen < sizeof(int))
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
else else
*(int *)buf = DHD_IOCTL_MAGIC; *(int *)buf = DHD_IOCTL_MAGIC;
break; break;
case DHD_GET_VERSION: case DHD_GET_VERSION:
if (buflen < sizeof(int)) if (buflen < sizeof(int))
bcmerror = -BCME_BUFTOOSHORT; bcmerror = BCME_BUFTOOSHORT;
else else
*(int *)buf = DHD_IOCTL_VERSION; *(int *)buf = DHD_IOCTL_VERSION;
break; break;
...@@ -448,7 +448,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) ...@@ -448,7 +448,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
; ;
if (*arg) { if (*arg) {
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
break; break;
} }
...@@ -464,7 +464,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) ...@@ -464,7 +464,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
bcmerror = bcmerror =
dhd_iovar_op(dhd_pub, buf, NULL, 0, arg, dhd_iovar_op(dhd_pub, buf, NULL, 0, arg,
arglen, IOV_SET); arglen, IOV_SET);
if (bcmerror != BCME_UNSUPPORTED) if (bcmerror != -BCME_UNSUPPORTED)
break; break;
/* not in generic table, try protocol module */ /* not in generic table, try protocol module */
...@@ -476,7 +476,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) ...@@ -476,7 +476,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
bcmerror = dhd_prot_iovar_op(dhd_pub, buf, bcmerror = dhd_prot_iovar_op(dhd_pub, buf,
NULL, 0, arg, NULL, 0, arg,
arglen, IOV_SET); arglen, IOV_SET);
if (bcmerror != BCME_UNSUPPORTED) if (bcmerror != -BCME_UNSUPPORTED)
break; break;
/* if still not found, try bus module */ /* if still not found, try bus module */
...@@ -493,7 +493,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) ...@@ -493,7 +493,7 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen)
} }
default: default:
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
} }
return bcmerror; return bcmerror;
...@@ -815,14 +815,14 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, ...@@ -815,14 +815,14 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata,
if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) { if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) {
DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__)); DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__));
return BCME_ERROR; return -BCME_ERROR;
} }
/* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */ /* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */
if (get_unaligned_be16(&pvt_data->bcm_hdr.usr_subtype) != if (get_unaligned_be16(&pvt_data->bcm_hdr.usr_subtype) !=
BCMILCP_BCM_SUBTYPE_EVENT) { BCMILCP_BCM_SUBTYPE_EVENT) {
DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__)); DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__));
return BCME_ERROR; return -BCME_ERROR;
} }
*data_ptr = &pvt_data[1]; *data_ptr = &pvt_data[1];
......
...@@ -1620,48 +1620,48 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) ...@@ -1620,48 +1620,48 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr)
} }
static s16 linuxbcmerrormap[] = { 0, /* 0 */ static s16 linuxbcmerrormap[] = { 0, /* 0 */
-EINVAL, /* BCME_ERROR */ -EINVAL, /* -BCME_ERROR */
-EINVAL, /* BCME_BADARG */ -EINVAL, /* -BCME_BADARG */
-EINVAL, /* BCME_BADOPTION */ -EINVAL, /* -BCME_BADOPTION */
-EINVAL, /* BCME_NOTUP */ -EINVAL, /* -BCME_NOTUP */
-EINVAL, /* BCME_NOTDOWN */ -EINVAL, /* -BCME_NOTDOWN */
-EINVAL, /* BCME_NOTAP */ -EINVAL, /* -BCME_NOTAP */
-EINVAL, /* BCME_NOTSTA */ -EINVAL, /* -BCME_NOTSTA */
-EINVAL, /* BCME_BADKEYIDX */ -EINVAL, /* -BCME_BADKEYIDX */
-EINVAL, /* BCME_RADIOOFF */ -EINVAL, /* -BCME_RADIOOFF */
-EINVAL, /* BCME_NOTBANDLOCKED */ -EINVAL, /* -BCME_NOTBANDLOCKED */
-EINVAL, /* BCME_NOCLK */ -EINVAL, /* -BCME_NOCLK */
-EINVAL, /* BCME_BADRATESET */ -EINVAL, /* -BCME_BADRATESET */
-EINVAL, /* BCME_BADBAND */ -EINVAL, /* -BCME_BADBAND */
-E2BIG, /* BCME_BUFTOOSHORT */ -E2BIG, /* -BCME_BUFTOOSHORT */
-E2BIG, /* BCME_BUFTOOLONG */ -E2BIG, /* -BCME_BUFTOOLONG */
-EBUSY, /* BCME_BUSY */ -EBUSY, /* -BCME_BUSY */
-EINVAL, /* BCME_NOTASSOCIATED */ -EINVAL, /* -BCME_NOTASSOCIATED */
-EINVAL, /* BCME_BADSSIDLEN */ -EINVAL, /* -BCME_BADSSIDLEN */
-EINVAL, /* BCME_OUTOFRANGECHAN */ -EINVAL, /* -BCME_OUTOFRANGECHAN */
-EINVAL, /* BCME_BADCHAN */ -EINVAL, /* -BCME_BADCHAN */
-EFAULT, /* BCME_BADADDR */ -EFAULT, /* -BCME_BADADDR */
-ENOMEM, /* BCME_NORESOURCE */ -ENOMEM, /* -BCME_NORESOURCE */
-EOPNOTSUPP, /* BCME_UNSUPPORTED */ -EOPNOTSUPP, /* -BCME_UNSUPPORTED */
-EMSGSIZE, /* BCME_BADLENGTH */ -EMSGSIZE, /* -BCME_BADLENGTH */
-EINVAL, /* BCME_NOTREADY */ -EINVAL, /* -BCME_NOTREADY */
-EPERM, /* BCME_NOTPERMITTED */ -EPERM, /* -BCME_NOTPERMITTED */
-ENOMEM, /* BCME_NOMEM */ -ENOMEM, /* -BCME_NOMEM */
-EINVAL, /* BCME_ASSOCIATED */ -EINVAL, /* -BCME_ASSOCIATED */
-ERANGE, /* BCME_RANGE */ -ERANGE, /* -BCME_RANGE */
-EINVAL, /* BCME_NOTFOUND */ -EINVAL, /* -BCME_NOTFOUND */
-EINVAL, /* BCME_WME_NOT_ENABLED */ -EINVAL, /* -BCME_WME_NOT_ENABLED */
-EINVAL, /* BCME_TSPEC_NOTFOUND */ -EINVAL, /* -BCME_TSPEC_NOTFOUND */
-EINVAL, /* BCME_ACM_NOTSUPPORTED */ -EINVAL, /* -BCME_ACM_NOTSUPPORTED */
-EINVAL, /* BCME_NOT_WME_ASSOCIATION */ -EINVAL, /* -BCME_NOT_WME_ASSOCIATION */
-EIO, /* BCME_SDIO_ERROR */ -EIO, /* -BCME_SDIO_ERROR */
-ENODEV, /* BCME_DONGLE_DOWN */ -ENODEV, /* -BCME_DONGLE_DOWN */
-EINVAL, /* BCME_VERSION */ -EINVAL, /* -BCME_VERSION */
-EIO, /* BCME_TXFAIL */ -EIO, /* -BCME_TXFAIL */
-EIO, /* BCME_RXFAIL */ -EIO, /* -BCME_RXFAIL */
-EINVAL, /* BCME_NODEVICE */ -EINVAL, /* -BCME_NODEVICE */
-EINVAL, /* BCME_NMODE_DISABLED */ -EINVAL, /* -BCME_NMODE_DISABLED */
-ENODATA, /* BCME_NONRESIDENT */ -ENODATA, /* -BCME_NONRESIDENT */
}; };
static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
...@@ -1699,7 +1699,7 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1699,7 +1699,7 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* Copy the ioc control structure part of ioctl request */ /* Copy the ioc control structure part of ioctl request */
if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) { if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) {
bcmerror = -BCME_BADADDR; bcmerror = BCME_BADADDR;
goto done; goto done;
} }
...@@ -1715,11 +1715,11 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1715,11 +1715,11 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
{ {
buf = kmalloc(buflen, GFP_ATOMIC); buf = kmalloc(buflen, GFP_ATOMIC);
if (!buf) { if (!buf) {
bcmerror = -BCME_NOMEM; bcmerror = BCME_NOMEM;
goto done; goto done;
} }
if (copy_from_user(buf, ioc.buf, buflen)) { if (copy_from_user(buf, ioc.buf, buflen)) {
bcmerror = -BCME_BADADDR; bcmerror = BCME_BADADDR;
goto done; goto done;
} }
} }
...@@ -1728,12 +1728,12 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1728,12 +1728,12 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* To differentiate between wl and dhd read 4 more byes */ /* To differentiate between wl and dhd read 4 more byes */
if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t), if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t),
sizeof(uint)) != 0)) { sizeof(uint)) != 0)) {
bcmerror = -BCME_BADADDR; bcmerror = BCME_BADADDR;
goto done; goto done;
} }
if (!capable(CAP_NET_ADMIN)) { if (!capable(CAP_NET_ADMIN)) {
bcmerror = -BCME_EPERM; bcmerror = BCME_EPERM;
goto done; goto done;
} }
...@@ -1748,12 +1748,12 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1748,12 +1748,12 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
/* send to dongle (must be up, and wl) */ /* send to dongle (must be up, and wl) */
if ((dhd->pub.busstate != DHD_BUS_DATA)) { if ((dhd->pub.busstate != DHD_BUS_DATA)) {
DHD_ERROR(("%s DONGLE_DOWN,__func__\n", __func__)); DHD_ERROR(("%s DONGLE_DOWN,__func__\n", __func__));
bcmerror = BCME_DONGLE_DOWN; bcmerror = -BCME_DONGLE_DOWN;
goto done; goto done;
} }
if (!dhd->pub.iswl) { if (!dhd->pub.iswl) {
bcmerror = BCME_DONGLE_DOWN; bcmerror = -BCME_DONGLE_DOWN;
goto done; goto done;
} }
...@@ -1781,8 +1781,8 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) ...@@ -1781,8 +1781,8 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
if (bcmerror > 0) if (bcmerror > 0)
bcmerror = 0; bcmerror = 0;
else if (bcmerror < BCME_LAST) else if (bcmerror < -BCME_LAST)
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
return linuxbcmerrormap[-bcmerror]; return linuxbcmerrormap[-bcmerror];
} }
...@@ -2280,7 +2280,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx) ...@@ -2280,7 +2280,7 @@ int dhd_net_attach(dhd_pub_t *dhdp, int ifidx)
fail: fail:
net->netdev_ops = NULL; net->netdev_ops = NULL;
return BCME_ERROR; return -BCME_ERROR;
} }
void dhd_bus_detach(dhd_pub_t *dhdp) void dhd_bus_detach(dhd_pub_t *dhdp)
......
...@@ -541,7 +541,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) ...@@ -541,7 +541,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (err) { if (err) {
DHD_ERROR(("%s: HT Avail request error: %d\n", DHD_ERROR(("%s: HT Avail request error: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID) if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID)
...@@ -557,7 +557,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) ...@@ -557,7 +557,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (err) { if (err) {
DHD_ERROR(("%s: HT Avail read error: %d\n", DHD_ERROR(("%s: HT Avail read error: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
/* Go to pending and await interrupt if appropriate */ /* Go to pending and await interrupt if appropriate */
...@@ -569,7 +569,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) ...@@ -569,7 +569,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (err) { if (err) {
DHD_ERROR(("%s: Devctl error setting CA: %d\n", DHD_ERROR(("%s: Devctl error setting CA: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; devctl |= SBSDIO_DEVCTL_CA_INT_ONLY;
...@@ -602,12 +602,12 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) ...@@ -602,12 +602,12 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (err) { if (err) {
DHD_ERROR(("%s: HT Avail request error: %d\n", DHD_ERROR(("%s: HT Avail request error: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) {
DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n", DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n",
__func__, PMU_MAX_TRANSITION_DLY, clkctl)); __func__, PMU_MAX_TRANSITION_DLY, clkctl));
return BCME_ERROR; return -BCME_ERROR;
} }
/* Mark clock available */ /* Mark clock available */
...@@ -651,7 +651,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) ...@@ -651,7 +651,7 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok)
if (err) { if (err) {
DHD_ERROR(("%s: Failed access turning clock off: %d\n", DHD_ERROR(("%s: Failed access turning clock off: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} }
return 0; return 0;
...@@ -674,7 +674,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -674,7 +674,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error enabling sd_clock: %d\n", DHD_ERROR(("%s: error enabling sd_clock: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
iovalue = bus->sd_mode; iovalue = bus->sd_mode;
...@@ -683,7 +683,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -683,7 +683,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error changing sd_mode: %d\n", DHD_ERROR(("%s: error changing sd_mode: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} else if (bus->idleclock != DHD_IDLE_ACTIVE) { } else if (bus->idleclock != DHD_IDLE_ACTIVE) {
/* Restore clock speed */ /* Restore clock speed */
...@@ -693,7 +693,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -693,7 +693,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error restoring sd_divisor: %d\n", DHD_ERROR(("%s: error restoring sd_divisor: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} }
bus->clkstate = CLK_SDONLY; bus->clkstate = CLK_SDONLY;
...@@ -702,7 +702,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -702,7 +702,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if ((bus->sd_divisor == -1) || (bus->sd_mode == -1)) { if ((bus->sd_divisor == -1) || (bus->sd_mode == -1)) {
DHD_TRACE(("%s: can't idle clock, divisor %d mode %d\n", DHD_TRACE(("%s: can't idle clock, divisor %d mode %d\n",
__func__, bus->sd_divisor, bus->sd_mode)); __func__, bus->sd_divisor, bus->sd_mode));
return BCME_ERROR; return -BCME_ERROR;
} }
if (bus->idleclock == DHD_IDLE_STOP) { if (bus->idleclock == DHD_IDLE_STOP) {
if (sd1idle) { if (sd1idle) {
...@@ -715,7 +715,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -715,7 +715,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error changing sd_clock: %d\n", DHD_ERROR(("%s: error changing sd_clock: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} }
...@@ -725,7 +725,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -725,7 +725,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error disabling sd_clock: %d\n", DHD_ERROR(("%s: error disabling sd_clock: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} else if (bus->idleclock != DHD_IDLE_ACTIVE) { } else if (bus->idleclock != DHD_IDLE_ACTIVE) {
/* Set divisor to idle value */ /* Set divisor to idle value */
...@@ -735,7 +735,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) ...@@ -735,7 +735,7 @@ static int dhdsdio_sdclk(dhd_bus_t *bus, bool on)
if (err) { if (err) {
DHD_ERROR(("%s: error changing sd_divisor: %d\n", DHD_ERROR(("%s: error changing sd_divisor: %d\n",
__func__, err)); __func__, err));
return BCME_ERROR; return -BCME_ERROR;
} }
} }
bus->clkstate = CLK_NONE; bus->clkstate = CLK_NONE;
...@@ -819,7 +819,7 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) ...@@ -819,7 +819,7 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep)
if (sleep) { if (sleep) {
/* Don't sleep if something is pending */ /* Don't sleep if something is pending */
if (bus->dpc_sched || bus->rxskip || pktq_len(&bus->txq)) if (bus->dpc_sched || bus->rxskip || pktq_len(&bus->txq))
return BCME_BUSY; return -BCME_BUSY;
/* Disable SDIO interrupts (no longer interested) */ /* Disable SDIO interrupts (no longer interested) */
bcmsdh_intr_disable(bus->sdh); bcmsdh_intr_disable(bus->sdh);
...@@ -943,7 +943,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -943,7 +943,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
sdh = bus->sdh; sdh = bus->sdh;
if (bus->dhd->dongle_reset) { if (bus->dhd->dongle_reset) {
ret = BCME_NOTREADY; ret = -BCME_NOTREADY;
goto done; goto done;
} }
...@@ -961,7 +961,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -961,7 +961,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
DHD_ERROR(("%s: couldn't allocate new %d-byte " DHD_ERROR(("%s: couldn't allocate new %d-byte "
"packet\n", "packet\n",
__func__, pkt->len + DHD_SDALIGN)); __func__, pkt->len + DHD_SDALIGN));
ret = BCME_NOMEM; ret = -BCME_NOMEM;
goto done; goto done;
} }
...@@ -1040,7 +1040,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1040,7 +1040,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2,
F2SYNC, frame, len, pkt, NULL, NULL); F2SYNC, frame, len, pkt, NULL, NULL);
bus->f2txdata++; bus->f2txdata++;
ASSERT(ret != BCME_PENDING); ASSERT(ret != -BCME_PENDING);
if (ret < 0) { if (ret < 0) {
/* On failure, abort the command /* On failure, abort the command
...@@ -1089,7 +1089,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, ...@@ -1089,7 +1089,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
{ {
int ret = BCME_ERROR; int ret = -BCME_ERROR;
uint datalen, prec; uint datalen, prec;
DHD_TRACE(("%s: Enter\n", __func__)); DHD_TRACE(("%s: Enter\n", __func__));
...@@ -1133,7 +1133,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) ...@@ -1133,7 +1133,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
dhd_txcomplete(bus->dhd, pkt, false); dhd_txcomplete(bus->dhd, pkt, false);
pkt_buf_free_skb(pkt); pkt_buf_free_skb(pkt);
DHD_ERROR(("%s: out of bus->txq !!!\n", __func__)); DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
ret = BCME_NORESOURCE; ret = -BCME_NORESOURCE;
} else { } else {
ret = 0; ret = 0;
} }
...@@ -1347,7 +1347,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) ...@@ -1347,7 +1347,7 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen)
SDIO_FUNC_2, F2SYNC, frame, len, SDIO_FUNC_2, F2SYNC, frame, len,
NULL, NULL, NULL); NULL, NULL, NULL);
ASSERT(ret != BCME_PENDING); ASSERT(ret != -BCME_PENDING);
if (ret < 0) { if (ret < 0) {
/* On failure, abort the command and /* On failure, abort the command and
...@@ -1690,7 +1690,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) ...@@ -1690,7 +1690,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg)
memcpy(&pktgen, arg, sizeof(pktgen)); memcpy(&pktgen, arg, sizeof(pktgen));
if (pktgen.version != DHD_PKTGEN_VERSION) if (pktgen.version != DHD_PKTGEN_VERSION)
return BCME_BADARG; return -BCME_BADARG;
oldcnt = bus->pktgen_count; oldcnt = bus->pktgen_count;
oldmode = bus->pktgen_mode; oldmode = bus->pktgen_mode;
...@@ -1799,7 +1799,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) ...@@ -1799,7 +1799,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) { if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) {
DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n", DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n",
__func__, addr)); __func__, addr));
return BCME_ERROR; return -BCME_ERROR;
} }
/* Read hndrte_shared structure */ /* Read hndrte_shared structure */
...@@ -1822,7 +1822,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) ...@@ -1822,7 +1822,7 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
"is different than sdpcm_shared version %d in dongle\n", "is different than sdpcm_shared version %d in dongle\n",
__func__, SDPCM_SHARED_VERSION, __func__, SDPCM_SHARED_VERSION,
sh->flags & SDPCM_SHARED_VERSION_MASK)); sh->flags & SDPCM_SHARED_VERSION_MASK));
return BCME_ERROR; return -BCME_ERROR;
} }
return 0; return 0;
...@@ -1851,7 +1851,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) ...@@ -1851,7 +1851,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
if (mbuffer == NULL) { if (mbuffer == NULL) {
DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__,
msize)); msize));
bcmerror = BCME_NOMEM; bcmerror = -BCME_NOMEM;
goto done; goto done;
} }
} }
...@@ -1859,7 +1859,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) ...@@ -1859,7 +1859,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
str = kmalloc(maxstrlen, GFP_ATOMIC); str = kmalloc(maxstrlen, GFP_ATOMIC);
if (str == NULL) { if (str == NULL) {
DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen)); DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));
bcmerror = BCME_NOMEM; bcmerror = -BCME_NOMEM;
goto done; goto done;
} }
...@@ -2028,14 +2028,14 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) ...@@ -2028,14 +2028,14 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
c->bufsize = le32_to_cpu(c->log.buf_size); c->bufsize = le32_to_cpu(c->log.buf_size);
c->buf = kmalloc(c->bufsize, GFP_ATOMIC); c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL) if (c->buf == NULL)
return BCME_NOMEM; return -BCME_NOMEM;
} }
idx = le32_to_cpu(c->log.idx); idx = le32_to_cpu(c->log.idx);
/* Protect against corrupt value */ /* Protect against corrupt value */
if (idx > c->bufsize) if (idx > c->bufsize)
return BCME_ERROR; return -BCME_ERROR;
/* Skip reading the console buffer if the index pointer /* Skip reading the console buffer if the index pointer
has not moved */ has not moved */
...@@ -2090,11 +2090,11 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len) ...@@ -2090,11 +2090,11 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
/* Basic sanity checks */ /* Basic sanity checks */
if (bus->dhd->up) { if (bus->dhd->up) {
bcmerror = BCME_NOTDOWN; bcmerror = -BCME_NOTDOWN;
goto err; goto err;
} }
if (!len) { if (!len) {
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
goto err; goto err;
} }
...@@ -2104,7 +2104,7 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len) ...@@ -2104,7 +2104,7 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
bus->vars = kmalloc(len, GFP_ATOMIC); bus->vars = kmalloc(len, GFP_ATOMIC);
bus->varsz = bus->vars ? len : 0; bus->varsz = bus->vars ? len : 0;
if (bus->vars == NULL) { if (bus->vars == NULL) {
bcmerror = BCME_NOMEM; bcmerror = -BCME_NOMEM;
goto err; goto err;
} }
...@@ -2143,7 +2143,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2143,7 +2143,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
/* Check if dongle is in reset. If so, only allow DEVRESET iovars */ /* Check if dongle is in reset. If so, only allow DEVRESET iovars */
if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) || if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) ||
actionid == IOV_GVAL(IOV_DEVRESET))) { actionid == IOV_GVAL(IOV_DEVRESET))) {
bcmerror = BCME_NOTREADY; bcmerror = -BCME_NOTREADY;
goto exit; goto exit;
} }
...@@ -2203,7 +2203,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2203,7 +2203,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_SVAL(IOV_IDLETIME): case IOV_SVAL(IOV_IDLETIME):
if ((int_val < 0) && (int_val != DHD_IDLE_IMMEDIATE)) if ((int_val < 0) && (int_val != DHD_IDLE_IMMEDIATE))
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
else else
bus->idletime = int_val; bus->idletime = int_val;
break; break;
...@@ -2249,7 +2249,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2249,7 +2249,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
"0x%08x size %d dsize %d\n", "0x%08x size %d dsize %d\n",
__func__, (set ? "set" : "get"), __func__, (set ? "set" : "get"),
address, size, dsize)); address, size, dsize));
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
...@@ -2264,7 +2264,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2264,7 +2264,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d " DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d "
"bytes at 0x%08x\n", "bytes at 0x%08x\n",
__func__, bus->orig_ramsize, size, address)); __func__, bus->orig_ramsize, size, address));
bcmerror = BCME_BADARG; bcmerror = -BCME_BADARG;
break; break;
} }
...@@ -2322,7 +2322,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2322,7 +2322,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
case IOV_SVAL(IOV_SDRXCHAIN): case IOV_SVAL(IOV_SDRXCHAIN):
if (bool_val && !bus->sd_rxchain) if (bool_val && !bus->sd_rxchain)
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
else else
bus->use_rxchain = bool_val; bus->use_rxchain = bool_val;
break; break;
...@@ -2345,7 +2345,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2345,7 +2345,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
if (bus->varsz < (uint) len) if (bus->varsz < (uint) len)
memcpy(arg, bus->vars, bus->varsz); memcpy(arg, bus->vars, bus->varsz);
else else
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
break; break;
#endif /* DHD_DEBUG */ #endif /* DHD_DEBUG */
...@@ -2361,7 +2361,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2361,7 +2361,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
size = sd_ptr->func; size = sd_ptr->func;
int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size); int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
if (bcmsdh_regfail(bus->sdh)) if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
memcpy(arg, &int_val, sizeof(s32)); memcpy(arg, &int_val, sizeof(s32));
break; break;
} }
...@@ -2377,7 +2377,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2377,7 +2377,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
size = sd_ptr->func; size = sd_ptr->func;
bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value); bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value);
if (bcmsdh_regfail(bus->sdh)) if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
break; break;
} }
...@@ -2394,7 +2394,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2394,7 +2394,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
size = sdreg.func; size = sdreg.func;
int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size); int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size);
if (bcmsdh_regfail(bus->sdh)) if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
memcpy(arg, &int_val, sizeof(s32)); memcpy(arg, &int_val, sizeof(s32));
break; break;
} }
...@@ -2410,7 +2410,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2410,7 +2410,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
size = sdreg.func; size = sdreg.func;
bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value); bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value);
if (bcmsdh_regfail(bus->sdh)) if (bcmsdh_regfail(bus->sdh))
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
break; break;
} }
...@@ -2509,7 +2509,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, ...@@ -2509,7 +2509,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid,
break; break;
default: default:
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
break; break;
} }
...@@ -2546,7 +2546,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) ...@@ -2546,7 +2546,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
if (bus->vars) { if (bus->vars) {
vbuffer = kzalloc(varsize, GFP_ATOMIC); vbuffer = kzalloc(varsize, GFP_ATOMIC);
if (!vbuffer) if (!vbuffer)
return BCME_NOMEM; return -BCME_NOMEM;
memcpy(vbuffer, bus->vars, bus->varsz); memcpy(vbuffer, bus->vars, bus->varsz);
...@@ -2558,7 +2558,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) ...@@ -2558,7 +2558,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize)); DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize));
nvram_ularray = kmalloc(varsize, GFP_ATOMIC); nvram_ularray = kmalloc(varsize, GFP_ATOMIC);
if (!nvram_ularray) if (!nvram_ularray)
return BCME_NOMEM; return -BCME_NOMEM;
/* Upload image to verify downloaded contents. */ /* Upload image to verify downloaded contents. */
memset(nvram_ularray, 0xaa, varsize); memset(nvram_ularray, 0xaa, varsize);
...@@ -2644,7 +2644,7 @@ static int dhdsdio_download_state(dhd_bus_t *bus, bool enter) ...@@ -2644,7 +2644,7 @@ static int dhdsdio_download_state(dhd_bus_t *bus, bool enter)
if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) { if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) {
DHD_ERROR(("%s: SOCRAM core is down after reset?\n", DHD_ERROR(("%s: SOCRAM core is down after reset?\n",
__func__)); __func__));
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
goto fail; goto fail;
} }
...@@ -3105,7 +3105,7 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) ...@@ -3105,7 +3105,7 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff)
(bus->rxctl + firstread), rdlen, NULL, NULL, (bus->rxctl + firstread), rdlen, NULL, NULL,
NULL); NULL);
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != -BCME_PENDING);
/* Control frame failures need retransmission */ /* Control frame failures need retransmission */
if (sdret < 0) { if (sdret < 0) {
...@@ -3291,7 +3291,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) ...@@ -3291,7 +3291,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
errcode = -1; errcode = -1;
} }
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(errcode != BCME_PENDING); ASSERT(errcode != -BCME_PENDING);
/* On failure, kill the superframe, allow a couple retries */ /* On failure, kill the superframe, allow a couple retries */
if (errcode < 0) { if (errcode < 0) {
...@@ -3659,7 +3659,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3659,7 +3659,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
rdlen, NULL, rdlen, NULL,
NULL, NULL); NULL, NULL);
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != -BCME_PENDING);
/* Control frame failures need /* Control frame failures need
retransmission */ retransmission */
...@@ -3701,7 +3701,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3701,7 +3701,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
rxbuf, rdlen, pkt, NULL, rxbuf, rdlen, pkt, NULL,
NULL); NULL);
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != -BCME_PENDING);
if (sdret < 0) { if (sdret < 0) {
DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n", DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
...@@ -3902,7 +3902,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -3902,7 +3902,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
F2SYNC, bus->rxhdr, firstread, NULL, F2SYNC, bus->rxhdr, firstread, NULL,
NULL, NULL); NULL, NULL);
bus->f2rxhdrs++; bus->f2rxhdrs++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != -BCME_PENDING);
if (sdret < 0) { if (sdret < 0) {
DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __func__, DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __func__,
...@@ -4068,7 +4068,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) ...@@ -4068,7 +4068,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
F2SYNC, ((u8 *) (pkt->data)), rdlen, F2SYNC, ((u8 *) (pkt->data)), rdlen,
pkt, NULL, NULL); pkt, NULL, NULL);
bus->f2rxdata++; bus->f2rxdata++;
ASSERT(sdret != BCME_PENDING); ASSERT(sdret != -BCME_PENDING);
if (sdret < 0) { if (sdret < 0) {
DHD_ERROR(("%s: read %d %s bytes failed: %d\n", DHD_ERROR(("%s: read %d %s bytes failed: %d\n",
...@@ -4420,7 +4420,7 @@ bool dhdsdio_dpc(dhd_bus_t *bus) ...@@ -4420,7 +4420,7 @@ bool dhdsdio_dpc(dhd_bus_t *bus)
F2SYNC, (u8 *) bus->ctrl_frame_buf, F2SYNC, (u8 *) bus->ctrl_frame_buf,
(u32) bus->ctrl_frame_len, NULL, (u32) bus->ctrl_frame_len, NULL,
NULL, NULL); NULL, NULL);
ASSERT(ret != BCME_PENDING); ASSERT(ret != -BCME_PENDING);
if (ret < 0) { if (ret < 0) {
/* On failure, abort the command and /* On failure, abort the command and
...@@ -4918,7 +4918,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen) ...@@ -4918,7 +4918,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Address could be zero if CONSOLE := 0 in dongle Makefile */ /* Address could be zero if CONSOLE := 0 in dongle Makefile */
if (bus->console_addr == 0) if (bus->console_addr == 0)
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
/* Exclusive bus access */ /* Exclusive bus access */
dhd_os_sdlock(bus->dhd); dhd_os_sdlock(bus->dhd);
...@@ -4926,7 +4926,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen) ...@@ -4926,7 +4926,7 @@ extern int dhd_bus_console_in(dhd_pub_t *dhdp, unsigned char *msg, uint msglen)
/* Don't allow input if dongle is in reset */ /* Don't allow input if dongle is in reset */
if (bus->dhd->dongle_reset) { if (bus->dhd->dongle_reset) {
dhd_os_sdunlock(bus->dhd); dhd_os_sdunlock(bus->dhd);
return BCME_NOTREADY; return -BCME_NOTREADY;
} }
/* Request clock to allow SDIO accesses */ /* Request clock to allow SDIO accesses */
...@@ -5145,7 +5145,7 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no, ...@@ -5145,7 +5145,7 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
/* if firmware path present try to download and bring up bus */ /* if firmware path present try to download and bring up bus */
ret = dhd_bus_start(bus->dhd); ret = dhd_bus_start(bus->dhd);
if (ret != 0) { if (ret != 0) {
if (ret == BCME_NOTUP) { if (ret == -BCME_NOTUP) {
DHD_ERROR(("%s: dongle is not responding\n", __func__)); DHD_ERROR(("%s: dongle is not responding\n", __func__));
goto fail; goto fail;
} }
...@@ -5588,7 +5588,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus) ...@@ -5588,7 +5588,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
ularray = kmalloc(bus->ramsize, GFP_ATOMIC); ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
if (!ularray) { if (!ularray) {
bcmerror = BCME_NOMEM; bcmerror = -BCME_NOMEM;
goto err; goto err;
} }
/* Upload image to verify downloaded contents. */ /* Upload image to verify downloaded contents. */
...@@ -5811,7 +5811,7 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus) ...@@ -5811,7 +5811,7 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus)
} else { } else {
DHD_ERROR(("%s: error reading nvram file: %d\n", DHD_ERROR(("%s: error reading nvram file: %d\n",
__func__, len)); __func__, len));
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
} }
err: err:
...@@ -5969,7 +5969,7 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag) ...@@ -5969,7 +5969,7 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag)
DHD_TRACE(("%s: WLAN OFF DONE\n", __func__)); DHD_TRACE(("%s: WLAN OFF DONE\n", __func__));
/* App can now remove power from device */ /* App can now remove power from device */
} else } else
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
} else { } else {
/* App must have restored power to device before calling */ /* App must have restored power to device before calling */
...@@ -6004,14 +6004,14 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag) ...@@ -6004,14 +6004,14 @@ int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag)
DHD_TRACE(("%s: WLAN ON DONE\n", DHD_TRACE(("%s: WLAN ON DONE\n",
__func__)); __func__));
} else } else
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
} else } else
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
} else { } else {
bcmerror = BCME_NOTDOWN; bcmerror = -BCME_NOTDOWN;
DHD_ERROR(("%s: Set DEVRESET=false invoked when device " DHD_ERROR(("%s: Set DEVRESET=false invoked when device "
"is on\n", __func__)); "is on\n", __func__));
bcmerror = BCME_SDIO_ERROR; bcmerror = -BCME_SDIO_ERROR;
} }
} }
return bcmerror; return bcmerror;
......
...@@ -22366,7 +22366,7 @@ wlc_phy_tx_tone_nphy(phy_info_t *pi, u32 f_kHz, u16 max_val, ...@@ -22366,7 +22366,7 @@ wlc_phy_tx_tone_nphy(phy_info_t *pi, u32 f_kHz, u16 max_val,
num_samps = num_samps =
wlc_phy_gen_load_samples_nphy(pi, f_kHz, max_val, dac_test_mode); wlc_phy_gen_load_samples_nphy(pi, f_kHz, max_val, dac_test_mode);
if (num_samps == 0) { if (num_samps == 0) {
return BCME_ERROR; return -BCME_ERROR;
} }
wlc_phy_runsamples_nphy(pi, num_samps, loops, wait, iqmode, wlc_phy_runsamples_nphy(pi, num_samps, loops, wait, iqmode,
...@@ -24559,7 +24559,7 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask) ...@@ -24559,7 +24559,7 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask)
} }
if ((ii + qq) < NPHY_MIN_RXIQ_PWR) { if ((ii + qq) < NPHY_MIN_RXIQ_PWR) {
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
break; break;
} }
...@@ -24571,14 +24571,14 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask) ...@@ -24571,14 +24571,14 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask)
a = (-(iq << (30 - iq_nbits)) + (ii >> (1 + arsh))); a = (-(iq << (30 - iq_nbits)) + (ii >> (1 + arsh)));
temp = (s32) (ii >> arsh); temp = (s32) (ii >> arsh);
if (temp == 0) { if (temp == 0) {
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
break; break;
} }
} else { } else {
a = (-(iq << (30 - iq_nbits)) + (ii << (-1 - arsh))); a = (-(iq << (30 - iq_nbits)) + (ii << (-1 - arsh)));
temp = (s32) (ii << -arsh); temp = (s32) (ii << -arsh);
if (temp == 0) { if (temp == 0) {
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
break; break;
} }
} }
...@@ -24590,14 +24590,14 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask) ...@@ -24590,14 +24590,14 @@ static void wlc_phy_calc_rx_iq_comp_nphy(phy_info_t *pi, u8 core_mask)
b = (qq << (31 - qq_nbits)); b = (qq << (31 - qq_nbits));
temp = (s32) (ii >> brsh); temp = (s32) (ii >> brsh);
if (temp == 0) { if (temp == 0) {
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
break; break;
} }
} else { } else {
b = (qq << (31 - qq_nbits)); b = (qq << (31 - qq_nbits));
temp = (s32) (ii << -brsh); temp = (s32) (ii << -brsh);
if (temp == 0) { if (temp == 0) {
bcmerror = BCME_ERROR; bcmerror = -BCME_ERROR;
break; break;
} }
} }
......
...@@ -1793,7 +1793,7 @@ int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx) ...@@ -1793,7 +1793,7 @@ int wl_ucode_init_buf(struct wl_info *wl, void **pbuf, u32 idx)
WL_ERROR("ERROR: ucode buf tag:%d can not be found!\n", idx); WL_ERROR("ERROR: ucode buf tag:%d can not be found!\n", idx);
*pbuf = NULL; *pbuf = NULL;
fail: fail:
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
/* /*
......
...@@ -538,14 +538,14 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi, ...@@ -538,14 +538,14 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi,
/* Let pressure continue to build ... */ /* Let pressure continue to build ... */
qlen = pktq_plen(&qi->q, prec); qlen = pktq_plen(&qi->q, prec);
if (ini->tx_in_transit > 0 && qlen < scb_ampdu->max_pdu) { if (ini->tx_in_transit > 0 && qlen < scb_ampdu->max_pdu) {
return BCME_BUSY; return -BCME_BUSY;
} }
wlc_ampdu_agg(ampdu, scb, p, tid); wlc_ampdu_agg(ampdu, scb, p, tid);
if (wlc->block_datafifo) { if (wlc->block_datafifo) {
WL_ERROR("%s: Fifo blocked\n", __func__); WL_ERROR("%s: Fifo blocked\n", __func__);
return BCME_BUSY; return -BCME_BUSY;
} }
rr_retry_limit = ampdu->rr_retry_limit_tid[tid]; rr_retry_limit = ampdu->rr_retry_limit_tid[tid];
ampdu_len = 0; ampdu_len = 0;
...@@ -566,7 +566,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi, ...@@ -566,7 +566,7 @@ wlc_sendampdu(struct ampdu_info *ampdu, struct wlc_txq_info *qi,
} }
if (err) { if (err) {
if (err == BCME_BUSY) { if (err == -BCME_BUSY) {
WL_ERROR("wl%d: wlc_sendampdu: prep_xdu retry; seq 0x%x\n", WL_ERROR("wl%d: wlc_sendampdu: prep_xdu retry; seq 0x%x\n",
wlc->pub->unit, seq); wlc->pub->unit, seq);
WLCNTINCR(ampdu->cnt->sduretry); WLCNTINCR(ampdu->cnt->sduretry);
...@@ -1245,12 +1245,12 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on) ...@@ -1245,12 +1245,12 @@ static int wlc_ampdu_set(struct ampdu_info *ampdu, bool on)
if (!N_ENAB(wlc->pub)) { if (!N_ENAB(wlc->pub)) {
WL_AMPDU_ERR("wl%d: driver not nmode enabled\n", WL_AMPDU_ERR("wl%d: driver not nmode enabled\n",
wlc->pub->unit); wlc->pub->unit);
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
} }
if (!wlc_ampdu_cap(ampdu)) { if (!wlc_ampdu_cap(ampdu)) {
WL_AMPDU_ERR("wl%d: device not ampdu capable\n", WL_AMPDU_ERR("wl%d: device not ampdu capable\n",
wlc->pub->unit); wlc->pub->unit);
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
} }
wlc->pub->_ampdu = on; wlc->pub->_ampdu = on;
} }
......
...@@ -1143,7 +1143,7 @@ int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw) ...@@ -1143,7 +1143,7 @@ int wlc_bmac_up_prep(struct wlc_hw_info *wlc_hw)
if (wlc_hw->sih->bustype == PCI_BUS) if (wlc_hw->sih->bustype == PCI_BUS)
si_pci_down(wlc_hw->sih); si_pci_down(wlc_hw->sih);
wlc_bmac_xtal(wlc_hw, OFF); wlc_bmac_xtal(wlc_hw, OFF);
return BCME_RADIOOFF; return -BCME_RADIOOFF;
} }
if (wlc_hw->sih->bustype == PCI_BUS) if (wlc_hw->sih->bustype == PCI_BUS)
...@@ -2848,7 +2848,7 @@ static void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool on, mbool flags) ...@@ -2848,7 +2848,7 @@ static void wlc_bmac_mute(struct wlc_hw_info *wlc_hw, bool on, mbool flags)
int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo, uint *blocks) int wlc_bmac_xmtfifo_sz_get(struct wlc_hw_info *wlc_hw, uint fifo, uint *blocks)
{ {
if (fifo >= NFIFO) if (fifo >= NFIFO)
return BCME_RANGE; return -BCME_RANGE;
*blocks = wlc_hw->xmtfifo_sz[fifo]; *blocks = wlc_hw->xmtfifo_sz[fifo];
......
...@@ -729,7 +729,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm, ...@@ -729,7 +729,7 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
} }
if (country == NULL) if (country == NULL)
return BCME_BADARG; return -BCME_BADARG;
/* set the driver state for the country */ /* set the driver state for the country */
wlc_set_country_common(wlc_cm, country_abbrev, mapped_ccode, wlc_set_country_common(wlc_cm, country_abbrev, mapped_ccode,
......
...@@ -115,7 +115,7 @@ typedef struct wsec_key { ...@@ -115,7 +115,7 @@ typedef struct wsec_key {
#define WSEC_IBSS_PEER_GROUP_KEY (1 << 7) /* Flag: group key for a IBSS PEER */ #define WSEC_IBSS_PEER_GROUP_KEY (1 << 7) /* Flag: group key for a IBSS PEER */
#define WSEC_ICV_ERROR (1 << 8) /* Provoke deliberate ICV error */ #define WSEC_ICV_ERROR (1 << 8) /* Provoke deliberate ICV error */
#define wlc_key_insert(a, b, c, d, e, f, g, h, i, j) (BCME_ERROR) #define wlc_key_insert(a, b, c, d, e, f, g, h, i, j) (-BCME_ERROR)
#define wlc_key_update(a, b, c) do {} while (0) #define wlc_key_update(a, b, c) do {} while (0)
#define wlc_key_remove(a, b, c) do {} while (0) #define wlc_key_remove(a, b, c) do {} while (0)
#define wlc_key_remove_all(a, b) do {} while (0) #define wlc_key_remove_all(a, b) do {} while (0)
...@@ -126,12 +126,12 @@ typedef struct wsec_key { ...@@ -126,12 +126,12 @@ typedef struct wsec_key {
#define wlc_key_hw_init(a, b, c) do {} while (0) #define wlc_key_hw_init(a, b, c) do {} while (0)
#define wlc_key_hw_wowl_init(a, b, c, d) do {} while (0) #define wlc_key_hw_wowl_init(a, b, c, d) do {} while (0)
#define wlc_key_sw_wowl_update(a, b, c, d, e) do {} while (0) #define wlc_key_sw_wowl_update(a, b, c, d, e) do {} while (0)
#define wlc_key_sw_wowl_create(a, b, c) (BCME_ERROR) #define wlc_key_sw_wowl_create(a, b, c) (-BCME_ERROR)
#define wlc_key_iv_update(a, b, c, d, e) do {(void)e; } while (0) #define wlc_key_iv_update(a, b, c, d, e) do {(void)e; } while (0)
#define wlc_key_iv_init(a, b, c) do {} while (0) #define wlc_key_iv_init(a, b, c) do {} while (0)
#define wlc_key_set_error(a, b, c) (BCME_ERROR) #define wlc_key_set_error(a, b, c) (-BCME_ERROR)
#define wlc_key_dump_hw(a, b) (BCME_ERROR) #define wlc_key_dump_hw(a, b) (-BCME_ERROR)
#define wlc_key_dump_sw(a, b) (BCME_ERROR) #define wlc_key_dump_sw(a, b) (-BCME_ERROR)
#define wlc_key_defkeyflag(a) (0) #define wlc_key_defkeyflag(a) (0)
#define wlc_rcmta_add_bssid(a, b) do {} while (0) #define wlc_rcmta_add_bssid(a, b) do {} while (0)
#define wlc_rcmta_del_bssid(a, b) do {} while (0) #define wlc_rcmta_del_bssid(a, b) do {} while (0)
......
...@@ -255,12 +255,12 @@ int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force) ...@@ -255,12 +255,12 @@ int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force)
if ((txchain & ~wlc->stf->hw_txchain) if ((txchain & ~wlc->stf->hw_txchain)
|| !(txchain & wlc->stf->hw_txchain)) || !(txchain & wlc->stf->hw_txchain))
return BCME_RANGE; return -BCME_RANGE;
/* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */ /* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */
txstreams = (u8) WLC_BITSCNT(txchain); txstreams = (u8) WLC_BITSCNT(txchain);
if (txstreams > MAX_STREAMS_SUPPORTED) if (txstreams > MAX_STREAMS_SUPPORTED)
return BCME_RANGE; return -BCME_RANGE;
if (txstreams == 1) { if (txstreams == 1) {
for (i = 0; i < NBANDS(wlc); i++) for (i = 0; i < NBANDS(wlc); i++)
...@@ -269,7 +269,7 @@ int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force) ...@@ -269,7 +269,7 @@ int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force)
|| (RSPEC_STF(wlc->bandstate[i]->mrspec_override) != || (RSPEC_STF(wlc->bandstate[i]->mrspec_override) !=
PHY_TXC1_MODE_SISO)) { PHY_TXC1_MODE_SISO)) {
if (!force) if (!force)
return BCME_ERROR; return -BCME_ERROR;
/* over-write the override rspec */ /* over-write the override rspec */
if (RSPEC_STF(wlc->bandstate[i]->rspec_override) if (RSPEC_STF(wlc->bandstate[i]->rspec_override)
...@@ -375,7 +375,7 @@ int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val) ...@@ -375,7 +375,7 @@ int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val)
/* when there is only 1 tx_streams, don't allow to change the txant */ /* when there is only 1 tx_streams, don't allow to change the txant */
if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1)) if (WLCISNPHY(wlc->band) && (wlc->stf->txstreams == 1))
return ((val == wlc->stf->txant) ? bcmerror : BCME_RANGE); return ((val == wlc->stf->txant) ? bcmerror : -BCME_RANGE);
switch (val) { switch (val) {
case -1: case -1:
...@@ -391,7 +391,7 @@ int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val) ...@@ -391,7 +391,7 @@ int wlc_stf_ant_txant_validate(struct wlc_info *wlc, s8 val)
val = ANT_TX_LAST_RX; val = ANT_TX_LAST_RX;
break; break;
default: default:
bcmerror = BCME_RANGE; bcmerror = -BCME_RANGE;
break; break;
} }
......
...@@ -241,7 +241,7 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); ...@@ -241,7 +241,7 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
/* ** driver/apps-shared section ** */ /* ** driver/apps-shared section ** */
#define BCME_STRLEN 64 /* Max string length for BCM errors */ #define BCME_STRLEN 64 /* Max string length for BCM errors */
#define VALID_BCMERROR(e) ((e <= 0) && (e >= BCME_LAST)) #define VALID_BCMERROR(e) ((e <= 0) && (e >= -BCME_LAST))
/* /*
* error codes could be added but the defined ones shouldn't be changed/deleted * error codes could be added but the defined ones shouldn't be changed/deleted
...@@ -251,33 +251,33 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out); ...@@ -251,33 +251,33 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
* update osl files with os specific errorcode map * update osl files with os specific errorcode map
*/ */
#define BCME_ERROR -1 /* Error generic */ #define BCME_ERROR 1 /* Error generic */
#define BCME_BADARG -2 /* Bad Argument */ #define BCME_BADARG 2 /* Bad Argument */
#define BCME_NOTUP -4 /* Not up */ #define BCME_NOTUP 4 /* Not up */
#define BCME_NOTDOWN -5 /* Not down */ #define BCME_NOTDOWN 5 /* Not down */
#define BCME_BADKEYIDX -8 /* BAD Key Index */ #define BCME_BADKEYIDX 8 /* BAD Key Index */
#define BCME_RADIOOFF -9 /* Radio Off */ #define BCME_RADIOOFF 9 /* Radio Off */
#define BCME_NOTBANDLOCKED -10 /* Not band locked */ #define BCME_NOTBANDLOCKED 10 /* Not band locked */
#define BCME_NOCLK -11 /* No Clock */ #define BCME_NOCLK 11 /* No Clock */
#define BCME_BADRATESET -12 /* BAD Rate valueset */ #define BCME_BADRATESET 12 /* BAD Rate valueset */
#define BCME_BADBAND -13 /* BAD Band */ #define BCME_BADBAND 13 /* BAD Band */
#define BCME_BUFTOOSHORT -14 /* Buffer too short */ #define BCME_BUFTOOSHORT 14 /* Buffer too short */
#define BCME_BUFTOOLONG -15 /* Buffer too long */ #define BCME_BUFTOOLONG 15 /* Buffer too long */
#define BCME_BUSY -16 /* Busy */ #define BCME_BUSY 16 /* Busy */
#define BCME_OUTOFRANGECHAN -19 /* Out of Range Channel */ #define BCME_OUTOFRANGECHAN 19 /* Out of Range Channel */
#define BCME_BADCHAN -20 /* Bad Channel */ #define BCME_BADCHAN 20 /* Bad Channel */
#define BCME_BADADDR -21 /* Bad Address */ #define BCME_BADADDR 21 /* Bad Address */
#define BCME_NORESOURCE -22 /* Not Enough Resources */ #define BCME_NORESOURCE 22 /* Not Enough Resources */
#define BCME_UNSUPPORTED -23 /* Unsupported */ #define BCME_UNSUPPORTED 23 /* Unsupported */
#define BCME_NOTREADY -25 /* Not Ready */ #define BCME_NOTREADY 25 /* Not Ready */
#define BCME_EPERM -26 /* Not Permitted */ #define BCME_EPERM 26 /* Not Permitted */
#define BCME_NOMEM -27 /* No Memory */ #define BCME_NOMEM 27 /* No Memory */
#define BCME_ASSOCIATED -28 /* Associated */ #define BCME_ASSOCIATED 28 /* Associated */
#define BCME_RANGE -29 /* Not In Range */ #define BCME_RANGE 29 /* Not In Range */
#define BCME_NOTFOUND -30 /* Not Found */ #define BCME_NOTFOUND 30 /* Not Found */
#define BCME_SDIO_ERROR -35 /* SDIO Bus Error */ #define BCME_SDIO_ERROR 35 /* SDIO Bus Error */
#define BCME_DONGLE_DOWN -36 /* Dongle Not Accessible */ #define BCME_DONGLE_DOWN 36 /* Dongle Not Accessible */
#define BCME_NONRESIDENT -42 /* access to nonresident overlay */ #define BCME_NONRESIDENT 42 /* access to nonresident overlay */
#define BCME_LAST BCME_NONRESIDENT #define BCME_LAST BCME_NONRESIDENT
/* These are collection of BCME Error strings */ /* These are collection of BCME Error strings */
......
...@@ -384,11 +384,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -384,11 +384,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
sz = (uint) oi->hwlim - oi->hwbase; sz = (uint) oi->hwlim - oi->hwbase;
if (!(oi->status & OTPS_GUP_HW)) { if (!(oi->status & OTPS_GUP_HW)) {
*wlen = sz; *wlen = sz;
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
if (*wlen < sz) { if (*wlen < sz) {
*wlen = sz; *wlen = sz;
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
} }
base = oi->hwbase; base = oi->hwbase;
break; break;
...@@ -396,11 +396,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -396,11 +396,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
sz = ((uint) oi->swlim - oi->swbase); sz = ((uint) oi->swlim - oi->swbase);
if (!(oi->status & OTPS_GUP_SW)) { if (!(oi->status & OTPS_GUP_SW)) {
*wlen = sz; *wlen = sz;
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
if (*wlen < sz) { if (*wlen < sz) {
*wlen = sz; *wlen = sz;
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
} }
base = oi->swbase; base = oi->swbase;
break; break;
...@@ -408,11 +408,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -408,11 +408,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
sz = OTPGU_CI_SZ; sz = OTPGU_CI_SZ;
if (!(oi->status & OTPS_GUP_CI)) { if (!(oi->status & OTPS_GUP_CI)) {
*wlen = sz; *wlen = sz;
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
if (*wlen < sz) { if (*wlen < sz) {
*wlen = sz; *wlen = sz;
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
} }
base = oi->otpgu_base + OTPGU_CI_OFF; base = oi->otpgu_base + OTPGU_CI_OFF;
break; break;
...@@ -420,11 +420,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -420,11 +420,11 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
sz = (uint) oi->flim - oi->fbase; sz = (uint) oi->flim - oi->fbase;
if (!(oi->status & OTPS_GUP_FUSE)) { if (!(oi->status & OTPS_GUP_FUSE)) {
*wlen = sz; *wlen = sz;
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
if (*wlen < sz) { if (*wlen < sz) {
*wlen = sz; *wlen = sz;
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
} }
base = oi->fbase; base = oi->fbase;
break; break;
...@@ -432,16 +432,16 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -432,16 +432,16 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
sz = ((uint) oi->flim - oi->hwbase); sz = ((uint) oi->flim - oi->hwbase);
if (!(oi->status & (OTPS_GUP_HW | OTPS_GUP_SW))) { if (!(oi->status & (OTPS_GUP_HW | OTPS_GUP_SW))) {
*wlen = sz; *wlen = sz;
return BCME_NOTFOUND; return -BCME_NOTFOUND;
} }
if (*wlen < sz) { if (*wlen < sz) {
*wlen = sz; *wlen = sz;
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
} }
base = oi->hwbase; base = oi->hwbase;
break; break;
default: default:
return BCME_BADARG; return -BCME_BADARG;
} }
idx = si_coreidx(oi->sih); idx = si_coreidx(oi->sih);
...@@ -459,7 +459,7 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -459,7 +459,7 @@ static int ipxotp_read_region(void *oh, int region, u16 *data, uint *wlen)
static int ipxotp_nvread(void *oh, char *data, uint *len) static int ipxotp_nvread(void *oh, char *data, uint *len)
{ {
return BCME_UNSUPPORTED; return -BCME_UNSUPPORTED;
} }
static otp_fn_t ipxotp_fn = { static otp_fn_t ipxotp_fn = {
...@@ -708,7 +708,7 @@ static int hndotp_read_region(void *oh, int region, u16 *data, uint *wlen) ...@@ -708,7 +708,7 @@ static int hndotp_read_region(void *oh, int region, u16 *data, uint *wlen)
/* Region empty? */ /* Region empty? */
st = oi->hwprot | oi->signvalid; st = oi->hwprot | oi->signvalid;
if ((st & region) == 0) if ((st & region) == 0)
return BCME_NOTFOUND; return -BCME_NOTFOUND;
*wlen = *wlen =
((int)*wlen < oi->boundary / 2) ? *wlen : (uint) oi->boundary / 2; ((int)*wlen < oi->boundary / 2) ? *wlen : (uint) oi->boundary / 2;
...@@ -926,13 +926,13 @@ otp_read_region(si_t *sih, int region, u16 *data, ...@@ -926,13 +926,13 @@ otp_read_region(si_t *sih, int region, u16 *data,
si_otp_power(sih, true); si_otp_power(sih, true);
if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) { if (!si_is_otp_powered(sih) || si_is_otp_disabled(sih)) {
err = BCME_NOTREADY; err = -BCME_NOTREADY;
goto out; goto out;
} }
oh = otp_init(sih); oh = otp_init(sih);
if (oh == NULL) { if (oh == NULL) {
err = BCME_ERROR; err = -BCME_ERROR;
goto out; goto out;
} }
......
...@@ -280,7 +280,7 @@ static int otp_read_pci(si_t *sih, u16 *buf, uint bufsz) ...@@ -280,7 +280,7 @@ static int otp_read_pci(si_t *sih, u16 *buf, uint bufsz)
otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC); otp = kzalloc(OTP_SZ_MAX, GFP_ATOMIC);
if (otp == NULL) { if (otp == NULL) {
return BCME_ERROR; return -BCME_ERROR;
} }
err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz); err = otp_read_region(sih, OTP_HW_RGN, (u16 *) otp, &sz);
...@@ -324,7 +324,7 @@ static int initvars_table(char *start, char *end, ...@@ -324,7 +324,7 @@ static int initvars_table(char *start, char *end,
char *vp = kmalloc(c, GFP_ATOMIC); char *vp = kmalloc(c, GFP_ATOMIC);
ASSERT(vp != NULL); ASSERT(vp != NULL);
if (!vp) if (!vp)
return BCME_NOMEM; return -BCME_NOMEM;
memcpy(vp, start, c); memcpy(vp, start, c);
*vars = vp; *vars = vp;
*count = c; *count = c;
...@@ -353,7 +353,7 @@ static int initvars_flash(si_t *sih, char **base, uint len) ...@@ -353,7 +353,7 @@ static int initvars_flash(si_t *sih, char **base, uint len)
/* allocate memory and read in flash */ /* allocate memory and read in flash */
flash = kmalloc(NVRAM_SPACE, GFP_ATOMIC); flash = kmalloc(NVRAM_SPACE, GFP_ATOMIC);
if (!flash) if (!flash)
return BCME_NOMEM; return -BCME_NOMEM;
err = nvram_getall(flash, NVRAM_SPACE); err = nvram_getall(flash, NVRAM_SPACE);
if (err) if (err)
goto exit; goto exit;
...@@ -372,7 +372,7 @@ static int initvars_flash(si_t *sih, char **base, uint len) ...@@ -372,7 +372,7 @@ static int initvars_flash(si_t *sih, char **base, uint len)
/* is there enough room to copy? */ /* is there enough room to copy? */
copy_len = l - dl + 1; copy_len = l - dl + 1;
if (len < copy_len) { if (len < copy_len) {
err = BCME_BUFTOOSHORT; err = -BCME_BUFTOOSHORT;
goto exit; goto exit;
} }
...@@ -384,7 +384,7 @@ static int initvars_flash(si_t *sih, char **base, uint len) ...@@ -384,7 +384,7 @@ static int initvars_flash(si_t *sih, char **base, uint len)
/* add null string as terminator */ /* add null string as terminator */
if (len < 1) { if (len < 1) {
err = BCME_BUFTOOSHORT; err = -BCME_BUFTOOSHORT;
goto exit; goto exit;
} }
*vp++ = '\0'; *vp++ = '\0';
...@@ -410,7 +410,7 @@ static int initvars_flash_si(si_t *sih, char **vars, uint *count) ...@@ -410,7 +410,7 @@ static int initvars_flash_si(si_t *sih, char **vars, uint *count)
base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC); base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
ASSERT(vp != NULL); ASSERT(vp != NULL);
if (!vp) if (!vp)
return BCME_NOMEM; return -BCME_NOMEM;
err = initvars_flash(sih, &vp, MAXSZ_NVRAM_VARS); err = initvars_flash(sih, &vp, MAXSZ_NVRAM_VARS);
if (err == 0) if (err == 0)
......
...@@ -472,9 +472,9 @@ const char *bcmerrorstr(int bcmerror) ...@@ -472,9 +472,9 @@ const char *bcmerrorstr(int bcmerror)
{ {
/* check if someone added a bcmerror code but /* check if someone added a bcmerror code but
forgot to add errorstring */ forgot to add errorstring */
ASSERT(ABS(BCME_LAST) == (ARRAY_SIZE(bcmerrorstrtable) - 1)); ASSERT(ABS(-BCME_LAST) == (ARRAY_SIZE(bcmerrorstrtable) - 1));
if (bcmerror > 0 || bcmerror < BCME_LAST) { if (bcmerror > 0 || bcmerror < -BCME_LAST) {
snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d", snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d",
bcmerror); bcmerror);
return bcm_undeferrstr; return bcm_undeferrstr;
...@@ -524,31 +524,31 @@ int bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set) ...@@ -524,31 +524,31 @@ int bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set)
case IOVT_UINT32: case IOVT_UINT32:
/* all integers are s32 sized args at the ioctl interface */ /* all integers are s32 sized args at the ioctl interface */
if (len < (int)sizeof(int)) { if (len < (int)sizeof(int)) {
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
} }
break; break;
case IOVT_BUFFER: case IOVT_BUFFER:
/* buffer must meet minimum length requirement */ /* buffer must meet minimum length requirement */
if (len < vi->minlen) { if (len < vi->minlen) {
bcmerror = BCME_BUFTOOSHORT; bcmerror = -BCME_BUFTOOSHORT;
} }
break; break;
case IOVT_VOID: case IOVT_VOID:
if (!set) { if (!set) {
/* Cannot return nil... */ /* Cannot return nil... */
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
} else if (len) { } else if (len) {
/* Set is an action w/o parameters */ /* Set is an action w/o parameters */
bcmerror = BCME_BUFTOOLONG; bcmerror = -BCME_BUFTOOLONG;
} }
break; break;
default: default:
/* unknown type for length check in iovar info */ /* unknown type for length check in iovar info */
ASSERT(0); ASSERT(0);
bcmerror = BCME_UNSUPPORTED; bcmerror = -BCME_UNSUPPORTED;
} }
return bcmerror; return bcmerror;
......
...@@ -89,7 +89,7 @@ int nvram_append(void *si, char *varlst, uint varsz) ...@@ -89,7 +89,7 @@ int nvram_append(void *si, char *varlst, uint varsz)
new = kmalloc(bufsz, GFP_ATOMIC); new = kmalloc(bufsz, GFP_ATOMIC);
if (new == NULL) if (new == NULL)
return BCME_NOMEM; return -BCME_NOMEM;
new->vars = varlst; new->vars = varlst;
new->bufsz = bufsz; new->bufsz = bufsz;
...@@ -188,7 +188,7 @@ int nvram_getall(char *buf, int count) ...@@ -188,7 +188,7 @@ int nvram_getall(char *buf, int count)
while ((from < lim) && (*from)) { while ((from < lim) && (*from)) {
len = strlen(from) + 1; len = strlen(from) + 1;
if (resid < (acc + len)) if (resid < (acc + len))
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
memcpy(to, from, len); memcpy(to, from, len);
acc += len; acc += len;
from += len; from += len;
...@@ -200,7 +200,7 @@ int nvram_getall(char *buf, int count) ...@@ -200,7 +200,7 @@ int nvram_getall(char *buf, int count)
this = this->next; this = this->next;
} }
if (resid < 1) if (resid < 1)
return BCME_BUFTOOSHORT; return -BCME_BUFTOOSHORT;
*buf = '\0'; *buf = '\0';
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册