Skip to content

Commit 35bba23

Browse files
committed
Merge remote-tracking branch 'spi/for-6.2' into spi-6.2
2 parents 5002898 + eede42c commit 35bba23

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
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 & 5 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,10 +113,9 @@ 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);
116+
status = spidev_sync_unlocked(spi, message);
105117

106-
if (status == 0)
107-
status = message->actual_length;
118+
mutex_unlock(&spidev->spi_lock);
108119

109120
mutex_unlock(&spidev->spi_lock);
110121
return status;
@@ -294,7 +305,7 @@ static int spidev_message(struct spidev_data *spidev,
294305
spi_message_add_tail(k_tmp, &msg);
295306
}
296307

297-
status = spidev_sync(spidev, &msg);
308+
status = spidev_sync_unlocked(spidev->spi, &msg);
298309
if (status < 0)
299310
goto done;
300311

0 commit comments

Comments
 (0)