mwifiex: fix checkpatch --strict warnings/errors Part 6

For file sdio.c

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Yogesh Ashok Powar 2012-03-13 19:22:39 -07:00 коммит произвёл John W. Linville
Родитель cff23cec82
Коммит 5dbd326ca7
1 изменённых файлов: 96 добавлений и 92 удалений

Просмотреть файл

@ -67,7 +67,7 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id)
struct sdio_mmc_card *card = NULL; struct sdio_mmc_card *card = NULL;
pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n",
func->vendor, func->device, func->class, func->num); func->vendor, func->device, func->class, func->num);
card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL); card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL);
if (!card) { if (!card) {
@ -112,6 +112,7 @@ mwifiex_sdio_remove(struct sdio_func *func)
{ {
struct sdio_mmc_card *card; struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter; struct mwifiex_adapter *adapter;
struct mwifiex_private *priv;
int i; int i;
pr_debug("info: SDIO func num=%d\n", func->num); pr_debug("info: SDIO func num=%d\n", func->num);
@ -131,15 +132,12 @@ mwifiex_sdio_remove(struct sdio_func *func)
for (i = 0; i < adapter->priv_num; i++) for (i = 0; i < adapter->priv_num; i++)
if ((GET_BSS_ROLE(adapter->priv[i]) == if ((GET_BSS_ROLE(adapter->priv[i]) ==
MWIFIEX_BSS_ROLE_STA) && MWIFIEX_BSS_ROLE_STA) &&
adapter->priv[i]->media_connected) adapter->priv[i]->media_connected)
mwifiex_deauthenticate(adapter->priv[i], NULL); mwifiex_deauthenticate(adapter->priv[i], NULL);
mwifiex_disable_auto_ds(mwifiex_get_priv(adapter, priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
MWIFIEX_BSS_ROLE_ANY)); mwifiex_disable_auto_ds(priv);
mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter,
MWIFIEX_BSS_ROLE_ANY),
MWIFIEX_FUNC_SHUTDOWN);
} }
mwifiex_remove_card(card->adapter, &add_remove_card_sem); mwifiex_remove_card(card->adapter, &add_remove_card_sem);
@ -169,7 +167,7 @@ static int mwifiex_sdio_suspend(struct device *dev)
if (func) { if (func) {
pm_flag = sdio_get_host_pm_caps(func); pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n", pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
sdio_func_id(func), pm_flag); sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) { if (!(pm_flag & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is" pr_err("%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func)); " suspended\n", sdio_func_id(func));
@ -363,12 +361,11 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
{ {
struct sdio_mmc_card *card = adapter->card; struct sdio_mmc_card *card = adapter->card;
int ret = -1; int ret = -1;
u8 blk_mode = u8 blk_mode = (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE
(port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE; : BLOCK_MODE;
u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1; u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
u32 blk_cnt = u32 blk_cnt = (blk_mode == BLOCK_MODE) ? (len / MWIFIEX_SDIO_BLOCK_SIZE)
(blk_mode == : len;
BLOCK_MODE) ? (len / MWIFIEX_SDIO_BLOCK_SIZE) : len;
u32 ioport = (port & MWIFIEX_SDIO_IO_PORT_MASK); u32 ioport = (port & MWIFIEX_SDIO_IO_PORT_MASK);
if (claim) if (claim)
@ -472,8 +469,7 @@ static int mwifiex_write_data_to_card(struct mwifiex_adapter *adapter,
i++; i++;
dev_err(adapter->dev, "host_to_card, write iomem" dev_err(adapter->dev, "host_to_card, write iomem"
" (%d) failed: %d\n", i, ret); " (%d) failed: %d\n", i, ret);
if (mwifiex_write_reg(adapter, if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04))
CONFIGURATION_REG, 0x04))
dev_err(adapter->dev, "write CFG reg failed\n"); dev_err(adapter->dev, "write CFG reg failed\n");
ret = -1; ret = -1;
@ -507,11 +503,11 @@ static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port)
card->mp_rd_bitmap &= (u16) (~CTRL_PORT_MASK); card->mp_rd_bitmap &= (u16) (~CTRL_PORT_MASK);
*port = CTRL_PORT; *port = CTRL_PORT;
dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%04x\n", dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%04x\n",
*port, card->mp_rd_bitmap); *port, card->mp_rd_bitmap);
} else { } else {
if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) { if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) {
card->mp_rd_bitmap &= card->mp_rd_bitmap &= (u16)
(u16) (~(1 << card->curr_rd_port)); (~(1 << card->curr_rd_port));
*port = card->curr_rd_port; *port = card->curr_rd_port;
if (++card->curr_rd_port == MAX_PORT) if (++card->curr_rd_port == MAX_PORT)
@ -522,7 +518,7 @@ static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port)
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"data: port=%d mp_rd_bitmap=0x%04x -> 0x%04x\n", "data: port=%d mp_rd_bitmap=0x%04x -> 0x%04x\n",
*port, rd_bitmap, card->mp_rd_bitmap); *port, rd_bitmap, card->mp_rd_bitmap);
} }
return 0; return 0;
} }
@ -556,14 +552,14 @@ static int mwifiex_get_wr_port_data(struct mwifiex_adapter *adapter, u8 *port)
if (*port == CTRL_PORT) { if (*port == CTRL_PORT) {
dev_err(adapter->dev, "invalid data port=%d cur port=%d" dev_err(adapter->dev, "invalid data port=%d cur port=%d"
" mp_wr_bitmap=0x%04x -> 0x%04x\n", " mp_wr_bitmap=0x%04x -> 0x%04x\n",
*port, card->curr_wr_port, wr_bitmap, *port, card->curr_wr_port, wr_bitmap,
card->mp_wr_bitmap); card->mp_wr_bitmap);
return -1; return -1;
} }
dev_dbg(adapter->dev, "data: port=%d mp_wr_bitmap=0x%04x -> 0x%04x\n", dev_dbg(adapter->dev, "data: port=%d mp_wr_bitmap=0x%04x -> 0x%04x\n",
*port, wr_bitmap, card->mp_wr_bitmap); *port, wr_bitmap, card->mp_wr_bitmap);
return 0; return 0;
} }
@ -586,8 +582,8 @@ mwifiex_sdio_poll_card_status(struct mwifiex_adapter *adapter, u8 bits)
usleep_range(10, 20); usleep_range(10, 20);
} }
dev_err(adapter->dev, "poll card status failed, tries = %d\n", dev_err(adapter->dev, "poll card status failed, tries = %d\n", tries);
tries);
return -1; return -1;
} }
@ -670,14 +666,14 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter,
if (ret) { if (ret) {
dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__, dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__,
ret); ret);
return -1; return -1;
} }
nb = le16_to_cpu(*(__le16 *) (buffer)); nb = le16_to_cpu(*(__le16 *) (buffer));
if (nb > npayload) { if (nb > npayload) {
dev_err(adapter->dev, "%s: invalid packet, nb=%d, npayload=%d\n", dev_err(adapter->dev, "%s: invalid packet, nb=%d npayload=%d\n",
__func__, nb, npayload); __func__, nb, npayload);
return -1; return -1;
} }
@ -707,19 +703,19 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
u32 i = 0; u32 i = 0;
if (!firmware_len) { if (!firmware_len) {
dev_err(adapter->dev, "firmware image not found!" dev_err(adapter->dev,
" Terminating download\n"); "firmware image not found! Terminating download\n");
return -1; return -1;
} }
dev_dbg(adapter->dev, "info: downloading FW image (%d bytes)\n", dev_dbg(adapter->dev, "info: downloading FW image (%d bytes)\n",
firmware_len); firmware_len);
/* Assume that the allocated buffer is 8-byte aligned */ /* Assume that the allocated buffer is 8-byte aligned */
fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL); fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL);
if (!fwbuf) { if (!fwbuf) {
dev_err(adapter->dev, "unable to alloc buffer for firmware." dev_err(adapter->dev,
" Terminating download\n"); "unable to alloc buffer for FW. Terminating dnld\n");
return -ENOMEM; return -ENOMEM;
} }
@ -731,7 +727,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
DN_LD_CARD_RDY); DN_LD_CARD_RDY);
if (ret) { if (ret) {
dev_err(adapter->dev, "FW download with helper:" dev_err(adapter->dev, "FW download with helper:"
" poll status timeout @ %d\n", offset); " poll status timeout @ %d\n", offset);
goto done; goto done;
} }
@ -743,17 +739,19 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_0, ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_0,
&base0); &base0);
if (ret) { if (ret) {
dev_err(adapter->dev, "dev BASE0 register read" dev_err(adapter->dev,
" failed: base0=0x%04X(%d). Terminating " "dev BASE0 register read failed: "
"download\n", base0, base0); "base0=%#04X(%d). Terminating dnld\n",
base0, base0);
goto done; goto done;
} }
ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_1, ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_1,
&base1); &base1);
if (ret) { if (ret) {
dev_err(adapter->dev, "dev BASE1 register read" dev_err(adapter->dev,
" failed: base1=0x%04X(%d). Terminating " "dev BASE1 register read failed: "
"download\n", base1, base1); "base1=%#04X(%d). Terminating dnld\n",
base1, base1);
goto done; goto done;
} }
len = (u16) (((base1 & 0xff) << 8) | (base0 & 0xff)); len = (u16) (((base1 & 0xff) << 8) | (base0 & 0xff));
@ -767,8 +765,9 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
if (!len) { if (!len) {
break; break;
} else if (len > MWIFIEX_UPLD_SIZE) { } else if (len > MWIFIEX_UPLD_SIZE) {
dev_err(adapter->dev, "FW download failed @ %d," dev_err(adapter->dev,
" invalid length %d\n", offset, len); "FW dnld failed @ %d, invalid length %d\n",
offset, len);
ret = -1; ret = -1;
goto done; goto done;
} }
@ -778,13 +777,14 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
if (len & BIT(0)) { if (len & BIT(0)) {
i++; i++;
if (i > MAX_WRITE_IOMEM_RETRY) { if (i > MAX_WRITE_IOMEM_RETRY) {
dev_err(adapter->dev, "FW download failed @" dev_err(adapter->dev,
" %d, over max retry count\n", offset); "FW dnld failed @ %d, over max retry\n",
offset);
ret = -1; ret = -1;
goto done; goto done;
} }
dev_err(adapter->dev, "CRC indicated by the helper:" dev_err(adapter->dev, "CRC indicated by the helper:"
" len = 0x%04X, txlen = %d\n", len, txlen); " len = 0x%04X, txlen = %d\n", len, txlen);
len &= ~BIT(0); len &= ~BIT(0);
/* Setting this to 0 to resend from same offset */ /* Setting this to 0 to resend from same offset */
txlen = 0; txlen = 0;
@ -796,8 +796,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
if (firmware_len - offset < txlen) if (firmware_len - offset < txlen)
txlen = firmware_len - offset; txlen = firmware_len - offset;
tx_blocks = (txlen + MWIFIEX_SDIO_BLOCK_SIZE - tx_blocks = (txlen + MWIFIEX_SDIO_BLOCK_SIZE - 1)
1) / MWIFIEX_SDIO_BLOCK_SIZE; / MWIFIEX_SDIO_BLOCK_SIZE;
/* Copy payload to buffer */ /* Copy payload to buffer */
memmove(fwbuf, &firmware[offset], txlen); memmove(fwbuf, &firmware[offset], txlen);
@ -807,8 +807,9 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
MWIFIEX_SDIO_BLOCK_SIZE, MWIFIEX_SDIO_BLOCK_SIZE,
adapter->ioport); adapter->ioport);
if (ret) { if (ret) {
dev_err(adapter->dev, "FW download, write iomem (%d)" dev_err(adapter->dev,
" failed @ %d\n", i, offset); "FW download, write iomem (%d) failed @ %d\n",
i, offset);
if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04)) if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04))
dev_err(adapter->dev, "write CFG reg failed\n"); dev_err(adapter->dev, "write CFG reg failed\n");
@ -820,7 +821,7 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
} while (true); } while (true);
dev_dbg(adapter->dev, "info: FW download over, size %d bytes\n", dev_dbg(adapter->dev, "info: FW download over, size %d bytes\n",
offset); offset);
ret = 0; ret = 0;
done: done:
@ -912,7 +913,7 @@ mwifiex_sdio_interrupt(struct sdio_func *func)
card = sdio_get_drvdata(func); card = sdio_get_drvdata(func);
if (!card || !card->adapter) { if (!card || !card->adapter) {
pr_debug("int: func=%p card=%p adapter=%p\n", pr_debug("int: func=%p card=%p adapter=%p\n",
func, card, card ? card->adapter : NULL); func, card, card ? card->adapter : NULL);
return; return;
} }
adapter = card->adapter; adapter = card->adapter;
@ -955,10 +956,12 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter,
if (adapter->ps_state == PS_STATE_SLEEP_CFM) if (adapter->ps_state == PS_STATE_SLEEP_CFM)
mwifiex_process_sleep_confirm_resp(adapter, mwifiex_process_sleep_confirm_resp(adapter,
skb->data, skb->len); skb->data,
skb->len);
memcpy(cmd_buf, skb->data, min_t(u32, memcpy(cmd_buf, skb->data,
MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER,
skb->len));
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
} else { } else {
@ -1016,7 +1019,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter,
if (port == CTRL_PORT) { if (port == CTRL_PORT) {
/* Read the command Resp without aggr */ /* Read the command Resp without aggr */
dev_dbg(adapter->dev, "info: %s: no aggregation for cmd " dev_dbg(adapter->dev, "info: %s: no aggregation for cmd "
"response\n", __func__); "response\n", __func__);
f_do_rx_cur = 1; f_do_rx_cur = 1;
goto rx_curr_single; goto rx_curr_single;
@ -1024,7 +1027,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter,
if (!card->mpa_rx.enabled) { if (!card->mpa_rx.enabled) {
dev_dbg(adapter->dev, "info: %s: rx aggregation disabled\n", dev_dbg(adapter->dev, "info: %s: rx aggregation disabled\n",
__func__); __func__);
f_do_rx_cur = 1; f_do_rx_cur = 1;
goto rx_curr_single; goto rx_curr_single;
@ -1071,7 +1074,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter,
if (MP_RX_AGGR_PKT_LIMIT_REACHED(card) || if (MP_RX_AGGR_PKT_LIMIT_REACHED(card) ||
MP_RX_AGGR_PORT_LIMIT_REACHED(card)) { MP_RX_AGGR_PORT_LIMIT_REACHED(card)) {
dev_dbg(adapter->dev, "info: %s: aggregated packet " dev_dbg(adapter->dev, "info: %s: aggregated packet "
"limit reached\n", __func__); "limit reached\n", __func__);
/* No more pkts allowed in Aggr buf, rx it */ /* No more pkts allowed in Aggr buf, rx it */
f_do_rx_aggr = 1; f_do_rx_aggr = 1;
} }
@ -1080,7 +1083,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct mwifiex_adapter *adapter,
if (f_do_rx_aggr) { if (f_do_rx_aggr) {
/* do aggr RX now */ /* do aggr RX now */
dev_dbg(adapter->dev, "info: do_rx_aggr: num of packets: %d\n", dev_dbg(adapter->dev, "info: do_rx_aggr: num of packets: %d\n",
card->mpa_rx.pkt_cnt); card->mpa_rx.pkt_cnt);
if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf, if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf,
card->mpa_rx.buf_len, card->mpa_rx.buf_len,
@ -1194,7 +1197,7 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
card->mp_wr_bitmap = ((u16) card->mp_regs[WR_BITMAP_U]) << 8; card->mp_wr_bitmap = ((u16) card->mp_regs[WR_BITMAP_U]) << 8;
card->mp_wr_bitmap |= (u16) card->mp_regs[WR_BITMAP_L]; card->mp_wr_bitmap |= (u16) card->mp_regs[WR_BITMAP_L];
dev_dbg(adapter->dev, "int: DNLD: wr_bitmap=0x%04x\n", dev_dbg(adapter->dev, "int: DNLD: wr_bitmap=0x%04x\n",
card->mp_wr_bitmap); card->mp_wr_bitmap);
if (adapter->data_sent && if (adapter->data_sent &&
(card->mp_wr_bitmap & card->mp_data_port_mask)) { (card->mp_wr_bitmap & card->mp_data_port_mask)) {
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
@ -1216,12 +1219,12 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
} }
dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n", dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n",
adapter->cmd_sent, adapter->data_sent); adapter->cmd_sent, adapter->data_sent);
if (sdio_ireg & UP_LD_HOST_INT_STATUS) { if (sdio_ireg & UP_LD_HOST_INT_STATUS) {
card->mp_rd_bitmap = ((u16) card->mp_regs[RD_BITMAP_U]) << 8; card->mp_rd_bitmap = ((u16) card->mp_regs[RD_BITMAP_U]) << 8;
card->mp_rd_bitmap |= (u16) card->mp_regs[RD_BITMAP_L]; card->mp_rd_bitmap |= (u16) card->mp_regs[RD_BITMAP_L];
dev_dbg(adapter->dev, "int: UPLD: rd_bitmap=0x%04x\n", dev_dbg(adapter->dev, "int: UPLD: rd_bitmap=0x%04x\n",
card->mp_rd_bitmap); card->mp_rd_bitmap);
while (true) { while (true) {
ret = mwifiex_get_rd_port(adapter, &port); ret = mwifiex_get_rd_port(adapter, &port);
@ -1235,15 +1238,15 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
rx_len = ((u16) card->mp_regs[len_reg_u]) << 8; rx_len = ((u16) card->mp_regs[len_reg_u]) << 8;
rx_len |= (u16) card->mp_regs[len_reg_l]; rx_len |= (u16) card->mp_regs[len_reg_l];
dev_dbg(adapter->dev, "info: RX: port=%d rx_len=%u\n", dev_dbg(adapter->dev, "info: RX: port=%d rx_len=%u\n",
port, rx_len); port, rx_len);
rx_blocks = rx_blocks =
(rx_len + MWIFIEX_SDIO_BLOCK_SIZE - (rx_len + MWIFIEX_SDIO_BLOCK_SIZE -
1) / MWIFIEX_SDIO_BLOCK_SIZE; 1) / MWIFIEX_SDIO_BLOCK_SIZE;
if (rx_len <= INTF_HEADER_LEN if (rx_len <= INTF_HEADER_LEN ||
|| (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) > (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) >
MWIFIEX_RX_DATA_BUF_SIZE) { MWIFIEX_RX_DATA_BUF_SIZE) {
dev_err(adapter->dev, "invalid rx_len=%d\n", dev_err(adapter->dev, "invalid rx_len=%d\n",
rx_len); rx_len);
return -1; return -1;
} }
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE); rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);
@ -1252,42 +1255,42 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
if (!skb) { if (!skb) {
dev_err(adapter->dev, "%s: failed to alloc skb", dev_err(adapter->dev, "%s: failed to alloc skb",
__func__); __func__);
return -1; return -1;
} }
skb_put(skb, rx_len); skb_put(skb, rx_len);
dev_dbg(adapter->dev, "info: rx_len = %d skb->len = %d\n", dev_dbg(adapter->dev, "info: rx_len = %d skb->len = %d\n",
rx_len, skb->len); rx_len, skb->len);
if (mwifiex_sdio_card_to_host_mp_aggr(adapter, skb, if (mwifiex_sdio_card_to_host_mp_aggr(adapter, skb,
port)) { port)) {
u32 cr = 0; u32 cr = 0;
dev_err(adapter->dev, "card_to_host_mpa failed:" dev_err(adapter->dev, "card_to_host_mpa failed:"
" int status=%#x\n", sdio_ireg); " int status=%#x\n", sdio_ireg);
if (mwifiex_read_reg(adapter, if (mwifiex_read_reg(adapter,
CONFIGURATION_REG, &cr)) CONFIGURATION_REG, &cr))
dev_err(adapter->dev, dev_err(adapter->dev,
"read CFG reg failed\n"); "read CFG reg failed\n");
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"info: CFG reg val = %d\n", cr); "info: CFG reg val = %d\n", cr);
if (mwifiex_write_reg(adapter, if (mwifiex_write_reg(adapter,
CONFIGURATION_REG, CONFIGURATION_REG,
(cr | 0x04))) (cr | 0x04)))
dev_err(adapter->dev, dev_err(adapter->dev,
"write CFG reg failed\n"); "write CFG reg failed\n");
dev_dbg(adapter->dev, "info: write success\n"); dev_dbg(adapter->dev, "info: write success\n");
if (mwifiex_read_reg(adapter, if (mwifiex_read_reg(adapter,
CONFIGURATION_REG, &cr)) CONFIGURATION_REG, &cr))
dev_err(adapter->dev, dev_err(adapter->dev,
"read CFG reg failed\n"); "read CFG reg failed\n");
dev_dbg(adapter->dev, dev_dbg(adapter->dev,
"info: CFG reg val =%x\n", cr); "info: CFG reg val =%x\n", cr);
return -1; return -1;
} }
} }
@ -1323,7 +1326,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
if ((!card->mpa_tx.enabled) || (port == CTRL_PORT)) { if ((!card->mpa_tx.enabled) || (port == CTRL_PORT)) {
dev_dbg(adapter->dev, "info: %s: tx aggregation disabled\n", dev_dbg(adapter->dev, "info: %s: tx aggregation disabled\n",
__func__); __func__);
f_send_cur_buf = 1; f_send_cur_buf = 1;
goto tx_curr_single; goto tx_curr_single;
@ -1332,7 +1335,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
if (next_pkt_len) { if (next_pkt_len) {
/* More pkt in TX queue */ /* More pkt in TX queue */
dev_dbg(adapter->dev, "info: %s: more packets in queue.\n", dev_dbg(adapter->dev, "info: %s: more packets in queue.\n",
__func__); __func__);
if (MP_TX_AGGR_IN_PROGRESS(card)) { if (MP_TX_AGGR_IN_PROGRESS(card)) {
if (!MP_TX_AGGR_PORT_LIMIT_REACHED(card) && if (!MP_TX_AGGR_PORT_LIMIT_REACHED(card) &&
@ -1340,9 +1343,9 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
f_precopy_cur_buf = 1; f_precopy_cur_buf = 1;
if (!(card->mp_wr_bitmap & if (!(card->mp_wr_bitmap &
(1 << card->curr_wr_port)) (1 << card->curr_wr_port)) ||
|| !MP_TX_AGGR_BUF_HAS_ROOM( !MP_TX_AGGR_BUF_HAS_ROOM(
card, pkt_len + next_pkt_len)) card, pkt_len + next_pkt_len))
f_send_aggr_buf = 1; f_send_aggr_buf = 1;
} else { } else {
/* No room in Aggr buf, send it */ /* No room in Aggr buf, send it */
@ -1356,8 +1359,8 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
f_postcopy_cur_buf = 1; f_postcopy_cur_buf = 1;
} }
} else { } else {
if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len) if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len) &&
&& (card->mp_wr_bitmap & (1 << card->curr_wr_port))) (card->mp_wr_bitmap & (1 << card->curr_wr_port)))
f_precopy_cur_buf = 1; f_precopy_cur_buf = 1;
else else
f_send_cur_buf = 1; f_send_cur_buf = 1;
@ -1365,7 +1368,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
} else { } else {
/* Last pkt in TX queue */ /* Last pkt in TX queue */
dev_dbg(adapter->dev, "info: %s: Last packet in Tx Queue.\n", dev_dbg(adapter->dev, "info: %s: Last packet in Tx Queue.\n",
__func__); __func__);
if (MP_TX_AGGR_IN_PROGRESS(card)) { if (MP_TX_AGGR_IN_PROGRESS(card)) {
/* some packs in Aggr buf already */ /* some packs in Aggr buf already */
@ -1383,7 +1386,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
if (f_precopy_cur_buf) { if (f_precopy_cur_buf) {
dev_dbg(adapter->dev, "data: %s: precopy current buffer\n", dev_dbg(adapter->dev, "data: %s: precopy current buffer\n",
__func__); __func__);
MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port); MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port);
if (MP_TX_AGGR_PKT_LIMIT_REACHED(card) || if (MP_TX_AGGR_PKT_LIMIT_REACHED(card) ||
@ -1394,7 +1397,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
if (f_send_aggr_buf) { if (f_send_aggr_buf) {
dev_dbg(adapter->dev, "data: %s: send aggr buffer: %d %d\n", dev_dbg(adapter->dev, "data: %s: send aggr buffer: %d %d\n",
__func__, __func__,
card->mpa_tx.start_port, card->mpa_tx.ports); card->mpa_tx.start_port, card->mpa_tx.ports);
ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf, ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf,
card->mpa_tx.buf_len, card->mpa_tx.buf_len,
@ -1408,14 +1411,14 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter,
tx_curr_single: tx_curr_single:
if (f_send_cur_buf) { if (f_send_cur_buf) {
dev_dbg(adapter->dev, "data: %s: send current buffer %d\n", dev_dbg(adapter->dev, "data: %s: send current buffer %d\n",
__func__, port); __func__, port);
ret = mwifiex_write_data_to_card(adapter, payload, pkt_len, ret = mwifiex_write_data_to_card(adapter, payload, pkt_len,
adapter->ioport + port); adapter->ioport + port);
} }
if (f_postcopy_cur_buf) { if (f_postcopy_cur_buf) {
dev_dbg(adapter->dev, "data: %s: postcopy current buffer\n", dev_dbg(adapter->dev, "data: %s: postcopy current buffer\n",
__func__); __func__);
MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port); MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port);
} }
@ -1460,7 +1463,7 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
ret = mwifiex_get_wr_port_data(adapter, &port); ret = mwifiex_get_wr_port_data(adapter, &port);
if (ret) { if (ret) {
dev_err(adapter->dev, "%s: no wr_port available\n", dev_err(adapter->dev, "%s: no wr_port available\n",
__func__); __func__);
return ret; return ret;
} }
} else { } else {
@ -1470,7 +1473,7 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
if (pkt_len <= INTF_HEADER_LEN || if (pkt_len <= INTF_HEADER_LEN ||
pkt_len > MWIFIEX_UPLD_SIZE) pkt_len > MWIFIEX_UPLD_SIZE)
dev_err(adapter->dev, "%s: payload=%p, nb=%d\n", dev_err(adapter->dev, "%s: payload=%p, nb=%d\n",
__func__, payload, pkt_len); __func__, payload, pkt_len);
} }
/* Transfer data to card */ /* Transfer data to card */
@ -1478,10 +1481,11 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter,
if (tx_param) if (tx_param)
ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len, ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
port, tx_param->next_pkt_len); port, tx_param->next_pkt_len
);
else else
ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len, ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
port, 0); port, 0);
if (ret) { if (ret) {
if (type == MWIFIEX_TYPE_CMD) if (type == MWIFIEX_TYPE_CMD)
@ -1734,7 +1738,7 @@ mwifiex_update_mp_end_port(struct mwifiex_adapter *adapter, u16 port)
card->curr_wr_port = 1; card->curr_wr_port = 1;
dev_dbg(adapter->dev, "cmd: mp_end_port %d, data port mask 0x%x\n", dev_dbg(adapter->dev, "cmd: mp_end_port %d, data port mask 0x%x\n",
port, card->mp_data_port_mask); port, card->mp_data_port_mask);
} }
static struct mwifiex_if_ops sdio_ops = { static struct mwifiex_if_ops sdio_ops = {