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 01.09.2015 01:28, skrev Stefan Bruens:
On Monday 24 August 2015 01:24:59 Noralf Trønnes wrote:
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.
IMHO, this is a bad idea. A controller supporting more than 32 bpw can
not set the bpw mask, as the mask is limited to 32 bits. Thus it has to
check the bpw in its own setup function, and may or may not reject 9 bpw.

Why should one penalize any controllers having an unset bpw mask, which
is a completely valid configuration?

BTW, the SPI core patch needed for this to work is in the 4.3 pull request.

I have acked a patch from Stefan Wahren adressing this issue:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2015-August/075423.html

_______________________________________________
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