From: greg@kroah.com (Greg KH)
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: [PATCH] I2C fixes for 2.6.10-rc2
Date: Thu, 19 May 2005 06:25:25 +0000 [thread overview]
Message-ID: <11018600193653@kroah.com> (raw)
In-Reply-To: <1101860019530@kroah.com>
In-Reply-To: <20041119220001.GB15956@kroah.com>
ChangeSet 1.2223.2.9, 2004/11/29 15:07:15-08:00, aris@cathedrallabs.org
[PATCH] i2c-ite: get rid of cli()/sti()
I found only this one. Next time I'll try to make better grep
expressions :^)
[I2C] i2c-ite: get rid of cli()/sti()
Signed-off-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/busses/i2c-ite.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff -Nru a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c
--- a/drivers/i2c/busses/i2c-ite.c 2004-11-30 16:00:43 -08:00
+++ b/drivers/i2c/busses/i2c-ite.c 2004-11-30 16:00:43 -08:00
@@ -62,6 +62,7 @@
static struct iic_ite gpi;
static wait_queue_head_t iic_wait;
static int iic_pending;
+static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */
@@ -108,6 +109,7 @@
static void iic_ite_waitforpin(void) {
int timeout = 2;
+ long flags;
/* If interrupts are enabled (which they are), then put the process to
* sleep. This process will be awakened by two events -- either the
@@ -116,24 +118,36 @@
* of time and return.
*/
if (gpi.iic_irq > 0) {
- cli();
+ spin_lock_irqsave(&lock, flags);
if (iic_pending = 0) {
- interruptible_sleep_on_timeout(&iic_wait, timeout*HZ );
- } else
+ spin_unlock_irqrestore(&lock, flags);
+ if (interruptible_sleep_on_timeout(&iic_wait, timeout*HZ)) {
+ spin_lock_irqsave(&lock, flags);
+ if (iic_pending = 1) {
+ iic_pending = 0;
+ }
+ spin_unlock_irqrestore(&lock, flags);
+ }
+ } else {
iic_pending = 0;
- sti();
+ spin_unlock_irqrestore(&lock, flags);
+ }
} else {
udelay(100);
}
}
-static void iic_ite_handler(int this_irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t iic_ite_handler(int this_irq, void *dev_id,
+ struct pt_regs *regs)
{
-
- iic_pending = 1;
+ spin_lock(&lock);
+ iic_pending = 1;
+ spin_unlock(&lock);
+
+ wake_up_interruptible(&iic_wait);
- wake_up_interruptible(&iic_wait);
+ return IRQ_HANDLED;
}
@@ -221,6 +235,7 @@
iic_ite_data.data = (void *)piic;
init_waitqueue_head(&iic_wait);
+ spin_lock_init(&lock);
if (iic_hw_resrc_init() = 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV;
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org, sensors@stimpy.netroedge.com
Subject: Re: [PATCH] I2C fixes for 2.6.10-rc2
Date: Tue, 30 Nov 2004 16:13:39 -0800 [thread overview]
Message-ID: <11018600193653@kroah.com> (raw)
In-Reply-To: <1101860019530@kroah.com>
ChangeSet 1.2223.2.9, 2004/11/29 15:07:15-08:00, aris@cathedrallabs.org
[PATCH] i2c-ite: get rid of cli()/sti()
I found only this one. Next time I'll try to make better grep
expressions :^)
[I2C] i2c-ite: get rid of cli()/sti()
Signed-off-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/i2c/busses/i2c-ite.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff -Nru a/drivers/i2c/busses/i2c-ite.c b/drivers/i2c/busses/i2c-ite.c
--- a/drivers/i2c/busses/i2c-ite.c 2004-11-30 16:00:43 -08:00
+++ b/drivers/i2c/busses/i2c-ite.c 2004-11-30 16:00:43 -08:00
@@ -62,6 +62,7 @@
static struct iic_ite gpi;
static wait_queue_head_t iic_wait;
static int iic_pending;
+static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */
@@ -108,6 +109,7 @@
static void iic_ite_waitforpin(void) {
int timeout = 2;
+ long flags;
/* If interrupts are enabled (which they are), then put the process to
* sleep. This process will be awakened by two events -- either the
@@ -116,24 +118,36 @@
* of time and return.
*/
if (gpi.iic_irq > 0) {
- cli();
+ spin_lock_irqsave(&lock, flags);
if (iic_pending == 0) {
- interruptible_sleep_on_timeout(&iic_wait, timeout*HZ );
- } else
+ spin_unlock_irqrestore(&lock, flags);
+ if (interruptible_sleep_on_timeout(&iic_wait, timeout*HZ)) {
+ spin_lock_irqsave(&lock, flags);
+ if (iic_pending == 1) {
+ iic_pending = 0;
+ }
+ spin_unlock_irqrestore(&lock, flags);
+ }
+ } else {
iic_pending = 0;
- sti();
+ spin_unlock_irqrestore(&lock, flags);
+ }
} else {
udelay(100);
}
}
-static void iic_ite_handler(int this_irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t iic_ite_handler(int this_irq, void *dev_id,
+ struct pt_regs *regs)
{
-
- iic_pending = 1;
+ spin_lock(&lock);
+ iic_pending = 1;
+ spin_unlock(&lock);
+
+ wake_up_interruptible(&iic_wait);
- wake_up_interruptible(&iic_wait);
+ return IRQ_HANDLED;
}
@@ -221,6 +235,7 @@
iic_ite_data.data = (void *)piic;
init_waitqueue_head(&iic_wait);
+ spin_lock_init(&lock);
if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV;
next prev parent reply other threads:[~2005-05-19 6:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-01 0:12 [BK PATCH] I2C fixes for 2.6.10-rc2 Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` [PATCH] " Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH [this message]
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-12-01 0:13 ` Greg KH
2005-05-19 6:25 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-19 21:59 [BK PATCH] " Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-19 22:00 ` [PATCH] " Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-19 22:00 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-19 22:00 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-19 22:00 ` Greg KH
2005-05-19 6:25 ` Greg KH
2004-11-19 22:01 ` Greg KH
2005-05-19 6:25 ` Greg KH
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=11018600193653@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sensors@stimpy.netroedge.com \
/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.