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

can: m_can: Keep interrupts enabled during peripheral read

Interrupts currently get disabled if the interrupt status shows new
received data. Non-peripheral chips handle receiving in a worker thread,
but peripheral chips are handling the receive process in the threaded
interrupt routine itself without scheduling it for a different worker.
So there is no need to disable interrupts for peripheral chips.

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/all/20230315110546.2518305-6-msp@baylibre.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Markus Schneider-Pargmann and committed by
Marc Kleine-Budde
9083e0b0 897e6632

+6 -5
+6 -5
drivers/net/can/m_can/m_can.c
··· 972 972 /* Don't re-enable interrupts if the driver had a fatal error 973 973 * (e.g., FIFO read failure). 974 974 */ 975 - if (work_done >= 0) 976 - m_can_enable_all_interrupts(cdev); 975 + if (work_done < 0) 976 + m_can_disable_all_interrupts(cdev); 977 977 978 978 return work_done; 979 979 } ··· 1095 1095 */ 1096 1096 if ((ir & IR_RF0N) || (ir & IR_ERR_ALL_30X)) { 1097 1097 cdev->irqstatus = ir; 1098 - m_can_disable_all_interrupts(cdev); 1099 - if (!cdev->is_peripheral) 1098 + if (!cdev->is_peripheral) { 1099 + m_can_disable_all_interrupts(cdev); 1100 1100 napi_schedule(&cdev->napi); 1101 - else if (m_can_rx_peripheral(dev, ir) < 0) 1101 + } else if (m_can_rx_peripheral(dev, ir) < 0) { 1102 1102 goto out_fail; 1103 + } 1103 1104 } 1104 1105 1105 1106 if (cdev->version == 30) {