Skip to content

Commit

Permalink
Merge remote-tracking branch 'spi/topic/devm' into spi-qspi
Browse files Browse the repository at this point in the history
Conflicts:
	drivers/spi/spi-ti-qspi.c
  • Loading branch information
Mark Brown committed Oct 7, 2013
2 parents 3b3a800 + 2fe7e4a commit dabefd5
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 57 deletions.
3 changes: 3 additions & 0 deletions Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,6 @@ PHY

SLAVE DMA ENGINE
devm_acpi_dma_controller_register()

SPI
devm_spi_register_master()
4 changes: 1 addition & 3 deletions drivers/spi/spi-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);

err = spi_register_master(master);
err = devm_spi_register_master(&pdev->dev, master);
if (err) {
dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
goto out_free_irq;
Expand All @@ -381,14 +381,12 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
struct bcm2835_spi *bs = spi_master_get_devdata(master);

free_irq(bs->irq, master);
spi_unregister_master(master);

/* Clear FIFOs, and disable the HW block */
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);

clk_disable_unprepare(bs->clk);
spi_master_put(master);

return 0;
}
Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi-bcm63xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);

/* register and we are done */
ret = spi_register_master(master);
ret = devm_spi_register_master(dev, master);
if (ret) {
dev_err(dev, "spi register failed\n");
goto out_clk_disable;
Expand All @@ -438,17 +438,13 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
struct bcm63xx_spi *bs = spi_master_get_devdata(master);

spi_unregister_master(master);

/* reset spi block */
bcm_spi_writeb(bs, 0, SPI_INT_MASK);

/* HW shutdown */
clk_disable_unprepare(bs->clk);
clk_put(bs->clk);

spi_master_put(master);

return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-bfin-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static int bfin_spi_probe(struct platform_device *pdev)
tasklet_init(&drv_data->pump_transfers,
bfin_spi_pump_transfers, (unsigned long)drv_data);
/* register with the SPI framework */
ret = spi_register_master(master);
ret = devm_spi_register_master(dev, master);
if (ret) {
dev_err(dev, "can not register spi master\n");
goto err_free_peripheral;
Expand Down Expand Up @@ -898,7 +898,6 @@ static int bfin_spi_remove(struct platform_device *pdev)
free_dma(drv_data->rx_dma);
free_dma(drv_data->tx_dma);

spi_unregister_master(drv_data->master);
return 0;
}

Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi-clps711x.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static int spi_clps711x_probe(struct platform_device *pdev)
goto clk_out;
}

ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (!ret) {
dev_info(&pdev->dev,
"SPI bus driver initialized. Master clock %u Hz\n",
Expand All @@ -247,7 +247,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 @@ -262,9 +261,6 @@ static int spi_clps711x_remove(struct platform_device *pdev)
if (gpio_is_valid(hw->chipselect[i]))
gpio_free(hw->chipselect[i]);

spi_unregister_master(master);
kfree(master);

return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-ep93xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
/* make sure that the hardware is disabled */
ep93xx_spi_write_u8(espi, SSPCR1, 0);

error = spi_register_master(master);
error = devm_spi_register_master(&pdev->dev, master);
if (error) {
dev_err(&pdev->dev, "failed to register SPI master\n");
goto fail_free_dma;
Expand All @@ -968,7 +968,6 @@ static int ep93xx_spi_remove(struct platform_device *pdev)

ep93xx_spi_release_dma(espi);

spi_unregister_master(master);
return 0;
}

Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-mpc512x-psc.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
if (ret < 0)
goto free_clock;

ret = spi_register_master(master);
ret = devm_spi_register_master(dev, master);
if (ret < 0)
goto free_clock;

Expand All @@ -557,12 +557,10 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);

spi_unregister_master(master);
clk_disable_unprepare(mps->clk_mclk);
free_irq(mps->irq, mps);
if (mps->psc)
iounmap(mps->psc);
spi_master_put(master);

return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ static int mxs_spi_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, master);

ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret) {
dev_err(&pdev->dev, "Cannot register SPI master, %d\n", ret);
goto out_disable_clk;
Expand All @@ -598,10 +598,8 @@ static int mxs_spi_remove(struct platform_device *pdev)
spi = spi_master_get_devdata(master);
ssp = &spi->ssp;

spi_unregister_master(master);
clk_disable_unprepare(ssp->clk);
dma_release_channel(ssp->dmach);
spi_master_put(master);

return 0;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-octeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static int octeon_spi_probe(struct platform_device *pdev)
master->bits_per_word_mask = SPI_BPW_MASK(8);

master->dev.of_node = pdev->dev.of_node;
err = spi_register_master(master);
err = devm_spi_register_master(&pdev->dev, master);
if (err) {
dev_err(&pdev->dev, "register master failed: %d\n", err);
goto fail;
Expand All @@ -292,8 +292,6 @@ static int octeon_spi_remove(struct platform_device *pdev)
struct octeon_spi *p = spi_master_get_devdata(master);
u64 register_base = p->register_base;

spi_unregister_master(master);

/* Clear the CSENA* and put everything in a known state. */
cvmx_write_csr(register_base + OCTEON_SPI_CFG, 0);

Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-omap-100k.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)
goto err;
}

