firewire: core: fix source bus ID detection for AT context in big-endian systems
Subsystems (2)
Takashi Sakamoto
maintainerPATCH 1/1 firewire: core: fix source bus ID detection for AT context in big-endian systems
The source bus ID bit in AT DMA context is not detected correctly on big-endian systems because the little-endian data is not converted to CPU endianness.
Fix the bug. The helper functions related to this are never used in driver code, so extend the test to check the field instead.
Cc [email protected] # v6.12
Fixes 8db9d1557122 ("firewire: ohci: add static inline functions to serialize/deserialize data of AT DMA")
Signed-off-by Takashi Sakamoto <[email protected]>
--- drivers/firewire/ohci-serdes-test.c | 4 ++-- drivers/firewire/ohci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/firewire/ohci-serdes-test.c +2 -2
@@ -43,7 +43,7 @@ static void test_self_id_receive_buffer_deserialization(struct kunit *test)static void test_at_data_serdes (struct kunit *test) {static const __le32 expected[] = { -cpu_to_le32 (0x00020e80 ), +cpu_to_le32 (0x00820e80 ),cpu_to_le32 (0xffc2ffff ),cpu_to_le32 (0xe0000000 ), };
@@ -56,7 +56,7 @@ static void test_at_data_serdes(struct kunit *test)unsigned int destination_id =ohci1394_at_data_get_destination_id (expected);u64 destination_offset =ohci1394_at_data_get_destination_offset (expected); -KUNIT_EXPECT_FALSE (test, has_src_bus_id); +KUNIT_EXPECT_TRUE (test, has_src_bus_id);KUNIT_EXPECT_EQ (test,0x02 , speed);KUNIT_EXPECT_EQ (test,0x03 , tlabel);KUNIT_EXPECT_EQ (test,0x02 , retry);
drivers/firewire/ohci.h +1 -1
@@ -178,7 +178,7 @@static inline bool ohci1394_at_data_get_src_bus_id (const __le32 *data) { -return !!((data[0 ] & OHCI1394_AT_DATA_Q0_srcBusID_MASK) >> OHCI1394_AT_DATA_Q0_srcBusID_SHIFT); +return !!((le32_to_cpu (data[0 ]) & OHCI1394_AT_DATA_Q0_srcBusID_MASK) >> OHCI1394_AT_DATA_Q0_srcBusID_SHIFT); }static inline void ohci1394_at_data_set_src_bus_id (__le32 *data,bool src_bus_id)
Signature · 1 line
2.53.0
Hi,
Quoted 7 lines · Takashi Sakamoto
The source bus ID bit in AT DMA context is not detected correctly on big-endian systems because the little-endian data is not converted to CPU endianness.
Fix the bug. The helper functions related to this are never used in driver code, so extend the test to check the field instead.
Quoted 7 lines
Cc [email protected] # v6.12Fixes 8db9d1557122 ("firewire: ohci: add static inline functions to serialize/deserialize data of AT DMA")Signed-off-by Takashi Sakamoto <[email protected]>--- drivers/firewire/ohci-serdes-test.c | 4 ++-- drivers/firewire/ohci.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Applied to for-next branch.
Regards
Takashi Sakamoto