diff options
| author | Martin Sperl <kernel@martin.sperl.org> | 2015-12-14 10:20:20 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2016-02-09 14:32:07 -0500 |
| commit | d9f1212272818420fcde611a940c1ad611a8b785 (patch) | |
| tree | 0799bc9b7950503331bfbb384fbda85a427b9eeb /include/linux/spi | |
| parent | 523baf5a0609690cb742b3662b7ccac0ea0b2ef2 (diff) | |
spi: core: add spi_split_transfers_maxsize
Add spi_split_transfers_maxsize method that splits
spi_transfers transparently into multiple transfers
that are below the given max-size.
This makes use of the spi_res framework via
spi_replace_transfers to allocate/free the extra
transfers as well as reverting back the changes applied
while processing the spi_message.
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.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index d71385756fee..3c02b4d06268 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -53,6 +53,10 @@ extern struct bus_type spi_bus_type; | |||
| 53 | * | 53 | * |
| 54 | * @transfer_bytes_histo: | 54 | * @transfer_bytes_histo: |
| 55 | * transfer bytes histogramm | 55 | * transfer bytes histogramm |
| 56 | * | ||
| 57 | * @transfers_split_maxsize: | ||
| 58 | * number of transfers that have been split because of | ||
| 59 | * maxsize limit | ||
| 56 | */ | 60 | */ |
| 57 | struct spi_statistics { | 61 | struct spi_statistics { |
| 58 | spinlock_t lock; /* lock for the whole structure */ | 62 | spinlock_t lock; /* lock for the whole structure */ |
| @@ -72,6 +76,8 @@ struct spi_statistics { | |||
| 72 | 76 | ||
| 73 | #define SPI_STATISTICS_HISTO_SIZE 17 | 77 | #define SPI_STATISTICS_HISTO_SIZE 17 |
| 74 | unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE]; | 78 | unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE]; |
| 79 | |||
| 80 | unsigned long transfers_split_maxsize; | ||
| 75 | }; | 81 | }; |
| 76 | 82 | ||
| 77 | void spi_statistics_add_transfer_stats(struct spi_statistics *stats, | 83 | void spi_statistics_add_transfer_stats(struct spi_statistics *stats, |
| @@ -935,6 +941,15 @@ extern struct spi_replaced_transfers *spi_replace_transfers( | |||
| 935 | 941 | ||
| 936 | /*---------------------------------------------------------------------------*/ | 942 | /*---------------------------------------------------------------------------*/ |
| 937 | 943 | ||
| 944 | /* SPI transfer transformation methods */ | ||
| 945 | |||
| 946 | extern int spi_split_transfers_maxsize(struct spi_master *master, | ||
| 947 | struct spi_message *msg, | ||
| 948 | size_t maxsize, | ||
| 949 | gfp_t gfp); | ||
| 950 | |||
| 951 | /*---------------------------------------------------------------------------*/ | ||
| 952 | |||
| 938 | /* All these synchronous SPI transfer routines are utilities layered | 953 | /* All these synchronous SPI transfer routines are utilities layered |
| 939 | * over the core async transfer primitive. Here, "synchronous" means | 954 | * over the core async transfer primitive. Here, "synchronous" means |
| 940 | * they will sleep uninterruptibly until the async transfer completes. | 955 | * they will sleep uninterruptibly until the async transfer completes. |