status = spi_register_master(master);
status = devm_spi_register_master(&pdev->dev, master);
if (status < 0)
goto err;

Expand Down Expand Up @@ -485,8 +485,6 @@ static int omap1_spi100k_remove(struct platform_device *pdev)

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);

spi_unregister_master(master);

return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-omap2-mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
if (status < 0)
goto disable_pm;

status = spi_register_master(master);
status = devm_spi_register_master(&pdev->dev, master);
if (status < 0)
goto disable_pm;

Expand Down Expand Up @@ -1435,7 +1435,6 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
pm_runtime_put_sync(mcspi->dev);
pm_runtime_disable(&pdev->dev);

spi_unregister_master(master);
kfree(dma_channels);

return 0;
Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static int orion_spi_probe(struct platform_device *pdev)
goto out_rel_clk;

master->dev.of_node = pdev->dev.of_node;
status = spi_register_master(master);
status = devm_spi_register_master(&pdev->dev, master);
if (status < 0)
goto out_rel_clk;

Expand All @@ -483,8 +483,6 @@ static int orion_spi_remove(struct platform_device *pdev)
clk_disable_unprepare(spi->clk);
clk_put(spi->clk);

spi_unregister_master(master);

return 0;
}

Expand Down
6 changes: 1 addition & 5 deletions drivers/spi/spi-pl022.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,6 @@ static int verify_controller_parameters(struct pl022 *pl022,
dev_err(&pl022->adev->dev,
"RX FIFO Trigger Level is configured incorrectly\n");
return -EINVAL;
break;
}
switch (chip_info->tx_lev_trig) {
case SSP_TX_1_OR_MORE_EMPTY_LOC:
Expand All @@ -1645,7 +1644,6 @@ static int verify_controller_parameters(struct pl022 *pl022,
dev_err(&pl022->adev->dev,
"TX FIFO Trigger Level is configured incorrectly\n");
return -EINVAL;
break;
}
if (chip_info->iface == SSP_INTERFACE_NATIONAL_MICROWIRE) {
if ((chip_info->ctrl_len < SSP_BITS_4)
Expand Down Expand Up @@ -2227,7 +2225,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)

/* Register with the SPI framework */
amba_set_drvdata(adev, pl022);
status = spi_register_master(master);
status = devm_spi_register_master(&adev->dev, master);
if (status != 0) {
dev_err(&adev->dev,
"probe - problem registering spi master\n");
Expand Down Expand Up @@ -2287,8 +2285,6 @@ pl022_remove(struct amba_device *adev)
clk_unprepare(pl022->clk);
amba_release_regions(adev);
tasklet_disable(&pl022->pump_transfers);
spi_unregister_master(pl022->master);
amba_set_drvdata(adev, NULL);
return 0;
}

Expand Down
5 changes: 1 addition & 4 deletions drivers/spi/spi-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)

/* Register with the SPI framework */
platform_set_drvdata(pdev, drv_data);
status = spi_register_master(master);
status = devm_spi_register_master(&pdev->dev, master);
if (status != 0) {
dev_err(&pdev->dev, "problem registering spi master\n");
goto out_error_clock_enabled;
Expand Down Expand Up @@ -1248,9 +1248,6 @@ static int pxa2xx_spi_remove(struct platform_device *pdev)
/* Release SSP */
pxa_ssp_free(ssp);

/* Disconnect from the SPI framework */
spi_unregister_master(drv_data->master);

return 0;
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-sh-hspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ static int hspi_probe(struct platform_device *pdev)
master->mode_bits = SPI_CPOL | SPI_CPHA;
master->auto_runtime_pm = true;
master->transfer_one_message = hspi_transfer_one_message;
ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret < 0) {
dev_err(&pdev->dev, "spi_register_master error.\n");
goto error1;
Expand All @@ -328,7 +328,6 @@ static int hspi_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);

clk_put(hspi->clk);
spi_unregister_master(hspi->master);

return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-tegra114.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ static int tegra_spi_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev);

