Merge existing fixes from spi/for-5.13

This commit is contained in:
Mark Brown 2021-05-10 13:01:03 +01:00
Родитель 6efb943b86 6d5ff8e632
Коммит ccef8441fb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
3 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -65,7 +65,7 @@ config SPI_ALTERA
This is the driver for the Altera SPI Controller. This is the driver for the Altera SPI Controller.
config SPI_ALTERA_CORE config SPI_ALTERA_CORE
tristate "Altera SPI Controller core code" tristate "Altera SPI Controller core code" if COMPILE_TEST
select REGMAP select REGMAP
help help
"The core code for the Altera SPI Controller" "The core code for the Altera SPI Controller"

Просмотреть файл

@ -367,7 +367,7 @@ static int zynq_qspi_config_op(struct zynq_qspi *xqspi, struct spi_device *spi)
} }
/** /**
* zynq_qspi_setup - Configure the QSPI controller * zynq_qspi_setup_op - Configure the QSPI controller
* @spi: Pointer to the spi_device structure * @spi: Pointer to the spi_device structure
* *
* Sets the operational mode of QSPI controller for the next QSPI transfer, baud * Sets the operational mode of QSPI controller for the next QSPI transfer, baud
@ -528,18 +528,17 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master); struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master);
int err = 0, i; int err = 0, i;
u8 *tmpbuf; u8 *tmpbuf;
u8 opcode = op->cmd.opcode;
dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n", dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
opcode, op->cmd.buswidth, op->addr.buswidth, op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
op->dummy.buswidth, op->data.buswidth); op->dummy.buswidth, op->data.buswidth);
zynq_qspi_chipselect(mem->spi, true); zynq_qspi_chipselect(mem->spi, true);
zynq_qspi_config_op(xqspi, mem->spi); zynq_qspi_config_op(xqspi, mem->spi);
if (op->cmd.nbytes) { if (op->cmd.opcode) {
reinit_completion(&xqspi->data_completion); reinit_completion(&xqspi->data_completion);
xqspi->txbuf = &opcode; xqspi->txbuf = (u8 *)&op->cmd.opcode;
xqspi->rxbuf = NULL; xqspi->rxbuf = NULL;
xqspi->tx_bytes = op->cmd.nbytes; xqspi->tx_bytes = op->cmd.nbytes;
xqspi->rx_bytes = op->cmd.nbytes; xqspi->rx_bytes = op->cmd.nbytes;

Просмотреть файл

@ -47,10 +47,6 @@ static void spidev_release(struct device *dev)
{ {
struct spi_device *spi = to_spi_device(dev); struct spi_device *spi = to_spi_device(dev);
/* spi controllers may cleanup for released devices */
if (spi->controller->cleanup)
spi->controller->cleanup(spi);
spi_controller_put(spi->controller); spi_controller_put(spi->controller);
kfree(spi->driver_override); kfree(spi->driver_override);
kfree(spi); kfree(spi);
@ -558,6 +554,12 @@ static int spi_dev_check(struct device *dev, void *data)
return 0; return 0;
} }
static void spi_cleanup(struct spi_device *spi)
{
if (spi->controller->cleanup)
spi->controller->cleanup(spi);
}
/** /**
* spi_add_device - Add spi_device allocated with spi_alloc_device * spi_add_device - Add spi_device allocated with spi_alloc_device
* @spi: spi_device to register * @spi: spi_device to register
@ -622,11 +624,13 @@ int spi_add_device(struct spi_device *spi)
/* Device may be bound to an active driver when this returns */ /* Device may be bound to an active driver when this returns */
status = device_add(&spi->dev); status = device_add(&spi->dev);
if (status < 0) if (status < 0) {
dev_err(dev, "can't add %s, status %d\n", dev_err(dev, "can't add %s, status %d\n",
dev_name(&spi->dev), status); dev_name(&spi->dev), status);
else spi_cleanup(spi);
} else {
dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev));
}
done: done:
mutex_unlock(&spi_add_lock); mutex_unlock(&spi_add_lock);
@ -710,6 +714,8 @@ void spi_unregister_device(struct spi_device *spi)
if (!spi) if (!spi)
return; return;
spi_cleanup(spi);
if (spi->dev.of_node) { if (spi->dev.of_node) {
of_node_clear_flag(spi->dev.of_node, OF_POPULATED); of_node_clear_flag(spi->dev.of_node, OF_POPULATED);
of_node_put(spi->dev.of_node); of_node_put(spi->dev.of_node);