summaryrefslogtreecommitdiff
path: root/include/linux/spi/spi.h
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2023-02-14 11:34:50 +0100
committerMark Brown <broonie@kernel.org>2023-02-14 13:27:58 +0000
commit9d77522b45246c3dc5950b9641aea49ce3c973d7 (patch)
tree4b27e9f633ec4a540531f3618f126bb18f3537d4 /include/linux/spi/spi.h
parent937ca916bf4de427242fb78105a0089af0dd43b3 (diff)
spi: Reorder fields in 'struct spi_transfer'
Group some variables based on their sizes to reduce hole and avoid padding. On x86_64, this shrinks the size from 144 to 128 bytes. Turn 'timestamped' into a bitfield so that it can be easily merged with some other bifields and move 'error'. This should have no real impact on memory allocation because 'struct spi_transfer' is mostly used on stack, but it can save a few cycles when the structure is initialized or copied. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/93a051da85a895bc6003aedfb00a13e1c2fc6338.1676370870.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/spi/spi.h')
-rw-r--r--include/linux/spi/spi.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 88cb2a1390ce..a08c20bd833b 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -1022,6 +1022,9 @@ struct spi_transfer {
void *rx_buf;
unsigned len;
+#define SPI_TRANS_FAIL_NO_START BIT(0)
+ u16 error;
+
dma_addr_t tx_dma;
dma_addr_t rx_dma;
struct sg_table tx_sg;
@@ -1032,6 +1035,7 @@ struct spi_transfer {
unsigned cs_change:1;
unsigned tx_nbits:3;
unsigned rx_nbits:3;
+ unsigned timestamped:1;
#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
@@ -1048,12 +1052,7 @@ struct spi_transfer {
struct ptp_system_timestamp *ptp_sts;
- bool timestamped;
-
struct list_head transfer_list;
-
-#define SPI_TRANS_FAIL_NO_START BIT(0)
- u16 error;
};
/**