]> www.infradead.org Git - users/jedix/linux-maple.git/commit
firewire: ohci: use common macro to interpret be32 data in le32 buffer
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 2 Jul 2024 22:20:30 +0000 (07:20 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 3 Jul 2024 23:12:48 +0000 (08:12 +0900)
commitf26a38e61c03fdfacb6b596e1daf665cf4526a60
tree2a8f08743880165846661b334a020f9c1b2143bd
parent502099acb8cbf08acb6b43ff2b8da43d2bf85166
firewire: ohci: use common macro to interpret be32 data in le32 buffer

The 1394 OHCI driver configures the hardware to transfer the data quadlets
of packet via DMA after converting it to little endian, therefore the data
is typed as __le32. Nevertheless some actual hardware ignores the
configuration. In the case, the data in DMA buffer is aligned to big endian
(__be32).

For the case in big-endian machine, the driver includes the following
interpretation from __le32 to u32 (host-endian = __be32):

    * (__force __u32)(v)

In include/linux/byteorder/generic.h, be32_to_cpu() is available. It is
expanded to the following expression in
'include/uapi/linux/byteorder/big_endian.h':

    * (__force __u32)(__be32)(x)

This commit replace the ad-hoc endian interpretation with the above.

Link: https://lore.kernel.org/r/20240702222034.1378764-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/ohci.c