ASSERT(bcmsdh);
status = brcmf_sdioh_interrupt_query(bcmsdh->sdioh, &on);
- if (SDIOH_API_SUCCESS(status))
+ if (status == 0)
return false;
else
return on;
int brcmf_sdcard_intr_enable(void *sdh)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
ASSERT(bcmsdh);
- status = brcmf_sdioh_interrupt_set(bcmsdh->sdioh, true);
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return brcmf_sdioh_interrupt_set(bcmsdh->sdioh, true);
}
int brcmf_sdcard_intr_disable(void *sdh)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
ASSERT(bcmsdh);
- status = brcmf_sdioh_interrupt_set(bcmsdh->sdioh, false);
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return brcmf_sdioh_interrupt_set(bcmsdh->sdioh, false);
}
int brcmf_sdcard_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
ASSERT(bcmsdh);
- status = brcmf_sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return brcmf_sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
}
int brcmf_sdcard_intr_dereg(void *sdh)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
ASSERT(bcmsdh);
- status = brcmf_sdioh_interrupt_deregister(bcmsdh->sdioh);
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return brcmf_sdioh_interrupt_deregister(bcmsdh->sdioh);
}
#if defined(BCMDBG)
brcmf_sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr,
(u8 *) &data);
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
- } while (!SDIOH_API_SUCCESS(status)
+ } while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
#endif
if (err)
- *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
+ *err = status;
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
__func__, fnc_num, addr, data));
brcmf_sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr,
(u8 *) &data);
#ifdef SDIOH_API_ACCESS_RETRY_LIMIT
- } while (!SDIOH_API_SUCCESS(status)
+ } while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
#endif
if (err)
- *err = SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ *err = status;
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n",
__func__, fnc_num, addr, data));
SDIOH_READ, fnc_num, addr, &data, 4);
if (err)
- *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
+ *err = status;
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
__func__, fnc_num, addr, data));
SDIOH_WRITE, fnc_num, addr, &data, 4);
if (err)
- *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO);
+ *err = status;
BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n",
__func__, fnc_num, addr, data));
kfree(tmp_buf);
}
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return status;
}
static int brcmf_sdcard_set_sbaddr_window(void *sdh, u32 address)
status = brcmf_sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, SDIO_FUNC_1, addr, &word, size);
- bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
+ bcmsdh->regfail = (status != 0);
BCMSDH_INFO(("u32data = 0x%x\n", word));
/* if ok, return appropriately masked word */
- if (SDIOH_API_SUCCESS(status)) {
+ if (status == 0) {
switch (size) {
case sizeof(u8):
return word & 0xff;
status =
brcmf_sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
- bcmsdh->regfail = !(SDIOH_API_SUCCESS(status));
+ bcmsdh->regfail = (status != 0);
- if (SDIOH_API_SUCCESS(status))
+ if (status == 0)
return 0;
BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n",
status = brcmf_sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO,
incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
+ return status;
}
int
bcmsdh_cmplt_fn_t complete, void *handle)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
uint incr_fix;
uint width;
uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK;
if (width == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
- status = brcmf_sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO,
+ return brcmf_sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO,
incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
-
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
}
int brcmf_sdcard_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes)
{
struct brcmf_sdio *bcmsdh = (struct brcmf_sdio *) sdh;
- int status;
ASSERT(bcmsdh);
ASSERT(bcmsdh->init_success);
addr &= SBSDIO_SB_OFT_ADDR_MASK;
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
- status = brcmf_sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO,
+ return brcmf_sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO,
SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
addr, 4, nbytes, buf, NULL);
-
- return SDIOH_API_SUCCESS(status) ? 0 : -EIO;
}
int brcmf_sdcard_abort(void *sdh, uint fn)
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/suspend.h>
+#include <linux/errno.h>
#include <defs.h>
#include <brcm_hw_ids.h>
kfree(sd);
}
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
/* Configure callback to client when we receive client interrupt */
if (fn == NULL) {
sd_err(("%s: interrupt handler is NULL, not registering\n",
__func__));
- return SDIOH_API_RC_FAIL;
+ return -EINVAL;
}
sd->intr_handler = fn;
sdio_release_host(gInstance->func[1]);
}
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
sd->intr_handler = NULL;
sd->intr_handler_arg = NULL;
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
extern int
{
sd_trace(("%s: Entering\n", __func__));
*onoff = sd->client_intr_enabled;
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
#if defined(BCMDBG)
if (!sd->func_cis_ptr[func]) {
memset(cis, 0, length);
sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func));
- return SDIOH_API_RC_FAIL;
+ return -ENOTSUPP;
}
sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __func__, func,
if (brcmf_sdioh_card_regread(sd, 0, offset, 1, &foo) < 0) {
sd_err(("%s: regread failed: Can't read CIS\n",
__func__));
- return SDIOH_API_RC_FAIL;
+ return -EIO;
}
*cis = (u8) (foo & 0xff);
cis++;
}
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
extern int
regaddr));
BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait);
- BRCMF_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
if (rw) { /* CMD52 Write */
if (func == 0) {
/* Can only directly write to some F0 registers.
"Err: %d\n", rw ? "Write" : "Read", func, regaddr,
*byte, err_ret));
- return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
+ return err_ret;
}
extern int
brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
uint func, uint addr, u32 *word, uint nbytes)
{
- int err_ret = SDIOH_API_RC_FAIL;
+ int err_ret = -EIO;
if (func == 0) {
sd_err(("%s: Only CMD52 allowed to F0.\n", __func__));
- return SDIOH_API_RC_FAIL;
+ return -EINVAL;
}
sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
__func__, cmd_type, rw, func, addr, nbytes));
BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait);
- BRCMF_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
rw ? "Write" : "Read", err_ret));
}
- return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
+ return err_ret;
}
static int
ASSERT(pkt);
BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
- BRCMF_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
sdio_release_host(gInstance->func[func]);
sd_trace(("%s: Exit\n", __func__));
- return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
+ return err_ret;
}
/*
sd_trace(("%s: Enter\n", __func__));
BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait);
- BRCMF_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
/* Case 1: we don't have a packet. */
if (pkt == NULL) {
sd_data(("%s: Creating new %s Packet, len=%d\n",
if (!mypkt) {
sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n",
__func__, buflen_u));
- return SDIOH_API_RC_FAIL;
+ return -EIO;
}
/* For a write, copy the buffer data into the packet. */
if (!mypkt) {
sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n",
__func__, pkt->len));
- return SDIOH_API_RC_FAIL;
+ return -EIO;
}
/* For a write, copy the buffer data into the packet. */
&t_func);
sd_trace(("%s: Exit\n", __func__));
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
/* Reset and re-initialize the device */
{
sd_trace(("%s: Enter\n", __func__));
sd_trace(("%s: Exit\n", __func__));
- return SDIOH_API_RC_SUCCESS;
+ return 0;
}
/* Disable device interrupt */