aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-imx.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2011-07-09 13:16:35 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-07-14 15:19:41 -0400
commitedd501bbf177ab62f963476c917cbdb0dc7dc862 (patch)
tree729a221c338ddbe615ece1c55db59ef49b582e38 /drivers/spi/spi-imx.c
parent40bfff85ffb5c85ffabcb6d71e64f70799595f89 (diff)
spi/imx: do not make copy of spi_imx_devtype_data
spi_imx_devtype_data has already been driver private data. There is really no need to make a copy in spi_imx_data. Instead, a reference pointer works perfectly fine. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-imx.c')
-rw-r--r--drivers/spi/spi-imx.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 69d6dba67c19..1c55dc9adb02 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -96,7 +96,7 @@ struct spi_imx_data {
96 const void *tx_buf; 96 const void *tx_buf;
97 unsigned int txfifo; /* number of words pushed in tx FIFO */ 97 unsigned int txfifo; /* number of words pushed in tx FIFO */
98 98
99 struct spi_imx_devtype_data devtype_data; 99 struct spi_imx_devtype_data *devtype_data;
100}; 100};
101 101
102#define MXC_SPI_BUF_RX(type) \ 102#define MXC_SPI_BUF_RX(type) \
@@ -539,7 +539,7 @@ static void __maybe_unused mx1_reset(struct spi_imx_data *spi_imx)
539 * These version numbers are taken from the Freescale driver. Unfortunately it 539 * These version numbers are taken from the Freescale driver. Unfortunately it
540 * doesn't support i.MX1, so this entry doesn't match the scheme. :-( 540 * doesn't support i.MX1, so this entry doesn't match the scheme. :-(
541 */ 541 */
542static struct spi_imx_devtype_data spi_imx_devtype_data[] __devinitdata = { 542static struct spi_imx_devtype_data spi_imx_devtype_data[] = {
543#ifdef CONFIG_SPI_IMX_VER_IMX1 543#ifdef CONFIG_SPI_IMX_VER_IMX1
544 [SPI_IMX_VER_IMX1] = { 544 [SPI_IMX_VER_IMX1] = {
545 .intctrl = mx1_intctrl, 545 .intctrl = mx1_intctrl,
@@ -607,21 +607,21 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
607 607
608static void spi_imx_push(struct spi_imx_data *spi_imx) 608static void spi_imx_push(struct spi_imx_data *spi_imx)
609{ 609{
610 while (spi_imx->txfifo < spi_imx->devtype_data.fifosize) { 610 while (spi_imx->txfifo < spi_imx->devtype_data->fifosize) {
611 if (!spi_imx->count) 611 if (!spi_imx->count)
612 break; 612 break;
613 spi_imx->tx(spi_imx); 613 spi_imx->tx(spi_imx);
614 spi_imx->txfifo++; 614 spi_imx->txfifo++;
615 } 615 }
616 616
617 spi_imx->devtype_data.trigger(spi_imx); 617 spi_imx->devtype_data->trigger(spi_imx);
618} 618}
619 619
620static irqreturn_t spi_imx_isr(int irq, void *dev_id) 620static irqreturn_t spi_imx_isr(int irq, void *dev_id)
621{ 621{
622 struct spi_imx_data *spi_imx = dev_id; 622 struct spi_imx_data *spi_imx = dev_id;
623 623
624 while (spi_imx->devtype_data.rx_available(spi_imx)) { 624 while (spi_imx->devtype_data->rx_available(spi_imx)) {
625 spi_imx->rx(spi_imx); 625 spi_imx->rx(spi_imx);
626 spi_imx->txfifo--; 626 spi_imx->txfifo--;
627 } 627 }
@@ -635,12 +635,12 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id)
635 /* No data left to push, but still waiting for rx data, 635 /* No data left to push, but still waiting for rx data,
636 * enable receive data available interrupt. 636 * enable receive data available interrupt.
637 */ 637 */
638 spi_imx->devtype_data.intctrl( 638 spi_imx->devtype_data->intctrl(
639 spi_imx, MXC_INT_RR); 639 spi_imx, MXC_INT_RR);
640 return IRQ_HANDLED; 640 return IRQ_HANDLED;
641 } 641 }
642 642
643 spi_imx->devtype_data.intctrl(spi_imx, 0); 643 spi_imx->devtype_data->intctrl(spi_imx, 0);
644 complete(&spi_imx->xfer_done); 644 complete(&spi_imx->xfer_done);
645 645
646 return IRQ_HANDLED; 646 return IRQ_HANDLED;
@@ -677,7 +677,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
677 } else 677 } else
678 BUG(); 678 BUG();
679 679
680 spi_imx->devtype_data.config(spi_imx, &config); 680 spi_imx->devtype_data->config(spi_imx, &config);
681 681
682 return 0; 682 return 0;
683} 683}
@@ -696,7 +696,7 @@ static int spi_imx_transfer(struct spi_device *spi,
696 696
697 spi_imx_push(spi_imx); 697 spi_imx_push(spi_imx);
698 698
699 spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE); 699 spi_imx->devtype_data->intctrl(spi_imx, MXC_INT_TE);
700 700
701 wait_for_completion(&spi_imx->xfer_done); 701 wait_for_completion(&spi_imx->xfer_done);
702 702
@@ -811,7 +811,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
811 init_completion(&spi_imx->xfer_done); 811 init_completion(&spi_imx->xfer_done);
812 812
813 spi_imx->devtype_data = 813 spi_imx->devtype_data =
814 spi_imx_devtype_data[pdev->id_entry->driver_data]; 814 &spi_imx_devtype_data[pdev->id_entry->driver_data];
815 815
816 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 816 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
817 if (!res) { 817 if (!res) {
@@ -854,9 +854,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
854 clk_enable(spi_imx->clk); 854 clk_enable(spi_imx->clk);
855 spi_imx->spi_clk = clk_get_rate(spi_imx->clk); 855 spi_imx->spi_clk = clk_get_rate(spi_imx->clk);
856 856
857 spi_imx->devtype_data.reset(spi_imx); 857 spi_imx->devtype_data->reset(spi_imx);
858 858
859 spi_imx->devtype_data.intctrl(spi_imx, 0); 859 spi_imx->devtype_data->intctrl(spi_imx, 0);
860 860
861 ret = spi_bitbang_start(&spi_imx->bitbang); 861 ret = spi_bitbang_start(&spi_imx->bitbang);
862 if (ret) { 862 if (ret) {