Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: pxa2xx: Factor out handle_bad_msg

As suggested by Andy Shevchenko: Decouple this corner cause from the
general handling logic in ssp_int.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jan Kiszka and committed by
Mark Brown
b0312482 25014521

+15 -14
+15 -14
drivers/spi/spi-pxa2xx.c
··· 732 732 return IRQ_HANDLED; 733 733 } 734 734 735 + static void handle_bad_msg(struct driver_data *drv_data) 736 + { 737 + pxa2xx_spi_write(drv_data, SSCR0, 738 + pxa2xx_spi_read(drv_data, SSCR0) & ~SSCR0_SSE); 739 + pxa2xx_spi_write(drv_data, SSCR1, 740 + pxa2xx_spi_read(drv_data, SSCR1) & ~drv_data->int_cr1); 741 + if (!pxa25x_ssp_comp(drv_data)) 742 + pxa2xx_spi_write(drv_data, SSTO, 0); 743 + write_SSSR_CS(drv_data, drv_data->clear_sr); 744 + 745 + dev_err(&drv_data->pdev->dev, 746 + "bad message state in interrupt handler\n"); 747 + } 748 + 735 749 static irqreturn_t ssp_int(int irq, void *dev_id) 736 750 { 737 751 struct driver_data *drv_data = dev_id; ··· 786 772 return IRQ_NONE; 787 773 788 774 if (!drv_data->master->cur_msg) { 789 - 790 - pxa2xx_spi_write(drv_data, SSCR0, 791 - pxa2xx_spi_read(drv_data, SSCR0) 792 - & ~SSCR0_SSE); 793 - pxa2xx_spi_write(drv_data, SSCR1, 794 - pxa2xx_spi_read(drv_data, SSCR1) 795 - & ~drv_data->int_cr1); 796 - if (!pxa25x_ssp_comp(drv_data)) 797 - pxa2xx_spi_write(drv_data, SSTO, 0); 798 - write_SSSR_CS(drv_data, drv_data->clear_sr); 799 - 800 - dev_err(&drv_data->pdev->dev, 801 - "bad message state in interrupt handler\n"); 802 - 775 + handle_bad_msg(drv_data); 803 776 /* Never fail */ 804 777 return IRQ_HANDLED; 805 778 }