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/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 88fb2c0..8eae6ef 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par) /* enable SPI interface by having CS and MOSI low during reset */ save_mode = par->spi->mode; par->spi->mode |= SPI_CS_HIGH; - ret = par->spi->master->setup(par->spi); /* set CS inactive low */ + ret = spi_setup(par->spi); /* set CS inactive low */ if (ret) { dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); return ret; @@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par) par->fbtftops.reset(par); mdelay(1000); par->spi->mode = save_mode; - ret = par->spi->master->setup(par->spi); + ret = spi_setup(par->spi); if (ret) { dev_err(par->info->device, "Could not restore SPI mode\n"); return ret; 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); 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 */ diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c index 2c4ce07..fecf486 100644 --- a/drivers/staging/fbtft/flexfb.c +++ b/drivers/staging/fbtft/flexfb.c @@ -440,12 +440,12 @@ static int flexfb_probe_common(struct spi_device *sdev, par->fbtftops.write_register = fbtft_write_reg8_bus9; par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; sdev->bits_per_word = 9; - ret = sdev->master->setup(sdev); + ret = spi_setup(sdev); if (ret) { dev_warn(dev, "9-bit SPI not available, emulating using 8-bit.\n"); sdev->bits_per_word = 8; - ret = sdev->master->setup(sdev); + ret = spi_setup(sdev); if (ret) goto out_release; /* allocate buffer with room for dc bits */ -- 2.1.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel