mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Potin Lai <potin.lai.pt@gmail.com>
To: Corey Minyard <corey@minyard.net>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Quan Nguyen <quan@os.amperecomputing.com>,
	 Patrick Williams <patrick@stwcx.xyz>
Cc: openipmi-developer@lists.sourceforge.net,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Cosmo Chou <cosmo.chou@quantatw.com>,
	 Potin Lai <potin.lai@quantatw.com>,
	Potin Lai <potin.lai.pt@gmail.com>
Subject: [PATCH 2/2] ipmi: ssif_bmc: Add support for adjustable response timeout
Date: Mon, 03 Feb 2025 21:09:14 +0800	[thread overview]
Message-ID: <20250203-ssif-response-timeout-ms-v1-2-6fe279740181@gmail.com> (raw)
In-Reply-To: <20250203-ssif-response-timeout-ms-v1-0-6fe279740181@gmail.com>

Implement support for the `timeout-ms` device tree property, allowing
platforms to adjust the userspace response timeout as needed.

If `timeout-ms` is not specified, the default response timeout remains
500 ms. This ensures compatibility while providing flexibility for
platforms that require longer timeouts due to BMC or application load.

Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
 drivers/char/ipmi/ssif_bmc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
index 310f17dd9511..8f0fbc941936 100644
--- a/drivers/char/ipmi/ssif_bmc.c
+++ b/drivers/char/ipmi/ssif_bmc.c
@@ -87,6 +87,7 @@ struct ssif_bmc_ctx {
 	/* Timeout waiting for response */
 	struct timer_list       response_timer;
 	bool                    response_timer_inited;
+	u32                     response_timeout;
 	/* Flag to identify a Multi-part Read Transaction */
 	bool                    is_singlepart_read;
 	u8                      nbytes_processed;
@@ -331,7 +332,8 @@ static void handle_request(struct ssif_bmc_ctx *ssif_bmc)
 		timer_setup(&ssif_bmc->response_timer, response_timeout, 0);
 		ssif_bmc->response_timer_inited = true;
 	}
-	mod_timer(&ssif_bmc->response_timer, jiffies + msecs_to_jiffies(RESPONSE_TIMEOUT));
+	mod_timer(&ssif_bmc->response_timer, jiffies +
+		  msecs_to_jiffies(ssif_bmc->response_timeout));
 }
 
 static void calculate_response_part_pec(struct ssif_part_buffer *part)
@@ -809,6 +811,10 @@ static int ssif_bmc_probe(struct i2c_client *client)
 	if (!ssif_bmc)
 		return -ENOMEM;
 
+	if (of_property_read_u32(client->dev.of_node, "timeout-ms",
+				 &ssif_bmc->response_timeout))
+		ssif_bmc->response_timeout = RESPONSE_TIMEOUT;
+
 	spin_lock_init(&ssif_bmc->lock);
 
 	init_waitqueue_head(&ssif_bmc->wait_queue);

-- 
2.31.1


      parent reply	other threads:[~2025-02-03 13:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 13:09 [PATCH 0/2] " Potin Lai
2025-02-03 13:09 ` [PATCH 1/2] bindings: ipmi: ssif-bmc: Add property to adjust " Potin Lai
2025-02-03 23:01   ` Rob Herring (Arm)
2025-02-03 13:09 ` Potin Lai [this message]

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=20250203-ssif-response-timeout-ms-v1-2-6fe279740181@gmail.com \
    --to=potin.lai.pt@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=corey@minyard.net \
    --cc=cosmo.chou@quantatw.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=patrick@stwcx.xyz \
    --cc=potin.lai@quantatw.com \
    --cc=quan@os.amperecomputing.com \
    --cc=robh@kernel.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

all inboxes | Powered by JetHome®