Skip to contentSkip to conversation

PM / wakeup : remove misuse of IRQF_NO_SUSPEND flag

PATCH Applied Sudeep Holla 17 participants 72 messages Sep 21, 2015 – Oct 26, 2015

Subsystems (28)
lore
Share & tools
lore
#0 lore raw

cover PM / wakeup : remove misuse of IRQF_NO_SUSPEND flag

Hi,

As discussed in under the topic "Wakeup sources configuration and management" in LPC PM microconference @ Seattle[1], this is the first set of changes to remove the mis/ab-use of IRQF_NO_SUSPEND for wakeup IRQ configuration. This list is not complete, there are few more usages that can be removed.

Regards,
Sudeep

[1] http://www.linuxplumbersconf.org/2015/ocw//system/presentations/3051/original/wakeup_config.pdf

Sudeep Holla (17):
rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag
rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag
input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag
powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant
mpic_irq_set_wake
platform: x86: remove misuse of IRQF_NO_SUSPEND flag
rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag
input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag
hwmon: abx500: drop the use of IRQF_NO_SUSPEND
MIPS: ttyFDC: replace IRQF_NO_SUSPEND with IRQF_COND_SUSPEND tty/serial: st-asc: drop the use of IRQF_NO_SUSPEND
pm: bf609: remove misuse of IRQF_NO_SUSPEND flag
ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag
net: gianfar: remove misuse of IRQF_NO_SUSPEND flag
media: st-rc: remove misuse of IRQF_NO_SUSPEND flag
ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
pinctrl: single: remove misuse of IRQF_NO_SUSPEND flag mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

 arch/arm/mach-omap2/mux.c                 |  4 ++--
 arch/arm/mach-omap2/pm34xx.c              |  9 ++++-----
 arch/blackfin/mach-bf609/pm.c             | 13 +++++++------
 arch/powerpc/sysdev/mpic.c                | 23 ++++-------------------
 drivers/hwmon/abx500.c                    |  2 +-
 drivers/input/keyboard/tegra-kbc.c        |  2 +-
 drivers/media/rc/ir-hix5hd2.c             |  2 +-
 drivers/media/rc/st_rc.c                  | 14 +++++++++-----
 drivers/mfd/ab8500-core.c                 | 11 +++++++++--
 drivers/mfd/ab8500-debugfs.c              |  2 +-
 drivers/mfd/ab8500-gpadc.c                | 15 +++++++++++----
 drivers/mfd/db8500-prcmu.c                | 24 +++++++++++++++++-------
 drivers/mfd/qcom_rpm.c                    |  2 +-
 drivers/net/ethernet/freescale/gianfar.c  |  9 +++++----
 drivers/pinctrl/pinctrl-single.c          |  7 ++++---
 drivers/platform/x86/intel_mid_powerbtn.c | 10 ++++++++--
 drivers/power/ab8500_btemp.c              |  6 ++++--
 drivers/power/ab8500_charger.c            |  6 ++++--
 drivers/power/ab8500_fg.c                 |  9 ++++++---
 drivers/rtc/rtc-ab8500.c                  |  6 +++++-
 drivers/rtc/rtc-ds1343.c                  |  9 ++++++---
 drivers/rtc/rtc-pl031.c                   | 13 ++++++++-----
 drivers/thermal/db8500_thermal.c          |  5 ++---
 drivers/tty/mips_ejtag_fdc.c              |  4 ++--
 drivers/tty/serial/st-asc.c               |  2 +-
 drivers/tty/serial/stm32-usart.c          |  3 +--
 drivers/usb/phy/phy-ab8500-usb.c          | 10 ++++++----
 27 files changed, 130 insertions(+), 92 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/17 rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-pl031.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/rtc/rtc-pl031.c +8 -5
index 41dcb7ddb906..e1687e19c59f 100644
@@ -23,6 +23,7 @@
 #include <linux/io.h>
 #include <linux/bcd.h>
 #include <linux/delay.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/slab.h>
 
 /*
@@ -305,6 +306,8 @@ static int pl031_remove(struct amba_device *adev)
 {
 	struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
 
+	dev_pm_clear_wake_irq(&adev->dev);
+	device_init_wakeup(&adev->dev, false);
 	free_irq(adev->irq[0], ldata);
 	rtc_device_unregister(ldata->rtc);
 	iounmap(ldata->base);
@@ -370,7 +373,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
 		}
 	}
 
-	device_init_wakeup(&adev->dev, 1);
+	device_init_wakeup(&adev->dev, true);
 	ldata->rtc = rtc_device_register("pl031", &adev->dev, ops,
 					THIS_MODULE);
 	if (IS_ERR(ldata->rtc)) {
@@ -383,7 +386,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
 		ret = -EIO;
 		goto out_no_irq;
 	}
-
+	dev_pm_set_wake_irq(&adev->dev, adev->irq[0]);
 	return 0;
 
 out_no_irq:
@@ -408,7 +411,6 @@ static struct pl031_vendor_data arm_pl031 = {
 		.set_alarm = pl031_set_alarm,
 		.alarm_irq_enable = pl031_alarm_irq_enable,
 	},
-	.irqflags = IRQF_NO_SUSPEND,
 };
 
 /* The First ST derivative */
@@ -422,7 +424,6 @@ static struct pl031_vendor_data stv1_pl031 = {
 	},
 	.clockwatch = true,
 	.st_weekday = true,
-	.irqflags = IRQF_NO_SUSPEND,
 };
 
 /* And the second ST derivative */
@@ -439,8 +440,10 @@ static struct pl031_vendor_data stv2_pl031 = {
 	/*
 	 * This variant shares the IRQ with another block and must not
 	 * suspend that IRQ line.
+	 * TODO check if it shares with IRQF_NO_SUSPEND user, else we can
+	 * remove IRQF_COND_SUSPEND
 	 */
-	.irqflags = IRQF_SHARED | IRQF_NO_SUSPEND,
+	.irqflags = IRQF_SHARED | IRQF_COND_SUSPEND,
 };
 
 static struct amba_id pl031_ids[] = {
Signature · 1 line
1.9.1
Acked-by on v1 1/17
#2 lore raw

Re: [PATCH 01/17] rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 8 lines

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>

Looks correct to me.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH 01/17] rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

Quoted 11 lines · Linus Walleij
Quoted 9 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Quoted 9 lines
Quoted 5 lines
Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>

Looks correct to me.

Thanks, while you are at it, do you know what interrupt stv2_pl031 shares so that I can fix the TODO in the comment or the code(whichever applicable).

Regards,
Sudeep

#4 lore raw

Re: [PATCH 01/17] rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

Quoted 20 lines · Sudeep Holla
Quoted 17 lines · Linus Walleij
Quoted 14 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
Quoted 8 lines
Quoted 3 lines

Looks correct to me.

Thanks, while you are at it, do you know what interrupt stv2_pl031 shares so that I can fix the TODO in the comment or the code(whichever applicable).

So that you know, I'm planning to apply them this weekend, I couldn't find time to do it before.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

Re: [PATCH 01/17] rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla
Quoted 6 lines · Sudeep Holla
Quoted 2 lines

Looks correct to me.

Thanks, while you are at it, do you know what interrupt stv2_pl031 shares so that I can fix the TODO in the comment or the code(whichever applicable).

This is shared with a hardware called RTT (real-time timer) that has no upstream driver as of now.

Yours,
Linus Walleij

Signature · 9 lines
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
#6 lore raw

Re: [PATCH 01/17] rtc: pl031: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla
Quoted 9 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Quoted 9 lines
Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-pl031.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Applied, thanks.

Signature · 14 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
#7 lore raw

PATCH 2/17 rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-ab8500.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/rtc/rtc-ab8500.c +5 -1
index 51407c4c7bd2..24a0af650a1b 100644
@@ -18,6 +18,7 @@
 #include <linux/mfd/abx500/ab8500.h>
 #include <linux/delay.h>
 #include <linux/of.h>
+#include <linux/pm_wakeirq.h>
 
 #define AB8500_RTC_SOFF_STAT_REG	0x00
 #define AB8500_RTC_CC_CONF_REG		0x01
@@ -493,11 +494,12 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
 	}
 
 	err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
-			rtc_alarm_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
+			rtc_alarm_handler, IRQF_ONESHOT,
 			"ab8500-rtc", rtc);
 	if (err < 0)
 		return err;
 
+	dev_pm_set_wake_irq(&pdev->dev, irq);
 	platform_set_drvdata(pdev, rtc);
 
 	err = ab8500_sysfs_rtc_register(&pdev->dev);
@@ -513,6 +515,8 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
 
 static int ab8500_rtc_remove(struct platform_device *pdev)
 {
+	dev_pm_clear_wake_irq(&pdev->dev);
+	device_init_wakeup(&pdev->dev, false);
 	ab8500_sysfs_rtc_unregister(&pdev->dev);
 
 	return 0;
Signature · 1 line
1.9.1
Acked-by on v1 2/17
#8 lore raw

Re: [PATCH 02/17] rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag

Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 8 lines

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>

Yours,
Linus Walleij

Signature · 9 lines
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
#9 lore raw

Re: [PATCH 02/17] rtc: ab8500: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla
Quoted 9 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Quoted 9 lines
Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-ab8500.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw

PATCH 3/17 input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The driver handles wakeup irq correctly using device_init_wakeup and enable_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

---
 drivers/input/keyboard/tegra-kbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/tegra-kbc.c +1 -1
index f97c73bd14f8..5f5dbbd51991 100644
@@ -705,7 +705,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 	input_set_drvdata(kbc->idev, kbc);
 
 	err = devm_request_irq(&pdev->dev, kbc->irq, tegra_kbc_isr,
-			  IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
+			       IRQF_TRIGGER_HIGH, pdev->name, kbc);
 	if (err) {
 		dev_err(&pdev->dev, "failed to request keyboard IRQ\n");
 		return err;
Signature · 1 line
1.9.1
Acked-by on v1 3/17
#11 lore raw

Re: [PATCH 03/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Quoted 12 lines · Sudeep Holla

The driver handles wakeup irq correctly using device_init_wakeup and enable_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Quoted 3 lines
---
 drivers/input/keyboard/tegra-kbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
maintainer Acked-by on v1 3/17
#12 lore raw

Re: [PATCH 03/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

drivers/input/keyboard/tegra-kbc.c static int tegra_kbc_probe(struct platform_device *pdev) · line 709

Quoted 12 lines · Sudeep Holla
drivers/input/keyboard/tegra-kbc.c +1 -1
index f97c73bd14f8..5f5dbbd51991 100644
@@ -705,7 +705,7 @@ static int tegra_kbc_probe(struct platform_device *pdev)
  	input_set_drvdata(kbc->idev, kbc);
 
  	err = devm_request_irq(&pdev->dev, kbc->irq, tegra_kbc_isr,
-			  IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
+			       IRQF_TRIGGER_HIGH, pdev->name, kbc);
 
#13 lore raw

Re: [PATCH 03/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Hi Dmitry,

Quoted 18 lines · Laxman Dewangan

drivers/input/keyboard/tegra-kbc.c static int tegra_kbc_probe(struct platform_device · line 709

Quoted 13 lines · Sudeep Holla
drivers/input/keyboard/tegra-kbc.c +1 -1
index f97c73bd14f8..5f5dbbd51991 100644
@@ -705,7 +705,7 @@ static int tegra_kbc_probe(struct platform_device
 *pdev)
      input_set_drvdata(kbc->idev, kbc);
      err = devm_request_irq(&pdev->dev, kbc->irq, tegra_kbc_isr,
-              IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
+                   IRQF_TRIGGER_HIGH, pdev->name, kbc);
 

Can you pick this up with all the Acks ?

Signature · 2 lines
Regards,
Sudeep
maintainer Applied
#14 lore raw

Re: [PATCH 03/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Quoted 22 lines · Sudeep Holla

Hi Dmitry,

Quoted 18 lines · Laxman Dewangan

drivers/input/keyboard/tegra-kbc.c static int tegra_kbc_probe(struct platform_device · line 709

Quoted 13 lines · Sudeep Holla
drivers/input/keyboard/tegra-kbc.c +1 -1
index f97c73bd14f8..5f5dbbd51991 100644
@@ -705,7 +705,7 @@ static int tegra_kbc_probe(struct platform_device
 *pdev)
     input_set_drvdata(kbc->idev, kbc);
     err = devm_request_irq(&pdev->dev, kbc->irq, tegra_kbc_isr,
-              IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
+                   IRQF_TRIGGER_HIGH, pdev->name, kbc);
 
Quoted 1 line

Can you pick this up with all the Acks ?

Applied, thank you.

Signature · 1 line
Dmitry
#15 lore raw

PATCH 4/17 powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

In reply to Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

This patch removes the redundant mpic_irq_set_wake and sets the IRQCHIP_SKIP_SET_WAKE for only FSL MPIC.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Scott Wood <[email protected]>
Cc Hongtao Jia <[email protected]>
Cc Marc Zyngier <[email protected]>
---
 arch/powerpc/sysdev/mpic.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)
arch/powerpc/sysdev/mpic.c +4 -19
index 537e5db85a06..123e43612f0a 100644
@@ -924,22 +924,6 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
 	return IRQ_SET_MASK_OK_NOCOPY;
 }
 
-static int mpic_irq_set_wake(struct irq_data *d, unsigned int on)
-{
-	struct irq_desc *desc = container_of(d, struct irq_desc, irq_data);
-	struct mpic *mpic = mpic_from_irq_data(d);
-
-	if (!(mpic->flags & MPIC_FSL))
-		return -ENXIO;
-
-	if (on)
-		desc->action->flags |= IRQF_NO_SUSPEND;
-	else
-		desc->action->flags &= ~IRQF_NO_SUSPEND;
-
-	return 0;
-}
-
 void mpic_set_vector(unsigned int virq, unsigned int vector)
 {
 	struct mpic *mpic = mpic_from_irq(virq);
@@ -977,7 +961,6 @@ static struct irq_chip mpic_irq_chip = {
 	.irq_unmask	= mpic_unmask_irq,
 	.irq_eoi	= mpic_end_irq,
 	.irq_set_type	= mpic_set_irq_type,
-	.irq_set_wake	= mpic_irq_set_wake,
 };
 
 #ifdef CONFIG_SMP
@@ -992,7 +975,6 @@ static struct irq_chip mpic_tm_chip = {
 	.irq_mask	= mpic_mask_tm,
 	.irq_unmask	= mpic_unmask_tm,
 	.irq_eoi	= mpic_end_irq,
-	.irq_set_wake	= mpic_irq_set_wake,
 };
 
 #ifdef CONFIG_MPIC_U3_HT_IRQS
@@ -1283,8 +1265,11 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 		flags |= MPIC_NO_RESET;
 	if (of_get_property(node, "single-cpu-affinity", NULL))
 		flags |= MPIC_SINGLE_DEST_CPU;
-	if (of_device_is_compatible(node, "fsl,mpic"))
+	if (of_device_is_compatible(node, "fsl,mpic")) {
 		flags |= MPIC_FSL | MPIC_LARGE_VECTORS;
+		mpic_irq_chip.flags |= IRQCHIP_SKIP_SET_WAKE;
+		mpic_tm_chip.flags |= IRQCHIP_SKIP_SET_WAKE;
+	}
 
 	mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL);
 	if (mpic == NULL)
Signature · 1 line
1.9.1
#16 lore raw

Re: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 65 lines · Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

This patch removes the redundant mpic_irq_set_wake and sets the IRQCHIP_SKIP_SET_WAKE for only FSL MPIC.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Scott Wood <[email protected]>
Cc Hongtao Jia <[email protected]>
Cc Marc Zyngier <[email protected]>
---
 arch/powerpc/sysdev/mpic.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)
arch/powerpc/sysdev/mpic.c +0 -16
index 537e5db85a06..123e43612f0a 100644
@@ -924,22 +924,6 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int 
 flow_type)
      return IRQ_SET_MASK_OK_NOCOPY;
 }
 
-static int mpic_irq_set_wake(struct irq_data *d, unsigned int on)
-{
-     struct irq_desc *desc = container_of(d, struct irq_desc, irq_data);
-     struct mpic *mpic = mpic_from_irq_data(d);
-
-     if (!(mpic->flags & MPIC_FSL))
-             return -ENXIO;
-
-     if (on)
-             desc->action->flags |= IRQF_NO_SUSPEND;
-     else
-             desc->action->flags &= ~IRQF_NO_SUSPEND;
-
-     return 0;
-}
-
 void mpic_set_vector(unsigned int virq, unsigned int vector)
 {
      struct mpic *mpic = mpic_from_irq(virq);
arch/powerpc/sysdev/mpic.c +0 -2
@@ -977,7 +961,6 @@ static struct irq_chip mpic_irq_chip = {
      .irq_unmask     = mpic_unmask_irq,
      .irq_eoi        = mpic_end_irq,
      .irq_set_type   = mpic_set_irq_type,
-     .irq_set_wake   = mpic_irq_set_wake,
 };
 
 #ifdef CONFIG_SMP
@@ -992,7 +975,6 @@ static struct irq_chip mpic_tm_chip = {
      .irq_mask       = mpic_mask_tm,
      .irq_unmask     = mpic_unmask_tm,
      .irq_eoi        = mpic_end_irq,
-     .irq_set_wake   = mpic_irq_set_wake,
 };
 
 #ifdef CONFIG_MPIC_U3_HT_IRQS

arch/powerpc/sysdev/mpic.c struct mpic * __init mpic_alloc(struct device_node · line 1273

Quoted 10 lines
arch/powerpc/sysdev/mpic.c +4 -1
@@ -1283,8 +1265,11 @@ struct mpic * __init mpic_alloc(struct device_node 
 *node,
              flags |= MPIC_NO_RESET;
      if (of_get_property(node, "single-cpu-affinity", NULL))
              flags |= MPIC_SINGLE_DEST_CPU;
-     if (of_device_is_compatible(node, "fsl,mpic"))
+     if (of_device_is_compatible(node, "fsl,mpic")) {
              flags |= MPIC_FSL | MPIC_LARGE_VECTORS;
+             mpic_irq_chip.flags |= IRQCHIP_SKIP_SET_WAKE;
+             mpic_tm_chip.flags |= IRQCHIP_SKIP_SET_WAKE;
+     }

What difference does IRQCHIP_SKIP_SET_WAKE make in the absence of an .irq_set_wake() callback?

This is basically repealing commit 5ff04b7287d87c1db7 ("powerpc/mpic: add irq_set_wake support"). Wang Dongsheng, can you explain why that patch was needed?

-Scott

#17 lore raw

RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 13 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Wednesday, September 23, 2015 7:50 AM
To: Sudeep Holla
Cc: [email protected]; [email protected]; Thomas Gleixner; Rafael J. Wysocki; Benjamin Herrenschmidt; Paul Mackerras; Michael Ellerman; Jia Hongtao-B38951; Marc Zyngier; [email protected]; Wang Dongsheng- B40534
Subject: Re: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 6 lines
Quoted 5 lines · Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

Non-freescale return -ENXIO, is there any issue? If non-freescale platform does not support it, but IPs still use enable/disable_irq_wake, we should return a error number.

IRQCHIP_SKIP_SET_WAKE just skip this feature, this is not our expected. If non-freescale platform need this flag to skip this feature, it should be add in self platform.

@Scott:
If set this flag we cannot keep a irq as a wakeup source when system going to SUSPEND or MEM.

irq_set_wake() means we can set this irq as a wake source. IRQCHIP_SKIP_SET_WAKE is ignore irq_set_wake() feature.

Regards,
-Dongsheng

#18 lore raw

RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 10 lines · Wang Dongsheng
Quoted 6 lines · Sudeep Holla
Quoted 5 lines

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

Non-freescale return -ENXIO, is there any issue? If non-freescale platform does not support it, but IPs still use enable/disable_irq_wake, we should return a error number.

You can just set IRQCHIP_SKIP_SET_WAKE for FSL chips and not for the others.

Quoted 6 lines

@Scott:
If set this flag we cannot keep a irq as a wakeup source when system going to SUSPEND or MEM.

irq_set_wake() means we can set this irq as a wake source. IRQCHIP_SKIP_SET_WAKE is ignore irq_set_wake() feature.

Nonsense. IRQCHIP_SKIP_SET_WAKE merily tells the core not to bail on !chip->irq_set_wake(), but its still marking the interrupt as wakeup source and therefor not masking it on suspend.

IRQF_NO_SUSPEND is the wrong tool. End of story.

Thanks,

tglx

#19 lore raw

RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 33 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Thomas Gleixner
Sent: Wednesday, September 23, 2015 11:49 AM
To: Wang Dongsheng-B40534
Cc: Wood Scott-B07421; Sudeep Holla; [email protected]; linux- [email protected]; Rafael J. Wysocki; Benjamin Herrenschmidt; Paul Mackerras; Michael Ellerman; Jia Hongtao-B38951; Marc Zyngier; linuxppc- [email protected]
Subject: RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 10 lines · Wang Dongsheng
Quoted 6 lines · Sudeep Holla
Quoted 5 lines

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

Non-freescale return -ENXIO, is there any issue? If non-freescale platform does not support it, but IPs still use enable/disable_irq_wake, we should return a error number.

You can just set IRQCHIP_SKIP_SET_WAKE for FSL chips and not for the others.

Quoted 4 lines

@Scott:
If set this flag we cannot keep a irq as a wakeup source when system going to SUSPEND or MEM.

Quoted 7 lines
Quoted 2 lines

irq_set_wake() means we can set this irq as a wake source. IRQCHIP_SKIP_SET_WAKE is ignore irq_set_wake() feature.

Nonsense. IRQCHIP_SKIP_SET_WAKE merily tells the core not to bail on !chip->irq_set_wake(), but its still marking the interrupt as wakeup source and therefor not masking it on suspend.

Sorry, I just check irq_set_irq_wake() code, right, IRQCHIP_SKIP_SET_WAKE also can going to irqd_set to mask IRQD_WAKEUP_STATE.

Yes, this flag just skip the irq_set_wake() not this feature.

Regards,
-Dongsheng

#20 lore raw

RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 11 lines · Wang Dongsheng
Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Thomas Gleixner
Sent: Wednesday, September 23, 2015 11:49 AM
To: Wang Dongsheng-B40534
Cc: Wood Scott-B07421; Sudeep Holla; [email protected]; linux- [email protected]; Rafael J. Wysocki; Benjamin Herrenschmidt; Paul Mackerras; Michael Ellerman; Jia Hongtao-B38951; Marc Zyngier; linuxppc- [email protected]
Subject: RE: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Can you please fix you mail client to get rid of that silly copy of the mail header?

Quoted 27 lines
Quoted 19 lines · Wang Dongsheng
Quoted 10 lines
Quoted 6 lines · Sudeep Holla
Quoted 5 lines

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

Non-freescale return -ENXIO, is there any issue? If non-freescale platform does not support it, but IPs still use enable/disable_irq_wake, we should return a error number.

You can just set IRQCHIP_SKIP_SET_WAKE for FSL chips and not for the others.

Quoted 4 lines

@Scott:
If set this flag we cannot keep a irq as a wakeup source when system going to SUSPEND or MEM.

Quoted 7 lines
Quoted 2 lines

irq_set_wake() means we can set this irq as a wake source. IRQCHIP_SKIP_SET_WAKE is ignore irq_set_wake() feature.

Nonsense. IRQCHIP_SKIP_SET_WAKE merily tells the core not to bail on !chip->irq_set_wake(), but its still marking the interrupt as wakeup source and therefor not masking it on suspend.

Quoted 4 lines

Sorry, I just check irq_set_irq_wake() code, right, IRQCHIP_SKIP_SET_WAKE also can going to irqd_set to mask IRQD_WAKEUP_STATE.

Yes, this flag just skip the irq_set_wake() not this feature.

And just for completeness. That commit 5ff04b7287d87c 'powerpc/mpic:
add irq_set_wake support' is another example of trainwreck engineering.

    desc->action->flags |= IRQF_NO_SUSPEND;

This is not only horribly avoiding any of the existing APIs, it's also broken as hell. desc->action can be NULL when that is called.

It seems fleascale is hell bent to fiddle with the guts of the core code mindlessly. See commit c866cda47f2c

Yours grumpy

tglx

Acked-by on v1 4/17
#21 lore raw

Re: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

In reply to Sudeep Holla
Quoted 16 lines · Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

This patch removes the redundant mpic_irq_set_wake and sets the IRQCHIP_SKIP_SET_WAKE for only FSL MPIC.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Scott Wood <[email protected]>
Cc Hongtao Jia <[email protected]>
Cc Marc Zyngier <[email protected]>
Quoted 3 lines
---
 arch/powerpc/sysdev/mpic.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

-Scott

#22 lore raw

Re: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Hi Ben,

Quoted 21 lines · Scott Wood
Quoted 16 lines · Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

This patch removes the redundant mpic_irq_set_wake and sets the IRQCHIP_SKIP_SET_WAKE for only FSL MPIC.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Scott Wood <[email protected]>
Cc Hongtao Jia <[email protected]>
Cc Marc Zyngier <[email protected]>
Quoted 3 lines
---
  arch/powerpc/sysdev/mpic.c | 23 ++++-------------------
  1 file changed, 4 insertions(+), 19 deletions(-)
Quoted 2 lines

Can you pick this up via your tree ?

Signature · 2 lines
Regards,
Sudeep
#23 lore raw

Re: [PATCH 04/17] powerpc: mpic: use IRQCHIP_SKIP_SET_WAKE instead of redundant mpic_irq_set_wake

Quoted 25 lines · Sudeep Holla

Hi Ben,

Quoted 22 lines · Scott Wood
Quoted 20 lines · Sudeep Holla

mpic_irq_set_wake return -ENXIO for non FSL MPIC and sets IRQF_NO_SUSPEND
flag for FSL ones. enable_irq_wake already returns -ENXIO if irq_set_wak is not implemented. Also there's no need to set the IRQF_NO_SUSPEND flag as it doesn't guarantee wakeup for that interrupt.

This patch removes the redundant mpic_irq_set_wake and sets the IRQCHIP_SKIP_SET_WAKE for only FSL MPIC.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Scott Wood <[email protected]>
Cc Hongtao Jia <[email protected]>
Cc Marc Zyngier <[email protected]>
---
  arch/powerpc/sysdev/mpic.c | 23 ++++-------------------
  1 file changed, 4 insertions(+), 19 deletions(-)
Quoted 4 lines
Quoted 2 lines

Can you pick this up via your tree ?

OK.

-Scott

#24 lore raw

PATCH 5/17 platform: x86: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

---
 drivers/platform/x86/intel_mid_powerbtn.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/platform/x86/intel_mid_powerbtn.c +8 -2
index 22606d6b2af3..1fc0de870ff8 100644
@@ -24,6 +24,7 @@
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/mfd/intel_msic.h>
+#include <linux/pm_wakeirq.h>
 
 #define DRIVER_NAME "msic_power_btn"
 
@@ -76,14 +77,17 @@ static int mfld_pb_probe(struct platform_device *pdev)
 
 	input_set_capability(input, EV_KEY, KEY_POWER);
 
-	error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND,
-			DRIVER_NAME, input);
+	error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0,
+				     DRIVER_NAME, input);
 	if (error) {
 		dev_err(&pdev->dev, "Unable to request irq %d for mfld power"
 				"button\n", irq);
 		goto err_free_input;
 	}
 
+	device_init_wakeup(&pdev->dev, true);
+	dev_pm_set_wake_irq(&pdev->dev, irq);
+
 	error = input_register_device(input);
 	if (error) {
 		dev_err(&pdev->dev, "Unable to register input dev, error "
@@ -124,6 +128,8 @@ static int mfld_pb_remove(struct platform_device *pdev)
 	struct input_dev *input = platform_get_drvdata(pdev);
 	int irq = platform_get_irq(pdev, 0);
 
+	dev_pm_clear_wake_irq(&pdev->dev);
+	device_init_wakeup(&pdev->dev, false);
 	free_irq(irq, input);
 	input_unregister_device(input);
 
Signature · 1 line
1.9.1
#25 lore raw

Re: [PATCH 05/17] platform: x86: remove misuse of IRQF_NO_SUSPEND flag

Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 6 lines

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Queued to testing, thanks Sudeep.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#26 lore raw

PATCH 6/17 rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-ds1343.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/rtc/rtc-ds1343.c +6 -3
index 79a06dd3c185..615ce5c370eb 100644
@@ -21,6 +21,7 @@
 #include <linux/rtc.h>
 #include <linux/bcd.h>
 #include <linux/pm.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/slab.h>
 
 #define DS1343_DRV_VERSION	"01.00"
@@ -663,15 +664,15 @@ static int ds1343_probe(struct spi_device *spi)
 
 	if (priv->irq >= 0) {
 		res = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
-						ds1343_thread,
-						IRQF_NO_SUSPEND | IRQF_ONESHOT,
+						ds1343_thread, IRQF_ONESHOT,
 						"ds1343", priv);
 		if (res) {
 			priv->irq = -1;
 			dev_err(&spi->dev,
 				"unable to request irq for rtc ds1343\n");
 		} else {
-			device_set_wakeup_capable(&spi->dev, 1);
+			device_init_wakeup(&spi->dev, true);
+			dev_pm_set_wake_irq(&spi->dev, spi->irq);
 		}
 	}
 
@@ -692,6 +693,8 @@ static int ds1343_remove(struct spi_device *spi)
 		priv->irqen &= ~RTC_AF;
 		mutex_unlock(&priv->mutex);
 
+		dev_pm_clear_wake_irq(&spi->dev);
+		device_init_wakeup(&spi->dev, false);
 		devm_free_irq(&spi->dev, spi->irq, priv);
 	}
 
Signature · 1 line
1.9.1
#27 lore raw

Re: [PATCH 06/17] rtc: ds1343: remove misuse of IRQF_NO_SUSPEND flag

Quoted 9 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags and uses newly introduce PM wakeup APIs dev_pm_{set,clear}_wake_irq.

Quoted 8 lines
Cc Alessandro Zummo <[email protected]>
Cc Alexandre Belloni <[email protected]>
---
 drivers/rtc/rtc-ds1343.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 14 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
#28 lore raw

PATCH 7/17 input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/qcom_rpm.c +1 -1
index 6afc9fabd94c..207a3bd68559 100644
@@ -550,7 +550,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev,
 			       irq_ack,
 			       qcom_rpm_ack_interrupt,
-			       IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
+			       IRQF_TRIGGER_RISING,
 			       "qcom_rpm_ack",
 			       rpm);
 	if (ret) {
Signature · 1 line
1.9.1
Acked-by on v1 7/17
#29 lore raw

Re: [PATCH 07/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

The $SUBJECT is not correct.

Quoted 11 lines

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

... code is fine though:

Please re-submit with the subject line fixed.

Quoted 13 lines
drivers/mfd/qcom_rpm.c +1 -1
index 6afc9fabd94c..207a3bd68559 100644
@@ -550,7 +550,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev,
 			       irq_ack,
 			       qcom_rpm_ack_interrupt,
-			       IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
+			       IRQF_TRIGGER_RISING,
 			       "qcom_rpm_ack",
 			       rpm);
 	if (ret) {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
maintainer
#30 lore raw

Re: [PATCH 07/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Quoted 14 lines · Lee Jones

The $SUBJECT is not correct.

Quoted 11 lines

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines

... code is fine though:

Please re-submit with the subject line fixed.

What's wrong with the subject?

Thanks.

Signature · 1 line
Dmitry
#31 lore raw

Re: [PATCH 07/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Quoted 15 lines · Dmitry Torokhov
Quoted 14 lines · Lee Jones

The $SUBJECT is not correct.

Quoted 11 lines

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 5 lines

... code is fine though:

Please re-submit with the subject line fixed.

What's wrong with the subject?

This patch has nothing to do with Input and the first word of the explanatory sentence should start with an uppercase character.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#32 lore raw

Re: [PATCH 07/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

Quoted 19 lines · Lee Jones
Quoted 17 lines · Dmitry Torokhov
Quoted 16 lines · Lee Jones

The $SUBJECT is not correct.

Quoted 11 lines

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Cc Samuel Ortiz <[email protected]>
Cc Lee Jones <[email protected]>
---
  drivers/mfd/qcom_rpm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

... code is fine though:

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Please re-submit with the subject line fixed.

What's wrong with the subject?

This patch has nothing to do with Input and the first word of the explanatory sentence should start with an uppercase character.

Ah my stupid mistake, I didn't realize it. Sorry for the noise, will fix it and send.

Regards,
Sudeep

#33 lore raw

Re: [PATCH 07/17] input: tegra-kbc: drop use of IRQF_NO_SUSPEND flag

In reply to Lee Jones

Hi Lee,

Quoted 2 lines · Lee Jones

The $SUBJECT is not correct.

Any suggestions ? Most of this series I have used "remove misuse..." But this driver was doing things correctly, just that it left this flag as is.

Regards,
Sudeep

#34 lore raw

PATCH 7/17 mfd: qcom_rpm: Drop use of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Updated version with the $subject fixed and Lee's ACK.

drivers/mfd/qcom_rpm.c +1 -1
index 6afc9fabd94c..207a3bd68559 100644
@@ -550,7 +550,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev,
 			       irq_ack,
 			       qcom_rpm_ack_interrupt,
-			       IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
+			       IRQF_TRIGGER_RISING,
 			       "qcom_rpm_ack",
 			       rpm);
 	if (ret) {
Signature · 1 line
1.9.1
Applied
#35 lore raw

Re: [PATCH 07/17][UPDATE] mfd: qcom_rpm: Drop use of IRQF_NO_SUSPEND flag

Quoted 5 lines · Sudeep Holla

The driver handles wakeup irq correctly using irq_set_irq_wake. There's no need to use IRQF_NO_SUSPEND while registering the interrupt.

This patch removes the use of IRQF_NO_SUSPEND flag.

Quoted 8 lines
---
 drivers/mfd/qcom_rpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Updated version with the $subject fixed and Lee's ACK.

Applied, thanks.

Quoted 13 lines
drivers/mfd/qcom_rpm.c +1 -1
index 6afc9fabd94c..207a3bd68559 100644
@@ -550,7 +550,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev,
 			       irq_ack,
 			       qcom_rpm_ack_interrupt,
-			       IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
+			       IRQF_TRIGGER_RISING,
 			       "qcom_rpm_ack",
 			       rpm);
 	if (ret) {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#36 lore raw

PATCH 8/17 hwmon: abx500: drop the use of IRQF_NO_SUSPEND

In reply to Sudeep Holla

The description in the driver states: "ABX500 does not provide auto ADC, so to monitor the required temperatures, a periodic work is used. It is more important to not wake up the CPU... If the chip gets too hot during a sleep state it's most likely due to external factors, such as the surrounding temperature and nothing can be done in S/W."

So it makes no sense to keep IRQs enabled as it need not be wakeup source. This patch removes the use of IRQF_NO_SUSPEND flag

---
 drivers/hwmon/abx500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/abx500.c +1 -1
index 6cb89c0ebab6..dcab258f60c1 100644
@@ -377,7 +377,7 @@ static int setup_irqs(struct platform_device *pdev)
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
-		abx500_temp_irq_handler, IRQF_NO_SUSPEND, "abx500-temp", pdev);
+		abx500_temp_irq_handler, 0, "abx500-temp", pdev);
 	if (ret < 0)
 		dev_err(&pdev->dev, "Request threaded irq failed (%d)\n", ret);
 
Signature · 1 line
1.9.1
maintainer Applied
#37 lore raw

Re: [PATCH 08/17] hwmon: abx500: drop the use of IRQF_NO_SUSPEND

Quoted 6 lines · Sudeep Holla

The description in the driver states: "ABX500 does not provide auto ADC, so to monitor the required temperatures, a periodic work is used. It is more important to not wake up the CPU... If the chip gets too hot during a sleep state it's most likely due to external factors, such as the surrounding temperature and nothing can be done in S/W."

Quoted 7 lines

So it makes no sense to keep IRQs enabled as it need not be wakeup source. This patch removes the use of IRQF_NO_SUSPEND flag

Applied to hwmon-next.

Thanks,
Guenter

Quoted 18 lines
---
  drivers/hwmon/abx500.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/abx500.c +1 -1
index 6cb89c0ebab6..dcab258f60c1 100644
@@ -377,7 +377,7 @@ static int setup_irqs(struct platform_device *pdev)
  	}
 
  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
-		abx500_temp_irq_handler, IRQF_NO_SUSPEND, "abx500-temp", pdev);
+		abx500_temp_irq_handler, 0, "abx500-temp", pdev);
  	if (ret < 0)
  		dev_err(&pdev->dev, "Request threaded irq failed (%d)\n", ret);
 
#38 lore raw

PATCH 9/17 MIPS: ttyFDC: replace IRQF_NO_SUSPEND with IRQF_COND_SUSPEND

In reply to Sudeep Holla

Since the FD interrupt handler can discern spurious IRQs and it is shared with timer interrupt, use IRQF_COND_SUSPEND instead of IRQF_NO_SUSPEND.

Cc Greg Kroah-Hartman <[email protected]>
Cc Jiri Slaby <[email protected]>
---
 drivers/tty/mips_ejtag_fdc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/mips_ejtag_fdc.c +2 -2
index a8c8cfd52a23..5a6d0b5cd18b 100644
@@ -977,7 +977,7 @@ static int mips_ejtag_fdc_tty_probe(struct mips_cdmm_device *dev)
 	/* Try requesting the IRQ */
 	if (priv->irq >= 0) {
 		/*
-		 * IRQF_SHARED, IRQF_NO_SUSPEND: The FDC IRQ may be shared with
+		 * IRQF_SHARED, IRQF_COND_SUSPEND: The FDC IRQ may be shared with
 		 * other local interrupts such as the timer which sets
 		 * IRQF_TIMER (including IRQF_NO_SUSPEND).
 		 *
@@ -987,7 +987,7 @@ static int mips_ejtag_fdc_tty_probe(struct mips_cdmm_device *dev)
 		 */
 		ret = devm_request_irq(priv->dev, priv->irq, mips_ejtag_fdc_isr,
 				       IRQF_PERCPU | IRQF_SHARED |
-				       IRQF_NO_THREAD | IRQF_NO_SUSPEND,
+				       IRQF_NO_THREAD | IRQF_COND_SUSPEND,
 				       priv->fdc_name, priv);
 		if (ret)
 			priv->irq = -1;
Signature · 1 line
1.9.1
#39 lore raw

PATCH 10/17 tty/serial: st-asc: drop the use of IRQF_NO_SUSPEND

In reply to Sudeep Holla

These drivers doesn't claim the serial device to be wakeup source. Even if it is, it needs to use enable_irq_wake or other related PM wakeup APIs to enable it.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc Srinivas Kandagatla <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc kernel at stlinux.com
Cc linux-serial at vger.kernel.org
---
 drivers/tty/serial/st-asc.c      | 2 +-
 drivers/tty/serial/stm32-usart.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/st-asc.c +1 -1
index d625664ce1b5..2d78cb3627ae 100644
@@ -430,7 +430,7 @@ static void asc_break_ctl(struct uart_port *port, int break_state)
  */
 static int asc_startup(struct uart_port *port)
 {
-	if (request_irq(port->irq, asc_interrupt, IRQF_NO_SUSPEND,
+	if (request_irq(port->irq, asc_interrupt, 0,
 			asc_port_name(port), port)) {
 		dev_err(port->dev, "cannot allocate irq.\n");
 		return -ENODEV;
drivers/tty/serial/stm32-usart.c +1 -2
index e3de9c6d2226..f89d1f79be18 100644
@@ -322,8 +322,7 @@ static int stm32_startup(struct uart_port *port)
 	u32 val;
 	int ret;
 
-	ret = request_irq(port->irq, stm32_interrupt, IRQF_NO_SUSPEND,
-			  name, port);
+	ret = request_irq(port->irq, stm32_interrupt, 0, name, port);
 	if (ret)
 		return ret;
 
Signature · 1 line
1.9.1
#40 lore raw

PATCH 11/17 pm: bf609: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

---
 arch/blackfin/mach-bf609/pm.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
arch/blackfin/mach-bf609/pm.c +7 -6
index b1bfcf434d16..dab42d39b085 100644
@@ -338,21 +338,22 @@ static int __init bf609_init_pm(void)
 				GPIO_PE12, error);
 	}
 
-	error = request_irq(irq, test_isr, IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND
-				| IRQF_FORCE_RESUME, "gpiope12", NULL);
+	error = request_irq(irq, test_isr, IRQF_TRIGGER_RISING,
+			    "gpiope12", NULL);
 	if(error < 0)
 		printk(KERN_DEBUG "Unable to get irq\n");
+	enable_irq_wake(irq);
 #endif
 
-	error = request_irq(IRQ_CGU_EVT, dpm0_isr, IRQF_NO_SUSPEND |
-				IRQF_FORCE_RESUME, "cgu0 event", NULL);
+	error = request_irq(IRQ_CGU_EVT, dpm0_isr, 0, "cgu0 event", NULL);
 	if(error < 0)
 		printk(KERN_DEBUG "Unable to get irq\n");
+	enable_irq_wake(IRQ_CGU_EVT);
 
-	error = request_irq(IRQ_DPM, dpm0_isr, IRQF_NO_SUSPEND |
-				IRQF_FORCE_RESUME, "dpm0 event", NULL);
+	error = request_irq(IRQ_DPM, dpm0_isr, 0, "dpm0 event", NULL);
 	if (error < 0)
 		printk(KERN_DEBUG "Unable to get irq\n");
+	enable_irq_wake(IRQ_DPM);
 
 	bfin_cpu_pm = &bf609_cpu_pm;
 	return 0;
Signature · 1 line
1.9.1
#41 lore raw

Re: [PATCH 11/17] pm: bf609: remove misuse of IRQF_NO_SUSPEND flag

Quoted 10 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Steven Miao <[email protected]>

Gentle Ping !

Signature · 2 lines
Regards,
Sudeep
#42 lore raw

PATCH 12/17 ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc linux-omap at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-omap2/mux.c    | 4 ++--
 arch/arm/mach-omap2/pm34xx.c | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/mux.c +2 -2
index 176eef6ef338..12012bef8e63 100644
@@ -810,13 +810,13 @@ int __init omap_mux_late_init(void)
 		return 0;
 
 	ret = request_irq(omap_prcm_event_to_irq("io"),
-		omap_hwmod_mux_handle_irq, IRQF_SHARED | IRQF_NO_SUSPEND,
+		omap_hwmod_mux_handle_irq, IRQF_SHARED,
 			"hwmod_io", omap_mux_late_init);
 
 	if (ret)
 		pr_warn("mux: Failed to setup hwmod io irq %d\n", ret);
 
-	return 0;
+	return enable_irq_wake(omap_prcm_event_to_irq("io"));
 }
 
 static void __init omap_mux_package_fixup(struct omap_mux *p,
arch/arm/mach-omap2/pm34xx.c +4 -5
index 87b98bf92366..4b7ac7cd633a 100644
@@ -472,23 +472,22 @@ int __init omap3_pm_init(void)
 	prcm_setup_regs();
 
 	ret = request_irq(omap_prcm_event_to_irq("wkup"),
-		_prcm_int_handle_wakeup, IRQF_NO_SUSPEND, "pm_wkup", NULL);
+		_prcm_int_handle_wakeup, 0, "pm_wkup", NULL);
 
 	if (ret) {
 		pr_err("pm: Failed to request pm_wkup irq\n");
 		goto err1;
 	}
+	enable_irq_wake(omap_prcm_event_to_irq("wkup"));
 
 	/* IO interrupt is shared with mux code */
 	ret = request_irq(omap_prcm_event_to_irq("io"),
-		_prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io",
-		omap3_pm_init);
-	enable_irq(omap_prcm_event_to_irq("io"));
-
+		_prcm_int_handle_io, IRQF_SHARED, "pm_io", omap3_pm_init);
 	if (ret) {
 		pr_err("pm: Failed to request pm_io irq\n");
 		goto err2;
 	}
+	enable_irq_wake(omap_prcm_event_to_irq("io"));
 
 	ret = pwrdm_for_each(pwrdms_setup, NULL);
 	if (ret) {
Signature · 1 line
1.9.1
maintainer
#43 lore raw

Re: [PATCH 12/17] ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

Quoted 8 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Applying into omap-for-v4.4/cleanup thanks.

Tony

maintainer
#44 lore raw

Re: [PATCH 12/17] ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

Quoted 11 lines · Tony Lindgren
Quoted 8 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Applying into omap-for-v4.4/cleanup thanks.

Actually I don't think this does the right thing. The interrupts in the $subject patch are in the always on powerdomain, and we really want them to be excluded from the suspend.

So not applying without further explanations.

Regards,

Tony

#45 lore raw

Re: [PATCH 12/17] ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Applying into omap-for-v4.4/cleanup thanks.

Actually I don't think this does the right thing. The interrupts in the $subject patch are in the always on powerdomain, and we really

Agreed

Quoted 2 lines

want them to be excluded from the suspend.

OK but what's wrong with this patch. At-least the name suggest it's a wakeup interrupt. And using IRQF_NO_SUSPEND for the wakeup interrupt is simply wrong.

Quoted 2 lines

So not applying without further explanations.

But I don't understand the real need for IRQF_NO_SUSPEND over wakeup APIs ?

Signature · 2 lines
Regards,
Sudeep
maintainer
#46 lore raw

Re: [PATCH 12/17] ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

Quoted 19 lines · Sudeep Holla
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Applying into omap-for-v4.4/cleanup thanks.

Actually I don't think this does the right thing. The interrupts in the $subject patch are in the always on powerdomain, and we really

Quoted 8 lines

Agreed

Quoted 2 lines

want them to be excluded from the suspend.

OK but what's wrong with this patch. At-least the name suggest it's a wakeup interrupt. And using IRQF_NO_SUSPEND for the wakeup interrupt is simply wrong.

Hmm so if we have a separate always on irq controller for the wake-up events and we want to keep it always on and exclude it from any suspend related things.. Why would we not use IRQF_NO_SUSPEND on it?

Above you say "The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle..." and that's exactly what we want to do here :)

For the dedicated wake-up interrupts, we have separate registers to enable and disable them. The $subject irq is the shared interrupt that allows making use of the pin specific wake-up interrupts, and for those yes we are using enable_irq_wake().

Quoted 4 lines
Quoted 2 lines

So not applying without further explanations.

But I don't understand the real need for IRQF_NO_SUSPEND over wakeup APIs ?

Because in the $subject case we just want to always keep it on and never suspend it. It's unrelated to the wakeup APIs at least for the omap related SoCs.

Regards,

Tony

#47 lore raw

Re: [PATCH 12/17] ARM: OMAP2+: remove misuse of IRQF_NO_SUSPEND flag

Quoted 29 lines · Tony Lindgren
Quoted 19 lines · Sudeep Holla
Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Applying into omap-for-v4.4/cleanup thanks.

Actually I don't think this does the right thing. The interrupts in the $subject patch are in the always on powerdomain, and we really

Quoted 8 lines

Agreed

Quoted 2 lines

want them to be excluded from the suspend.

OK but what's wrong with this patch. At-least the name suggest it's a wakeup interrupt. And using IRQF_NO_SUSPEND for the wakeup interrupt is simply wrong.

Quoted 8 lines

Hmm so if we have a separate always on irq controller for the wake-up events and we want to keep it always on and exclude it from any suspend related things.. Why would we not use IRQF_NO_SUSPEND on it?

Above you say "The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle..." and that's exactly what we want to do here :)

OK if these interrupts meet that criteria to use IRQF_NO_SUSPEND, then it should be fine, my earlier argument was based on the assumption that it's just another wakeup interrupt.

Quoted 5 lines

For the dedicated wake-up interrupts, we have separate registers to enable and disable them. The $subject irq is the shared interrupt that allows making use of the pin specific wake-up interrupts, and for those yes we are using enable_irq_wake().

If it's already take care, then fine. I am just hunting all the misuse of IRQF_NO_SUSPEND flag especially as wakeup source and fixing them

Quoted 9 lines
Quoted 4 lines
Quoted 2 lines

So not applying without further explanations.

But I don't understand the real need for IRQF_NO_SUSPEND over wakeup APIs ?

Because in the $subject case we just want to always keep it on and never suspend it. It's unrelated to the wakeup APIs at least for the omap related SoCs.

OK, understood now. Thanks

--
Regards,
Sudeep

#48 lore raw

PATCH 13/17 net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc "David S. Miller" <[email protected]>
Cc Claudiu Manoil <[email protected]>
Cc Kevin Hao <[email protected]>
---
 drivers/net/ethernet/freescale/gianfar.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +5 -4
index 4b69d061d90f..803ed4c93503 100644
@@ -1970,8 +1970,7 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
 		/* Install our interrupt handlers for Error,
 		 * Transmit, and Receive
 		 */
-		err = request_irq(gfar_irq(grp, ER)->irq, gfar_error,
-				  IRQF_NO_SUSPEND,
+		err = request_irq(gfar_irq(grp, ER)->irq, gfar_error, 0,
 				  gfar_irq(grp, ER)->name, grp);
 		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
@@ -1979,6 +1978,8 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
 
 			goto err_irq_fail;
 		}
+		enable_irq_wake(gfar_irq(grp, ER)->irq);
+
 		err = request_irq(gfar_irq(grp, TX)->irq, gfar_transmit, 0,
 				  gfar_irq(grp, TX)->name, grp);
 		if (err < 0) {
@@ -1994,14 +1995,14 @@ static int register_grp_irqs(struct gfar_priv_grp *grp)
 			goto rx_irq_fail;
 		}
 	} else {
-		err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt,
-				  IRQF_NO_SUSPEND,
+		err = request_irq(gfar_irq(grp, TX)->irq, gfar_interrupt, 0,
 				  gfar_irq(grp, TX)->name, grp);
 		if (err < 0) {
 			netif_err(priv, intr, dev, "Can't get IRQ %d\n",
 				  gfar_irq(grp, TX)->irq);
 			goto err_irq_fail;
 		}
+		enable_irq_wake(gfar_irq(grp, TX)->irq);
 	}
 
 	return 0;
Signature · 1 line
1.9.1
#49 lore raw

RE: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 12 lines

-----Original Message-----
From: Sudeep Holla [mailto:[email protected]]
Sent: Monday, September 21, 2015 6:47 PM
To: [email protected]; [email protected]
Cc: Sudeep Holla <[email protected]>; Thomas Gleixner <[email protected]>; Rafael J. Wysocki <[email protected]>; David S. Miller <[email protected]>; Manoil Claudiu-B08782 <[email protected]>; Kevin Hao <[email protected]>; [email protected]
Subject: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels, on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

Thanks,
Claudiu

#50 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 16 lines · Manoil Claudiu
Quoted 16 lines

-----Original Message-----
From: Sudeep Holla [mailto:[email protected]]
Sent: Monday, September 21, 2015 6:47 PM
To: [email protected]; [email protected]
Cc: Sudeep Holla <[email protected]>; Thomas Gleixner <[email protected]>; Rafael J. Wysocki <[email protected]>; David S. Miller <[email protected]>; Manoil Claudiu-B08782 <[email protected]>; Kevin Hao <[email protected]>; [email protected]
Subject: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

Quoted 5 lines
Quoted 3 lines

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then?

If you look at the section "IRQF_NO_SUSPEND Flag" in Documentation/power/suspend-and-interrupts.txt, it states it doesn't guarantee that the interrupt will wake the system from a suspended state -- for such cases it is necessary to use enable_irq_wake().

Quoted 1 line

The flag is a friendlier API compared to calling enable_irq_wake().

In what sense ?

Quoted 1 line

For older kernels, on PPC architectures, the flag did the job.

Agreed, it does the job even now, just that it's not designed for that. One can change that anytime internally as the APIs for configuring wakeups as in place now. I am just making use of right APIs.

Quoted 2 lines

When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

Sorry if the term "misuse" is not appropriate here, since the intention of the flag usage doesn't meet the requirements, I mentioned it as misuse.

Regards,
Sudeep

#51 lore raw

RE: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

In reply to Manoil Claudiu
Quoted 10 lines · Manoil Claudiu
Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels,

It's not an API, it's just a bandaid for lazy programmers.

Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

Thanks,

tglx

#52 lore raw

RE: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 25 lines

-----Original Message-----
From: Thomas Gleixner [mailto:[email protected]]
Sent: Monday, September 21, 2015 7:52 PM
To: Manoil Claudiu-B08782 <[email protected]>
Cc: Sudeep Holla <[email protected]>; [email protected]; linux- [email protected]; Rafael J. Wysocki <[email protected]>; David S. Miller <[email protected]>; Kevin Hao <[email protected]>; [email protected]
Subject: RE: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 10 lines · Manoil Claudiu
Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels,

It's not an API, it's just a bandaid for lazy programmers.

Quoted 8 lines
Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

I'm seeing also a "powerpc: mpic" patch in the series, unfortunately I can't afford to test it right now. However I ran a quick test with this gianfar patch in isolation on a powerpc system, and seen some difference in the behavior (with and w/o the patch). In both cases the system wakes up from standby by magic packet. However, without the IRQF_NO_SUSPEND flag 2 wake-up interrupts are reported in /proc/interrupts for one magic packet; with the flag on there's just 1 interrupt. Maybe this is not relevant, maybe the "powerpc: mpic" patch from this series changes this behavior.
But if this is the API, what can I say? We'll see in time. Btw, enable_irq_wake() returns an error code, normally it should be handled by printing a warning message at least, right? But since most drivers don't handle that, I'm assuming it should be left unhandled to avoid overcomplicating things.
FWIW

#53 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 2 lines · Manoil Claudiu
Quoted 2 lines

-----Original Message-----
From: Thomas Gleixner [mailto:[email protected]]

[...]

Quoted 10 lines
Quoted 8 lines
Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

I'm seeing also a "powerpc: mpic" patch in the series, unfortunately I can't

Yes I think that was a redundant code, so I removed it. IIRC it was setting IRQF_NO_SUSPEND in irq_set_wake callback which again is incorrect.

Quoted 5 lines

afford to test it right now. However I ran a quick test with this gianfar patch in isolation on a powerpc system, and seen some difference in the behavior (with and w/o the patch). In both cases the system wakes up from standby by magic packet. However, without the IRQF_NO_SUSPEND flag 2 wake-up interrupts are reported in /proc/interrupts for one magic packet; with the

OK that's interesting, will have check if I have similar behavior on my setup too.

Quoted 2 lines

flag on there's just 1 interrupt. Maybe this is not relevant, maybe the "powerpc: mpic" patch from this series changes this behavior.

Hmm not sure, but better to test it together if possible. If required we can reorder for bisect-ability reasons.

Quoted 4 lines

But if this is the API, what can I say? We'll see in time. Btw, enable_irq_wake() returns an error code, normally it should be handled by printing a warning message at least, right? But since most drivers don't handle that, I'm assuming it should be left unhandled to avoid overcomplicating things.

Yes I left it so that I can add if the maintainer insist and not churn too much code adding warning.

Quoted 3 lines

FWIW

Thanks.

Regards,
Sudeep

#54 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

In reply to Thomas Gleixner
Quoted 14 lines · Thomas Gleixner
Quoted 10 lines · Manoil Claudiu
Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels,

It's not an API, it's just a bandaid for lazy programmers.

Quoted 7 lines
Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

It was not very clear on the intended use of IRQF_NO_SUSPEND at the beginning as it was not documented anywhere. It's good that we have the Documentation/power/suspend-and-interrupts.txt to clarify that now.

Regards,
Leo

#55 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 23 lines · Li Yang
Quoted 14 lines · Thomas Gleixner
Quoted 10 lines · Manoil Claudiu
Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels,

It's not an API, it's just a bandaid for lazy programmers.

Quoted 7 lines
Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

Quoted 4 lines

It was not very clear on the intended use of IRQF_NO_SUSPEND at the beginning as it was not documented anywhere. It's good that we have the Documentation/power/suspend-and-interrupts.txt to clarify that now.

This is complete and utter bullshit to put it blunt.

The documentation of IRQF_NO_SUSPEND as non suitable for marking a particular device interrupt as wakeup source was added on Feb 20 2015 with commit 737eb0301f2. Further clarification was added with commit 7438b633a6b on Mar 4 2015.

The IRQF_NO_SUSPEND crap was introduced to gianfar with commit 614b42426cc3 on Jul 31 2015.

Did you really expect that nobody will notice that the documentation which you praise now, has been available FIVE month before you decided to ignore it?

You can play your $corp fingerpointing games inside of your $corp without someone noticing, but in that community this is an absolute nono.

No thanks,

tglx

#56 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

Quoted 31 lines · Thomas Gleixner
Quoted 23 lines · Li Yang
Quoted 14 lines · Thomas Gleixner
Quoted 10 lines · Manoil Claudiu
Quoted 7 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

What would be the purpose of IRQF_NO_SUSPEND flag then? The flag is a friendlier API compared to calling enable_irq_wake(). For older kernels,

It's not an API, it's just a bandaid for lazy programmers.

Quoted 7 lines
Quoted 2 lines

on PPC architectures, the flag did the job. When did this change? Since when using IRQF_NO_SUSPEND is a "misuse"?

It always was. Simply because IRQF_NO_SUSPEND has absolutely nothing to do with wakeup interrupt sources. It's a flag which excludes the interrupt from the suspend mechanism, but it does not flag it a wakeup source.

Quoted 4 lines

It was not very clear on the intended use of IRQF_NO_SUSPEND at the beginning as it was not documented anywhere. It's good that we have the Documentation/power/suspend-and-interrupts.txt to clarify that now.

This is complete and utter bullshit to put it blunt.

Quoted 7 lines

The documentation of IRQF_NO_SUSPEND as non suitable for marking a particular device interrupt as wakeup source was added on Feb 20 2015 with commit 737eb0301f2. Further clarification was added with commit 7438b633a6b on Mar 4 2015.

The IRQF_NO_SUSPEND crap was introduced to gianfar with commit 614b42426cc3 on Jul 31 2015.

It is definitely an oversight of us to have missed the new development on this topic. It's a problem for us and I'm not trying to defend that. But the decision to use IRQF_NO_SUSPEND for wakeup interrupt was made several years ago. (https://lkml.org/lkml/2012/7/20/174) I was just trying to say that it's hard to make the right decision at the beginning.

Regards,
Leo

maintainer Applied
#57 lore raw

Re: [PATCH 13/17] net: gianfar: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

From: Sudeep Holla <[email protected]>
Date: Mon, 21 Sep 2015 16:47:09 +0100

Quoted 4 lines

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

Quoted 8 lines

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc "David S. Miller" <[email protected]>
Cc Claudiu Manoil <[email protected]>
Cc Kevin Hao <[email protected]>

Applied, thanks.

#58 lore raw

PATCH 14/17 media: st-rc: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Srinivas Kandagatla <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc kernel at stlinux.com
Cc linux-media at vger.kernel.org
---
 drivers/media/rc/st_rc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/media/rc/st_rc.c +9 -5
index 37d040158dff..1fa0c9d1c508 100644
@@ -16,6 +16,7 @@
 #include <linux/reset.h>
 #include <media/rc-core.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pm_wakeirq.h>
 
 struct st_rc_device {
 	struct device			*dev;
@@ -190,6 +191,9 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
 static int st_rc_remove(struct platform_device *pdev)
 {
 	struct st_rc_device *rc_dev = platform_get_drvdata(pdev);
+
+	dev_pm_clear_wake_irq(&pdev->dev);
+	device_init_wakeup(&pdev->dev, false);
 	clk_disable_unprepare(rc_dev->sys_clock);
 	rc_unregister_device(rc_dev->rdev);
 	return 0;
@@ -298,22 +302,22 @@ static int st_rc_probe(struct platform_device *pdev)
 	rdev->map_name = RC_MAP_LIRC;
 	rdev->input_name = "ST Remote Control Receiver";
 
-	/* enable wake via this device */
-	device_set_wakeup_capable(dev, true);
-	device_set_wakeup_enable(dev, true);
-
 	ret = rc_register_device(rdev);
 	if (ret < 0)
 		goto clkerr;
 
 	rc_dev->rdev = rdev;
 	if (devm_request_irq(dev, rc_dev->irq, st_rc_rx_interrupt,
-			IRQF_NO_SUSPEND, IR_ST_NAME, rc_dev) < 0) {
+			     0, IR_ST_NAME, rc_dev) < 0) {
 		dev_err(dev, "IRQ %d register failed\n", rc_dev->irq);
 		ret = -EINVAL;
 		goto rcerr;
 	}
 
+	/* enable wake via this device */
+	device_init_wakeup(dev, true);
+	dev_pm_set_wake_irq(dev, rc_dev->irq);
+
 	/**
 	 * for LIRC_MODE_MODE2 or LIRC_MODE_PULSE or LIRC_MODE_RAW
 	 * lircd expects a long space first before a signal train to sync.
Signature · 1 line
1.9.1
#59 lore raw

Re: [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag

Hi,

Quoted 11 lines · Sudeep Holla

The device is set as wakeup capable using proper wakeup API but the driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Srinivas Kandagatla <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>

Can you pick couple of these media patches ?

Signature · 2 lines
Regards,
Sudeep
#60 lore raw

PATCH 15/17 ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

In reply to Sudeep Holla

This driver doesn't claim the IR transmitter to be wakeup source. It even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Guoxiong Yan <[email protected]>
---
 drivers/media/rc/ir-hix5hd2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-hix5hd2.c +1 -1
index 1c087cb76815..d0549fba711c 100644
@@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
 		goto clkerr;
 
 	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
-			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
+			     0, pdev->name, priv) < 0) {
 		dev_err(dev, "IRQ %d register failed\n", priv->irq);
 		ret = -EINVAL;
 		goto regerr;
Signature · 1 line
1.9.1
#61 lore raw

Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

Quoted 22 lines · Sudeep Holla

This driver doesn't claim the IR transmitter to be wakeup source. It even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Guoxiong Yan <[email protected]>
---
  drivers/media/rc/ir-hix5hd2.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-hix5hd2.c +0 -0
index 1c087cb76815..d0549fba711c 100644

drivers/media/rc/ir-hix5hd2.c static int hix5hd2_ir_probe(struct platform_device *pdev) · line 263

Quoted 8 lines
drivers/media/rc/ir-hix5hd2.c +1 -1
@@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
  		goto clkerr;
 
  	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
-			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
+			     0, pdev->name, priv) < 0) {
  		dev_err(dev, "IRQ %d register failed\n", priv->irq);
  		ret = -EINVAL;
  		goto regerr;

ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND. However, it is true the wakeup mechanism is not realized on hix5hd2 yet. I am fine with either using IRQF_NO_SUSPEND or not.

Thanks for the patch.

#62 lore raw

Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

Quoted 26 lines · zhangfei
Quoted 23 lines · Sudeep Holla

This driver doesn't claim the IR transmitter to be wakeup source. It even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc Mauro Carvalho Chehab <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Guoxiong Yan <[email protected]>
---
   drivers/media/rc/ir-hix5hd2.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-hix5hd2.c +0 -0
index 1c087cb76815..d0549fba711c 100644
@@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
   		goto clkerr;
 
Quoted 9 lines

drivers/media/rc/ir-hix5hd2.c static int hix5hd2_ir_probe(struct platform_device *pdev) · line 263

Quoted 7 lines
drivers/media/rc/ir-hix5hd2.c +1 -1
   	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
-			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
+			     0, pdev->name, priv) < 0) {
   		dev_err(dev, "IRQ %d register failed\n", priv->irq);
   		ret = -EINVAL;
   		goto regerr;

ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND.

OK, but from the existing implementation of suspend/resume callbacks, I read that the clocks as well as the IP block is powered off. Is part of the logic always-on ?

Quoted 1 line

However, it is true the wakeup mechanism is not realized on hix5hd2 yet.

OK, then I assume you can add the right APIs(enable_irq_wake and friends) when you add that feature.

Quoted 2 lines

I am fine with either using IRQF_NO_SUSPEND or not.

No using IRQF_NO_SUSPEND for wakeup is simply wrong and hence this patch series removes all those misuse. If you need it as wakeup, then you need to use right APIs for that. Since I don't see any support for wakeup in this driver I decided to just remove the flag. Please feel free to add the support making use of right APIs.

Regards,
Sudeep

Acked-by
#63 lore raw

Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

Quoted 11 lines · Sudeep Holla
Quoted 8 lines · zhangfei
Quoted 5 lines · Sudeep Holla

This driver doesn't claim the IR transmitter to be wakeup source. It even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Cc Mauro Carvalho Chehab <[email protected]>
Cc Zhangfei Gao <[email protected]>
Cc Patrice Chotard <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Guoxiong Yan <[email protected]>
Quoted 32 lines
Quoted 13 lines
Quoted 13 lines
---
   drivers/media/rc/ir-hix5hd2.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-hix5hd2.c +0 -0
index 1c087cb76815..d0549fba711c 100644
@@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct
 platform_device *pdev)
           goto clkerr;
 
Quoted 9 lines
Quoted 7 lines
drivers/media/rc/ir-hix5hd2.c +1 -1
       if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
-                 IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
+                 0, pdev->name, priv) < 0) {
           dev_err(dev, "IRQ %d register failed\n", priv->irq);
           ret = -EINVAL;
           goto regerr;

ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND.

OK, but from the existing implementation of suspend/resume callbacks, I read that the clocks as well as the IP block is powered off. Is part of the logic always-on ?

Quoted 1 line

However, it is true the wakeup mechanism is not realized on hix5hd2 yet.

OK, then I assume you can add the right APIs(enable_irq_wake and friends) when you add that feature.

Quoted 8 lines
Quoted 2 lines

I am fine with either using IRQF_NO_SUSPEND or not.

No using IRQF_NO_SUSPEND for wakeup is simply wrong and hence this patch series removes all those misuse. If you need it as wakeup, then you need to use right APIs for that. Since I don't see any support for wakeup in this driver I decided to just remove the flag. Please feel free to add the support making use of right APIs.

Thanks Sudeep for the kind info.
Yes, you are right.

Thanks

#64 lore raw

PATCH 16/17 pinctrl: single: remove misuse of IRQF_NO_SUSPEND flag

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with irq_set_irq_wake instead.

---
 drivers/pinctrl/pinctrl-single.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +4 -3
index ef04b962c3d5..a5d0f0e52de1 100644
@@ -1615,12 +1615,14 @@ static void pcs_irq_unmask(struct irq_data *d)
  */
 static int pcs_irq_set_wake(struct irq_data *d, unsigned int state)
 {
+	struct pcs_soc_data *pcs_soc = irq_data_get_irq_chip_data(d);
+
 	if (state)
 		pcs_irq_unmask(d);
 	else
 		pcs_irq_mask(d);
 
-	return 0;
+	return irq_set_irq_wake(pcs_soc->irq, state);
 }
 
 /**
@@ -1755,8 +1757,7 @@ static int pcs_irq_init_chained_handler(struct pcs_device *pcs,
 		int res;
 
 		res = request_irq(pcs_soc->irq, pcs_irq_handler,
-				  IRQF_SHARED | IRQF_NO_SUSPEND |
-				  IRQF_NO_THREAD,
+				  IRQF_SHARED | IRQF_NO_THREAD,
 				  name, pcs_soc);
 		if (res) {
 			pcs_soc->irq = -1;
Signature · 1 line
1.9.1
#65 lore raw

Re: [PATCH 16/17] pinctrl: single: remove misuse of IRQF_NO_SUSPEND flag

Quoted 23 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with irq_set_irq_wake instead.

---
 drivers/pinctrl/pinctrl-single.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +0 -0
index ef04b962c3d5..a5d0f0e52de1 100644
@@ -1615,12 +1615,14 @@ static void pcs_irq_unmask(struct irq_data *d)
  */
 static int pcs_irq_set_wake(struct irq_data *d, unsigned int state)

drivers/pinctrl/pinctrl-single.c static void pcs_irq_unmask(struct irq_data *d) · line 1625

Quoted 10 lines
drivers/pinctrl/pinctrl-single.c +3 -1
 {
+	struct pcs_soc_data *pcs_soc = irq_data_get_irq_chip_data(d);
+
 	if (state)
 		pcs_irq_unmask(d);
 	else
 		pcs_irq_mask(d);
 
-	return 0;
+	return irq_set_irq_wake(pcs_soc->irq, state);

That's going to create at least a lockdep splat due to nesting irq_desc->lock.

Thanks,

tglx

#66 lore raw

Re: [PATCH 16/17] pinctrl: single: remove misuse of IRQF_NO_SUSPEND flag

Quoted 32 lines · Thomas Gleixner
Quoted 31 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with irq_set_irq_wake instead.

---
  drivers/pinctrl/pinctrl-single.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +2 -0
index ef04b962c3d5..a5d0f0e52de1 100644
@@ -1615,12 +1615,14 @@ static void pcs_irq_unmask(struct irq_data *d)
   */
  static int pcs_irq_set_wake(struct irq_data *d, unsigned int state)
  {
+	struct pcs_soc_data *pcs_soc = irq_data_get_irq_chip_data(d);
+
  	if (state)
  		pcs_irq_unmask(d);
  	else
  		pcs_irq_mask(d);
 
Quoted 6 lines

drivers/pinctrl/pinctrl-single.c static void pcs_irq_unmask(struct irq_data *d) · line 1625

Quoted 2 lines
drivers/pinctrl/pinctrl-single.c +1 -1
-	return 0;
+	return irq_set_irq_wake(pcs_soc->irq, state);

That's going to create at least a lockdep splat due to nesting irq_desc->lock.

Ah right, I noted that I must fix it when you pointed out similar issue on the other thread[1]. I forgot later, sorry will look into that.

Regards,
Sudeep

[1] https://lkml.org/lkml/2015/9/8/617

#67 lore raw

PATCH 17/17 mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

In reply to Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Linus Walleij <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 drivers/mfd/ab8500-core.c        | 11 +++++++++--
 drivers/mfd/ab8500-debugfs.c     |  2 +-
 drivers/mfd/ab8500-gpadc.c       | 15 +++++++++++----
 drivers/mfd/db8500-prcmu.c       | 24 +++++++++++++++++-------
 drivers/power/ab8500_btemp.c     |  6 ++++--
 drivers/power/ab8500_charger.c   |  6 ++++--
 drivers/power/ab8500_fg.c        |  9 ++++++---
 drivers/thermal/db8500_thermal.c |  5 ++---
 drivers/usb/phy/phy-ab8500-usb.c | 10 ++++++----
 9 files changed, 60 insertions(+), 28 deletions(-)

Hi Linus,

This just compile tested and need proper testing as the changes are more invasive compared to other patches in the series. Any review/testing is much appreciated.

Regards,
Sudeep

drivers/mfd/ab8500-core.c +9 -2
index fefbe4cfa61d..640c1854c953 100644
@@ -435,6 +435,13 @@ static int ab8500_irq_set_type(struct irq_data *data, unsigned int type)
 	return 0;
 }
 
+static int ab8500_irq_set_wake(struct irq_data *data, unsigned int on)
+{
+	struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data);
+
+	return irq_set_irq_wake(ab8500->irq, on);
+}
+
 static struct irq_chip ab8500_irq_chip = {
 	.name			= "ab8500",
 	.irq_bus_lock		= ab8500_irq_lock,
@@ -443,6 +450,7 @@ static struct irq_chip ab8500_irq_chip = {
 	.irq_disable		= ab8500_irq_mask,
 	.irq_unmask		= ab8500_irq_unmask,
 	.irq_set_type		= ab8500_irq_set_type,
+	.irq_set_wake		= ab8500_irq_set_wake,
 };
 
 static void update_latch_offset(u8 *offset, int i)
@@ -1744,8 +1752,7 @@ static int ab8500_probe(struct platform_device *pdev)
 		return ret;
 
 	ret = devm_request_threaded_irq(&pdev->dev, ab8500->irq, NULL,
-			ab8500_hierarchical_irq,
-			IRQF_ONESHOT | IRQF_NO_SUSPEND,
+			ab8500_hierarchical_irq, IRQF_ONESHOT,
 			"ab8500", ab8500);
 	if (ret)
 		return ret;
drivers/mfd/ab8500-debugfs.c +1 -1
index 0236cd7cdce4..9a2c37041b9e 100644
@@ -2885,7 +2885,7 @@ static ssize_t ab8500_subscribe_write(struct file *file,
 	}
 
 	err = request_threaded_irq(user_val, NULL, ab8500_debug_handler,
-				   IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT,
+				   IRQF_SHARED | IRQF_ONESHOT,
 				   "ab8500-debug", &dev->kobj);
 	if (err < 0) {
 		pr_info("request_threaded_irq failed %d, %lu\n",
drivers/mfd/ab8500-gpadc.c +11 -4
index c51c1b188d64..69a8122a334f 100644
@@ -948,7 +948,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 	if (gpadc->irq_sw >= 0) {
 		ret = request_threaded_irq(gpadc->irq_sw, NULL,
 			ab8500_bm_gpadcconvend_handler,
-			IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
+			IRQF_SHARED | IRQF_ONESHOT,
 			"ab8500-gpadc-sw",
 			gpadc);
 		if (ret < 0) {
@@ -962,7 +962,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 	if (gpadc->irq_hw >= 0) {
 		ret = request_threaded_irq(gpadc->irq_hw, NULL,
 			ab8500_bm_gpadcconvend_handler,
-			IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
+			IRQF_SHARED | IRQF_ONESHOT,
 			"ab8500-gpadc-hw",
 			gpadc);
 		if (ret < 0) {
@@ -994,6 +994,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 	pm_runtime_set_active(gpadc->dev);
 	pm_runtime_enable(gpadc->dev);
 
+	enable_irq_wake(gpadc->irq_sw);
+	enable_irq_wake(gpadc->irq_hw);
+
 	ab8500_gpadc_read_calibration_data(gpadc);
 	list_add_tail(&gpadc->node, &ab8500_gpadc_list);
 	dev_dbg(gpadc->dev, "probe success\n");
@@ -1015,10 +1018,14 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
 	/* remove this gpadc entry from the list */
 	list_del(&gpadc->node);
 	/* remove interrupt  - completion of Sw ADC conversion */
-	if (gpadc->irq_sw >= 0)
+	if (gpadc->irq_sw >= 0) {
+		disable_irq_wake(gpadc->irq_sw);
 		free_irq(gpadc->irq_sw, gpadc);
-	if (gpadc->irq_hw >= 0)
+	}
+	if (gpadc->irq_hw >= 0) {
+		disable_irq_wake(gpadc->irq_hw);
 		free_irq(gpadc->irq_hw, gpadc);
+	}
 
 	pm_runtime_get_sync(gpadc->dev);
 	pm_runtime_disable(gpadc->dev);
drivers/mfd/db8500-prcmu.c +17 -7
index e6e4bacb09ee..d568ecd66f7e 100644
@@ -266,6 +266,7 @@ static struct {
 } fw_info;
 
 static struct irq_domain *db8500_irq_domain;
+static int prcmu_irq;
 
 /*
  * This vector maps irq numbers to the bits in the bit field used in
@@ -2599,12 +2600,20 @@ static void noop(struct irq_data *d)
 {
 }
 
+static int prcmu_irq_set_wake(struct irq_data *data, unsigned int on)
+{
+	int *irq = irq_data_get_irq_chip_data(data);
+
+	return irq_set_irq_wake(*irq, on);
+}
+
 static struct irq_chip prcmu_irq_chip = {
 	.name		= "prcmu",
 	.irq_disable	= prcmu_irq_mask,
 	.irq_ack	= noop,
 	.irq_mask	= prcmu_irq_mask,
 	.irq_unmask	= prcmu_irq_unmask,
+	.irq_set_wake	= prcmu_irq_set_wake,
 };
 
 static __init char *fw_project_name(u32 project)
@@ -2652,6 +2661,7 @@ static __init char *fw_project_name(u32 project)
 static int db8500_irq_map(struct irq_domain *d, unsigned int virq,
 				irq_hw_number_t hwirq)
 {
+	irq_set_chip_data(virq, d->host_data);
 	irq_set_chip_and_handler(virq, &prcmu_irq_chip,
 				handle_simple_irq);
 
@@ -2669,7 +2679,7 @@ static int db8500_irq_init(struct device_node *np)
 
 	db8500_irq_domain = irq_domain_add_simple(
 		np, NUM_PRCMU_WAKEUPS, 0,
-		&db8500_irq_ops, NULL);
+		&db8500_irq_ops, &prcmu_irq);
 
 	if (!db8500_irq_domain) {
 		pr_err("Failed to create irqdomain\n");
@@ -3134,7 +3144,7 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev);
-	int irq = 0, err = 0;
+	int err = 0;
 	struct resource *res;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu");
@@ -3166,14 +3176,14 @@ static int db8500_prcmu_probe(struct platform_device *pdev)
 	/* Clean up the mailbox interrupts after pre-kernel code. */
 	writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
+	prcmu_irq = platform_get_irq(pdev, 0);
+	if (prcmu_irq <= 0) {
 		dev_err(&pdev->dev, "no prcmu irq provided\n");
-		return irq;
+		return prcmu_irq;
 	}
 
-	err = request_threaded_irq(irq, prcmu_irq_handler,
-	        prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL);
+	err = request_threaded_irq(prcmu_irq, prcmu_irq_handler,
+				   prcmu_irq_thread_fn, 0, "prcmu", NULL);
 	if (err < 0) {
 		pr_err("prcmu: Failed to allocate IRQ_DB8500_PRCMU1.\n");
 		return err;
drivers/power/ab8500_btemp.c +4 -2
index 8f8044e1acf3..ab838b35c7be 100644
@@ -1032,6 +1032,7 @@ static int ab8500_btemp_remove(struct platform_device *pdev)
 	/* Disable interrupts */
 	for (i = 0; i < ARRAY_SIZE(ab8500_btemp_irq); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name);
+		disable_irq_wake(irq);
 		free_irq(irq, di);
 	}
 
@@ -1149,14 +1150,14 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(ab8500_btemp_irq); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name);
 		ret = request_threaded_irq(irq, NULL, ab8500_btemp_irq[i].isr,
-			IRQF_SHARED | IRQF_NO_SUSPEND,
-			ab8500_btemp_irq[i].name, di);
+			IRQF_SHARED, ab8500_btemp_irq[i].name, di);
 
 		if (ret) {
 			dev_err(di->dev, "failed to request %s IRQ %d: %d\n"
 				, ab8500_btemp_irq[i].name, irq, ret);
 			goto free_irq;
 		}
+		enable_irq_wake(irq);
 		dev_dbg(di->dev, "Requested %s IRQ %d: %d\n",
 			ab8500_btemp_irq[i].name, irq, ret);
 	}
@@ -1175,6 +1176,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
 	/* We also have to free all successfully registered irqs */
 	for (i = i - 1; i >= 0; i--) {
 		irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name);
+		disable_irq_wake(irq);
 		free_irq(irq, di);
 	}
 free_btemp_wq:
drivers/power/ab8500_charger.c +4 -2
index e388171f4e58..734fe43181ab 100644
@@ -3406,6 +3406,7 @@ static int ab8500_charger_remove(struct platform_device *pdev)
 	/* Disable interrupts */
 	for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name);
+		disable_irq_wake(irq);
 		free_irq(irq, di);
 	}
 
@@ -3680,14 +3681,14 @@ static int ab8500_charger_probe(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name);
 		ret = request_threaded_irq(irq, NULL, ab8500_charger_irq[i].isr,
-			IRQF_SHARED | IRQF_NO_SUSPEND,
-			ab8500_charger_irq[i].name, di);
+			IRQF_SHARED, ab8500_charger_irq[i].name, di);
 
 		if (ret != 0) {
 			dev_err(di->dev, "failed to request %s IRQ %d: %d\n"
 				, ab8500_charger_irq[i].name, irq, ret);
 			goto free_irq;
 		}
+		enable_irq_wake(irq);
 		dev_dbg(di->dev, "Requested %s IRQ %d: %d\n",
 			ab8500_charger_irq[i].name, irq, ret);
 	}
@@ -3721,6 +3722,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
 	/* We also have to free all successfully registered irqs */
 	for (i = i - 1; i >= 0; i--) {
 		irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name);
+		disable_irq_wake(irq);
 		free_irq(irq, di);
 	}
 put_usb_phy:
drivers/power/ab8500_fg.c +6 -3
index 3830dade5d69..8f0193e7c42c 100644
@@ -3168,14 +3168,14 @@ static int ab8500_fg_probe(struct platform_device *pdev)
 	for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name);
 		ret = request_irq(irq, ab8500_fg_irq_th[i].isr,
-				  IRQF_SHARED | IRQF_NO_SUSPEND,
-				  ab8500_fg_irq_th[i].name, di);
+				  IRQF_SHARED, ab8500_fg_irq_th[i].name, di);
 
 		if (ret != 0) {
 			dev_err(di->dev, "failed to request %s IRQ %d: %d\n",
 				ab8500_fg_irq_th[i].name, irq, ret);
 			goto free_irq;
 		}
+		enable_irq_wake(irq);
 		dev_dbg(di->dev, "Requested %s IRQ %d: %d\n",
 			ab8500_fg_irq_th[i].name, irq, ret);
 	}
@@ -3183,7 +3183,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
 	/* Register threaded interrupt handler */
 	irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name);
 	ret = request_threaded_irq(irq, NULL, ab8500_fg_irq_bh[0].isr,
-				IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT,
+				IRQF_SHARED | IRQF_ONESHOT,
 			ab8500_fg_irq_bh[0].name, di);
 
 	if (ret != 0) {
@@ -3191,6 +3191,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
 			ab8500_fg_irq_bh[0].name, irq, ret);
 		goto free_irq;
 	}
+	enable_irq_wake(irq);
 	dev_dbg(di->dev, "Requested %s IRQ %d: %d\n",
 		ab8500_fg_irq_bh[0].name, irq, ret);
 
@@ -3233,9 +3234,11 @@ static int ab8500_fg_probe(struct platform_device *pdev)
 	/* We also have to free all registered irqs */
 	for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) {
 		irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name);
+		disable_irq_wake(irq);
 		free_irq(irq, di);
 	}
 	irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name);
+	disable_irq_wake(irq);
 	free_irq(irq, di);
 free_inst_curr_wq:
 	destroy_workqueue(di->fg_wq);
drivers/thermal/db8500_thermal.c +2 -3
index 652acd8fbe48..27b534374d29 100644
@@ -423,8 +423,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, low_irq, NULL,
-		prcmu_low_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
-		"dbx500_temp_low", pzone);
+		prcmu_low_irq_handler, IRQF_ONESHOT, "dbx500_temp_low", pzone);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to allocate temp low irq.\n");
 		goto out_unlock;
@@ -438,7 +437,7 @@ static int db8500_thermal_probe(struct platform_device *pdev)
 	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, high_irq, NULL,
-		prcmu_high_irq_handler, IRQF_NO_SUSPEND | IRQF_ONESHOT,
+		prcmu_high_irq_handler, IRQF_ONESHOT,
 		"dbx500_temp_high", pzone);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to allocate temp high irq.\n");
