linux/drivers/fsi
Andrew Jeffery 9b5fcb15be fsi: core: Fix small accesses and unaligned offsets via sysfs
[ Upstream commit 9f4c2b516b ]

Subtracting the offset delta from four-byte alignment lead to wrapping
of the requested length where `count` is less than `off`. Generalise the
length handling to enable and optimise aligned access sizes for all
offset and size combinations. The new formula produces the following
results for given offset and count values:

    offset  count | length
    --------------+-------
    0       1     | 1
    0       2     | 2
    0       3     | 2
    0       4     | 4
    0       5     | 4
    1       1     | 1
    1       2     | 1
    1       3     | 1
    1       4     | 1
    1       5     | 1
    2       1     | 1
    2       2     | 2
    2       3     | 2
    2       4     | 2
    2       5     | 2
    3       1     | 1
    3       2     | 1
    3       3     | 1
    3       4     | 1
    3       5     | 1

We might need something like this for the cfam chardevs as well, for
example we don't currently implement any alignment restrictions /
handling in the hardware master driver.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20191108051945.7109-6-joel@jms.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:45:09 +01:00
..
cf-fsi-fw.h fsi: cf-fsi-fw: Use the correct style for SPDX License Identifier 2019-06-19 19:35:51 +02:00
fsi-core.c fsi: core: Fix small accesses and unaligned offsets via sysfs 2019-12-31 16:45:09 +01:00
fsi-master-ast-cf.c fsi: master-ast-cf: Rename dump_trace() to avoid name collision 2018-07-26 14:49:50 +10:00
fsi-master-gpio.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
fsi-master-hub.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
fsi-master.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
fsi-occ.c OCC: FSI and hwmon: Add sequence numbering 2019-07-03 10:41:22 +09:30
fsi-sbefifo.c fsi: sbefifo: Don't fail operations when in SBE IPL state 2019-07-03 21:17:11 +02:00
fsi-scom.c fsi: scom: Don't abort operations for minor errors 2019-08-28 22:59:18 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00