diff options
author | Marek BehĂșn <kabel@kernel.org> | 2023-10-04 11:19:03 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-10-06 11:41:52 +0100 |
commit | 5652d1741574eb89cc02576e50ee3e348bd6dd77 (patch) | |
tree | 38279a477f2ba5dd8aedeedd4d2d23811db27836 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 109c2de9ab36c7006d0cd36d2df7f8894356e17c (diff) |
net: dsa: qca8k: fix regmap bulk read/write methods on big endian systems
Commit c766e077d927 ("net: dsa: qca8k: convert to regmap read/write
API") introduced bulk read/write methods to qca8k's regmap.
The regmap bulk read/write methods get the register address in a buffer
passed as a void pointer parameter (the same buffer contains also the
read/written values). The register address occupies only as many bytes
as it requires at the beginning of this buffer. For example if the
.reg_bits member in regmap_config is 16 (as is the case for this
driver), the register address occupies only the first 2 bytes in this
buffer, so it can be cast to u16.
But the original commit implementing these bulk read/write methods cast
the buffer to u32:
u32 reg = *(u32 *)reg_buf & U16_MAX;
taking the first 4 bytes. This works on little endian systems where the
first 2 bytes of the buffer correspond to the low 16-bits, but it
obviously cannot work on big endian systems.
Fix this by casting the beginning of the buffer to u16 as
u32 reg = *(u16 *)reg_buf;
Fixes: c766e077d927 ("net: dsa: qca8k: convert to regmap read/write API")
Signed-off-by: Marek BehĂșn <kabel@kernel.org>
Tested-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions