Skip to content

Commit 191ec11

Browse files
AxelLinbroonie
authored andcommitted
spi: pic32-sqi: Remove pic32_sqi_setup and pic32_sqi_cleanup
Current code does not use ctldata at all, so remove spi_set_ctldata call. spi_setup() will set spi->bits_per_word = 8 if it was not set, so remove !spi->max_speed_hz checking. The spi core allows absent of spi->max_speed_hz setting, if it was not set spi_setup() assigns spi->master->max_speed_hz to it. spi core allows spi->max_speed_hz > spi->master->max_speed_hz, in this case spi core will limit the transfer speed to ensure xfer->speed_hz won't greater than spi->master->max_speed_hz so remove checking if spi->max_speed_hz is higher than spi->master->max_speed_hz. As a result, both pic32_sqi_setup() and pic32_sqi_cleanup() can be removed. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 989ffc7 commit 191ec11

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

drivers/spi/spi-pic32-sqi.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -460,45 +460,6 @@ static int pic32_sqi_unprepare_hardware(struct spi_master *master)
460460
return 0;
461461
}
462462

463-
/* This may be called twice for each spi dev */
464-
static int pic32_sqi_setup(struct spi_device *spi)
465-
{
466-
struct pic32_sqi *sqi;
467-
468-
if (spi_get_ctldata(spi)) {
469-
dev_err(&spi->dev, "is already associated\n");
470-
return -EBUSY;
471-
}
472-
473-
/* check word size */
474-
if (!spi->bits_per_word) {
475-
dev_err(&spi->dev, "No bits_per_word defined\n");
476-
return -EINVAL;
477-
}
478-
479-
/* check maximum SPI clk rate */
480-
if (!spi->max_speed_hz) {
481-
dev_err(&spi->dev, "No max speed HZ parameter\n");
482-
return -EINVAL;
483-
}
484-
485-
if (spi->master->max_speed_hz < spi->max_speed_hz) {
486-
dev_err(&spi->dev, "max speed %u HZ is too high\n",
487-
spi->max_speed_hz);
488-
return -EINVAL;
489-
}
490-
491-
sqi = spi_master_get_devdata(spi->master);
492-
spi_set_ctldata(spi, (void *)sqi);
493-
494-
return 0;
495-
}
496-
497-
static void pic32_sqi_cleanup(struct spi_device *spi)
498-
{
499-
spi_set_ctldata(spi, (void *)NULL);
500-
}
501-
502463
static int ring_desc_ring_alloc(struct pic32_sqi *sqi)
503464
{
504465
struct ring_desc *rdesc;
@@ -700,8 +661,6 @@ static int pic32_sqi_probe(struct platform_device *pdev)
700661
master->mode_bits = SPI_MODE_3 | SPI_MODE_0 | SPI_TX_DUAL |
701662
SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD;
702663
master->flags = SPI_MASTER_HALF_DUPLEX;
703-
master->setup = pic32_sqi_setup;
704-
master->cleanup = pic32_sqi_cleanup;
705664
master->can_dma = pic32_sqi_can_dma;
706665
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32);
707666
master->transfer_one_message = pic32_sqi_one_message;

0 commit comments

Comments
 (0)