Skip to content

Commit 4f739af

Browse files
committed
soc: microchip: mpfs: use a consistent completion timeout
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. Tested-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
1 parent 5ca631e commit 4f739af

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/soc/microchip/mpfs-sys-controller.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
#include <linux/slab.h>
1212
#include <linux/kref.h>
1313
#include <linux/module.h>
14+
#include <linux/jiffies.h>
1415
#include <linux/interrupt.h>
1516
#include <linux/of_platform.h>
1617
#include <linux/mailbox_client.h>
1718
#include <linux/platform_device.h>
1819
#include <soc/microchip/mpfs.h>
1920

21+
#define MPFS_SYS_CTRL_TIMEOUT_MS 100
22+
2023
static DEFINE_MUTEX(transaction_lock);
2124

2225
struct mpfs_sys_controller {
@@ -28,6 +31,7 @@ struct mpfs_sys_controller {
2831

2932
int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct mpfs_mss_msg *msg)
3033
{
34+
unsigned long timeout = msecs_to_jiffies(MPFS_SYS_CTRL_TIMEOUT_MS);
3135
int ret, err;
3236

3337
err = mutex_lock_interruptible(&transaction_lock);
@@ -38,7 +42,7 @@ int mpfs_blocking_transaction(struct mpfs_sys_controller *sys_controller, struct
3842

3943
ret = mbox_send_message(sys_controller->chan, msg);
4044
if (ret >= 0) {
41-
if (wait_for_completion_timeout(&sys_controller->c, HZ)) {
45+
if (wait_for_completion_timeout(&sys_controller->c, timeout)) {
4246
ret = 0;
4347
} else {
4448
ret = -ETIMEDOUT;

0 commit comments

Comments
 (0)