Skip to content

Commit f91c75d

Browse files
committed
Merge remote-tracking branches 'spi/topic/doc', 'spi/topic/dw' and 'spi/topic/flash' into spi-next
4 parents 6beb9fe + ee7683a + 2f6fdef + 49023d2 commit f91c75d

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

drivers/spi/spi-dw-mid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ static void mid_spi_dma_exit(struct dw_spi *dws)
8989
if (!dws->dma_inited)
9090
return;
9191

92-
dmaengine_terminate_all(dws->txchan);
92+
dmaengine_terminate_sync(dws->txchan);
9393
dma_release_channel(dws->txchan);
9494

95-
dmaengine_terminate_all(dws->rxchan);
95+
dmaengine_terminate_sync(dws->rxchan);
9696
dma_release_channel(dws->rxchan);
9797
}
9898

drivers/spi/spi-dw-mmio.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
4747

4848
/* Get basic io resource and map it */
4949
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
50-
if (!mem) {
51-
dev_err(&pdev->dev, "no mem resource?\n");
52-
return -EINVAL;
53-
}
54-
5550
dws->regs = devm_ioremap_resource(&pdev->dev, mem);
5651
if (IS_ERR(dws->regs)) {
5752
dev_err(&pdev->dev, "SPI region map failed\n");

drivers/spi/spi.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_transfer);
10471047
* __spi_pump_messages - function which processes spi message queue
10481048
* @master: master to process queue for
10491049
* @in_kthread: true if we are in the context of the message pump thread
1050+
* @bus_locked: true if the bus mutex is held when calling this function
10501051
*
10511052
* This function checks if there is any spi message in the queue that
10521053
* needs processing and if so call out to the driver to initialize hardware
@@ -1056,7 +1057,8 @@ EXPORT_SYMBOL_GPL(spi_finalize_current_transfer);
10561057
* inside spi_sync(); the queue extraction handling at the top of the
10571058
* function should deal with this safely.
10581059
*/
1059-
static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
1060+
static void __spi_pump_messages(struct spi_master *master, bool in_kthread,
1061+
bool bus_locked)
10601062
{
10611063
unsigned long flags;
10621064
bool was_busy = false;
@@ -1152,7 +1154,9 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
11521154
}
11531155
}
11541156

1155-
mutex_lock(&master->bus_lock_mutex);
1157+
if (!bus_locked)
1158+
mutex_lock(&master->bus_lock_mutex);
1159+
11561160
trace_spi_message_start(master->cur_msg);
11571161

11581162
if (master->prepare_message) {
@@ -1162,8 +1166,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
11621166
"failed to prepare message: %d\n", ret);
11631167
master->cur_msg->status = ret;
11641168
spi_finalize_current_message(master);
1165-
mutex_unlock(&master->bus_lock_mutex);
1166-
return;
1169+
goto out;
11671170
}
11681171
master->cur_msg_prepared = true;
11691172
}
@@ -1172,21 +1175,23 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread)
11721175
if (ret) {
11731176
master->cur_msg->status = ret;
11741177
spi_finalize_current_message(master);
1175-
mutex_unlock(&master->bus_lock_mutex);
1176-
return;
1178+
goto out;
11771179
}
11781180

11791181
ret = master->transfer_one_message(master, master->cur_msg);
11801182
if (ret) {
11811183
dev_err(&master->dev,
11821184
"failed to transfer one message from queue\n");
1183-
mutex_unlock(&master->bus_lock_mutex);
1184-
return;
1185+
goto out;
11851186
}
1186-
mutex_unlock(&master->bus_lock_mutex);
1187+
1188+
out:
1189+
if (!bus_locked)
1190+
mutex_unlock(&master->bus_lock_mutex);
11871191

11881192
/* Prod the scheduler in case transfer_one() was busy waiting */
1189-
cond_resched();
1193+
if (!ret)
1194+
cond_resched();
11901195
}
11911196

11921197
/**
@@ -1198,7 +1203,7 @@ static void spi_pump_messages(struct kthread_work *work)
11981203
struct spi_master *master =
11991204
container_of(work, struct spi_master, pump_messages);
12001205

1201-
__spi_pump_messages(master, true);
1206+
__spi_pump_messages(master, true, false);
12021207
}
12031208

12041209
static int spi_init_queue(struct spi_master *master)
@@ -2479,7 +2484,7 @@ static int __spi_sync(struct spi_device *spi, struct spi_message *message,
24792484
spi_sync_immediate);
24802485
SPI_STATISTICS_INCREMENT_FIELD(&spi->statistics,
24812486
spi_sync_immediate);
2482-
__spi_pump_messages(master, false);
2487+
__spi_pump_messages(master, false, bus_locked);
24832488
}
24842489

24852490
wait_for_completion(&done);

include/linux/spi/spi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
304304
* @min_speed_hz: Lowest supported transfer speed
305305
* @max_speed_hz: Highest supported transfer speed
306306
* @flags: other constraints relevant to this driver
307+
* @max_transfer_size: function that returns the max transfer size for
308+
* a &spi_device; may be %NULL, so the default %SIZE_MAX will be used.
307309
* @bus_lock_spinlock: spinlock for SPI bus locking
308310
* @bus_lock_mutex: mutex for SPI bus locking
309311
* @bus_lock_flag: indicates that the SPI bus is locked for exclusive use

0 commit comments

Comments
 (0)