From bfd86272362032c2e6926a8a96a658002586c777 Mon Sep 17 00:00:00 2001
From: Jingdong Lu <jingdong.lu@windriver.com>
Date: Fri, 25 Nov 2011 15:44:50 +0800
Subject: [PATCH 59/60] Fix kernel panic caused by twl6040-irq related functions

Fix kernel panic caused by twl6040-irq
[    3.431091] [<c00b918c>] (irq_enable+0x24/0x30) from [<c00b91d8>] (irq_startup+0x40/0x48)
[    3.439697] [<c00b91d8>] (irq_startup+0x40/0x48) from [<c00b8118>] (__setup_irq+0x1f8/0x364)
[    3.448547] [<c00b8118>] (__setup_irq+0x1f8/0x364) from [<c00b8340>] (request_threaded_irq+0xbc/0x100)
[    3.458343] [<c00b8340>] (request_threaded_irq+0xbc/0x100) from [<c0410330>] (twl6040_probe+0x13c/0x2ac)
[    3.468322] [<c0410330>] (twl6040_probe+0x13c/0x2ac) from [<c0288108>] (platform_drv_probe+0x14/0x18)
[    3.477996] [<c0288108>] (platform_drv_probe+0x14/0x18) from [<c0286f70>] (driver_probe_device+0xec/0x1b4)
[    3.488159] [<c0286f70>] (driver_probe_device+0xec/0x1b4) from [<c02870a0>] (__driver_attach+0x68/0x8c)
[    3.498016] [<c02870a0>] (__driver_attach+0x68/0x8c) from [<c0286788>] (bus_for_each_dev+0x48/0x74)
[    3.507537] [<c0286788>] (bus_for_each_dev+0x48/0x74) from [<c02860c8>] (bus_add_driver+0xc0/0x244)
[    3.517028] [<c02860c8>] (bus_add_driver+0xc0/0x244) from [<c02876bc>] (driver_register+0xa8/0x134)
[    3.526550] [<c02876bc>] (driver_register+0xa8/0x134) from [<c003d57c>] (do_one_initcall+0x98/0x16c)
[    3.536163] [<c003d57c>] (do_one_initcall+0x98/0x16c) from [<c00083a4>] (kernel_init+0x84/0x160)
[    3.545410] [<c00083a4>] (kernel_init+0x84/0x160) from [<c0047eec>] (kernel_thread_exit+0x0/0x8)
[    3.554626] Code: bad PC value
[    3.557983] ---[ end trace f19ae640b77169fd ]---
[    3.562835] Kernel panic - not syncing: Attempted to kill init!

Signed-off-by: Jingdong Lu <jingdong.lu@windriver.com>
---
 drivers/mfd/twl6040-irq.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/twl6040-irq.c b/drivers/mfd/twl6040-irq.c
index 3b34417..6beac7a 100644
--- a/drivers/mfd/twl6040-irq.c
+++ b/drivers/mfd/twl6040-irq.c
@@ -57,16 +57,16 @@ static inline struct twl6040_irq_data *irq_to_twl6040_irq(struct twl6040 *twl604
 	return &twl6040_irqs[irq - twl6040->irq_base];
 }
 
-static void twl6040_irq_lock(unsigned int irq)
+static void twl6040_irq_lock(struct irq_data *data)
 {
-	struct twl6040 *twl6040 = irq_get_chip_data(irq);
+	struct twl6040 *twl6040 = irq_data_get_irq_chip_data(data);
 
 	mutex_lock(&twl6040->irq_mutex);
 }
 
-static void twl6040_irq_sync_unlock(unsigned int irq)
+static void twl6040_irq_sync_unlock(struct irq_data *data)
 {
-	struct twl6040 *twl6040 = irq_get_chip_data(irq);
+	struct twl6040 *twl6040 = irq_data_get_irq_chip_data(data);
 
 	/* write back to hardware any change in irq mask */
 	if (twl6040->irq_masks_cur != twl6040->irq_masks_cache) {
@@ -78,28 +78,28 @@ static void twl6040_irq_sync_unlock(unsigned int irq)
 	mutex_unlock(&twl6040->irq_mutex);
 }
 
-static void twl6040_irq_unmask(unsigned int irq)
+static void twl6040_irq_unmask(struct irq_data *data)
 {
-	struct twl6040 *twl6040 = irq_get_chip_data(irq);
-	struct twl6040_irq_data *irq_data = irq_to_twl6040_irq(twl6040, irq);
+	struct twl6040 *twl6040 = irq_data_get_irq_chip_data(data);
+	struct twl6040_irq_data *irq_data = irq_to_twl6040_irq(twl6040, data->irq);
 
 	twl6040->irq_masks_cur &= ~irq_data->mask;
 }
 
-static void twl6040_irq_mask(unsigned int irq)
+static void twl6040_irq_mask(struct irq_data *data)
 {
-	struct twl6040 *twl6040 = irq_get_chip_data(irq);
-	struct twl6040_irq_data *irq_data = irq_to_twl6040_irq(twl6040, irq);
+	struct twl6040 *twl6040 = irq_data_get_irq_chip_data(data);
+	struct twl6040_irq_data *irq_data = irq_to_twl6040_irq(twl6040, data->irq);
 
 	twl6040->irq_masks_cur |= irq_data->mask;
 }
 
 static struct irq_chip twl6040_irq_chip = {
 	.name = "twl6040",
-	.bus_lock = twl6040_irq_lock,
-	.bus_sync_unlock = twl6040_irq_sync_unlock,
-	.mask = twl6040_irq_mask,
-	.unmask = twl6040_irq_unmask,
+	.irq_bus_lock = twl6040_irq_lock,
+	.irq_bus_sync_unlock = twl6040_irq_sync_unlock,
+	.irq_mask = twl6040_irq_mask,
+	.irq_unmask = twl6040_irq_unmask,
 };
 
 static irqreturn_t twl6040_irq_thread(int irq, void *data)
@@ -168,7 +168,7 @@ int twl6040_irq_init(struct twl6040 *twl6040)
 	}
 
 	ret = request_threaded_irq(twl6040->irq, NULL, twl6040_irq_thread,
-				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+				   IRQF_ONESHOT,
 				   "twl6040", twl6040);
 	if (ret) {
 		dev_err(twl6040->dev, "failed to request IRQ %d: %d\n",
-- 
1.7.4.1

