* [PATCH] bnx2x: use ARRAY_SIZE where possible
[not found] <1356030701-16284-1-git-send-email-sasha.levin@oracle.com>
@ 2012-12-20 19:11 ` Sasha Levin
2012-12-23 8:49 ` Eilon Greenstein
2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
To: Eilon Greenstein, netdev, linux-kernel; +Cc: Sasha Levin
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 09096b4..cb41f54 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -3659,7 +3659,7 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy,
bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
MDIO_WC_REG_CL49_USERB0_CTRL, (3<<6));
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(reg_set); i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
reg_set[i].val);
@@ -3713,7 +3713,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
};
DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n");
/* Set to default registers that may be overriden by 10G force */
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(reg_set); i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
reg_set[i].val);
@@ -3854,7 +3854,7 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy,
{MDIO_PMA_DEVAD, MDIO_WC_REG_PMD_KR_CONTROL, 0x2}
};
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(reg_set); i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
reg_set[i].val);
@@ -4242,7 +4242,7 @@ static void bnx2x_warpcore_clear_regs(struct bnx2x_phy *phy,
bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
MDIO_WC_REG_RX66_CONTROL, (3<<13));
- for (i = 0; i < sizeof(wc_regs)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(wc_regs); i++)
bnx2x_cl45_write(bp, phy, wc_regs[i].devad, wc_regs[i].reg,
wc_regs[i].val);
@@ -9520,7 +9520,7 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy,
} else {
/* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */
/* (1) set reg 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set);
+ for (i = 0; i < ARRAY_SIZE(reg_set);
i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad,
reg_set[i].reg, reg_set[i].val);
@@ -9592,7 +9592,7 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp,
MDIO_PMA_DEVAD,
MDIO_PMA_REG_8481_LINK_SIGNAL, val);
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(reg_set); i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
reg_set[i].val);
@@ -13395,7 +13395,7 @@ static void bnx2x_disable_kr2(struct link_params *params,
};
DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n");
- for (i = 0; i < sizeof(reg_set)/sizeof(struct bnx2x_reg_set); i++)
+ for (i = 0; i < ARRAY_SIZE(reg_set); i++)
bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
reg_set[i].val);
vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
--
1.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] wireless: mwifiex: remove unreachable paths
[not found] <1356030701-16284-1-git-send-email-sasha.levin@oracle.com>
2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-20 19:11 ` Sasha Levin
2012-12-20 20:13 ` Bing Zhao
1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2012-12-20 19:11 UTC (permalink / raw)
To: Bing Zhao, John W. Linville, linux-wireless, netdev, linux-kernel
Cc: Sasha Levin
We know 'firmware' is non-NULL from the beginning of mwifiex_prog_fw_w_helper,
remove all !firmware paths from the rest of the function.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
drivers/net/wireless/mwifiex/usb.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index 63ac9f2..8bd7098 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -836,23 +836,14 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
dlen = 0;
} else {
/* copy the header of the fw_data to get the length */
- if (firmware)
- memcpy(&fwdata->fw_hdr, &firmware[tlen],
- sizeof(struct fw_header));
- else
- mwifiex_get_fw_data(adapter, tlen,
- sizeof(struct fw_header),
- (u8 *)&fwdata->fw_hdr);
+ memcpy(&fwdata->fw_hdr, &firmware[tlen],
+ sizeof(struct fw_header));
dlen = le32_to_cpu(fwdata->fw_hdr.data_len);
dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd);
tlen += sizeof(struct fw_header);
- if (firmware)
- memcpy(fwdata->data, &firmware[tlen], dlen);
- else
- mwifiex_get_fw_data(adapter, tlen, dlen,
- (u8 *)fwdata->data);
+ memcpy(fwdata->data, &firmware[tlen], dlen);
fwdata->seq_num = cpu_to_le32(fw_seqnum);
tlen += dlen;
--
1.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH] wireless: mwifiex: remove unreachable paths
2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
@ 2012-12-20 20:13 ` Bing Zhao
0 siblings, 0 replies; 5+ messages in thread
From: Bing Zhao @ 2012-12-20 20:13 UTC (permalink / raw)
To: Sasha Levin; +Cc: John W. Linville, linux-wireless, netdev, linux-kernel
Hi Sasha,
Thanks for the patch.
> We know 'firmware' is non-NULL from the beginning of mwifiex_prog_fw_w_helper,
> remove all !firmware paths from the rest of the function.
After removing all !firmware paths the function 'mwifiex_get_fw_data' becomes an orphan.
Could you please remove that function as well and resend a v2 patch?
Thanks,
Bing
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> drivers/net/wireless/mwifiex/usb.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
> index 63ac9f2..8bd7098 100644
> --- a/drivers/net/wireless/mwifiex/usb.c
> +++ b/drivers/net/wireless/mwifiex/usb.c
> @@ -836,23 +836,14 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter,
> dlen = 0;
> } else {
> /* copy the header of the fw_data to get the length */
> - if (firmware)
> - memcpy(&fwdata->fw_hdr, &firmware[tlen],
> - sizeof(struct fw_header));
> - else
> - mwifiex_get_fw_data(adapter, tlen,
> - sizeof(struct fw_header),
> - (u8 *)&fwdata->fw_hdr);
> + memcpy(&fwdata->fw_hdr, &firmware[tlen],
> + sizeof(struct fw_header));
>
> dlen = le32_to_cpu(fwdata->fw_hdr.data_len);
> dnld_cmd = le32_to_cpu(fwdata->fw_hdr.dnld_cmd);
> tlen += sizeof(struct fw_header);
>
> - if (firmware)
> - memcpy(fwdata->data, &firmware[tlen], dlen);
> - else
> - mwifiex_get_fw_data(adapter, tlen, dlen,
> - (u8 *)fwdata->data);
> + memcpy(fwdata->data, &firmware[tlen], dlen);
>
> fwdata->seq_num = cpu_to_le32(fw_seqnum);
> tlen += dlen;
> --
> 1.8.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bnx2x: use ARRAY_SIZE where possible
2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
@ 2012-12-23 8:49 ` Eilon Greenstein
2012-12-28 4:30 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Eilon Greenstein @ 2012-12-23 8:49 UTC (permalink / raw)
To: Sasha Levin; +Cc: netdev, linux-kernel
On Thu, 2012-12-20 at 14:11 -0500, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Hi Sasha,
I have no problem with this cosmetic change, but it should probably be
sent to net-next when it is open again. When you do resubmit it, you can
add my ACK:
Acked-by Eilon Greenstein <eilong@broadcom.com>
Thanks,
Eilon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bnx2x: use ARRAY_SIZE where possible
2012-12-23 8:49 ` Eilon Greenstein
@ 2012-12-28 4:30 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-12-28 4:30 UTC (permalink / raw)
To: eilong; +Cc: sasha.levin, netdev, linux-kernel
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Sun, 23 Dec 2012 10:49:27 +0200
> On Thu, 2012-12-20 at 14:11 -0500, Sasha Levin wrote:
>> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
>
> Acked-by Eilon Greenstein <eilong@broadcom.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-28 4:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1356030701-16284-1-git-send-email-sasha.levin@oracle.com>
2012-12-20 19:11 ` [PATCH] bnx2x: use ARRAY_SIZE where possible Sasha Levin
2012-12-23 8:49 ` Eilon Greenstein
2012-12-28 4:30 ` David Miller
2012-12-20 19:11 ` [PATCH] wireless: mwifiex: remove unreachable paths Sasha Levin
2012-12-20 20:13 ` Bing Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).