spi/rockchip: do an error handling in proper time
There was handle_err() callback introduced that is dedicated for error handling. The patch moves error handling to this callback. Cc: Heiko Stuebner <heiko@sntech.de> Cc: linux-rockchip@lists.infradead.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
b716c4ffc6
commit
2291793cc4
@@ -302,7 +302,7 @@ static int rockchip_spi_prepare_message(struct spi_master *master,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rockchip_spi_unprepare_message(struct spi_master *master,
|
static void rockchip_spi_handle_err(struct spi_master *master,
|
||||||
struct spi_message *msg)
|
struct spi_message *msg)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@@ -313,8 +313,8 @@ static int rockchip_spi_unprepare_message(struct spi_master *master,
|
|||||||
/*
|
/*
|
||||||
* For DMA mode, we need terminate DMA channel and flush
|
* For DMA mode, we need terminate DMA channel and flush
|
||||||
* fifo for the next transfer if DMA thansfer timeout.
|
* fifo for the next transfer if DMA thansfer timeout.
|
||||||
* unprepare_message() was called by core if transfer complete
|
* handle_err() was called by core if transfer failed.
|
||||||
* or timeout. Maybe it is reasonable for error handling here.
|
* Maybe it is reasonable for error handling here.
|
||||||
*/
|
*/
|
||||||
if (rs->use_dma) {
|
if (rs->use_dma) {
|
||||||
if (rs->state & RXBUSY) {
|
if (rs->state & RXBUSY) {
|
||||||
@@ -327,6 +327,12 @@ static int rockchip_spi_unprepare_message(struct spi_master *master,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&rs->lock, flags);
|
spin_unlock_irqrestore(&rs->lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rockchip_spi_unprepare_message(struct spi_master *master,
|
||||||
|
struct spi_message *msg)
|
||||||
|
{
|
||||||
|
struct rockchip_spi *rs = spi_master_get_devdata(master);
|
||||||
|
|
||||||
spi_enable_chip(rs, 0);
|
spi_enable_chip(rs, 0);
|
||||||
|
|
||||||
@@ -688,6 +694,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
|
|||||||
master->prepare_message = rockchip_spi_prepare_message;
|
master->prepare_message = rockchip_spi_prepare_message;
|
||||||
master->unprepare_message = rockchip_spi_unprepare_message;
|
master->unprepare_message = rockchip_spi_unprepare_message;
|
||||||
master->transfer_one = rockchip_spi_transfer_one;
|
master->transfer_one = rockchip_spi_transfer_one;
|
||||||
|
master->handle_err = rockchip_spi_handle_err;
|
||||||
|
|
||||||
rs->dma_tx.ch = dma_request_slave_channel(rs->dev, "tx");
|
rs->dma_tx.ch = dma_request_slave_channel(rs->dev, "tx");
|
||||||
if (!rs->dma_tx.ch)
|
if (!rs->dma_tx.ch)
|
||||||
|
|||||||
Reference in New Issue
Block a user