[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1386042188-12246-6-git-send-email-balbi@ti.com>
Date: Mon, 2 Dec 2013 21:42:59 -0600
From: Felipe Balbi <balbi@...com>
To: Linux OMAP Mailing List <linux-omap@...r.kernel.org>
CC: Aaro Koskinen <aaro.koskinen@....fi>, <sameo@...ux.intel.com>,
Tony Lindgren <tony@...mide.com>, <lee.jones@...aro.org>,
Linux ARM Kernel Mailing List
<linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Felipe Balbi <balbi@...com>
Subject: [PATCH v2 06/15] mfd: menelaus: Pass menelaus pointer as argument to enable/disable irq
we want to, eventually, get rid of the global
the_menelaus pointer, so let's start passing
menelaus as argument to some function calls
and slowly phase out the_menelaus global pointer.
Signed-off-by: Felipe Balbi <balbi@...com>
---
drivers/mfd/menelaus.c | 48 ++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/drivers/mfd/menelaus.c b/drivers/mfd/menelaus.c
index 9ccbb79..4c51e4b 100644
--- a/drivers/mfd/menelaus.c
+++ b/drivers/mfd/menelaus.c
@@ -199,35 +199,35 @@ static int menelaus_read_reg(int reg)
return val;
}
-static int menelaus_enable_irq(int irq)
+static int menelaus_enable_irq(struct menelaus_chip *m, int irq)
{
if (irq > 7) {
irq -= 8;
- the_menelaus->mask2 &= ~(1 << irq);
+ m->mask2 &= ~(1 << irq);
return menelaus_write_reg(MENELAUS_INT_MASK2,
- the_menelaus->mask2);
+ m->mask2);
} else {
- the_menelaus->mask1 &= ~(1 << irq);
+ m->mask1 &= ~(1 << irq);
return menelaus_write_reg(MENELAUS_INT_MASK1,
- the_menelaus->mask1);
+ m->mask1);
}
}
-static int menelaus_disable_irq(int irq)
+static int menelaus_disable_irq(struct menelaus_chip *m, int irq)
{
if (irq > 7) {
irq -= 8;
- the_menelaus->mask2 |= (1 << irq);
+ m->mask2 |= (1 << irq);
return menelaus_write_reg(MENELAUS_INT_MASK2,
- the_menelaus->mask2);
+ m->mask2);
} else {
- the_menelaus->mask1 |= (1 << irq);
+ m->mask1 |= (1 << irq);
return menelaus_write_reg(MENELAUS_INT_MASK1,
- the_menelaus->mask1);
+ m->mask1);
}
}
-static int menelaus_ack_irq(int irq)
+static int menelaus_ack_irq(struct menelaus_chip *m, int irq)
{
if (irq > 7)
return menelaus_write_reg(MENELAUS_INT_ACK2, 1 << (irq - 8));
@@ -243,7 +243,7 @@ static int menelaus_add_irq_work(int irq,
mutex_lock(&the_menelaus->lock);
the_menelaus->handlers[irq] = handler;
- ret = menelaus_enable_irq(irq);
+ ret = menelaus_enable_irq(the_menelaus, irq);
mutex_unlock(&the_menelaus->lock);
return ret;
@@ -255,7 +255,7 @@ static int menelaus_remove_irq_work(int irq)
int ret = 0;
mutex_lock(&the_menelaus->lock);
- ret = menelaus_disable_irq(irq);
+ ret = menelaus_disable_irq(the_menelaus, irq);
the_menelaus->handlers[irq] = NULL;
mutex_unlock(&the_menelaus->lock);
@@ -793,25 +793,25 @@ out:
static irqreturn_t menelaus_irq(int irq, void *_menelaus)
{
- struct menelaus_chip *menelaus = _menelaus;
- void (*handler)(struct menelaus_chip *menelaus);
+ struct menelaus_chip *m = _menelaus;
+ void (*handler)(struct menelaus_chip *m);
unsigned long isr;
unsigned long i;
isr = (menelaus_read_reg(MENELAUS_INT_STATUS2)
- & ~menelaus->mask2) << 8;
+ & ~m->mask2) << 8;
isr |= menelaus_read_reg(MENELAUS_INT_STATUS1)
- & ~menelaus->mask1;
+ & ~m->mask1;
for_each_set_bit(i, &isr, 16) {
- mutex_lock(&menelaus->lock);
- menelaus_disable_irq(i);
- menelaus_ack_irq(i);
- handler = menelaus->handlers[i];
+ mutex_lock(&m->lock);
+ menelaus_disable_irq(m, i);
+ menelaus_ack_irq(m, i);
+ handler = m->handlers[i];
if (handler)
- handler(menelaus);
- menelaus_enable_irq(i);
- mutex_unlock(&menelaus->lock);
+ handler(m);
+ menelaus_enable_irq(m, i);
+ mutex_unlock(&m->lock);
}
return IRQ_HANDLED;
--
1.8.4.GIT
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists