aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-01-10 12:09:53 -0500
committerMark Brown <broonie@linaro.org>2014-01-13 05:13:28 -0500
commitd3fbd457013c0f6d96de461ce0a9cb1f8b73cd0b (patch)
tree0e6cce807a503acdeac23e1267a4c2fb1c9585b6 /include/linux/spi
parenta89e2d2754246645959f1a2f91e37e9b367bfd36 (diff)
spi: Use bitfields for multiple data lines
Trent Piepho observed that since the current realistic maximum number of data lines is four we can pack the spi_transfer struct more efficiently if we use a bitfield for the number of bits, allowing the fields to fit in a single byte along with cs_change. If space becomes an issue further optimiation is possible by only using the constants and packing the values chosen for them. Reported-by: Trent Piepho <tpiepho@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/spi.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 27a882978c15..77b529e418d5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -576,8 +576,8 @@ struct spi_transfer {
576 dma_addr_t rx_dma; 576 dma_addr_t rx_dma;
577 577
578 unsigned cs_change:1; 578 unsigned cs_change:1;
579 u8 tx_nbits; 579 unsigned tx_nbits:3;
580 u8 rx_nbits; 580 unsigned rx_nbits:3;
581#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */ 581#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
582#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ 582#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
583#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ 583#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */