Merge tag 'spi-v3.15-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 11 Apr 2014 20:35:49 +0000 (13:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 11 Apr 2014 20:35:49 +0000 (13:35 -0700)
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

Documentation/devicetree/bindings/spi/efm32-spi.txt
drivers/spi/Kconfig
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-fsl-spi.c
drivers/spi/spi-mpc512x-psc.c
drivers/spi/spi-mpc52xx-psc.c
drivers/spi/spi-mpc52xx.c
drivers/spi/spi-omap2-mcspi.c
drivers/spi/spi-sh.c
drivers/spi/spi-txx9.c

index 8f081c96a4fa96845edba3d060583ddc974bb239..130cd17e3680d825777d52e464b8a28e3597b9b8 100644 (file)
@@ -8,7 +8,13 @@ Required properties:
 - interrupts: pair specifying rx and tx irq
 - clocks: phandle to the spi clock
 - cs-gpios: see spi-bus.txt
-- efm32,location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values.
+
+Recommended properties :
+- efm32,location: Value to write to the ROUTE register's LOCATION bitfield to
+                  configure the pinmux for the device, see datasheet for values.
+                  If "efm32,location" property is not provided, keeping what is
+                  already configured in the hardware, so its either the reset
+                  default 0 or whatever the bootloader did.
 
 Example:
 
index efe1960af2b315704c39290617dbc2215f8aec48..60f2b41c7310529410939d1df6d0d1c3ee8b1222 100644 (file)
@@ -383,7 +383,7 @@ config SPI_RSPI
 
 config SPI_QUP
        tristate "Qualcomm SPI controller with QUP interface"
-       depends on ARCH_MSM_DT || (ARM && COMPILE_TEST)
+       depends on ARCH_QCOM || (ARM && COMPILE_TEST)
        help
          Qualcomm Universal Peripheral (QUP) core is an AHB slave that
          provides a common data path (an output FIFO and an input FIFO)
index 6fb2b75df821e78f80a0f6c1bf4c64e45e4292d5..e767f5831b9c7ce3d8ce015e34e67643f69a28df 100644 (file)
@@ -441,7 +441,8 @@ static void fsl_espi_do_one_msg(struct spi_message *m)
 
        m->actual_length = espi_trans.actual_length;
        m->status = espi_trans.status;
-       m->complete(m->context);
+       if (m->complete)
+               m->complete(m->context);
 }
 
 static int fsl_espi_setup(struct spi_device *spi)
index f35488ed62a9eaca3c353401d9bf7b935bf4a00c..b3e7775034dbd1d660b0ece95a197aea8cb24b54 100644 (file)
@@ -408,7 +408,8 @@ static void fsl_spi_do_one_msg(struct spi_message *m)
        }
 
        m->status = status;
-       m->complete(m->context);
+       if (m->complete)
+               m->complete(m->context);
 
        if (status || !cs_change) {
                ndelay(nsecs);
index 3822eef2ef9dacebd723ee2472a33dc04e1865a5..577d23a12763f79e5c9197aa8a252086c69cf7f2 100644 (file)
@@ -300,7 +300,8 @@ static int mpc512x_psc_spi_msg_xfer(struct spi_master *master,
        }
 
        m->status = status;
-       m->complete(m->context);
+       if (m->complete)
+               m->complete(m->context);
 
        if (status || !cs_change)
                mpc512x_psc_spi_deactivate_cs(spi);
index 3d18d93511854c1aa56fd6b5ebe6d10c65157242..de532aa11d34e9f76212e0e4fb74d6c2244d8c18 100644 (file)
@@ -247,7 +247,8 @@ static void mpc52xx_psc_spi_work(struct work_struct *work)
                }
 
                m->status = status;
-               m->complete(m->context);
+               if (m->complete)
+                       m->complete(m->context);
 
                if (status || !cs_change)
                        mpc52xx_psc_spi_deactivate_cs(spi);
index aac2a5ddd964efcf1086263fa1231235aa065141..b07db4b62d80d823804516caaf961d8c57b9bea6 100644 (file)
@@ -234,7 +234,8 @@ static int mpc52xx_spi_fsmstate_transfer(int irq, struct mpc52xx_spi *ms,
                dev_err(&ms->master->dev, "mode fault\n");
                mpc52xx_spi_chipsel(ms, 0);
                ms->message->status = -EIO;
-               ms->message->complete(ms->message->context);
+               if (ms->message->complete)
+                       ms->message->complete(ms->message->context);
                ms->state = mpc52xx_spi_fsmstate_idle;
                return FSM_CONTINUE;
        }
