Skip to contentSkip to conversation

ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

RFC PATCH Superseded Chen Yu 3 participants 11 messages Aug 10, 2015 – Sep 28, 2015 ACPI

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Chen Yu

author
#0 lore raw

RFC PATCH 1/1 ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

For ACPI compatible system, SCI(ACPI System Control Interrupt) is used to wake system up from suspend-to-idle. Once CPU is woken up by SCI, interrupt handler will firstly checks if current interrupt is legal to wake up the whole system, thus irq_pm_check_wakeup is invoked to validate the irq number. However, before suspend-to-idle, acpi_gbl_FADT.sci_interrupt is marked rather than actual irq number in acpi_freeze_prepare, this might lead to unable to wake up the system.

This patch fixes this problem by marking the irq number return by acpi_gsi_to_irq as IRQD_WAKEUP_STATE, rather than marking the acpi_gbl_FADT.sci_interrupt.

---
 drivers/acpi/osl.c   |  5 ++++-
 drivers/acpi/sleep.c | 20 ++++++++++++++++++--
 drivers/acpi/sleep.h |  5 +++++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/acpi/osl.c +4 -1
index 3b8963f..8e1420a 100644
@@ -49,6 +49,7 @@
 #include <asm/uaccess.h>
 
 #include "internal.h"
+#include "sleep.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES
 ACPI_MODULE_NAME("osl");
@@ -850,7 +851,9 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
 		       gsi);
 		return AE_OK;
 	}
-
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif
 	acpi_irq_handler = handler;
 	acpi_irq_context = context;
 	if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
drivers/acpi/sleep.c +18 -2
index 2f0d4db..9e7b54e 100644
@@ -620,6 +620,22 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
 	.end = acpi_pm_end,
 	.recover = acpi_pm_finish,
 };
+static int wake_irq_freeze = -EINVAL;
+
+int get_wake_irq_freeze(void)
+{
+	if (IS_ERR_VALUE(wake_irq_freeze))
+		return acpi_gbl_FADT.sci_interrupt;
+	else
+		return wake_irq_freeze;
+}
+EXPORT_SYMBOL_GPL(get_wake_irq_freeze);
+
+void set_wake_irq_freeze(unsigned int irq)
+{
+	wake_irq_freeze = (int)irq;
+}
+EXPORT_SYMBOL_GPL(set_wake_irq_freeze);
 
 static int acpi_freeze_begin(void)
 {
@@ -632,14 +648,14 @@ static int acpi_freeze_prepare(void)
 	acpi_enable_wakeup_devices(ACPI_STATE_S0);
 	acpi_enable_all_wakeup_gpes();
 	acpi_os_wait_events_complete();
-	enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	enable_irq_wake(get_wake_irq_freeze());
 	return 0;
 }
 
 static void acpi_freeze_restore(void)
 {
 	acpi_disable_wakeup_devices(ACPI_STATE_S0);
-	disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	disable_irq_wake(get_wake_irq_freeze());
 	acpi_enable_all_runtime_gpes();
 }
 
drivers/acpi/sleep.h +5 -0
index c797ffa..eca4fda 100644
@@ -6,3 +6,8 @@ extern struct list_head acpi_wakeup_device_list;
 extern struct mutex acpi_device_lock;
 
 extern void acpi_resume_power_resources(void);
+
+#ifdef CONFIG_SUSPEND
+extern int get_wake_irq_freeze(void);
+extern void set_wake_irq_freeze(unsigned int irq);
+#endif
Signature · 1 line
2.1.4
#1 lore raw
Quoted 10 lines · Chen Yu

For ACPI compatible system, SCI(ACPI System Control Interrupt) is used to wake system up from suspend-to-idle. Once CPU is woken up by SCI, interrupt handler will firstly checks if current interrupt is legal to wake up the whole system, thus irq_pm_check_wakeup is invoked to validate the irq number. However, before suspend-to-idle, acpi_gbl_FADT.sci_interrupt is marked rather than actual irq number in acpi_freeze_prepare, this might lead to unable to wake up the system.

Quoted 5 lines

This patch fixes this problem by marking the irq number return by acpi_gsi_to_irq as IRQD_WAKEUP_STATE, rather than marking the acpi_gbl_FADT.sci_interrupt.

That would only really matter if GPE devices were used, but I've never seen a system using them in practice, so this is more of a theoretical issue.

Quoted 19 lines
---
 drivers/acpi/osl.c   |  5 ++++-
 drivers/acpi/sleep.c | 20 ++++++++++++++++++--
 drivers/acpi/sleep.h |  5 +++++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/acpi/osl.c +1 -0
