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 удалений

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

@ -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);
@ -134,12 +135,9 @@ mwifiex_sdio_remove(struct sdio_func *func)
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);
@ -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;
@ -510,8 +506,8 @@ static int mwifiex_get_rd_port(struct mwifiex_adapter *adapter, u8 *port)
*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)
@ -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;
} }
@ -676,7 +672,7 @@ static int mwifiex_sdio_card_to_host(struct mwifiex_adapter *adapter,
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,8 +703,8 @@ 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;
} }
@ -718,8 +714,8 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
/* 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;
} }
@ -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,8 +777,9 @@ 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;
} }
@ -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");
@ -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 {
@ -1239,8 +1242,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
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);
@ -1340,8 +1343,8 @@ 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 {
@ -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;
@ -1478,7 +1481,8 @@ 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);