@@ -288,7 +289,8 @@ mpc52xx_spi_fsmstate_wait(int irq, struct mpc52xx_spi *ms, u8 status, u8 data)
                ms->msg_count++;
                mpc52xx_spi_chipsel(ms, 0);
                ms->message->status = 0;
-               ms->message->complete(ms->message->context);
+               if (ms->message->complete)
+                       ms->message->complete(ms->message->context);
                ms->state = mpc52xx_spi_fsmstate_idle;
                return FSM_CONTINUE;
        }
index 2941c5b96ebc2e063c22a4b2fcfea946d55b8849..4dc77df388642601510c41fb02dcb5153d2b2ea3 100644 (file)
@@ -1379,12 +1379,13 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 
        INIT_LIST_HEAD(&mcspi->ctx.cs);
 
-       mcspi->dma_channels = kcalloc(master->num_chipselect,
-                       sizeof(struct omap2_mcspi_dma),
-                       GFP_KERNEL);
-
-       if (mcspi->dma_channels == NULL)
+       mcspi->dma_channels = devm_kcalloc(&pdev->dev, master->num_chipselect,
+                                          sizeof(struct omap2_mcspi_dma),
+                                          GFP_KERNEL);
+       if (mcspi->dma_channels == NULL) {
+               status = -ENOMEM;
                goto free_master;
+       }
 
        for (i = 0; i < master->num_chipselect; i++) {
                char *dma_rx_ch_name = mcspi->dma_channels[i].dma_rx_ch_name;
@@ -1426,7 +1427,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        }
 
        if (status < 0)
-               goto dma_chnl_free;
+               goto free_master;
 
        pm_runtime_use_autosuspend(&pdev->dev);
        pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT);
@@ -1444,8 +1445,6 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 
 disable_pm:
        pm_runtime_disable(&pdev->dev);
-dma_chnl_free:
-       kfree(mcspi->dma_channels);
 free_master:
        spi_master_put(master);
        return status;
@@ -1453,19 +1452,12 @@ free_master:
 
 static int omap2_mcspi_remove(struct platform_device *pdev)
 {
-       struct spi_master       *master;
-       struct omap2_mcspi      *mcspi;
-       struct omap2_mcspi_dma  *dma_channels;
-
-       master = platform_get_drvdata(pdev);
-       mcspi = spi_master_get_devdata(master);
-       dma_channels = mcspi->dma_channels;
+       struct spi_master *master = platform_get_drvdata(pdev);
+       struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
 
        pm_runtime_put_sync(mcspi->dev);
        pm_runtime_disable(&pdev->dev);
 
-       kfree(dma_channels);
-
        return 0;
 }
 
index f6f2c701017795ed9a41133ac0da1151988c6f98..03edf5ed0e9fb5d3310a7442fed3c262864cad37 100644 (file)
@@ -322,7 +322,8 @@ static void spi_sh_work(struct work_struct *work)
                spin_lock_irqsave(&ss->lock, flags);
 
                mesg->status = 0;
-               mesg->complete(mesg->context);
+               if (mesg->complete)
+                       mesg->complete(mesg->context);
        }
 
        clear_fifo(ss);
@@ -340,7 +341,8 @@ static void spi_sh_work(struct work_struct *work)
 
  error:
        mesg->status = ret;
-       mesg->complete(mesg->context);
+       if (mesg->complete)
+               mesg->complete(mesg->context);
 
        spi_sh_clear_bit(ss, SPI_SH_SSA | SPI_SH_SSDB | SPI_SH_SSD,
                         SPI_SH_CR1);
index 820b499816f8ebfb6bc45a56026dbe05b9b4311f..5f183baa91a98bb343747eced81ae6f4e09c4536 100644 (file)
@@ -262,7 +262,8 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m)
 
 exit:
        m->status = status;
-       m->complete(m->context);
+       if (m->complete)
+               m->complete(m->context);
 
        /* normally deactivate chipselect ... unless no error and
         * cs_change has hinted that the next message will probably