index 3b8963f..8e1420a 100644
@@ -49,6 +49,7 @@
 #include <asm/uaccess.h>
 
 #include "internal.h"
+#include "sleep.h"
 
 #define _COMPONENT		ACPI_OS_SERVICES
 ACPI_MODULE_NAME("osl");

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, · line 856

Quoted 7 lines
drivers/acpi/osl.c +3 -1
@@ -850,7 +851,9 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
 		       gsi);
 		return AE_OK;
 	}
-
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif

Please don't use #ifdefs in function bodies. You can use IS_ENABLED() for that.

drivers/acpi/sleep.c static const struct platform_suspend_ops acpi_suspend_ops_old = { · line 623

Quoted 12 lines
drivers/acpi/osl.c +0 -0
 	acpi_irq_handler = handler;
 	acpi_irq_context = context;
 	if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
drivers/acpi/sleep.c +1 -0
index 2f0d4db..9e7b54e 100644
@@ -620,6 +620,22 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = {
 	.end = acpi_pm_end,
 	.recover = acpi_pm_finish,
 };
+static int wake_irq_freeze = -EINVAL;

There may be more than one of these in theory.

drivers/acpi/sleep.c static const struct platform_suspend_ops acpi_suspend_ops_old = { · line 630

Quoted 7 lines
drivers/acpi/sleep.c +7 -0
+
+int get_wake_irq_freeze(void)
+{
+	if (IS_ERR_VALUE(wake_irq_freeze))
+		return acpi_gbl_FADT.sci_interrupt;
+	else
+		return wake_irq_freeze;

That would look better this way IMO:

	return IS_ERR_VALUE(wake_irq_freeze) ?
		acpi_gbl_FADT.sci_interrupt : wake_irq_freeze;
Quoted 33 lines
drivers/acpi/sleep.c +10 -2
+}
+EXPORT_SYMBOL_GPL(get_wake_irq_freeze);
+
+void set_wake_irq_freeze(unsigned int irq)
+{
+	wake_irq_freeze = (int)irq;
+}
+EXPORT_SYMBOL_GPL(set_wake_irq_freeze);
 
 static int acpi_freeze_begin(void)
 {
@@ -632,14 +648,14 @@ static int acpi_freeze_prepare(void)
 	acpi_enable_wakeup_devices(ACPI_STATE_S0);
 	acpi_enable_all_wakeup_gpes();
 	acpi_os_wait_events_complete();
-	enable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	enable_irq_wake(get_wake_irq_freeze());
 	return 0;
 }
 
 static void acpi_freeze_restore(void)
 {
 	acpi_disable_wakeup_devices(ACPI_STATE_S0);
-	disable_irq_wake(acpi_gbl_FADT.sci_interrupt);
+	disable_irq_wake(get_wake_irq_freeze());
 	acpi_enable_all_runtime_gpes();
 }
 
drivers/acpi/sleep.h +0 -0
index c797ffa..eca4fda 100644

drivers/acpi/sleep.h extern struct list_head acpi_wakeup_device_list; · line 13

Quoted 8 lines
drivers/acpi/sleep.h +5 -0
@@ -6,3 +6,8 @@ extern struct list_head acpi_wakeup_device_list;
 extern struct mutex acpi_device_lock;
 
 extern void acpi_resume_power_resources(void);
+
+#ifdef CONFIG_SUSPEND
+extern int get_wake_irq_freeze(void);
+extern void set_wake_irq_freeze(unsigned int irq);
+#endif

Is the #ifdef needed here at all?

Thanks,
Rafael

author
#2 lore raw

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 9 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 6 lines
Quoted 1 line · Chen Yu

That would only really matter if GPE devices were used, but I've never seen a system using them in practice, so this is more of a theoretical issue.

I haven't encountered this problem, just find this suspicious when I was doing some other debugging.

Quoted 12 lines

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi,

Quoted 11 lines
---
 drivers/acpi/osl.c   |  5 ++++-
 drivers/acpi/sleep.c | 20 ++++++++++++++++++--  drivers/acpi/sleep.h
|  5 +++++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/acpi/osl.c index renamed from drivers/acpi/osl.c +0 -0

3b8963f..8e1420a 100644

drivers/acpi/osl.c +0 -0
@@ -850,7 +851,9 @@ acpi_os_install_interrupt_handler(u32 gsi,

acpi_osd_handler handler,

Quoted 11 lines

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, · line 856

Quoted 7 lines
drivers/acpi/osl.c +3 -1
 		       gsi);
 		return AE_OK;
 	}
-
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif

Please don't use #ifdefs in function bodies. You can use IS_ENABLED() for that.

OK, will do.

Quoted 9 lines

drivers/acpi/sleep.c static const struct platform_suspend_ops

Quoted 8 lines
drivers/acpi/osl.c +0 -0
 	acpi_irq_handler = handler;
 	acpi_irq_context = context;
 	if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
drivers/acpi/sleep.c index renamed from drivers/acpi/sleep.c +0 -0

2f0d4db..9e7b54e 100644

drivers/acpi/sleep.c +0 -0
@@ -620,6 +620,22 @@ static const struct platform_suspend_ops

acpi_suspend_ops_old = {

Quoted 7 lines

drivers/acpi/sleep.c static const struct platform_suspend_ops acpi_suspend_ops_old = { · line 623

Quoted 4 lines
drivers/acpi/sleep.c +1 -0
 	.end = acpi_pm_end,
 	.recover = acpi_pm_finish,
 };
+static int wake_irq_freeze = -EINVAL;

There may be more than one of these in theory.

Oh, do you mean the naming for this variable is un-suitable? OK, I'll change it to acpi_freeze_wake_irq

Quoted 10 lines

drivers/acpi/sleep.c static const struct platform_suspend_ops acpi_suspend_ops_old = { · line 630

Quoted 7 lines
drivers/acpi/sleep.c +7 -0
+
+int get_wake_irq_freeze(void)
+{
+	if (IS_ERR_VALUE(wake_irq_freeze))
+		return acpi_gbl_FADT.sci_interrupt;
+	else
+		return wake_irq_freeze;

That would look better this way IMO:

Quoted 3 lines
	return IS_ERR_VALUE(wake_irq_freeze) ?
		acpi_gbl_FADT.sci_interrupt : wake_irq_freeze;

OK, will do.

Quoted 7 lines
Quoted 7 lines
drivers/acpi/sleep.h index renamed from drivers/acpi/sleep.h +0 -0

c797ffa..eca4fda 100644

drivers/acpi/sleep.h +0 -0
@@ -6,3 +6,8 @@ extern struct list_head acpi_wakeup_device_list;
 extern struct mutex acpi_device_lock;
 
Quoted 8 lines

drivers/acpi/sleep.h extern struct list_head acpi_wakeup_device_list;

Quoted 5 lines
drivers/acpi/sleep.h +4 -0
 extern void acpi_resume_power_resources(void);
+
+#ifdef CONFIG_SUSPEND
+extern int get_wake_irq_freeze(void); extern void
+set_wake_irq_freeze(unsigned int irq); #endif

Is the #ifdef needed here at all?

Will delete the #ifdef

Best Regards,
Yu

#3 lore raw
Quoted 11 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 9 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 8 lines
Quoted 6 lines · Chen Yu
Quoted 1 line

That would only really matter if GPE devices were used, but I've never seen a system using them in practice, so this is more of a theoretical issue.

I haven't encountered this problem, just find this suspicious when I was doing some other debugging.

In fact what I said was incorrect. You might encounter this problem if the ACPI interrupt has been remapped and not when GPE devices are used.

Quoted 23 lines
Quoted 12 lines

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi,

Quoted 11 lines
---
 drivers/acpi/osl.c   |  5 ++++-
 drivers/acpi/sleep.c | 20 ++++++++++++++++++--  drivers/acpi/sleep.h
|  5 +++++
 3 files changed, 27 insertions(+), 3 deletions(-)
drivers/acpi/osl.c index renamed from drivers/acpi/osl.c +0 -0

3b8963f..8e1420a 100644

drivers/acpi/osl.c +0 -0
@@ -850,7 +851,9 @@ acpi_os_install_interrupt_handler(u32 gsi,

acpi_osd_handler handler,

Quoted 11 lines

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, · line 856

Quoted 7 lines
drivers/acpi/osl.c +3 -1
 		       gsi);
 		return AE_OK;
 	}
-
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif

Please don't use #ifdefs in function bodies. You can use IS_ENABLED() for that.

Quoted 1 line

OK, will do.

Alternatively, you can define an empty static inline stub of set_wake_irq_freeze() for CONFIG_SUSPEND and avoid using IS_ENABLED() even.

But I'd rather define a global acpi_irq variable, store irq in it and access it directly from acpi_freeze_prepare(). And it doesn't have to depend on CONFIG_SUSPEND as it is just the IRQ number actually used by ACPI.

BTW, I wonder if there are other places using acpi_gbl_FADT.sci_interrupt directly which they shouldn't do?

Quoted 14 lines
Quoted 14 lines

drivers/acpi/sleep.c static const struct platform_suspend_ops

Quoted 8 lines
drivers/acpi/osl.c +0 -0
 	acpi_irq_handler = handler;
 	acpi_irq_context = context;
 	if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
drivers/acpi/sleep.c index renamed from drivers/acpi/sleep.c +0 -0

2f0d4db..9e7b54e 100644

drivers/acpi/sleep.c +0 -0
@@ -620,6 +620,22 @@ static const struct platform_suspend_ops

acpi_suspend_ops_old = {

Quoted 4 lines
drivers/acpi/sleep.c +1 -0
 	.end = acpi_pm_end,
 	.recover = acpi_pm_finish,
 };
+static int wake_irq_freeze = -EINVAL;
Quoted 4 lines
Quoted 2 lines

There may be more than one of these in theory.

Oh, do you mean the naming for this variable is un-suitable? OK, I'll change it to acpi_freeze_wake_irq

No. What I mean is that in theory there may be multiple ACPI interrupts.

But you need not care about this case because of the

	if (gsi != acpi_gbl_FADT.sci_interrupt)
		return AE_BAD_PARAMETER;

check in acpi_os_install_interrupt_handler().

Thanks,
Rafael

author
#4 lore raw

Hi, Rafael,

Quoted 31 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 11 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 9 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 4 lines
Quoted 4 lines · Chen Yu

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, · line 856

Quoted 3 lines
drivers/acpi/osl.c +3 -0
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif

Alternatively, you can define an empty static inline stub of set_wake_irq_freeze() for CONFIG_SUSPEND and avoid using IS_ENABLED() even.

Quoted 4 lines

But I'd rather define a global acpi_irq variable, store irq in it and access it directly from acpi_freeze_prepare(). And it doesn't have to depend on CONFIG_SUSPEND as it is just the IRQ number actually used by ACPI.

OK, I've convert it to a global variable acpi_inuse_irq.

Quoted 3 lines

BTW, I wonder if there are other places using acpi_gbl_FADT.sci_interrupt directly which they shouldn't do?

I searched the code and found there are two other potential misuse of acpi_gbl_FADT.sci_interrupt, they are in acpi_os_remove_interrupt_handler and acpi_os_wait_events_complete, so I sent out a version 2 patch for them.

Quoted 11 lines
Quoted 2 lines

Oh, do you mean the naming for this variable is un-suitable? OK, I'll change it to acpi_freeze_wake_irq

No. What I mean is that in theory there may be multiple ACPI interrupts.

But you need not care about this case because of the

	if (gsi != acpi_gbl_FADT.sci_interrupt)
		return AE_BAD_PARAMETER;

check in acpi_os_install_interrupt_handler().

OK, thanks!

Best Regards,
Yu

#5 lore raw
Quoted 33 lines · Yu C

Hi, Rafael,

Quoted 31 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 11 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 9 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 4 lines
Quoted 4 lines · Chen Yu

drivers/acpi/osl.c acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, · line 856

Quoted 3 lines
drivers/acpi/osl.c +3 -0
+#ifdef CONFIG_SUSPEND
+	set_wake_irq_freeze(irq);
+#endif

Alternatively, you can define an empty static inline stub of set_wake_irq_freeze() for CONFIG_SUSPEND and avoid using IS_ENABLED() even.

Quoted 5 lines
Quoted 4 lines

But I'd rather define a global acpi_irq variable, store irq in it and access it directly from acpi_freeze_prepare(). And it doesn't have to depend on CONFIG_SUSPEND as it is just the IRQ number actually used by ACPI.

OK, I've convert it to a global variable acpi_inuse_irq.

Why do you need the "inuse" part? Why is acpi_irq not sufficient?

Quoted 7 lines
Quoted 3 lines

BTW, I wonder if there are other places using acpi_gbl_FADT.sci_interrupt directly which they shouldn't do?

I searched the code and found there are two other potential misuse of acpi_gbl_FADT.sci_interrupt, they are in acpi_os_remove_interrupt_handler and acpi_os_wait_events_complete, so I sent out a version 2 patch for them.

OK, thanks!

Rafael

author
#6 lore raw

Hi, Rafael,

Quoted 38 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Sunday, September 27, 2015 9:30 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 27 lines · Yu C

Hi, Rafael,

Quoted 25 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 13 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 11 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

On Monday, August 10, 2015 10:11:26 AM Chen Yu wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

But I'd rather define a global acpi_irq variable, store irq in it and access it directly from acpi_freeze_prepare(). And it doesn't have to depend on CONFIG_SUSPEND as it is just the IRQ number

actually used by ACPI.

Quoted 2 lines
Quoted 1 line

OK, I've convert it to a global variable acpi_inuse_irq.

Why do you need the "inuse" part? Why is acpi_irq not sufficient?

Because the name of acpi_irq is already used by acpi irq handler at drivers/acpi/osl.c:
request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)

Thanks
Yu

#7 lore raw
Quoted 43 lines · Yu C

Hi, Rafael,

Quoted 41 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Sunday, September 27, 2015 9:30 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 30 lines · Yu C

Hi, Rafael,

Quoted 28 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 13 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 11 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

On Monday, August 10, 2015 10:11:26 AM Chen Yu wrote:

But I'd rather define a global acpi_irq variable, store irq in it and access it directly from acpi_freeze_prepare(). And it doesn't have to depend on CONFIG_SUSPEND as it is just the IRQ number

Quoted 8 lines
Quoted 5 lines

actually used by ACPI.

Quoted 2 lines
Quoted 1 line

OK, I've convert it to a global variable acpi_inuse_irq.

Why do you need the "inuse" part? Why is acpi_irq not sufficient?

Because the name of acpi_irq is already used by acpi irq handler at drivers/acpi/osl.c:
request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)

Ah, this is the name of the handler. I forgot about that, sorry.

Well, it might be worth renaming the handler to something like acpi_interrupt(), then.

Thanks,
Rafael

author
#8 lore raw

Hi,

Quoted 51 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Monday, September 28, 2015 8:56 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 41 lines · Yu C

Hi, Rafael,

Quoted 39 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Sunday, September 27, 2015 9:30 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 28 lines · Yu C

Hi, Rafael,

Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 13 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 11 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

On Monday, August 10, 2015 10:11:26 AM Chen Yu wrote:

Quoted 8 lines
Quoted 3 lines

Because the name of acpi_irq is already used by acpi irq handler at drivers/acpi/osl.c:
request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)

