diff options
author | Lars-Peter Clausen | 2013-09-27 16:34:27 +0200 |
---|---|---|
committer | Mark Brown | 2013-10-03 13:52:03 +0100 |
commit | 05071aa864e84000759191438a4a9ff7ba2c360e (patch) | |
tree | 08528c6a707ad83eefbf57950fa19cfad86e579b /samples | |
parent | 15c03dd4859ab16f9212238f29dd315654aa94f6 (diff) |
spi: Add a spi_w8r16be() helper
This patch adds a new spi_w8r16be() helper, which is similar to spi_w8r16()
except that it converts the read data word from big endian to native endianness
before returning it. The reason for introducing this new helper is that for SPI
slave devices it is quite common that the read 16 bit data word is in big
endian. So users of spi_w8r16() have to convert the result to native endianness
manually. A second reason is that in this case the endianness of the return
value of spi_w8r16() depends on its sign. If it is negative (i.e. a error code)
it is already in native endianness, if it is positive it is in big endian. The
sparse code checker doesn't like this kind of mixed endianness and special
annotations are necessary to keep it quiet (E.g. casting to be16 using __force).
Doing the conversion to native endianness in the helper function does not
require such annotations since we are not mixing different endiannesses in the
same variable.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions