Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9441824rwl; Wed, 11 Jan 2023 05:53:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXvxBJR3QRHDVGPXBRUNoNyDUxrIXVjPaNVGL3dUOmUAh6B2+ZbjZqns7rTVsgCqA2HWJ310 X-Received: by 2002:a17:902:cf41:b0:192:82d4:f9b2 with SMTP id e1-20020a170902cf4100b0019282d4f9b2mr59775513plg.7.1673445202482; Wed, 11 Jan 2023 05:53:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673445202; cv=none; d=google.com; s=arc-20160816; b=RnWiyl915s2/paP1S+vcbG4gEJGRM0PanISQnFWpwp6ux2ZW4/Eg/YBzNDLgj9aU0p KuBT44bbI44GsOQ6bf+tCtN9NhJ4LLTgQKuvnufIl71ViFxBsIUTNB/Jt99X1Dej+W92 D0AzWx54FTy3jOVfpxwDiFDkEqsv6W2yflmfqLHX7XLUv4ISifxUOsy27I4nxnoieQMH EnNe0sTNvzgmHQGR+JiOVxkgjBdf/JJ43oDeKbGBG5/ucT+g1Swvd+YhzQfX3E2Aa1As aclmzNCj/6K9O213IjVqPQZUQsz2oUcmRZ0u2+N9mPRSP9LXJbUTEU7f5Fn9Om8CxO6e 6vCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uw9VR8hl+p2f8LH7UvLKr+WCyUcbVwEcj3kUkJCu53w=; b=B6ZP9wHGqp5q/6eOHRpgZnzvQ2xPWLL/bQn4bXjDk/hDvKz3WG7ljsJTycjs0N5SiT czFcbe0nNVQB4537TgbALGVYJQqil+dn3595pN5l0bCbYsqg7Ck1oWHIY4+yb0mmx/E2 6AwTcz4IPWXdif7e7WzuJaslAJ3pgcoFwsr46/BH4ZGm6FZh1/i17S6u3p8I3c/kGMsy DWmfk5Uae+8gLMN1Hh9pLzhOHliTVw4WgT4TTYEZ6cvclCbBTQ8yVfXrr25iv6GBfitH Js2lhzUsd3piyjuOJeJDqtXloHdobM1yckK4Fn6IPVT5agw/CiYvo84opRtY7BgedeFJ ojcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=DiijypHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a170902f71000b0019442e6b916si3892933plo.182.2023.01.11.05.53.15; Wed, 11 Jan 2023 05:53:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=DiijypHa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234854AbjAKNq2 (ORCPT + 53 others); Wed, 11 Jan 2023 08:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233600AbjAKNqV (ORCPT ); Wed, 11 Jan 2023 08:46:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40496265 for ; Wed, 11 Jan 2023 05:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673444755; x=1704980755; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YmvtEgsExmKnHFKrtsTC1qEk3keDAXMIHIB9CsFESV4=; b=DiijypHa7U81PoTg+Wr23aa0/TGNT2bfODEbzF0bDge4omZlrRrTOmVm ZH4JCUL0anpHrYJIQjUrax03exEDa5MnT0j4FlA+sdyOcP021DU4CvbCT Vy07/lztFIs1mcdHi4msnIdITR+aunpJI7fE9gn3y+mkr9L/sXoDVE+Wo PlxWOnKFjLj/MkyG+9XdR2E1A4AJdARitsj9jQah2lUVvr4ZjhvphwMGB ObMEj3IXuFKw5SB7aY9UI4a8PKxxK3rygpk4fIvmn7kNcfACE/G9OjOl7 idpLvc6c+mLSUuk9T5uoqCiKkI2FW2e/3h2Xgi09O0wRRsTF9QmSFK1hw A==; 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.39.0