From: Conor Dooley <conor.dooley@microchip.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Conor Dooley <conor.dooley@microchip.com>,
Daire McNamara <daire.mcnamara@microchip.com>,
<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v1 5/7] soc: microchip: mpfs: use a consistent completion timeout
Date: Wed, 11 Jan 2023 13:45:11 +0000 [thread overview]
Message-ID: <20230111134513.2495510-6-conor.dooley@microchip.com> (raw)
In-Reply-To: <20230111134513.2495510-1-conor.dooley@microchip.com>
Completion timeouts use jiffies, so passing a number directly will
produce inconsistent timeouts depending on config. Define the timeout in
ms and convert it to jiffies instead.
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
drivers/soc/microchip/mpfs-sys-controller.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/microchip/mpfs-sys-controller.c b/drivers/soc/microchip/mpfs-sys-controller.c
index 12039cb38b33..738ecd624d64 100644
--- a/drivers/soc/microchip/mpfs-sys-controller.c
+++ b/drivers/soc/microchip/mpfs-sys-controller.c
@@ -11,12 +11,15 @@
#include <linux/slab.h>
#include <linux/kref.h>
#include <linux/module.h>
+#include <linux/jiffies.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
#include <linux/mailbox_client.h>
#include <linux/platform_device.h>
#include <soc/microchip/mpfs.h>
+#define MPFS_SYS_CTRL_TIMEOUT_MS 100
+
static DEFINE_MUTEX(transaction_lock);
struct mpfs_sys_controller {
@@ -28,6 +31,7 @@ struct mpfs_sys_controller {
int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct mpfs_mss_msg *msg)
{
+ unsigned long timeout = msecs_to_jiffies(MPFS_SYS_CTRL_TIMEOUT_MS);
int ret, err;
err = mutex_lock_interruptible(&transaction_lock);
@@ -38,7 +42,7 @@ int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct
ret = mbox_send_message(sys_controller->chan, msg);
if (ret >= 0) {
- if (wait_for_completion_timeout(&sys_controller->c, HZ)) {
+ if (wait_for_completion_timeout(&sys_controller->c, timeout)) {
ret = 0;
} else {
ret = -ETIMEDOUT;
--
2.39.0
next prev parent reply other threads:[~2023-01-11 13:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 13:45 [PATCH v1 0/7] MPFS system controller/mailbox fixes Conor Dooley
2023-01-11 13:45 ` [PATCH v1 1/7] mailbox: mpfs: fix an incorrect mask width Conor Dooley
2023-01-11 13:45 ` [PATCH v1 2/7] mailbox: mpfs: switch to txdone_poll Conor Dooley
2023-01-11 13:45 ` [PATCH v1 3/7] mailbox: mpfs: ditch a useless busy check Conor Dooley
2023-01-11 13:45 ` [PATCH v1 4/7] soc: microchip: mpfs: fix some horrible alignment Conor Dooley
2023-01-11 13:45 ` Conor Dooley [this message]
2023-01-11 13:45 ` [PATCH v1 6/7] soc: microchip: mpfs: simplify error handling in mpfs_blocking_transaction() Conor Dooley
2023-01-11 13:45 ` [PATCH v1 7/7] soc: microchip: mpfs: handle timeouts and failed services differently Conor Dooley
2023-01-18 13:53 ` [PATCH v1 0/7] MPFS system controller/mailbox fixes Conor Dooley
2023-01-21 16:01 ` Jassi Brar
2023-01-21 19:12 ` Conor Dooley
2023-02-16 22:24 ` Conor Dooley
2023-02-17 4:04 ` Jassi Brar
2023-02-17 7:34 ` Conor Dooley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230111134513.2495510-6-conor.dooley@microchip.com \
--to=conor.dooley@microchip.com \
--cc=daire.mcnamara@microchip.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).