PM / sleep: Simplify sleep states sysfs interface code

Simplify the sleep states sysfs interface /sys/power/state code by
redefining pm_states[] as an array of pointers to constant strings
such that only the entries corresponding to valid states are set.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'pm-sleep-next' into bleeding-edge

* pm-sleep-next:
  PM / sleep: Simplify sleep states sysfs interface code
ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()

Since acpiphp_dev_to_bridge() is only called by
acpiphp_check_host_bridge(), move the code from it to that function
directly which reduces the call chain depth and makes the code
slightly easier to follow.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / hotplug: Simplify acpi_set_hp_context()

Since all of the acpi_set_hp_context() callers pass at least one NULL
function pointer and one caller passes NULL function pointers only
to it, drop function pointer arguments from acpi_set_hp_context()
and make the callers initialize the function pointers in struct
acpi_hotplug_context by themselves before passing it to
acpi_set_hp_context().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-hotplug' into bleeding-edge

* acpi-hotplug:
  ACPI / hotplug: Simplify acpi_set_hp_context()
  ACPI / hotplug / PCI: Eliminate acpiphp_dev_to_bridge()
ACPICA: Introduce acpi_mark_gpe_for_wake()

Some callers of acpi_setup_gpe_for_wake() know in advance that there
won't be any notify handlers installed for device wake notifications
from the given GPEs (one example is button GPEs in Linux).  For those
cases, introduce acpi_mark_gpe_for_wake() to be called instead of
acpi_setup_gpe_for_wake() that will only set the ACPI_GPE_CAN_WAKE
flag for the GPE without trying to set up implicit wake notification
for it if there's no handler method.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPICA: Refuse enabling GPEs with no handling

Make acpi_enable_gpe() refuse to enable a given GPE if there is no
way to handle it and return an error instead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / scan: No implicit wake notification for buttons

The ACPI device enumeration code in Linux assumes that buttons always
are wakeup devices, so it calls acpi_setup_gpe_for_wake() for them
which leads to undesirable side effects.  Namely, that function sets
up implicit device wake notification mechanism for a given GPE if
there is no handler method in the ACPI namespace, which from the
ACPICA's perspective means that there always is a way to handle
that GPE if enabled.  However, we don't handle wake notify events
for buttons, so if there are no handler methods for their GPEs in
the namespace, enabling a button GPE at run time leads to a GPE
storm in some cases (the GPE triggers, ACPICA carries out the
implicit wake notification for it which isn't handled, so the
GPE triggers again and so on).

To prevent that from happening use acpi_mark_gpe_for_wake()
instead of acpi_setup_gpe_for_wake() for buttons which will cause
ACPICA to only enable button GPEs if there are handler methods for
the in the namespace.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-gpe' into bleeding-edge

* acpi-gpe:
  ACPI / scan: No implicit wake notification for buttons
  ACPICA: Refuse enabling GPEs with no handling
  ACPICA: Introduce acpi_mark_gpe_for_wake()