drivers/usb/phy/phy-ab8500-usb.c +6 -4
index 0c912d3950a5..425bb4e171e7 100644
@@ -1179,12 +1179,13 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
 		}
 		err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 				ab8500_usb_link_status_irq,
-				IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
+				IRQF_SHARED | IRQF_ONESHOT,
 				"usb-link-status", ab);
 		if (err < 0) {
 			dev_err(ab->dev, "request_irq failed for link status irq\n");
 			return err;
 		}
+		enable_irq_wake(irq);
 	}
 
 	if (ab->flags & AB8500_USB_FLAG_USE_ID_WAKEUP_IRQ) {
@@ -1195,12 +1196,12 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
 		}
 		err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 				ab8500_usb_disconnect_irq,
-				IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
-				"usb-id-fall", ab);
+				IRQF_SHARED | IRQF_ONESHOT, "usb-id-fall", ab);
 		if (err < 0) {
 			dev_err(ab->dev, "request_irq failed for ID fall irq\n");
 			return err;
 		}
+		enable_irq_wake(irq);
 	}
 
 	if (ab->flags & AB8500_USB_FLAG_USE_VBUS_DET_IRQ) {
@@ -1211,12 +1212,13 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
 		}
 		err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 				ab8500_usb_disconnect_irq,
-				IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
+				IRQF_SHARED | IRQF_ONESHOT,
 				"usb-vbus-fall", ab);
 		if (err < 0) {
 			dev_err(ab->dev, "request_irq failed for Vbus fall irq\n");
 			return err;
 		}
+		enable_irq_wake(irq);
 	}
 
 	return 0;
Signature · 1 line
1.9.1
#68 lore raw

Re: [PATCH 17/17] mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

Quoted 12 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Linus Walleij <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Quoted 11 lines
---
 drivers/mfd/ab8500-core.c        | 11 +++++++++--
 drivers/mfd/ab8500-debugfs.c     |  2 +-
 drivers/mfd/ab8500-gpadc.c       | 15 +++++++++++----
 drivers/mfd/db8500-prcmu.c       | 24 +++++++++++++++++-------
 drivers/power/ab8500_btemp.c     |  6 ++++--
 drivers/power/ab8500_charger.c   |  6 ++++--
 drivers/power/ab8500_fg.c        |  9 ++++++---
 drivers/thermal/db8500_thermal.c |  5 ++---
 drivers/usb/phy/phy-ab8500-usb.c | 10 ++++++----
 9 files changed, 60 insertions(+), 28 deletions(-)

Is there a reason for bundling the changes in all of these subsystems together into a single patch?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#69 lore raw

Re: [PATCH 17/17] mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

Quoted 26 lines · Lee Jones
Quoted 12 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Linus Walleij <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Quoted 11 lines
---
  drivers/mfd/ab8500-core.c        | 11 +++++++++--
  drivers/mfd/ab8500-debugfs.c     |  2 +-
  drivers/mfd/ab8500-gpadc.c       | 15 +++++++++++----
  drivers/mfd/db8500-prcmu.c       | 24 +++++++++++++++++-------
  drivers/power/ab8500_btemp.c     |  6 ++++--
  drivers/power/ab8500_charger.c   |  6 ++++--
  drivers/power/ab8500_fg.c        |  9 ++++++---
  drivers/thermal/db8500_thermal.c |  5 ++---
  drivers/usb/phy/phy-ab8500-usb.c | 10 ++++++----
  9 files changed, 60 insertions(+), 28 deletions(-)
