Skip to content

Commit

Permalink
Merge tag 'spi-v3.12-rc4' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/broonie/spi

Pull spi fixes from Mark Brown:
 "This is all driver updates, mostly fixes for error handling paths
  except for the s3c64xx and hspi fixes for trying to use runtime PM
  before it is enabled and the pxa2xx fix for interactions between power
  management and interrupt handling"

* tag 'spi-v3.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: atmel: Fix incorrect error path
  spi/hspi: fixup Runtime PM enable timing
  spi/s3c64xx: Ensure runtime PM is enabled prior to registration
  spi/clps711x: drop clk_put for devm_clk_get in spi_clps711x_probe()
  spi: fix return value check in dspi_probe()
  spi: mpc512x: fix error return code in mpc512x_psc_spi_do_probe()
  spi: clps711x: Don't call kfree() after spi_master_put/spi_unregister_master
  spi/pxa2xx: check status register as well to determine if the device is off
  • Loading branch information
Linus Torvalds committed Oct 10, 2013
2 parents b291a22 + ac9fdc8 commit bd7df5a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion drivers/spi/spi-atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
/* Initialize the hardware */
ret = clk_prepare_enable(clk);
if (ret)
goto out_unmap_regs;
goto out_free_irq;
spi_writel(as, CR, SPI_BIT(SWRST));
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
if (as->caps.has_wdrbt) {
Expand Down Expand Up @@ -1614,6 +1614,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
spi_writel(as, CR, SPI_BIT(SWRST));
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
clk_disable_unprepare(clk);
out_free_irq:
free_irq(irq, master);
out_unmap_regs:
iounmap(as->regs);
Expand Down
3 changes: 0 additions & 3 deletions drivers/spi/spi-clps711x.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ static int spi_clps711x_probe(struct platform_device *pdev)
dev_name(&pdev->dev), hw);
if (ret) {
dev_err(&pdev->dev, "Can't request IRQ\n");
clk_put(hw->spi_clk);
goto clk_out;
}

Expand All @@ -247,7 +246,6 @@ static int spi_clps711x_probe(struct platform_device *pdev)
gpio_free(hw->chipselect[i]);

spi_master_put(master);
kfree(master);

return ret;
}
Expand All @@ -263,7 +261,6 @@ static int spi_clps711x_remove(struct platform_device *pdev)
gpio_free(hw->chipselect[i]);

spi_unregister_master(master);
kfree(master);

return 0;
}
Expand Down
10 changes: 2 additions & 8 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,9 @@ static int dspi_probe(struct platform_device *pdev)
master->bus_num = bus_num;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "can't get platform resource\n");
ret = -EINVAL;
goto out_master_put;
}

dspi->base = devm_ioremap_resource(&pdev->dev, res);
if (!dspi->base) {
ret = -EINVAL;
if (IS_ERR(dspi->base)) {
ret = PTR_ERR(dspi->base);
goto out_master_put;
}

Expand Down
4 changes: 3 additions & 1 deletion drivers/spi/spi-mpc512x-psc.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,10 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
psc_num = master->bus_num;
snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
clk = devm_clk_get(dev, clk_name);
if (IS_ERR(clk))
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
goto free_irq;
}
ret = clk_prepare_enable(clk);
if (ret)
goto free_irq;
Expand Down
11 changes: 10 additions & 1 deletion drivers/spi/spi-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,17 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
if (pm_runtime_suspended(&drv_data->pdev->dev))
return IRQ_NONE;

sccr1_reg = read_SSCR1(reg);
/*
* If the device is not yet in RPM suspended state and we get an
* interrupt that is meant for another device, check if status bits
* are all set to one. That means that the device is already
* powered off.
*/
status = read_SSSR(reg);
if (status == ~0)
return IRQ_NONE;

sccr1_reg = read_SSCR1(reg);

/* Ignore possible writes if we don't need to write */
if (!(sccr1_reg & SSCR1_TIE))
Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/spi-s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN,
sdd->regs + S3C64XX_SPI_INT_EN);

pm_runtime_enable(&pdev->dev);

if (spi_register_master(master)) {
dev_err(&pdev->dev, "cannot register SPI master\n");
ret = -EBUSY;
Expand All @@ -1440,8 +1442,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
mem_res,
sdd->rx_dma.dmach, sdd->tx_dma.dmach);

pm_runtime_enable(&pdev->dev);

return 0;

err3:
Expand Down
4 changes: 2 additions & 2 deletions drivers/spi/spi-sh-hspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ static int hspi_probe(struct platform_device *pdev)
goto error1;
}

pm_runtime_enable(&pdev->dev);

master->num_chipselect = 1;
master->bus_num = pdev->id;
master->setup = hspi_setup;
Expand All @@ -309,8 +311,6 @@ static int hspi_probe(struct platform_device *pdev)
goto error1;
}

pm_runtime_enable(&pdev->dev);

return 0;

error1:
Expand Down

0 comments on commit bd7df5a

Please sign in to comment.