summaryrefslogtreecommitdiff
path: root/scripts/objdiff
diff options
context:
space:
mode:
authorKrzysztof Wilczyński <kwilczynski@kernel.org>2026-06-16 16:31:31 +0000
committerKrzysztof Wilczyński <kwilczynski@kernel.org>2026-07-06 18:01:09 +0000
commit5b95212de6dcd7e0275cea7f894fe7226c7d9f29 (patch)
tree47df9a0538ec1b85b67bbed760fea6d8bf29870b /scripts/objdiff
parentdc76258d0132df1d831a5a29758bd448ca9c566e (diff)
downloadlinux-5b95212de6dcd7e0275cea7f894fe7226c7d9f29.tar.gz
linux-5b95212de6dcd7e0275cea7f894fe7226c7d9f29.zip
PCI/sysfs: Fix read byte order in pci_read_legacy_io()
pci_read_legacy_io() passes the sysfs buffer directly to pci_legacy_read(): return pci_legacy_read(bus, off, (u32 *)buf, count); The PowerPC implementation stores the result as a native-endian integer: *((u16 *)val) = in_le16(addr); On big-endian PowerPC this stores the bytes in the wrong order, so a 2-byte read of a device register returns different bytes than two 1-byte reads at the same addresses. The same applies to 4-byte reads. On little-endian the native byte order already matches PCI I/O port byte order, so the conversion is a no-op. Thus, let pci_legacy_read() store into a local u32 variable, then copy the I/O port value to the sysfs buffer using put_unaligned_le16() and put_unaligned_le32() for the 2 and 4 byte cases, converting from the native integer to little-endian byte order matching PCI I/O port space. No changes are needed for the Alpha platform. The legacy_io file is root-only and exists only on Alpha and PowerPC, the two architectures that define HAVE_PCI_LEGACY. Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260616163131.2763281-2-kwilczynski@kernel.org Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions