Re: [PATCH] spi: core: Abort active target transfer on controller suspend

From: Praveen Talari

Date: Thu Jun 25 2026 - 10:59:43 EST


Hi Mark

On 25-06-2026 18:57, Mark Brown wrote:
On Thu, Jun 25, 2026 at 11:09:35AM +0530, Praveen Talari wrote:
When an SPI controller operating in target mode has a transfer in
progress at the time of system suspend, the suspend path proceeds
without aborting the ongoing transfer. This can leave the hardware in
an inconsistent state, potentially causing the system to hang or fail
to resume cleanly.

Fix this by invoking the controller's target_abort callback from
spi_controller_suspend() when the controller is in target mode and the
callback is registered. This ensures any active target transfer is
cleanly terminated before the controller is suspended.
+ if (spi_controller_is_target(ctlr) && ctlr->target_abort)
+ ctlr->target_abort(ctlr);
+
We need to check for an active message here, drivers are going to
assume there's an in progress operation to cancel - for example the
pxa2xx driver unconditionally sets cur_msg->status during abort which is
going to go badly without a cur_msg.
Yes, i got it. Our spi driver had that check in target_abort.

is it fine?

if (ctrl->cur_msg && spi_controller_is_target(ctlr) && ctlr->target_abort)


Thanks,

Praveen Talari