Commit 33db085d authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: various fulmac sparse endianness fixes

Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarArend van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 40fbb290
...@@ -401,7 +401,9 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr) ...@@ -401,7 +401,9 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
/* read 24 bits and return valid 17 bit addr */ /* read 24 bits and return valid 17 bit addr */
int i; int i;
u32 scratch, regdata; u32 scratch, regdata;
u8 *ptr = (u8 *)&scratch; __le32 scratch_le;
u8 *ptr = (u8 *)&scratch_le;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if ((brcmf_sdioh_card_regread(sdiodev, 0, regaddr, 1, if ((brcmf_sdioh_card_regread(sdiodev, 0, regaddr, 1,
&regdata)) != SUCCESS) &regdata)) != SUCCESS)
...@@ -412,7 +414,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr) ...@@ -412,7 +414,7 @@ static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
} }
/* Only the lower 17-bits are valid */ /* Only the lower 17-bits are valid */
scratch = le32_to_cpu(scratch); scratch = le32_to_cpu(scratch_le);
scratch &= 0x0001FFFF; scratch &= 0x0001FFFF;
return scratch; return scratch;
} }
......
...@@ -138,6 +138,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -138,6 +138,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
struct net_device *dev; struct net_device *dev;
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u32 allmulti, cnt; u32 allmulti, cnt;
__le32 cnt_le;
__le32 allmulti_le;
struct brcmf_ioctl ioc; struct brcmf_ioctl ioc;
char *buf, *bufp; char *buf, *bufp;
...@@ -166,9 +168,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -166,9 +168,9 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
strcpy(bufp, "mcast_list"); strcpy(bufp, "mcast_list");
bufp += strlen("mcast_list") + 1; bufp += strlen("mcast_list") + 1;
cnt = cpu_to_le32(cnt); cnt_le = cpu_to_le32(cnt);
memcpy(bufp, &cnt, sizeof(cnt)); memcpy(bufp, &cnt_le, sizeof(cnt));
bufp += sizeof(cnt); bufp += sizeof(cnt_le);
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
if (!cnt) if (!cnt)
...@@ -205,10 +207,11 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -205,10 +207,11 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
brcmf_ifname(&drvr_priv->pub, 0)); brcmf_ifname(&drvr_priv->pub, 0));
return; return;
} }
allmulti = cpu_to_le32(allmulti); allmulti_le = cpu_to_le32(allmulti);
if (!brcmu_mkiovar if (!brcmu_mkiovar
("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) { ("allmulti", (void *)&allmulti_le,
sizeof(allmulti_le), buf, buflen)) {
brcmf_dbg(ERROR, "%s: mkiovar failed for allmulti, datalen %d buflen %u\n", brcmf_dbg(ERROR, "%s: mkiovar failed for allmulti, datalen %d buflen %u\n",
brcmf_ifname(&drvr_priv->pub, 0), brcmf_ifname(&drvr_priv->pub, 0),
(int)sizeof(allmulti), buflen); (int)sizeof(allmulti), buflen);
...@@ -226,7 +229,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -226,7 +229,7 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: set allmulti %d failed\n", brcmf_dbg(ERROR, "%s: set allmulti %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0), brcmf_ifname(&drvr_priv->pub, 0),
le32_to_cpu(allmulti)); le32_to_cpu(allmulti_le));
} }
kfree(buf); kfree(buf);
...@@ -235,19 +238,19 @@ static void _brcmf_set_multicast_list(struct work_struct *work) ...@@ -235,19 +238,19 @@ static void _brcmf_set_multicast_list(struct work_struct *work)
driver does */ driver does */
allmulti = (dev->flags & IFF_PROMISC) ? true : false; allmulti = (dev->flags & IFF_PROMISC) ? true : false;
allmulti = cpu_to_le32(allmulti); allmulti_le = cpu_to_le32(allmulti);
memset(&ioc, 0, sizeof(ioc)); memset(&ioc, 0, sizeof(ioc));
ioc.cmd = BRCMF_C_SET_PROMISC; ioc.cmd = BRCMF_C_SET_PROMISC;
ioc.buf = &allmulti; ioc.buf = &allmulti_le;
ioc.len = sizeof(allmulti); ioc.len = sizeof(allmulti_le);
ioc.set = true; ioc.set = true;
ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len); ret = brcmf_proto_ioctl(&drvr_priv->pub, 0, &ioc, ioc.len);
if (ret < 0) { if (ret < 0) {
brcmf_dbg(ERROR, "%s: set promisc %d failed\n", brcmf_dbg(ERROR, "%s: set promisc %d failed\n",
brcmf_ifname(&drvr_priv->pub, 0), brcmf_ifname(&drvr_priv->pub, 0),
le32_to_cpu(allmulti)); le32_to_cpu(allmulti_le));
} }
} }
......
...@@ -2361,8 +2361,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, ...@@ -2361,8 +2361,8 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
len = (u16) (pkt->len); len = (u16) (pkt->len);
*(u16 *) frame = cpu_to_le16(len); *(__le16 *) frame = cpu_to_le16(len);
*(((u16 *) frame) + 1) = cpu_to_le16(~len); *(((__le16 *) frame) + 1) = cpu_to_le16(~len);
/* Software tag: channel, sequence number, data offset */ /* Software tag: channel, sequence number, data offset */
swheader = swheader =
...@@ -2917,16 +2917,17 @@ static int ...@@ -2917,16 +2917,17 @@ static int
brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh) brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh)
{ {
u32 addr; u32 addr;
__le32 addr_le;
int rv; int rv;
/* Read last word in memory to determine address of /* Read last word in memory to determine address of
sdpcm_shared structure */ sdpcm_shared structure */
rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr, rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr_le,
4); 4);
if (rv < 0) if (rv < 0)
return rv; return rv;
addr = le32_to_cpu(addr); addr = le32_to_cpu(addr_le);
brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr); brcmf_dbg(INFO, "sdpcm_shared address 0x%08X\n", addr);
...@@ -3273,8 +3274,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) ...@@ -3273,8 +3274,8 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
/* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */
*(u16 *) frame = cpu_to_le16((u16) msglen); *(__le16 *) frame = cpu_to_le16((u16) msglen);
*(((u16 *) frame) + 1) = cpu_to_le16(~msglen); *(((__le16 *) frame) + 1) = cpu_to_le16(~msglen);
/* Software tag: channel, sequence number, data offset */ /* Software tag: channel, sequence number, data offset */
swheader = swheader =
...@@ -3466,6 +3467,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) ...@@ -3466,6 +3467,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
u32 varaddr; u32 varaddr;
u8 *vbuffer; u8 *vbuffer;
u32 varsizew; u32 varsizew;
__le32 varsizew_le;
#ifdef BCMDBG #ifdef BCMDBG
char *nvram_ularray; char *nvram_ularray;
#endif /* BCMDBG */ #endif /* BCMDBG */
...@@ -3529,10 +3531,11 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) ...@@ -3529,10 +3531,11 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
*/ */
if (bcmerror) { if (bcmerror) {
varsizew = 0; varsizew = 0;
varsizew_le = cpu_to_le32(0);
} else { } else {
varsizew = varsize / 4; varsizew = varsize / 4;
varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF); varsizew = (~varsizew << 16) | (varsizew & 0x0000FFFF);
varsizew = cpu_to_le32(varsizew); varsizew_le = cpu_to_le32(varsizew);
} }
brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n", brcmf_dbg(INFO, "New varsize is %d, length token=0x%08x\n",
...@@ -3540,7 +3543,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) ...@@ -3540,7 +3543,7 @@ static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus)
/* Write the length token to the last word */ /* Write the length token to the last word */
bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4), bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4),
(u8 *)&varsizew, 4); (u8 *)&varsizew_le, 4);
return bcmerror; return bcmerror;
} }
......
...@@ -378,7 +378,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) ...@@ -378,7 +378,7 @@ brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval)
{ {
union { union {
s8 buf[BRCMF_C_IOCTL_SMLEN]; s8 buf[BRCMF_C_IOCTL_SMLEN];
s32 val; __le32 val;
} var; } var;
u32 len; u32 len;
u32 data_null; u32 data_null;
...@@ -890,11 +890,11 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, ...@@ -890,11 +890,11 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
/* Configure Beacon Interval for starter */ /* Configure Beacon Interval for starter */
if (params->beacon_interval) if (params->beacon_interval)
bcnprd = cpu_to_le32(params->beacon_interval); bcnprd = params->beacon_interval;
else else
bcnprd = cpu_to_le32(100); bcnprd = 100;
err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd)); err = brcmf_dev_ioctl_u32(dev, BRCM_SET_BCNPRD, &bcnprd);
if (unlikely(err)) { if (unlikely(err)) {
WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err); WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err);
goto done; goto done;
...@@ -2029,7 +2029,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -2029,7 +2029,7 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
goto CleanUp; goto CleanUp;
} }
*(u32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX); *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
err = brcmf_dev_ioctl(dev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX); err = brcmf_dev_ioctl(dev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
if (unlikely(err)) { if (unlikely(err)) {
...@@ -2098,7 +2098,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2098,7 +2098,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg_priv, WL_PROF_SSID); ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg_priv, WL_PROF_SSID);
*(u32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); *(__le32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO, err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO,
cfg_priv->extra_buf, WL_EXTRA_BUF_MAX); cfg_priv->extra_buf, WL_EXTRA_BUF_MAX);
if (unlikely(err)) { if (unlikely(err)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment