Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: revert master->setup function removal for altera and nuc900

Commit 24778be "spi: convert drivers to use bits_per_word_mask" removed
what appeared to be redundant code from many drivers. However, it
appears that in the spi-bitbang case, these functions are required by
the spi-bitbang core, even if they don't do anything. Restore them.

For 3.12, the spi-bitbang core should be adjusted not to require these
callbacks to exist if they don't need to do anything.

This is the equivalent of Michal Simek's patch "spi/xilinx: Revert
master->setup function removal", applied to other affected drivers.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Stephen Warren and committed by
Mark Brown
103ccee4 ed893559

+25
+12
drivers/spi/spi-altera.c
··· 103 103 } 104 104 } 105 105 106 + static int altera_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) 107 + { 108 + return 0; 109 + } 110 + 111 + static int altera_spi_setup(struct spi_device *spi) 112 + { 113 + return 0; 114 + } 115 + 106 116 static inline unsigned int hw_txbyte(struct altera_spi *hw, int count) 107 117 { 108 118 if (hw->tx) { ··· 231 221 master->bus_num = pdev->id; 232 222 master->num_chipselect = 16; 233 223 master->mode_bits = SPI_CS_HIGH; 224 + master->setup = altera_spi_setup; 234 225 235 226 hw = spi_master_get_devdata(master); 236 227 platform_set_drvdata(pdev, hw); ··· 240 229 hw->bitbang.master = spi_master_get(master); 241 230 if (!hw->bitbang.master) 242 231 return err; 232 + hw->bitbang.setup_transfer = altera_spi_setupxfer; 243 233 hw->bitbang.chipselect = altera_spi_chipsel; 244 234 hw->bitbang.txrx_bufs = altera_spi_txrx; 245 235
+13
drivers/spi/spi-nuc900.c
··· 174 174 spin_unlock_irqrestore(&hw->lock, flags); 175 175 } 176 176 177 + static int nuc900_spi_setupxfer(struct spi_device *spi, 178 + struct spi_transfer *t) 179 + { 180 + return 0; 181 + } 182 + 183 + static int nuc900_spi_setup(struct spi_device *spi) 184 + { 185 + return 0; 186 + } 187 + 177 188 static inline unsigned int hw_txbyte(struct nuc900_spi *hw, int count) 178 189 { 179 190 return hw->tx ? hw->tx[count] : 0; ··· 377 366 master->num_chipselect = hw->pdata->num_cs; 378 367 master->bus_num = hw->pdata->bus_num; 379 368 hw->bitbang.master = hw->master; 369 + hw->bitbang.setup_transfer = nuc900_spi_setupxfer; 380 370 hw->bitbang.chipselect = nuc900_spi_chipsel; 381 371 hw->bitbang.txrx_bufs = nuc900_spi_txrx; 372 + hw->bitbang.master->setup = nuc900_spi_setup; 382 373 383 374 hw->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 384 375 if (hw->res == NULL) {