Commit 64eebaa4 authored by Aristeu Sergio Rozanski Filho's avatar Aristeu Sergio Rozanski Filho Committed by Greg Kroah-Hartman

[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: default avatarAristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 78d413e8
...@@ -62,6 +62,7 @@ static int own; ...@@ -62,6 +62,7 @@ static int own;
static struct iic_ite gpi; static struct iic_ite gpi;
static wait_queue_head_t iic_wait; static wait_queue_head_t iic_wait;
static int iic_pending; static int iic_pending;
static spinlock_t lock;
/* ----- local functions ---------------------------------------------- */ /* ----- local functions ---------------------------------------------- */
...@@ -108,6 +109,7 @@ static int iic_ite_getclock(void *data) ...@@ -108,6 +109,7 @@ static int iic_ite_getclock(void *data)
static void iic_ite_waitforpin(void) { static void iic_ite_waitforpin(void) {
int timeout = 2; int timeout = 2;
long flags;
/* If interrupts are enabled (which they are), then put the process to /* If interrupts are enabled (which they are), then put the process to
* sleep. This process will be awakened by two events -- either the * sleep. This process will be awakened by two events -- either the
...@@ -116,24 +118,36 @@ static void iic_ite_waitforpin(void) { ...@@ -116,24 +118,36 @@ static void iic_ite_waitforpin(void) {
* of time and return. * of time and return.
*/ */
if (gpi.iic_irq > 0) { if (gpi.iic_irq > 0) {
cli(); spin_lock_irqsave(&lock, flags);
if (iic_pending == 0) { if (iic_pending == 0) {
interruptible_sleep_on_timeout(&iic_wait, timeout*HZ ); spin_unlock_irqrestore(&lock, flags);
} else 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; iic_pending = 0;
sti(); spin_unlock_irqrestore(&lock, flags);
}
} else { } else {
udelay(100); 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)
{ {
spin_lock(&lock);
iic_pending = 1; iic_pending = 1;
spin_unlock(&lock);
wake_up_interruptible(&iic_wait);
wake_up_interruptible(&iic_wait); return IRQ_HANDLED;
} }
...@@ -221,6 +235,7 @@ static int __init iic_ite_init(void) ...@@ -221,6 +235,7 @@ static int __init iic_ite_init(void)
iic_ite_data.data = (void *)piic; iic_ite_data.data = (void *)piic;
init_waitqueue_head(&iic_wait); init_waitqueue_head(&iic_wait);
spin_lock_init(&lock);
if (iic_hw_resrc_init() == 0) { if (iic_hw_resrc_init() == 0) {
if (i2c_iic_add_bus(&iic_ite_ops) < 0) if (i2c_iic_add_bus(&iic_ite_ops) < 0)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment