MLK-16765-3 rtc: rtc-imx-sc: check group interrupt type
authorRobin Gong <yibin.gong@nxp.com>
Tue, 7 Nov 2017 09:18:44 +0000 (17:18 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:46:59 +0000 (15:46 -0500)
Check group interrupt type and irq status type supported, return directlly
if it's not the right group and interrupt status.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
drivers/rtc/rtc-imx-sc.c

index 4fd2619..9f09409 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/rtc.h>
 #include <soc/imx/fsl_sip.h>
 #include <soc/imx8/sc/sci.h>
+#include <soc/imx8/sc/svc/irq/api.h>
 
 sc_ipc_t timer_ipcHandle;
 
@@ -31,10 +32,16 @@ struct imx_sc_rtc_data {
 
 struct imx_sc_rtc_data *data;
 
-static int imx_sc_rtc_alarm_sc_notify(struct notifier_block *nb, unsigned long event, void *dummy)
+static int imx_sc_rtc_alarm_sc_notify(struct notifier_block *nb,
+                                       unsigned long event, void *group)
 {
        u32 events = 0;
 
+       /* ignore non-rtc irq */
+       if (!((event & SC_IRQ_RTC) &&
+               (*(sc_irq_group_t *)group == SC_IRQ_GROUP_RTC)))
+               return 0;
+
        rtc_update_irq(data->rtc, 1, events);
 
        return 0;