linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] firmware: ti_sci: Fix polled mode during system suspend
@ 2022-10-21 18:57 Georgi Vlaev
  2022-10-28 13:29 ` Nishanth Menon
  0 siblings, 1 reply; 2+ messages in thread
From: Georgi Vlaev @ 2022-10-21 18:57 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar,
	Vignesh Raghavendra, Vibhore Vardhan
  Cc: linux-arm-kernel, linux-kernel, Georgi Vlaev

Commit b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled
mode during system suspend") uses read_poll_timeout_atomic() macro
in ti_sci_do_xfer() to wait for completion when the system is
suspending. The break condition of the macro is set to "true" which
will cause it break immediately when evaluated, likely before the
TISCI xfer is completed, and always return 0. We want to poll here
until "done_state == true".

1) Change the break condition of read_poll_timeout_atomic() to
the bool variable "done_state".

2) The read_poll_timeout_atomic() returns 0 if the break condition
is met or -ETIMEDOUT if not. Since our break condition has changed
to "done_state", we also don't have to check for "!done_state" when
evaluating the return value.

Fixes: b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled mode during system suspend")

Signed-off-by: Georgi Vlaev <g-vlaev@ti.com>
---
 drivers/firmware/ti_sci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index ebc32bbd9b83..6281e7153b47 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -429,15 +429,14 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *info,
 		 * during noirq phase, so we must manually poll the completion.
 		 */
 		ret = read_poll_timeout_atomic(try_wait_for_completion, done_state,
-					       true, 1,
+					       done_state, 1,
 					       info->desc->max_rx_timeout_ms * 1000,
 					       false, &xfer->done);
 	}
 
-	if (ret == -ETIMEDOUT || !done_state) {
+	if (ret == -ETIMEDOUT)
 		dev_err(dev, "Mbox timedout in resp(caller: %pS)\n",
 			(void *)_RET_IP_);
-	}
 
 	/*
 	 * NOTE: we might prefer not to need the mailbox ticker to manage the

base-commit: 4d48f589d294ddc5e01d3b0dc7cecc55324c05ca
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] firmware: ti_sci: Fix polled mode during system suspend
  2022-10-21 18:57 [RESEND PATCH] firmware: ti_sci: Fix polled mode during system suspend Georgi Vlaev
@ 2022-10-28 13:29 ` Nishanth Menon
  0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2022-10-28 13:29 UTC (permalink / raw)
  To: Santosh Shilimkar, vigneshr, kristo, vibhore, g-vlaev
  Cc: Nishanth Menon, linux-kernel, linux-arm-kernel

Hi Georgi Vlaev,

On Fri, 21 Oct 2022 21:57:04 +0300, Georgi Vlaev wrote:
> Commit b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled
> mode during system suspend") uses read_poll_timeout_atomic() macro
> in ti_sci_do_xfer() to wait for completion when the system is
> suspending. The break condition of the macro is set to "true" which
> will cause it break immediately when evaluated, likely before the
> TISCI xfer is completed, and always return 0. We want to poll here
> until "done_state == true".
> 
> [...]

I have applied the following to branch ti-drivers-soc-next on [1].
Thank you!

[1/1] firmware: ti_sci: Fix polled mode during system suspend
      commit: b13b2c3e0e4d0854228b5217fa34e145f3ace8ac

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-28 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 18:57 [RESEND PATCH] firmware: ti_sci: Fix polled mode during system suspend Georgi Vlaev
2022-10-28 13:29 ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).