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

Merge tag 'spi-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A few driver specific fixes, the main one being the fix for handling
of complete callbacks that are open coded in individual drivers to
allow callers to omit the completion. As we move things into the core
that sort of issue should become less and less common"

* tag 'spi-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: qup: Depend on ARCH_QCOM
spi: efm32: Update binding document to make "efm32,location" property optional
spi: omap2-mcspi: Convert to use devm_kcalloc
spi: Always check complete callback before calling it

+35 -28
+7 -1
Documentation/devicetree/bindings/spi/efm32-spi.txt
··· 8 8 - interrupts: pair specifying rx and tx irq 9 9 - clocks: phandle to the spi clock 10 10 - cs-gpios: see spi-bus.txt 11 - - efm32,location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values. 11 + 12 + Recommended properties : 13 + - efm32,location: Value to write to the ROUTE register's LOCATION bitfield to 14 + configure the pinmux for the device, see datasheet for values. 15 + If "efm32,location" property is not provided, keeping what is 16 + already configured in the hardware, so its either the reset 17 + default 0 or whatever the bootloader did. 12 18 13 19 Example: 14 20
+1 -1
drivers/spi/Kconfig
··· 383 383 384 384 config SPI_QUP 385 385 tristate "Qualcomm SPI controller with QUP interface" 386 - depends on ARCH_MSM_DT || (ARM && COMPILE_TEST) 386 + depends on ARCH_QCOM || (ARM && COMPILE_TEST) 387 387 help 388 388 Qualcomm Universal Peripheral (QUP) core is an AHB slave that 389 389 provides a common data path (an output FIFO and an input FIFO)
+2 -1
drivers/spi/spi-fsl-espi.c
··· 441 441 442 442 m->actual_length = espi_trans.actual_length; 443 443 m->status = espi_trans.status; 444 - m->complete(m->context); 444 + if (m->complete) 445 + m->complete(m->context); 445 446 } 446 447 447 448 static int fsl_espi_setup(struct spi_device *spi)
+2 -1
drivers/spi/spi-fsl-spi.c
··· 408 408 } 409 409 410 410 m->status = status; 411 - m->complete(m->context); 411 + if (m->complete) 412 + m->complete(m->context); 412 413 413 414 if (status || !cs_change) { 414 415 ndelay(nsecs);
+2 -1
drivers/spi/spi-mpc512x-psc.c
··· 300 300 } 301 301 302 302 m->status = status; 303 - m->complete(m->context); 303 + if (m->complete) 304 + m->complete(m->context); 304 305 305 306 if (status || !cs_change) 306 307 mpc512x_psc_spi_deactivate_cs(spi);
+2 -1
drivers/spi/spi-mpc52xx-psc.c
··· 247 247 } 248 248 249 249 m->status = status; 250 - m->complete(m->context); 250 + if (m->complete) 251 + m->complete(m->context); 251 252 252 253 if (status || !cs_change) 253 254 mpc52xx_psc_spi_deactivate_cs(spi);
+4 -2
drivers/spi/spi-mpc52xx.c
··· 234 234 dev_err(&ms->master->dev, "mode fault\n"); 235 235 mpc52xx_spi_chipsel(ms, 0); 236 236 ms->message->status = -EIO; 237 - ms->message->complete(ms->message->context); 237 + if (ms->message->complete) 238 + ms->message->complete(ms->message->context); 238 239 ms->state = mpc52xx_spi_fsmstate_idle; 239 240 return FSM_CONTINUE; 240 241 } ··· 289 288 ms->msg_count++; 290 289 mpc52xx_spi_chipsel(ms, 0); 291 290 ms->message->status = 0; 292 - ms->message->complete(ms->message->context); 291 + if (ms->message->complete) 292 + ms->message->complete(ms->message->context); 293 293 ms->state = mpc52xx_spi_fsmstate_idle; 294 294 return FSM_CONTINUE; 295 295 }
+9 -17
drivers/spi/spi-omap2-mcspi.c
··· 1379 1379 1380 1380 INIT_LIST_HEAD(&mcspi->ctx.cs); 1381 1381 1382 - mcspi->dma_channels = kcalloc(master->num_chipselect, 1383 - sizeof(struct omap2_mcspi_dma), 1384 - GFP_KERNEL); 1385 - 1386 - if (mcspi->dma_channels == NULL) 1382 + mcspi->dma_channels = devm_kcalloc(&pdev->dev, master->num_chipselect, 1383 + sizeof(struct omap2_mcspi_dma), 1384 + GFP_KERNEL); 1385 + if (mcspi->dma_channels == NULL) { 1386 + status = -ENOMEM; 1387 1387 goto free_master; 1388 + } 1388 1389 1389 1390 for (i = 0; i < master->num_chipselect; i++) { 1390 1391 char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name; ··· 1427 1426 } 1428 1427 1429 1428 if (status < 0) 1430 - goto dma_chnl_free; 1429 + goto free_master; 1431 1430 1432 1431 pm_runtime_use_autosuspend(&pdev->dev); 1433 1432 pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); ··· 1445 1444 1446 1445 disable_pm: 1447 1446 pm_runtime_disable(&pdev->dev); 1448 - dma_chnl_free: 1449 - kfree(mcspi->dma_channels); 1450 1447 free_master: 1451 1448 spi_master_put(master); 1452 1449 return status; ··· 1452 1453 1453 1454 static int omap2_mcspi_remove(struct platform_device *pdev) 1454 1455 { 1455 - struct spi_master *master; 1456 - struct omap2_mcspi *mcspi; 1457 - struct omap2_mcspi_dma *dma_channels; 1458 - 1459 - master = platform_get_drvdata(pdev); 1460 - mcspi = spi_master_get_devdata(master); 1461 - dma_channels = mcspi->dma_channels; 1456 + struct spi_master *master = platform_get_drvdata(pdev); 1457 + struct omap2_mcspi *mcspi = spi_master_get_devdata(master); 1462 1458 1463 1459 pm_runtime_put_sync(mcspi->dev); 1464 1460 pm_runtime_disable(&pdev->dev); 1465 - 1466 - kfree(dma_channels); 1467 1461 1468 1462 return 0; 1469 1463 }
+4 -2
drivers/spi/spi-sh.c
··· 322 322 spin_lock_irqsave(&ss->lock, flags); 323 323 324 324 mesg->status = 0; 325 - mesg->complete(mesg->context); 325 + if (mesg->complete) 326 + mesg->complete(mesg->context); 326 327 } 327 328 328 329 clear_fifo(ss); ··· 341 340 342 341 error: 343 342 mesg->status = ret; 344 - mesg->complete(mesg->context); 343 + if (mesg->complete) 344 + mesg->complete(mesg->context); 345 345 346 346 spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD, 347 347 SPI_SH_CR1);
+2 -1
drivers/spi/spi-txx9.c
··· 262 262 263 263 exit: 264 264 m->status = status; 265 - m->complete(m->context); 265 + if (m->complete) 266 + m->complete(m->context); 266 267 267 268 /* normally deactivate chipselect ... unless no error and 268 269 * cs_change has hinted that the next message will probably