Re: [PATCH 2/2] staging/fbtft: use spi_setup instead of direct call to master->setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Den 24.08.2015 00:24, skrev Stefan Brüns:
Avoid a crash, as master->setup may be NULL (e.g. xilinx controller).
Even if master->setup is set, spi_setup does several compatibility/
sanity checks which should not be skipped (fixes problems with
displays/controllers needing emulation for bits_per_word = 9).

Signed-off-by: Stefan Brüns <stefan.bruens@xxxxxxxxxxxxxx>
---
  drivers/staging/fbtft/fb_watterott.c | 4 ++--
  drivers/staging/fbtft/fbtft-core.c   | 4 ++--
  drivers/staging/fbtft/flexfb.c       | 4 ++--
  3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 9cc8141..ba08da3 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1434,12 +1434,12 @@ int fbtft_probe_common(struct fbtft_display *display,
  	/* 9-bit SPI setup */
  	if (par->spi && display->buswidth == 9) {
  		par->spi->bits_per_word = 9;
-		ret = par->spi->master->setup(par->spi);
+		ret = spi_setup(par->spi);

You could also check against master->bits_per_word_mask to verify that
9-bit is supported before setting bits_per_word=9 and then drop
spi_setup() altogether. And if bits_per_word_mask is not set, assume
9-bit is not supported.

  		if (ret) {
  			dev_warn(&par->spi->dev,
  				"9-bit SPI not available, emulating using 8-bit.\n");
  			par->spi->bits_per_word = 8;
-			ret = par->spi->master->setup(par->spi);
+			ret = spi_setup(par->spi);
  			if (ret)
  				goto out_release;
  			/* allocate buffer with room for dc bits */



_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux