spmi: pmic-arb: Remove custom show_resume_irq code

The generic irq layer supports showing the resume irq via
/sys/power/pm_wakeup_irq as of commit a6f5f0dd4e21 ("PM / sleep:
Report interrupt that caused system wakeup"). Remove the custom
code here that duplicates that code.

Change-Id: Ic955890cf5d80743429f908a2be7489b4d84b15e
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index bfd4b7a..7d9a2e8 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -24,7 +24,6 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spmi.h>
-#include <linux/syscore_ops.h>
 
 /* PMIC Arbiter configuration registers */
 #define PMIC_ARB_VERSION		0x0000
@@ -174,7 +173,6 @@
 	u16			last_apid;
 	struct apid_data	apid_data[PMIC_ARB_MAX_PERIPHS];
 };
-static struct spmi_pmic_arb *the_pa;
 
 /**
  * pmic_arb_ver: version dependent functionality.
@@ -535,7 +533,7 @@
 	writel_relaxed(irq_mask, pa->intr + pa->ver_ops->irq_clear(apid));
 }
 
-static void periph_interrupt(struct spmi_pmic_arb *pa, u16 apid, bool show)
+static void periph_interrupt(struct spmi_pmic_arb *pa, u16 apid)
 {
 	unsigned int irq;
 	u32 status;
@@ -552,26 +550,14 @@
 			cleanup_irq(pa, apid, id);
 			continue;
 		}
-		if (show) {
-			struct irq_desc *desc;
-			const char *name = "null";
-
-			desc = irq_to_desc(irq);
-			if (desc == NULL)
-				name = "stray irq";
-			else if (desc->action && desc->action->name)
-				name = desc->action->name;
-
-			pr_warn("spmi_show_resume_irq: %d triggered [0x%01x, 0x%02x, 0x%01x] %s\n",
-				irq, sid, per, id, name);
-		} else {
-			generic_handle_irq(irq);
-		}
+		generic_handle_irq(irq);
 	}
 }
 
-static void __pmic_arb_chained_irq(struct spmi_pmic_arb *pa, bool show)
+static void pmic_arb_chained_irq(struct irq_desc *desc)
 {
+	struct spmi_pmic_arb *pa = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
 	int first = pa->min_apid >> 5;
 	int last = pa->max_apid >> 5;
 	u32 status, enable;
@@ -580,6 +566,8 @@
 	bool acc_valid = false;
 	u32 irq_status = 0;
 
+	chained_irq_enter(chip, desc);
+
 	for (i = first; i <= last; ++i) {
 		status = readl_relaxed(pa->acc_status +
 				      pa->ver_ops->owner_acc_status(pa->ee, i));
@@ -598,7 +586,7 @@
 			enable = readl_relaxed(pa->intr +
 					pa->ver_ops->acc_enable(apid));
 			if (enable & SPMI_PIC_ACC_ENABLE_BIT)
-				periph_interrupt(pa, apid, show);
+				periph_interrupt(pa, apid);
 		}
 	}
 
@@ -618,20 +606,12 @@
 					dev_dbg(&pa->spmic->dev,
 						"Dispatching IRQ for apid=%d status=%x\n",
 						i, irq_status);
-					periph_interrupt(pa, i, show);
+					periph_interrupt(pa, i);
 				}
 			}
 		}
 	}
-}
 
-static void pmic_arb_chained_irq(struct irq_desc *desc)
-{
-	struct spmi_pmic_arb *pa = irq_desc_get_handler_data(desc);
-	struct irq_chip *chip = irq_desc_get_chip(desc);
-
-	chained_irq_enter(chip, desc);
-	__pmic_arb_chained_irq(pa, false);
 	chained_irq_exit(chip, desc);
 }
 
@@ -1221,16 +1201,6 @@
 	.activate	= qpnpint_irq_domain_activate,
 };
 
-static void spmi_pmic_arb_resume(void)
-{
-	if (spmi_show_resume_irq())
-		__pmic_arb_chained_irq(the_pa, true);
-}
-
-static struct syscore_ops spmi_pmic_arb_syscore_ops = {
-	.resume = spmi_pmic_arb_resume,
-};
-
 static int spmi_pmic_arb_probe(struct platform_device *pdev)
 {
 	struct spmi_pmic_arb *pa;
@@ -1417,8 +1387,6 @@
 	if (err)
 		goto err_domain_remove;
 
-	the_pa = pa;
-	register_syscore_ops(&spmi_pmic_arb_syscore_ops);
 	return 0;
 
 err_domain_remove:
@@ -1436,8 +1404,6 @@
 
 	spmi_controller_remove(ctrl);
 	irq_set_chained_handler_and_data(pa->irq, NULL, NULL);
-	unregister_syscore_ops(&spmi_pmic_arb_syscore_ops);
-	the_pa = NULL;
 	irq_domain_remove(pa->domain);
 	spmi_controller_put(ctrl);
 	return 0;
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
index 319c52a2..7725dd7 100644
--- a/include/linux/spmi.h
+++ b/include/linux/spmi.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -171,19 +171,6 @@
 	module_driver(__spmi_driver, spmi_driver_register, \
 			spmi_driver_unregister)
 
-#ifdef CONFIG_QCOM_SHOW_RESUME_IRQ
-extern int msm_show_resume_irq_mask;
-static inline bool spmi_show_resume_irq(void)
-{
-	return msm_show_resume_irq_mask;
-}
-#else
-static inline bool spmi_show_resume_irq(void)
-{
-	return false;
-}
-#endif
-
 int spmi_register_read(struct spmi_device *sdev, u8 addr, u8 *buf);
 int spmi_ext_register_read(struct spmi_device *sdev, u8 addr, u8 *buf,
 			   size_t len);