mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-21 13:24:15 +08:00
spi: pxa2xx: Reuse int_error_stop() in pxa2xx_spi_slave_abort()
It appears that pxa2xx_spi_slave_abort()almost repeats the functionality of the int_error_stop(). Reuse int_error_stop() in pxa2xx_spi_slave_abort(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210510124134.24638-9-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ab77fe8935
commit
4761d2e7e5
@ -631,7 +631,7 @@ static void int_stop_and_reset(struct driver_data *drv_data)
|
||||
pxa2xx_spi_write(drv_data, SSTO, 0);
|
||||
}
|
||||
|
||||
static void int_error_stop(struct driver_data *drv_data, const char *msg)
|
||||
static void int_error_stop(struct driver_data *drv_data, const char *msg, int err)
|
||||
{
|
||||
int_stop_and_reset(drv_data);
|
||||
pxa2xx_spi_flush(drv_data);
|
||||
@ -639,7 +639,7 @@ static void int_error_stop(struct driver_data *drv_data, const char *msg)
|
||||
|
||||
dev_err(drv_data->ssp->dev, "%s\n", msg);
|
||||
|
||||
drv_data->controller->cur_msg->status = -EIO;
|
||||
drv_data->controller->cur_msg->status = err;
|
||||
spi_finalize_current_transfer(drv_data->controller);
|
||||
}
|
||||
|
||||
@ -658,12 +658,12 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
|
||||
u32 irq_status = pxa2xx_spi_read(drv_data, SSSR) & irq_mask;
|
||||
|
||||
if (irq_status & SSSR_ROR) {
|
||||
int_error_stop(drv_data, "interrupt_transfer: fifo overrun");
|
||||
int_error_stop(drv_data, "interrupt_transfer: fifo overrun", -EIO);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
if (irq_status & SSSR_TUR) {
|
||||
int_error_stop(drv_data, "interrupt_transfer: fifo underrun");
|
||||
int_error_stop(drv_data, "interrupt_transfer: fifo underrun", -EIO);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
@ -1154,14 +1154,7 @@ static int pxa2xx_spi_slave_abort(struct spi_controller *controller)
|
||||
{
|
||||
struct driver_data *drv_data = spi_controller_get_devdata(controller);
|
||||
|
||||
int_stop_and_reset(drv_data);
|
||||
pxa2xx_spi_flush(drv_data);
|
||||
pxa2xx_spi_off(drv_data);
|
||||
|
||||
dev_dbg(drv_data->ssp->dev, "transfer aborted\n");
|
||||
|
||||
drv_data->controller->cur_msg->status = -EINTR;
|
||||
spi_finalize_current_transfer(drv_data->controller);
|
||||
int_error_stop(drv_data, "transfer aborted", -EINTR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user