summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-topcliff-pch.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-06-15 18:41:38 +0100
committerMark Brown <broonie@kernel.org>2022-06-20 12:43:36 +0100
commit26f30e3ee1bf120af1bde22d890e46a0c8dbeca0 (patch)
treed5f0414ab1fa66c9522434d855b0afb368655d3a /drivers/spi/spi-topcliff-pch.c
parent2081ad1467469b649fc9f9226b235977a7bf9402 (diff)
downloadlinux-26f30e3ee1bf120af1bde22d890e46a0c8dbeca0.tar.gz
linux-26f30e3ee1bf120af1bde22d890e46a0c8dbeca0.tar.bz2
linux-26f30e3ee1bf120af1bde22d890e46a0c8dbeca0.zip
spi: topcliff-pch: Use core message validation
The topcliff-pch driver requires TX and RX buffers on all transfers, open coding checks for this. Remove those open coded checks and instead rely on the core functionality, which has the added bonus that it will fix up any transfers submitted by drivers as needed rather than erroring out. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20220615174138.4060912-1-broonie@kernel.org
Diffstat (limited to 'drivers/spi/spi-topcliff-pch.c')
-rw-r--r--drivers/spi/spi-topcliff-pch.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index dfaa1d79a78b..cbb60198a7f0 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -455,35 +455,10 @@ static void pch_spi_reset(struct spi_master *master)
static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg)
{
-
- struct spi_transfer *transfer;
struct pch_spi_data *data = spi_master_get_devdata(pspi->master);
int retval;
unsigned long flags;
- spin_lock_irqsave(&data->lock, flags);
- /* validate Tx/Rx buffers and Transfer length */
- list_for_each_entry(transfer, &pmsg->transfers, transfer_list) {
- if (!transfer->tx_buf && !transfer->rx_buf) {
- dev_err(&pspi->dev,
- "%s Tx and Rx buffer NULL\n", __func__);
- retval = -EINVAL;
- goto err_return_spinlock;
- }
-
- if (!transfer->len) {
- dev_err(&pspi->dev, "%s Transfer length invalid\n",
- __func__);
- retval = -EINVAL;
- goto err_return_spinlock;
- }
-
- dev_dbg(&pspi->dev,
- "%s Tx/Rx buffer valid. Transfer length valid\n",
- __func__);
- }
- spin_unlock_irqrestore(&data->lock, flags);
-
/* We won't process any messages if we have been asked to terminate */
if (data->status == STATUS_EXITING) {
dev_err(&pspi->dev, "%s status = STATUS_EXITING.\n", __func__);
@@ -518,10 +493,6 @@ static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg)
err_out:
dev_dbg(&pspi->dev, "%s RETURN=%d\n", __func__, retval);
return retval;
-err_return_spinlock:
- dev_dbg(&pspi->dev, "%s RETURN=%d\n", __func__, retval);
- spin_unlock_irqrestore(&data->lock, flags);
- return retval;
}
static inline void pch_spi_select_chip(struct pch_spi_data *data,
@@ -1365,6 +1336,7 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
master->max_speed_hz = PCH_MAX_BAUDRATE;
+ master->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX;
data->board_dat = board_dat;
data->plat_dev = plat_dev;