Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…/git/broonie/spi into spi-5.8
  • Loading branch information
Mark Brown committed May 20, 2020
2 parents 73da235 + b9dd3f6 commit c38a490
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion drivers/spi/spi-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
goto out_dma_release;
}

err = devm_spi_register_controller(&pdev->dev, ctlr);
err = spi_register_controller(ctlr);
if (err) {
dev_err(&pdev->dev, "could not register SPI controller: %d\n",
err);
Expand All @@ -1378,6 +1378,8 @@ static int bcm2835_spi_remove(struct platform_device *pdev)

bcm2835_debugfs_remove(bs);

spi_unregister_controller(ctlr);

/* Clear FIFOs, and disable the HW block */
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
Expand Down
4 changes: 3 additions & 1 deletion drivers/spi/spi-bcm2835aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static int bcm2835aux_spi_probe(struct platform_device *pdev)
goto out_clk_disable;
}

err = devm_spi_register_master(&pdev->dev, master);
err = spi_register_master(master);
if (err) {
dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
goto out_clk_disable;
Expand All @@ -593,6 +593,8 @@ static int bcm2835aux_spi_remove(struct platform_device *pdev)

bcm2835aux_debugfs_remove(bs);

spi_unregister_master(master);

bcm2835aux_spi_reset_hw(bs);

/* disable the HW block by releasing the clock */
Expand Down
3 changes: 2 additions & 1 deletion drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2761,6 +2761,8 @@ void spi_unregister_controller(struct spi_controller *ctlr)
struct spi_controller *found;
int id = ctlr->bus_num;

device_for_each_child(&ctlr->dev, NULL, __unregister);

/* First make sure that this controller was ever added */
mutex_lock(&board_lock);
found = idr_find(&spi_master_idr, id);
Expand All @@ -2773,7 +2775,6 @@ void spi_unregister_controller(struct spi_controller *ctlr)
list_del(&ctlr->list);
mutex_unlock(&board_lock);

device_for_each_child(&ctlr->dev, NULL, __unregister);
device_unregister(&ctlr->dev);
/* free bus id */
mutex_lock(&board_lock);
Expand Down

0 comments on commit c38a490

Please sign in to comment.