Commit cf7d8a55 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull SPI bug fixes from Grant Likely:
 "Miscellaneous driver bug fixes.  No major changes in this branch."

* tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
  spi/imx: prevent NULL pointer dereference in spi_imx_probe()
  spi/imx: mark base member in spi_imx_data as __iomem
  spi/mpc83xx: fix NULL pdata dereference bug
  spi/davinci: Fix DMA API usage in davinci
  spi/pL022: include types.h to remove compilation warnings
parents 4166fb64 39ec0d38
...@@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) ...@@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n",
rx_buf_count); rx_buf_count);
if (t->tx_buf) if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, t->len, dma_unmap_single(&spi->dev, t->tx_dma, t->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
return -ENOMEM; return -ENOMEM;
} }
...@@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) ...@@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
if (spicfg->io_type == SPI_IO_TYPE_DMA) { if (spicfg->io_type == SPI_IO_TYPE_DMA) {
if (t->tx_buf) if (t->tx_buf)
dma_unmap_single(NULL, t->tx_dma, t->len, dma_unmap_single(&spi->dev, t->tx_dma, t->len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
dma_unmap_single(NULL, t->rx_dma, rx_buf_count, dma_unmap_single(&spi->dev, t->rx_dma, rx_buf_count,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN);
......
...@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi) ...@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi)
static void fsl_spi_chipselect(struct spi_device *spi, int value) static void fsl_spi_chipselect(struct spi_device *spi, int value)
{ {
struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; struct fsl_spi_platform_data *pdata;
bool pol = spi->mode & SPI_CS_HIGH; bool pol = spi->mode & SPI_CS_HIGH;
struct spi_mpc8xxx_cs *cs = spi->controller_state; struct spi_mpc8xxx_cs *cs = spi->controller_state;
pdata = spi->dev.parent->parent->platform_data;
if (value == BITBANG_CS_INACTIVE) { if (value == BITBANG_CS_INACTIVE) {
if (pdata->cs_control) if (pdata->cs_control)
pdata->cs_control(spi, !pol); pdata->cs_control(spi, !pol);
......
...@@ -83,7 +83,7 @@ struct spi_imx_data { ...@@ -83,7 +83,7 @@ struct spi_imx_data {
struct spi_bitbang bitbang; struct spi_bitbang bitbang;
struct completion xfer_done; struct completion xfer_done;
void *base; void __iomem *base;
int irq; int irq;
struct clk *clk; struct clk *clk;
unsigned long spi_clk; unsigned long spi_clk;
...@@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) ...@@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
} }
ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs);
if (ret < 0) if (ret < 0) {
num_cs = mxc_platform_info->num_chipselect; if (mxc_platform_info)
num_cs = mxc_platform_info->num_chipselect;
else
return ret;
}
master = spi_alloc_master(&pdev->dev, master = spi_alloc_master(&pdev->dev,
sizeof(struct spi_imx_data) + sizeof(int) * num_cs); sizeof(struct spi_imx_data) + sizeof(int) * num_cs);
...@@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) ...@@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
for (i = 0; i < master->num_chipselect; i++) { for (i = 0; i < master->num_chipselect; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
if (cs_gpio < 0) if (cs_gpio < 0 && mxc_platform_info)
cs_gpio = mxc_platform_info->chipselect[i]; cs_gpio = mxc_platform_info->chipselect[i];
spi_imx->chipselect[i] = cs_gpio; spi_imx->chipselect[i] = cs_gpio;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef _SSP_PL022_H #ifndef _SSP_PL022_H
#define _SSP_PL022_H #define _SSP_PL022_H
#include <linux/types.h>
/** /**
* whether SSP is in loopback mode or not * whether SSP is in loopback mode or not
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment