From patchwork Wed Jan 11 13:45:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Conor Dooley X-Patchwork-Id: 13096688 X-Patchwork-Delegate: mail@conchuod.ie Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46FF8C46467 for ; Wed, 11 Jan 2023 13:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ni5OiWVtUIrx12zZ27WqTlfLvp+lCUrZtLgYS+aBnFM=; b=KM9HpHKf/ejC0h KUsNLamLfCF6PzByA+Hmi7jqEhnaMV/aUjsAFSa0q32zvdGm3wrzz3CTapoN2MYdLN6aLojCbsFId BFuZ/MQISl2v2SmXya1rjxRPp3iDuzMyav9Uq8e0PiZx5DNCPOBsN+9TiB52YwwhaHZRARp642Zky BDETMvWIKmqepDhi51QfqlsNGvtpD96bjNvf7HGQwQ7WN4Ii6fiUqof0tAGXDWotyJW/d0U19/0cg E3wFjrgBVuUMYPomayZ84KMIgi+4GPn9pjT+bg/dUxINNViBT3mgbnvBbE288lO/zCxIclSDB4kA6 suhG1RkPcZyDkO9Bzhag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFbQZ-00BetH-3A; Wed, 11 Jan 2023 13:46:03 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFbQS-00BeqO-3q for linux-riscv@lists.infradead.org; Wed, 11 Jan 2023 13:45:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673444756; x=1704980756; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YmvtEgsExmKnHFKrtsTC1qEk3keDAXMIHIB9CsFESV4=; b=zKZszEXdZklD1KO8d4uYwczISh562yVjFFauMdwKdOboYkFJp/VIqFzJ eWO6m6ngO3GWGPIR9ZLzS0mEZIaMielxhiorITJtW8nR79hbqBKP+4sCe RUNArZQrVzBFLKGqxlZy5C75K+p8yHHIwQxaZGYotuHfxfACVHUBD95cM JTr+cmGmZUxE9f5QKPa80k9UTN9VNWfxJlkFJo+sb0HFG6Jf/0kvtzTXf WwJZ7bDn8bX+vQmmUdS3KaoPU+JyONq1OgnIeXL6ZsYe5DLl0O+0Ng5az g+mfPfbFztQXoq6KFvTYKPx4O5eTBxnwr1bA+WHwe8tMwFSq0dk8ntsuS Q==; X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="207325803" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jan 2023 06:45:55 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 06:45:55 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Wed, 11 Jan 2023 06:45:54 -0700 From: Conor Dooley To: Jassi Brar CC: Conor Dooley , Daire McNamara , , Subject: [PATCH v1 5/7] soc: microchip: mpfs: use a consistent completion timeout Date: Wed, 11 Jan 2023 13:45:11 +0000 Message-ID: <20230111134513.2495510-6-conor.dooley@microchip.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111134513.2495510-1-conor.dooley@microchip.com> References: <20230111134513.2495510-1-conor.dooley@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230111_054556_184481_196903BC X-CRM114-Status: GOOD ( 11.01 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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 --- 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 #include #include +#include #include #include #include #include #include +#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;