All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Andrew Morton <akpm@osdl.org>, lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix for the IPMI SMB driver
Date: Tue, 22 Feb 2005 13:27:15 -0600	[thread overview]
Message-ID: <421B8793.7020704@acm.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: ipmi-smb-run-timer-when-in-run-to-completion-mode.diff --]
[-- Type: text/plain, Size: 2120 bytes --]

The IPMI SMB driver, when running in run-to-completion mode
(done during panic time), would sometimes get locked up if
a timeout occurred because the timer would not get run
properly.  This adds the timer handling to the run-to-completion
code.

Signed-off-by: Corey Minyard <minyard@acm.org>

Index: linux-2.6.11-rc4/drivers/char/ipmi/ipmi_smb.c
===================================================================
--- linux-2.6.11-rc4.orig/drivers/char/ipmi/ipmi_smb.c
+++ linux-2.6.11-rc4/drivers/char/ipmi/ipmi_smb.c
@@ -140,6 +140,10 @@
 	   sure stuff goes out. */
 	int                 run_to_completion;
 
+	/* Used to perform timer operations when run-to-completion
+	   mode is on.  This is a countdown timer. */
+	int                 rtc_us_timer;
+
 	/* Used for sending/receiving data.  +1 for the length. */
 	unsigned char data[IPMI_MAX_MSG_LENGTH + 1];
 	unsigned int  data_len;
@@ -322,6 +326,8 @@
         struct smb_info     *smb_info = (void *) data;
         struct i2c_op_q_entry *i2ce;
 
+	smb_info->rtc_us_timer = 0;
+
         i2ce = &smb_info->i2c_q_entry;
         i2ce->xfer_type = I2C_OP_SMBUS;
         i2ce->handler = msg_done_handler;
@@ -380,6 +386,7 @@
 			t->data = (unsigned long) smb_info;
 			t->function = retry_timeout;
 			add_timer(t);
+			smb_info->rtc_us_timer = 10000;
 			return;
 		}
 		if  (smb_info->smb_debug & SMB_DEBUG_MSG)
@@ -790,6 +797,13 @@
 		i2c_poll(&smb_info->client, 0);
 		while (! SMB_IDLE(smb_info)) {
 			udelay(500);
+			if (smb_info->rtc_us_timer > 0) {
+				smb_info->rtc_us_timer -= 500;
+				if (smb_info->rtc_us_timer <= 0) {
+					retry_timeout((unsigned long) smb_info);
+					del_timer(&smb_info->retry_timer);
+				}
+			}
 			i2c_poll(&smb_info->client, 500);
 		}
 		return;
@@ -856,6 +870,13 @@
 		i2c_poll(&smb_info->client, 0);
 		while (! SMB_IDLE(smb_info)) {
 			udelay(500);
+			if (smb_info->rtc_us_timer > 0) {
+				smb_info->rtc_us_timer -= 500;
+				if (smb_info->rtc_us_timer <= 0) {
+					retry_timeout((unsigned long) smb_info);
+					del_timer(&smb_info->retry_timer);
+				}
+			}
 			i2c_poll(&smb_info->client, 500);
 		}
 	}

                 reply	other threads:[~2005-02-22 19:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=421B8793.7020704@acm.org \
    --to=minyard@acm.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.