spi: Fixes for v4.0

A couple of driver specific fixes of the usual "important if you have
 that device" kind together with a fix for a use after free bug that was
 introduced into the trace code in some of the recent refactoring of the
 message queue handling.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVEdEPAAoJECTWi3JdVIfQADEIAIV7j0Ot7bkIBk9I5rxakQyI
 TxiAmrFASSJ1Li9tyL56FAzH6rkKtCp7RZgtyAQ7+GS7p8vUmVphVJP+JYbFMJ8t
 R7zdUg6YMphY1A2AjPgCskb33ZOWvy5V52+WmkSmVN+iTGgP8ixgdJKEwHQ+Ddjy
 JhGDl5MI2G3ubV4d4Deyde4n4tvasvHiwYVo5QxQArbUSU/LbA+kHh2iJxA1kBWX
 9x7PFM+SAOSgceddumA+pwvJBgd/52PkQZhSYCO+w40is1UxGlf39nqaYAPKV1Qv
 EDVaVZ3C4UodbL9qxFBzGspf+ASBs/LbOOa+Dlk2eKsqJH1XiSuEF0fkKCA0wYA=
 =x0qK
 -----END PGP SIGNATURE-----

Merge tag 'spi-v4.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A couple of driver specific fixes of the usual "important if you have
  that device" kind together with a fix for a use after free bug that
  was introduced into the trace code in some of the recent refactoring
  of the message queue handling"

* tag 'spi-v4.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: trigger trace event for message-done before mesg->complete
  spi: dw-mid: clear BUSY flag fist and test other one
  spi: qup: Fix cs-num DT property parsing
This commit is contained in:
Linus Torvalds 2015-03-24 16:58:29 -07:00
commit 8696938ae0
3 changed files with 12 additions and 8 deletions

View File

@ -108,7 +108,8 @@ static void dw_spi_dma_tx_done(void *arg)
{ {
struct dw_spi *dws = arg; struct dw_spi *dws = arg;
if (test_and_clear_bit(TX_BUSY, &dws->dma_chan_busy) & BIT(RX_BUSY)) clear_bit(TX_BUSY, &dws->dma_chan_busy);
if (test_bit(RX_BUSY, &dws->dma_chan_busy))
return; return;
dw_spi_xfer_done(dws); dw_spi_xfer_done(dws);
} }
@ -156,7 +157,8 @@ static void dw_spi_dma_rx_done(void *arg)
{ {
struct dw_spi *dws = arg; struct dw_spi *dws = arg;
if (test_and_clear_bit(RX_BUSY, &dws->dma_chan_busy) & BIT(TX_BUSY)) clear_bit(RX_BUSY, &dws->dma_chan_busy);
if (test_bit(TX_BUSY, &dws->dma_chan_busy))
return; return;
dw_spi_xfer_done(dws); dw_spi_xfer_done(dws);
} }

View File

@ -498,7 +498,7 @@ static int spi_qup_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct device *dev; struct device *dev;
void __iomem *base; void __iomem *base;
u32 max_freq, iomode; u32 max_freq, iomode, num_cs;
int ret, irq, size; int ret, irq, size;
dev = &pdev->dev; dev = &pdev->dev;
@ -550,10 +550,11 @@ static int spi_qup_probe(struct platform_device *pdev)
} }
/* use num-cs unless not present or out of range */ /* use num-cs unless not present or out of range */
if (of_property_read_u16(dev->of_node, "num-cs", if (of_property_read_u32(dev->of_node, "num-cs", &num_cs) ||
&master->num_chipselect) || num_cs > SPI_NUM_CHIPSELECTS)
(master->num_chipselect > SPI_NUM_CHIPSELECTS))
master->num_chipselect = SPI_NUM_CHIPSELECTS; master->num_chipselect = SPI_NUM_CHIPSELECTS;
else
master->num_chipselect = num_cs;
master->bus_num = pdev->id; master->bus_num = pdev->id;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;

View File

@ -1105,13 +1105,14 @@ void spi_finalize_current_message(struct spi_master *master)
"failed to unprepare message: %d\n", ret); "failed to unprepare message: %d\n", ret);
} }
} }
trace_spi_message_done(mesg);
master->cur_msg_prepared = false; master->cur_msg_prepared = false;
mesg->state = NULL; mesg->state = NULL;
if (mesg->complete) if (mesg->complete)
mesg->complete(mesg->context); mesg->complete(mesg->context);
trace_spi_message_done(mesg);
} }
EXPORT_SYMBOL_GPL(spi_finalize_current_message); EXPORT_SYMBOL_GPL(spi_finalize_current_message);