Fixes for turris-mox-rwtm driver
Marek Behún
maintainercover Fixes for turris-mox-rwtm driver
Hello Arnd,
as you requested I've split the 3 fix patches from the
Updates for turris-mox-rwtm driver
series. I will send the rest once the merge window is closed.
Marek
Marek Behún (3):
firmware: turris-mox-rwtm: Do not complete if there are no waiters
firmware: turris-mox-rwtm: Fix checking return value of
wait_for_completion_timeout()
firmware: turris-mox-rwtm: Initialize completion before mailbox
drivers/firmware/turris-mox-rwtm.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
Signature · 1 line
2.44.2
Marek Behún
maintainerPATCH 1/3 firmware: turris-mox-rwtm: Do not complete if there are no waiters
Do not complete the "command done" completion if there are no waiters. This can happen if a wait_for_completion() timed out or was interrupted.
--- drivers/firmware/turris-mox-rwtm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/firmware/turris-mox-rwtm.c +4 -1
@@ -2,7 +2,7 @@/* * Turris Mox rWTM firmware driver * -* Copyright (C) 2019 Marek Behún <[email protected]> +* Copyright (C) 2019, 2024 Marek Behún <[email protected]> */ #include <linux/armada-37xx-rwtm-mailbox.h>
@@ -174,6 +174,9 @@ static void mox_rwtm_rx_callback(struct mbox_client *cl, void *data)struct mox_rwtm *rwtm =dev_get_drvdata (cl->dev);struct armada_37xx_rwtm_rx_msg *msg = data; +if (completion_done (&rwtm->cmd_done)) +return ; + rwtm->reply = *msg;complete (&rwtm->cmd_done); }
Signature · 1 line
2.44.2
Marek Behún
maintainerPATCH 2/3 firmware: turris-mox-rwtm: Fix checking return value of wait_for_completion_timeout()
In reply to Marek BehúnThe wait_for_completion_timeout() function returns 0 if timed out, and a positive value if completed. Fix the usage of this function.
--- drivers/firmware/turris-mox-rwtm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/firmware/turris-mox-rwtm.c +6 -9
@@ -202,9 +202,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm)if (ret <0 )return ret; - ret =wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 ); -if (ret <0 ) -return ret; +if (!wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 )) +return -ETIMEDOUT ; ret =mox_get_status (MBOX_CMD_BOARD_INFO , reply->retval);if (ret == -ENODATA ) {
@@ -238,9 +237,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm)if (ret <0 )return ret; - ret =wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 ); -if (ret <0 ) -return ret; +if (!wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 )) +return -ETIMEDOUT ; ret =mox_get_status (MBOX_CMD_ECDSA_PUB_KEY , reply->retval);if (ret == -ENODATA ) {
@@ -277,9 +275,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm)if (ret <0 )return ret; - ret =wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 ); -if (ret <0 ) -return ret; +if (!wait_for_completion_timeout (&rwtm->cmd_done,HZ /2 )) +return -ETIMEDOUT ;return mox_get_status (MBOX_CMD_GET_RANDOM , rwtm->reply.retval); }
Signature · 1 line
2.44.2
Marek Behún
maintainerPATCH 3/3 firmware: turris-mox-rwtm: Initialize completion before mailbox
In reply to Marek BehúnInitialize the completion before the mailbox channel is requested.
--- drivers/firmware/turris-mox-rwtm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/firmware/turris-mox-rwtm.c +1 -2
@@ -499,6 +499,7 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev)platform_set_drvdata (pdev, rwtm);mutex_init (&rwtm->busy); +init_completion (&rwtm->cmd_done); rwtm->mbox_client.dev = dev; rwtm->mbox_client.rx_callback = mox_rwtm_rx_callback;
@@ -512,8 +513,6 @@ static int turris_mox_rwtm_probe(struct platform_device *pdev) goto remove_files; } -init_completion (&rwtm->cmd_done); - ret =mox_get_board_info (rwtm);if (ret <0 )dev_warn (dev,"Cannot read board information: %i\n" , ret);
Signature · 1 line
2.44.2
This series was applied to soc/soc.git (arm/fixes) by Arnd Bergmann <[email protected]>:
Hello:
This series was applied to soc/soc.git (arm/fixes) by Arnd Bergmann <[email protected]>:
Quoted 9 lines · On Mon, 15 Jul 2024 13:59:09 +0200 you wrote:
Hello Arnd,
as you requested I've split the 3 fix patches from the
Updates for turris-mox-rwtm driver
series. I will send the rest once the merge window is closed.Marek
[...]
Here is the summary with links:
- [1/3] firmware: turris-mox-rwtm: Do not complete if there are no waiters
https://git.kernel.org/soc/soc/c/0bafb172b111 - [2/3] firmware: turris-mox-rwtm: Fix checking return value of wait_for_completion_timeout() https://git.kernel.org/soc/soc/c/8467cfe821ac - [3/3] firmware: turris-mox-rwtm: Initialize completion before mailbox https://git.kernel.org/soc/soc/c/49e24c80d3c8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html