aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMartin Sperl <kernel@martin.sperl.org>2015-11-27 08:56:03 -0500
committerMark Brown <broonie@kernel.org>2015-12-12 18:05:18 -0500
commit49ddedf3bfcb59a562c7db0e50aecd1422e9cdc9 (patch)
tree7cff6705e103185779a162a5f2d7b46c6ab6d6ec /include/linux/spi
parent8005c49d9aea74d382f474ce11afbbc7d7130bec (diff)
spi: add spi_message_init_no_memset to avoid zeroing the spi_message
In the spi_loopback_test driver there is the need to initialize a spi_message that is filled with values from a static structure. Applying spi_message_init to such a prefilled structure results in all the settings getting reset to zero, which is not what we want. Copying each field of spi_message separately instead always includes the risk that some new fields have not been implemented in the copying code. So here we introduce a version of spi_message_init called spi_message_init_no_memset that does not fill the structure with zero first, but only initializes the relevant list_heads. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/spi.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index cce80e6dc7d1..4c54d4744107 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -762,10 +762,15 @@ struct spi_message {
762 void *state; 762 void *state;
763}; 763};
764 764
765static inline void spi_message_init_no_memset(struct spi_message *m)
766{
767 INIT_LIST_HEAD(&m->transfers);
768}
769
765static inline void spi_message_init(struct spi_message *m) 770static inline void spi_message_init(struct spi_message *m)
766{ 771{
767 memset(m, 0, sizeof *m); 772 memset(m, 0, sizeof *m);
768 INIT_LIST_HEAD(&m->transfers); 773 spi_message_init_no_memset(m);
769} 774}
770 775
771static inline void 776static inline void