Ah, this is the name of the handler. I forgot about that, sorry.

Well, it might be worth renaming the handler to something like acpi_interrupt(), then.

OK, will rewrite the patch, Thanks!

Best Regards,
Yu

#9 lore raw

Hi,

Quoted 57 lines · Yu C

Hi,

Quoted 55 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Monday, September 28, 2015 8:56 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 44 lines · Yu C

Hi, Rafael,

Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Sunday, September 27, 2015 9:30 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 29 lines
Quoted 28 lines · Yu C

Hi, Rafael,

Quoted 26 lines

-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Rafael J. Wysocki
Sent: Friday, September 25, 2015 9:57 PM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

Quoted 13 lines · Yu C

Hi,Rafael, thanks a lot for your review, will resend v2 version.

Quoted 11 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, September 25, 2015 9:24 AM
To: Chen, Yu C
Cc: Wysocki, Rafael J; [email protected]; Zhang, Rui; Brown, Len; linux- [email protected]; [email protected]
Subject: Re: [PATCH][RFC] ACPI / PM: Fix incorrect wakeup irq setting before suspend-to-idle

On Monday, August 10, 2015 10:11:26 AM Chen Yu wrote:

Because the name of acpi_irq is already used by acpi irq handler at drivers/acpi/osl.c:
request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)

Quoted 5 lines
Quoted 4 lines

Ah, this is the name of the handler. I forgot about that, sorry.

Well, it might be worth renaming the handler to something like acpi_interrupt(), then.

OK, will rewrite the patch, Thanks!

Alternatively, you can call the new variable acpi_sci_irq.

Thanks,
Rafael

#10 lore raw
Quoted 3 lines · Rafael J. Wysocki

Hi,

On Mon, Sep 28, 2015 at 7:56 PM, Chen, Yu C <[email protected]> wrote:

[cut]

Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Because the name of acpi_irq is already used by acpi irq handler at drivers/acpi/osl.c:
request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)

Ah, this is the name of the handler. I forgot about that, sorry.

Well, it might be worth renaming the handler to something like acpi_interrupt(), then.

OK, will rewrite the patch, Thanks!

Alternatively, you can call the new variable acpi_sci_irq.

BTW, please CC ACPI-related patches to linux-acpi too.

Thanks,
Rafael