From: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org> To: Linux ACPI <linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> Cc: Linux PCI <linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Linux PM <linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, Srinivas Pandruvada <srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, Linux USB <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Mathias Nyman <mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Mario Limonciello <mario_limonciello-8PEkshWhKlo@public.gmane.org>, Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, Dominik Brodowski <linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org>, Hans De Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Subject: [PATCH 4/6] ACPI / PM: Clean up device wakeup enable/disable code Date: Thu, 08 Jun 2017 02:04:21 +0200 [thread overview] Message-ID: <1592199.UEskShOjr9@aspire.rjw.lan> (raw) In-Reply-To: <8918199.uo13RZ8hZk-yvgW3jdyMHm1GS7QM15AGw@public.gmane.org> From: Rafael J. Wysocki <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> The wakeup.flags.enabled flag in struct acpi_device is not used consistently, as there is no reason why it should only apply to the enabling/disabling of the wakeup GPE, so put the invocation of acpi_enable_wakeup_device_power() under it too. Moreover, it is not necessary to call acpi_enable_wakeup_devices() and acpi_disable_wakeup_devices() for suspend-to-idle, so don't do that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- drivers/acpi/device_pm.c | 19 ++++++++----------- drivers/acpi/sleep.c | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) Index: linux-pm/drivers/acpi/device_pm.c =================================================================== --- linux-pm.orig/drivers/acpi/device_pm.c +++ linux-pm/drivers/acpi/device_pm.c @@ -688,26 +688,23 @@ static int acpi_device_wakeup(struct acp acpi_status res; int error; + if (adev->wakeup.flags.enabled) + return 0; + error = acpi_enable_wakeup_device_power(adev, target_state); if (error) return error; - if (adev->wakeup.flags.enabled) - return 0; - res = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); - if (ACPI_SUCCESS(res)) { - adev->wakeup.flags.enabled = 1; - } else { + if (ACPI_FAILURE(res)) { acpi_disable_wakeup_device_power(adev); return -EIO; } - } else { - if (adev->wakeup.flags.enabled) { - acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); - adev->wakeup.flags.enabled = 0; - } + adev->wakeup.flags.enabled = 1; + } else if (adev->wakeup.flags.enabled) { + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); acpi_disable_wakeup_device_power(adev); + adev->wakeup.flags.enabled = 0; } return 0; } Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -658,19 +658,19 @@ static int acpi_freeze_begin(void) static int acpi_freeze_prepare(void) { - acpi_enable_wakeup_devices(ACPI_STATE_S0); acpi_enable_all_wakeup_gpes(); acpi_os_wait_events_complete(); if (acpi_sci_irq_valid()) enable_irq_wake(acpi_sci_irq); + return 0; } static void acpi_freeze_restore(void) { - acpi_disable_wakeup_devices(ACPI_STATE_S0); if (acpi_sci_irq_valid()) disable_irq_wake(acpi_sci_irq); + acpi_enable_all_runtime_gpes(); } -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux ACPI <linux-acpi@vger.kernel.org> Cc: Linux PCI <linux-pci@vger.kernel.org>, Linux PM <linux-pm@vger.kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, LKML <linux-kernel@vger.kernel.org>, Mika Westerberg <mika.westerberg@linux.intel.com>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Linux USB <linux-usb@vger.kernel.org>, Mathias Nyman <mathias.nyman@linux.intel.com>, Felipe Balbi <balbi@kernel.org>, Mario Limonciello <mario_limonciello@dell.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Dominik Brodowski <linux@dominikbrodowski.net>, Hans De Goede <hdegoede@redhat.com> Subject: [PATCH 4/6] ACPI / PM: Clean up device wakeup enable/disable code Date: Thu, 08 Jun 2017 02:04:21 +0200 [thread overview] Message-ID: <1592199.UEskShOjr9@aspire.rjw.lan> (raw) In-Reply-To: <8918199.uo13RZ8hZk@aspire.rjw.lan> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> The wakeup.flags.enabled flag in struct acpi_device is not used consistently, as there is no reason why it should only apply to the enabling/disabling of the wakeup GPE, so put the invocation of acpi_enable_wakeup_device_power() under it too. Moreover, it is not necessary to call acpi_enable_wakeup_devices() and acpi_disable_wakeup_devices() for suspend-to-idle, so don't do that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- drivers/acpi/device_pm.c | 19 ++++++++----------- drivers/acpi/sleep.c | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) Index: linux-pm/drivers/acpi/device_pm.c =================================================================== --- linux-pm.orig/drivers/acpi/device_pm.c +++ linux-pm/drivers/acpi/device_pm.c @@ -688,26 +688,23 @@ static int acpi_device_wakeup(struct acp acpi_status res; int error; + if (adev->wakeup.flags.enabled) + return 0; + error = acpi_enable_wakeup_device_power(adev, target_state); if (error) return error; - if (adev->wakeup.flags.enabled) - return 0; - res = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); - if (ACPI_SUCCESS(res)) { - adev->wakeup.flags.enabled = 1; - } else { + if (ACPI_FAILURE(res)) { acpi_disable_wakeup_device_power(adev); return -EIO; } - } else { - if (adev->wakeup.flags.enabled) { - acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); - adev->wakeup.flags.enabled = 0; - } + adev->wakeup.flags.enabled = 1; + } else if (adev->wakeup.flags.enabled) { + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); acpi_disable_wakeup_device_power(adev); + adev->wakeup.flags.enabled = 0; } return 0; } Index: linux-pm/drivers/acpi/sleep.c =================================================================== --- linux-pm.orig/drivers/acpi/sleep.c +++ linux-pm/drivers/acpi/sleep.c @@ -658,19 +658,19 @@ static int acpi_freeze_begin(void) static int acpi_freeze_prepare(void) { - acpi_enable_wakeup_devices(ACPI_STATE_S0); acpi_enable_all_wakeup_gpes(); acpi_os_wait_events_complete(); if (acpi_sci_irq_valid()) enable_irq_wake(acpi_sci_irq); + return 0; } static void acpi_freeze_restore(void) { - acpi_disable_wakeup_devices(ACPI_STATE_S0); if (acpi_sci_irq_valid()) disable_irq_wake(acpi_sci_irq); + acpi_enable_all_runtime_gpes(); }
next prev parent reply other threads:[~2017-06-08 0:04 UTC|newest] Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-06-08 0:00 [PATCH 0/6] ACPI / PM: Suspend-to-idle rework to deal with spurious ACPI wakeups Rafael J. Wysocki 2017-06-08 0:01 ` [PATCH 1/6] ACPI / PM: Run wakeup notify handlers synchronously Rafael J. Wysocki 2017-06-08 0:02 ` [PATCH 2/6] USB / PCI / PM: Allow the PCI core to do the resume cleanup Rafael J. Wysocki 2017-06-08 15:24 ` Alan Stern 2017-06-08 23:01 ` Rafael J. Wysocki [not found] ` <8918199.uo13RZ8hZk-yvgW3jdyMHm1GS7QM15AGw@public.gmane.org> 2017-06-08 0:03 ` [PATCH 3/6] ACPI / PM: Change log level of wakeup-related message Rafael J. Wysocki 2017-06-08 0:03 ` Rafael J. Wysocki 2017-06-08 0:04 ` Rafael J. Wysocki [this message] 2017-06-08 0:04 ` [PATCH 4/6] ACPI / PM: Clean up device wakeup enable/disable code Rafael J. Wysocki 2017-06-08 0:05 ` [PATCH 5/6] PM / sleep: Print timing information if debug is enabled Rafael J. Wysocki 2017-06-08 0:06 ` [PATCH 6/6] ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle Rafael J. Wysocki 2017-06-08 7:24 ` [PATCH 0/6] ACPI / PM: Suspend-to-idle rework to deal with spurious ACPI wakeups Hans de Goede 2017-06-08 8:42 ` Dominik Brodowski 2017-06-08 11:56 ` Rafael J. Wysocki 2017-06-12 20:46 ` [PATCH v2 0/8] " Rafael J. Wysocki 2017-06-12 20:48 ` [PATCH v2 1/8] ACPI / PM: Run wakeup notify handlers synchronously Rafael J. Wysocki 2017-06-14 18:09 ` Bjorn Helgaas 2017-06-14 22:22 ` Rafael J. Wysocki 2017-06-12 20:49 ` [PATCH v2 2/8] USB / PCI / PM: Allow the PCI core to do the resume cleanup Rafael J. Wysocki 2017-06-13 8:52 ` Greg KH 2017-06-13 11:14 ` Rafael J. Wysocki 2017-06-12 20:50 ` [PATCH v2 3/8] ACPI / PM: Change log level of wakeup-related message Rafael J. Wysocki 2017-06-12 20:51 ` [PATCH v2 4/8] ACPI / PM: Clean up device wakeup enable/disable code Rafael J. Wysocki 2017-06-12 20:51 ` [PATCH v2 5/8] PM / sleep: Print timing information if debug is enabled Rafael J. Wysocki 2017-06-12 22:18 ` Joe Perches 2017-06-12 20:53 ` [PATCH v2 6/8] PCI / PM: Restore PME Enable if skipping wakeup setup Rafael J. Wysocki 2017-06-14 18:10 ` Bjorn Helgaas 2017-06-12 20:55 ` [PATCH v2 7/8] platform/x86: Add driver for ACPI INT0002 Virtual GPIO device Rafael J. Wysocki 2017-06-12 20:56 ` [PATCH v2 8/8] ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle Rafael J. Wysocki 2017-06-13 5:54 ` [PATCH v2 0/8] ACPI / PM: Suspend-to-idle rework to deal with spurious ACPI wakeups Dominik Brodowski 2017-06-13 11:14 ` Rafael J. Wysocki
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1592199.UEskShOjr9@aspire.rjw.lan \ --to=rjw-lthd3rsa81gm4rdzfppkha@public.gmane.org \ --cc=andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ --cc=balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \ --cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \ --cc=linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org \ --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=mario_limonciello-8PEkshWhKlo@public.gmane.org \ --cc=mathias.nyman-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ --cc=srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.