File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -1147,33 +1147,22 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
1147
1147
}
1148
1148
}
1149
1149
1150
+ ctlr -> cur_rx_dma_dev = rx_dev ;
1151
+ ctlr -> cur_tx_dma_dev = tx_dev ;
1150
1152
ctlr -> cur_msg_mapped = true;
1151
1153
1152
1154
return 0 ;
1153
1155
}
1154
1156
1155
1157
static int __spi_unmap_msg (struct spi_controller * ctlr , struct spi_message * msg )
1156
1158
{
1159
+ struct device * rx_dev = ctlr -> cur_rx_dma_dev ;
1160
+ struct device * tx_dev = ctlr -> cur_tx_dma_dev ;
1157
1161
struct spi_transfer * xfer ;
1158
- struct device * tx_dev , * rx_dev ;
1159
1162
1160
1163
if (!ctlr -> cur_msg_mapped || !ctlr -> can_dma )
1161
1164
return 0 ;
1162
1165
1163
- if (ctlr -> dma_tx )
1164
- tx_dev = ctlr -> dma_tx -> device -> dev ;
1165
- else if (ctlr -> dma_map_dev )
1166
- tx_dev = ctlr -> dma_map_dev ;
1167
- else
1168
- tx_dev = ctlr -> dev .parent ;
1169
-
1170
- if (ctlr -> dma_rx )
1171
- rx_dev = ctlr -> dma_rx -> device -> dev ;
1172
- else if (ctlr -> dma_map_dev )
1173
- rx_dev = ctlr -> dma_map_dev ;
1174
- else
1175
- rx_dev = ctlr -> dev .parent ;
1176
-
1177
1166
list_for_each_entry (xfer , & msg -> transfers , transfer_list ) {
1178
1167
if (!ctlr -> can_dma (ctlr , msg -> spi , xfer ))
1179
1168
continue ;
Original file line number Diff line number Diff line change @@ -378,6 +378,8 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
378
378
* @cleanup: frees controller-specific state
379
379
* @can_dma: determine whether this controller supports DMA
380
380
* @dma_map_dev: device which can be used for DMA mapping
381
+ * @cur_rx_dma_dev: device which is currently used for RX DMA mapping
382
+ * @cur_tx_dma_dev: device which is currently used for TX DMA mapping
381
383
* @queued: whether this controller is providing an internal message queue
382
384
* @kworker: pointer to thread struct for message pump
383
385
* @pump_messages: work struct for scheduling work to the message pump
@@ -609,6 +611,8 @@ struct spi_controller {
609
611
struct spi_device * spi ,
610
612
struct spi_transfer * xfer );
611
613
struct device * dma_map_dev ;
614
+ struct device * cur_rx_dma_dev ;
615
+ struct device * cur_tx_dma_dev ;
612
616
613
617
/*
614
618
* These hooks are for drivers that want to use the generic
You can’t perform that action at this time.
0 commit comments