Quoted 3 lines

Is there a reason for bundling the changes in all of these subsystems together into a single patch?

No, I understand this needs to be split. Since I was not 100% confident about this change, I wanted LinusW to review and provide feedback and gets things working before I can split this changes. I must have added RFC, but usually it gets ignored :)

Regards,
Sudeep

#70 lore raw

Re: [PATCH 17/17] mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

Quoted 27 lines · Sudeep Holla
Quoted 26 lines · Lee Jones
Quoted 23 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Linus Walleij <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 drivers/mfd/ab8500-core.c        | 11 +++++++++--
 drivers/mfd/ab8500-debugfs.c     |  2 +-
 drivers/mfd/ab8500-gpadc.c       | 15 +++++++++++----
 drivers/mfd/db8500-prcmu.c       | 24 +++++++++++++++++-------
 drivers/power/ab8500_btemp.c     |  6 ++++--
 drivers/power/ab8500_charger.c   |  6 ++++--
 drivers/power/ab8500_fg.c        |  9 ++++++---
 drivers/thermal/db8500_thermal.c |  5 ++---
 drivers/usb/phy/phy-ab8500-usb.c | 10 ++++++----
 9 files changed, 60 insertions(+), 28 deletions(-)
Quoted 8 lines
Quoted 3 lines

Is there a reason for bundling the changes in all of these subsystems together into a single patch?

No, I understand this needs to be split. Since I was not 100% confident about this change, I wanted LinusW to review and provide feedback and gets things working before I can split this changes. I must have added RFC, but usually it gets ignored :)

Best if Linus reviews the correct patch-set. Please split and resubmit.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#71 lore raw

Re: [PATCH 17/17] mfd : ab8500/db8500: fix the abuse of IRQF_NO_SUSPEND

Quoted 32 lines · Lee Jones
Quoted 31 lines · Sudeep Holla
Quoted 29 lines · Lee Jones
Quoted 12 lines · Sudeep Holla

The IRQF_NO_SUSPEND flag is used to identify the interrupts that should be left enabled so as to allow them to work as expected during the suspend-resume cycle, but doesn't guarantee that it will wake the system from a suspended state, enable_irq_wake is recommended to be used for the wakeup.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with enable_irq_wake instead.

Cc Linus Walleij <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Quoted 11 lines
---
  drivers/mfd/ab8500-core.c        | 11 +++++++++--
  drivers/mfd/ab8500-debugfs.c     |  2 +-
  drivers/mfd/ab8500-gpadc.c       | 15 +++++++++++----
  drivers/mfd/db8500-prcmu.c       | 24 +++++++++++++++++-------
  drivers/power/ab8500_btemp.c     |  6 ++++--
  drivers/power/ab8500_charger.c   |  6 ++++--
  drivers/power/ab8500_fg.c        |  9 ++++++---
  drivers/thermal/db8500_thermal.c |  5 ++---
  drivers/usb/phy/phy-ab8500-usb.c | 10 ++++++----
  9 files changed, 60 insertions(+), 28 deletions(-)

Is there a reason for bundling the changes in all of these subsystems together into a single patch?

Quoted 8 lines
Quoted 4 lines

No, I understand this needs to be split. Since I was not 100% confident about this change, I wanted LinusW to review and provide feedback and gets things working before I can split this changes. I must have added RFC, but usually it gets ignored :)

Best if Linus reviews the correct patch-set. Please split and resubmit.

Sure, but would like to get some feedback before I proceed just to ensure my understanding is correct.

Regards,
Sudeep