[PATCH 7/8] powernv/opal-dump: Convert to irq domain

Alistair Popple alistair at popple.id.au
Thu Apr 2 14:22:31 AEDT 2015


Convert the opal dump driver to the new opal irq domain.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 arch/powerpc/platforms/powernv/opal-dump.c | 33 +++++++++++++++---------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 23260f7..812f168 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -15,6 +15,7 @@
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
 #include <linux/delay.h>
+#include <linux/interrupt.h>
 
 #include <asm/opal.h>
 
@@ -60,7 +61,7 @@ static ssize_t dump_type_show(struct dump_obj *dump_obj,
 			      struct dump_attribute *attr,
 			      char *buf)
 {
-	
+
 	return sprintf(buf, "0x%x %s\n", dump_obj->type,
 		       dump_type_to_string(dump_obj->type));
 }
@@ -408,24 +409,16 @@ static void schedule_process_dump(void)
  * Once we get notification, we add sysfs entries for it.
  * We only fetch the dump on demand, and create sysfs asynchronously.
  */
-static int dump_event(struct notifier_block *nb,
-		      unsigned long events, void *change)
+static irqreturn_t dump_event(int irq, void *data)
 {
-	if (events & OPAL_EVENT_DUMP_AVAIL)
-		schedule_process_dump();
+	schedule_process_dump();
 
-	return 0;
+	return IRQ_HANDLED;
 }
 
-static struct notifier_block dump_nb = {
-	.notifier_call  = dump_event,
-	.next           = NULL,
-	.priority       = 0
-};
-
 void __init opal_platform_dump_init(void)
 {
-	int rc;
+	int rc, irq;
 
 	/* ELOG not supported by firmware */
 	if (!opal_check_token(OPAL_DUMP_READ))
@@ -445,10 +438,18 @@ void __init opal_platform_dump_init(void)
 		return;
 	}
 
-	rc = opal_notifier_register(&dump_nb);
+	irq = opal_event_request(ilog2(OPAL_EVENT_DUMP_AVAIL));
+	if (!irq) {
+		pr_err("%s: Can't register OPAL event irq (%d)\n",
+		       __func__, irq);
+		return;
+	}
+
+	rc = request_irq(irq, dump_event,
+			IRQ_TYPE_LEVEL_HIGH, "opal-dump", NULL);
 	if (rc) {
-		pr_warn("%s: Can't register OPAL event notifier (%d)\n",
-			__func__, rc);
+		pr_err("%s: Can't request OPAL event irq (%d)\n",
+		       __func__, rc);
 		return;
 	}
 
-- 
1.8.3.2



More information about the Linuxppc-dev mailing list