OSDN Git Service

spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 4 Mar 2020 22:00:33 +0000 (00:00 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 5 Mar 2020 14:06:14 +0000 (14:06 +0000)
commit53fadb4d90c762b560a9d0983bb5894129057ea1
tree3183338c66fadff172493d7f8b9c212ae02c4093
parentcb71d8efd74c588fc68cce2180a4861091e8fe8a
spi: spi-fsl-dspi: Simplify bytes_per_word gymnastics

Reduce the if-then-else-if-then-else sequence to:
 - a simple division in the case of bytes_per_word calculation
 - a memcpy command with a variable size. The semantics of larger-than-8
   xfer->bits_per_word is that those words are to be interpreted and
   transmitted in CPU native endianness.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20200304220044.11193-2-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c