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>
This commit is contained in:
parent
5ca631ec75
commit
4f739af193
@ -11,12 +11,15 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/kref.h>
|
#include <linux/kref.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/jiffies.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
#include <linux/mailbox_client.h>
|
#include <linux/mailbox_client.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <soc/microchip/mpfs.h>
|
#include <soc/microchip/mpfs.h>
|
||||||
|
|
||||||
|
#define MPFS_SYS_CTRL_TIMEOUT_MS 100
|
||||||
|
|
||||||
static DEFINE_MUTEX(transaction_lock);
|
static DEFINE_MUTEX(transaction_lock);
|
||||||
|
|
||||||
struct mpfs_sys_controller {
|
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)
|
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;
|
int ret, err;
|
||||||
|
|
||||||
err = mutex_lock_interruptible(&transaction_lock);
|
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);
|
ret = mbox_send_message(sys_controller->chan, msg);
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
if (wait_for_completion_timeout(&sys_controller->c, HZ)) {
|
if (wait_for_completion_timeout(&sys_controller->c, timeout)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
ret = -ETIMEDOUT;
|
ret = -ETIMEDOUT;
|
||||||
|
Loading…
Reference in New Issue
Block a user