* [PATCH] brcmfmac: fix SDIO access for big-endian host
@ 2020-10-20 17:46 Remi Depommier
2020-11-07 15:49 ` Kalle Valo
2020-11-16 0:16 ` [PATCH] brcmfmac: Fix incorrect type in assignment Remi Depommier
0 siblings, 2 replies; 4+ messages in thread
From: Remi Depommier @ 2020-10-20 17:46 UTC (permalink / raw)
To: linux-wireless; +Cc: Remi Depommier
These full-mac chips use little-endian byte ordering. This patch
adds a few missing conversions to/from little-endian so that the
driver may be used with a big-endian host.
Signed-off-by: Remi Depommier <rde@setrix.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 3c07d1bbe1c6..307f1d70224d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -1340,7 +1340,7 @@ static void brcmf_sdio_free_glom(struct brcmf_sdio *bus)
static inline u8 brcmf_sdio_getdatoffset(u8 *swheader)
{
u32 hdrvalue;
- hdrvalue = *(u32 *)swheader;
+ hdrvalue = le32_to_cpu(*(__le32 *)swheader);
return (u8)((hdrvalue & SDPCM_DOFFSET_MASK) >> SDPCM_DOFFSET_SHIFT);
}
@@ -1349,7 +1349,7 @@ static inline bool brcmf_sdio_fromevntchan(u8 *swheader)
u32 hdrvalue;
u8 ret;
- hdrvalue = *(u32 *)swheader;
+ hdrvalue = le32_to_cpu(*(__le32 *)swheader);
ret = (u8)((hdrvalue & SDPCM_CHANNEL_MASK) >> SDPCM_CHANNEL_SHIFT);
return (ret == SDPCM_EVENT_CHANNEL);
@@ -3544,7 +3544,7 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
/* otherwise, set txglomalign */
value = sdiodev->settings->bus.sdio.sd_sgentry_align;
/* SDIO ADMA requires at least 32 bit alignment */
- value = max_t(u32, value, ALIGNMENT);
+ value = cpu_to_le32(max_t(u32, value, ALIGNMENT));
err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
sizeof(u32));
}
@@ -3555,7 +3555,7 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
if (sdiodev->sg_support) {
bus->txglom = false;
- value = 1;
+ value = cpu_to_le32(1);
err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom",
&value, sizeof(u32));
if (err < 0) {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] brcmfmac: fix SDIO access for big-endian host
2020-10-20 17:46 [PATCH] brcmfmac: fix SDIO access for big-endian host Remi Depommier
@ 2020-11-07 15:49 ` Kalle Valo
2020-11-16 0:16 ` [PATCH] brcmfmac: Fix incorrect type in assignment Remi Depommier
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-07 15:49 UTC (permalink / raw)
To: Remi Depommier; +Cc: linux-wireless, Remi Depommier
Remi Depommier <rde@setrix.com> wrote:
> These full-mac chips use little-endian byte ordering. This patch
> adds a few missing conversions to/from little-endian so that the
> driver may be used with a big-endian host.
>
> Signed-off-by: Remi Depommier <rde@setrix.com>
Patch applied to wireless-drivers-next.git, thanks.
d56fd83cf99c brcmfmac: fix SDIO access for big-endian host
--
https://patchwork.kernel.org/project/linux-wireless/patch/20201020174639.28892-1-rde@setrix.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] brcmfmac: Fix incorrect type in assignment
2020-10-20 17:46 [PATCH] brcmfmac: fix SDIO access for big-endian host Remi Depommier
2020-11-07 15:49 ` Kalle Valo
@ 2020-11-16 0:16 ` Remi Depommier
2020-11-24 15:03 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Remi Depommier @ 2020-11-16 0:16 UTC (permalink / raw)
To: linux-wireless; +Cc: Remi Depommier
The left-hand side of the assignment from cpu_to_le32() should be of
type __le32. This commit clears the warning reported by sparse when
building with C=1 CF="-D__CHECK_ENDIAN__".
Fixes: d56fd83cf99c ("brcmfmac: fix SDIO access for big-endian host")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Remi Depommier <rde@setrix.com>
---
.../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index f58a96fa4eb5..805e8d121d00 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3517,6 +3517,7 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
struct brcmf_sdio *bus = sdiodev->bus;
struct brcmf_core *core = bus->sdio_core;
u32 value;
+ __le32 iovar;
int err;
/* maxctl provided by common layer */
@@ -3537,16 +3538,16 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
*/
if (core->rev < 12) {
/* for sdio core rev < 12, disable txgloming */
- value = 0;
- err = brcmf_iovar_data_set(dev, "bus:txglom", &value,
- sizeof(u32));
+ iovar = 0;
+ err = brcmf_iovar_data_set(dev, "bus:txglom", &iovar,
+ sizeof(iovar));
} else {
/* otherwise, set txglomalign */
value = sdiodev->settings->bus.sdio.sd_sgentry_align;
/* SDIO ADMA requires at least 32 bit alignment */
- value = cpu_to_le32(max_t(u32, value, ALIGNMENT));
- err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value,
- sizeof(u32));
+ iovar = cpu_to_le32(max_t(u32, value, ALIGNMENT));
+ err = brcmf_iovar_data_set(dev, "bus:txglomalign", &iovar,
+ sizeof(iovar));
}
if (err < 0)
@@ -3555,9 +3556,9 @@ static int brcmf_sdio_bus_preinit(struct device *dev)
bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN;
if (sdiodev->sg_support) {
bus->txglom = false;
- value = cpu_to_le32(1);
+ iovar = cpu_to_le32(1);
err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom",
- &value, sizeof(u32));
+ &iovar, sizeof(iovar));
if (err < 0) {
/* bus:rxglom is allowed to fail */
err = 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] brcmfmac: Fix incorrect type in assignment
2020-11-16 0:16 ` [PATCH] brcmfmac: Fix incorrect type in assignment Remi Depommier
@ 2020-11-24 15:03 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-24 15:03 UTC (permalink / raw)
To: Remi Depommier; +Cc: linux-wireless, Remi Depommier
Remi Depommier <rde@setrix.com> wrote:
> The left-hand side of the assignment from cpu_to_le32() should be of
> type __le32. This commit clears the warning reported by sparse when
> building with C=1 CF="-D__CHECK_ENDIAN__".
>
> Fixes: d56fd83cf99c ("brcmfmac: fix SDIO access for big-endian host")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Remi Depommier <rde@setrix.com>
Patch applied to wireless-drivers-next.git, thanks.
fa3622bbea10 brcmfmac: Fix incorrect type in assignment
--
https://patchwork.kernel.org/project/linux-wireless/patch/20201116001639.31958-1-rde@setrix.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-24 15:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 17:46 [PATCH] brcmfmac: fix SDIO access for big-endian host Remi Depommier
2020-11-07 15:49 ` Kalle Valo
2020-11-16 0:16 ` [PATCH] brcmfmac: Fix incorrect type in assignment Remi Depommier
2020-11-24 15:03 ` Kalle Valo
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).