Skip to content

Commit f339c25

Browse files
committed
Merge tag 'spi-fix-v6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A couple of hopefully final fixes for spi: one driver specific fix for an issue with very large transfers and a fix for an issue with the locking fixes in spidev merged earlier this release cycle which was missed" * tag 'spi-fix-v6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: spidev: fix a recursive locking error spi: dw: Fix wrong FIFO level setting for long xfers
2 parents 47e9aa1 + eede42c commit f339c25

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

drivers/spi/spi-dw-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ static void dw_spi_irq_setup(struct dw_spi *dws)
366366
* will be adjusted at the final stage of the IRQ-based SPI transfer
367367
* execution so not to lose the leftover of the incoming data.
368368
*/
369-
level = min_t(u16, dws->fifo_len / 2, dws->tx_len);
369+
level = min_t(unsigned int, dws->fifo_len / 2, dws->tx_len);
370370
dw_writel(dws, DW_SPI_TXFTLR, level);
371371
dw_writel(dws, DW_SPI_RXFTLR, level - 1);
372372

drivers/spi/spidev.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,22 @@ MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");
8989

9090
/*-------------------------------------------------------------------------*/
9191

92+
static ssize_t
93+
spidev_sync_unlocked(struct spi_device *spi, struct spi_message *message)
94+
{
95+
ssize_t status;
96+
97+
status = spi_sync(spi, message);
98+
if (status == 0)
99+
status = message->actual_length;
100+
101+
return status;
102+
}
103+
92104
static ssize_t
93105
spidev_sync(struct spidev_data *spidev, struct spi_message *message)
94106
{
95-
int status;
107+
ssize_t status;
96108
struct spi_device *spi;
97109

98110
mutex_lock(&spidev->spi_lock);
@@ -101,12 +113,10 @@ spidev_sync(struct spidev_data *spidev, struct spi_message *message)
101113
if (spi == NULL)
102114
status = -ESHUTDOWN;
103115
else
104-
status = spi_sync(spi, message);
105-
106-
if (status == 0)
107-
status = message->actual_length;
116+
status = spidev_sync_unlocked(spi, message);
108117

109118
mutex_unlock(&spidev->spi_lock);
119+
110120
return status;
111121
}
112122

@@ -294,7 +304,7 @@ static int spidev_message(struct spidev_data *spidev,
294304
spi_message_add_tail(k_tmp, &msg);
295305
}
296306

297-
status = spidev_sync(spidev, &msg);
307+
status = spidev_sync_unlocked(spidev->spi, &msg);
298308
if (status < 0)
299309
goto done;
300310

0 commit comments

Comments
 (0)