master->dev.of_node = pdev->dev.of_node;
ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret < 0) {
dev_err(&pdev->dev, "can not register to master err %d\n", ret);
goto exit_pm_disable;
Expand All @@ -1142,7 +1142,6 @@ static int tegra_spi_remove(struct platform_device *pdev)
struct tegra_spi_data *tspi = spi_master_get_devdata(master);

free_irq(tspi->irq, tspi);
spi_unregister_master(master);

if (tspi->tx_dma_chan)
tegra_spi_deinit_dma_param(tspi, false);
Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-tegra20-sflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev);

master->dev.of_node = pdev->dev.of_node;
ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret < 0) {
dev_err(&pdev->dev, "can not register to master err %d\n", ret);
goto exit_pm_disable;
Expand All @@ -553,7 +553,6 @@ static int tegra_sflash_remove(struct platform_device *pdev)
struct tegra_sflash_data *tsd = spi_master_get_devdata(master);

free_irq(tsd->irq, tsd);
spi_unregister_master(master);

pm_runtime_disable(&pdev->dev);
if (!pm_runtime_status_suspended(&pdev->dev))
Expand Down
3 changes: 1 addition & 2 deletions drivers/spi/spi-tegra20-slink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
pm_runtime_put(&pdev->dev);

master->dev.of_node = pdev->dev.of_node;
ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret < 0) {
dev_err(&pdev->dev, "can not register to master err %d\n", ret);
goto exit_pm_disable;
Expand All @@ -1191,7 +1191,6 @@ static int tegra_slink_remove(struct platform_device *pdev)
struct tegra_slink_data *tspi = spi_master_get_devdata(master);

free_irq(tspi->irq, tspi);
spi_unregister_master(master);

if (tspi->tx_dma_chan)
tegra_slink_deinit_dma_param(tspi, false);
Expand Down
5 changes: 2 additions & 3 deletions drivers/spi/spi-ti-qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ static int ti_qspi_probe(struct platform_device *pdev)
if (!of_property_read_u32(np, "spi-max-frequency", &max_freq))
qspi->spi_max_frequency = max_freq;

ret = spi_register_master(master);
ret = devm_spi_register_master(&pdev->dev, master);
if (ret)
goto free_master;

Expand All @@ -520,7 +520,6 @@ static int ti_qspi_remove(struct platform_device *pdev)
struct ti_qspi *qspi = platform_get_drvdata(pdev);

ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG);
spi_unregister_master(qspi->master);

return 0;
}
Expand All @@ -531,7 +530,7 @@ static const struct dev_pm_ops ti_qspi_pm_ops = {

static struct platform_driver ti_qspi_driver = {
.probe = ti_qspi_probe,
.remove = ti_qspi_remove,
.remove = ti_qspi_remove,
.driver = {
.name = "ti,dra7xxx-qspi",
.owner = THIS_MODULE,
Expand Down
4 changes: 1 addition & 3 deletions drivers/spi/spi-txx9.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static int txx9spi_probe(struct platform_device *dev)
master->num_chipselect = (u16)UINT_MAX; /* any GPIO numbers */
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);

ret = spi_register_master(master);
ret = devm_spi_register_master(&dev->dev, master);
if (ret)
goto exit;
return 0;
Expand All @@ -428,11 +428,9 @@ static int txx9spi_remove(struct platform_device *dev)
struct spi_master *master = spi_master_get(platform_get_drvdata(dev));
struct txx9spi *c = spi_master_get_devdata(master);

spi_unregister_master(master);
destroy_workqueue(c->workqueue);
clk_disable(c->clk);
clk_put(c->clk);
spi_master_put(master);
return 0;
}

Expand Down
Loading

0 comments on commit dabefd5

Please sign in to comment.