Skip to content

Commit 14fe5a9

Browse files
andy-shevbroonie
authored andcommitted
spi: Fix types of the last chip select storage variables
First of all, last_cs_index_mask should be aligned with the original cs_index_mask, which is 16-bit (for now) wide. Use the same pattern for the last_cs_index_mask. Second, last_cs can be negative and since 'char' is equal to 'unsigned char' in the kernel, it's incorrect, strictly speaking, to assign signed number to it. Use s8 type as it's done for *_native_cs ones. With this change, regroup a bit the ordering to avoid too much memory space to be wasted due to paddings. Shuffle kernel documentation accordignly. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1209c55 commit 14fe5a9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/linux/spi/spi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,11 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
450450
* the @cur_msg_completion. This flag is used to signal the context that
451451
* is running spi_finalize_current_message() that it needs to complete()
452452
* @cur_msg_mapped: message has been mapped for DMA
453+
* @fallback: fallback to PIO if DMA transfer return failure with
454+
* SPI_TRANS_FAIL_NO_START.
455+
* @last_cs_mode_high: was (mode & SPI_CS_HIGH) true on the last call to set_cs.
453456
* @last_cs: the last chip_select that is recorded by set_cs, -1 on non chip
454457
* selected
455-
* @last_cs_mode_high: was (mode & SPI_CS_HIGH) true on the last call to set_cs.
456458
* @xfer_completion: used by core transfer_one_message()
457459
* @busy: message pump is busy
458460
* @running: message pump is running
@@ -529,8 +531,6 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
529531
* If the driver does not set this, the SPI core takes the snapshot as
530532
* close to the driver hand-over as possible.
531533
* @irq_flags: Interrupt enable state during PTP system timestamping
532-
* @fallback: fallback to PIO if DMA transfer return failure with
533-
* SPI_TRANS_FAIL_NO_START.
534534
* @queue_empty: signal green light for opportunistically skipping the queue
535535
* for spi_sync transfers.
536536
* @must_async: disable all fast paths in the core
@@ -710,10 +710,10 @@ struct spi_controller {
710710
bool rt;
711711
bool auto_runtime_pm;
712712
bool cur_msg_mapped;
713-
char last_cs[SPI_CS_CNT_MAX];
714-
char last_cs_index_mask;
715-
bool last_cs_mode_high;
716713
bool fallback;
714+
bool last_cs_mode_high;
715+
s8 last_cs[SPI_CS_CNT_MAX];
716+
u32 last_cs_index_mask : SPI_CS_CNT_MAX;
717717
struct completion xfer_completion;
718718
size_t max_dma_len;
719719

0 commit comments

Comments
 (0)