PM: add TEST_PLATFORM support for freeze state

Invoke freeze_enter() after suspend_test(TEST_PLATFORM), so when
setting /sys/power/pm_test to "platform", it can be used to check
if freeze state is working well after all devices are suspended
and before freeze_enter() is called,

[rjw: Changelog]
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PM: invalidate TEST_CPUS and TEST_CORE support for freeze state

Freeze state is a software suspend state that does not run into
low-level platform callbacks which may interact with the BIOS.
And freeze state does not need to disable nonboot CPUs.

However, the current pm_test support may be confusing to users,
because they can request freeze state with pm_test set to
TEST_CPUS/TEST_CORE, while pm_test never goes so deep into the
tests when the freeze state is requested.

To fix that, make TEST_CPUS/TEST_CORE be treated as invalid for
freeze state.  Then, users will get an error when trying to enter
freeze state with pm_test mode set to TEST_CPUS/TEST_CORE.

[rjw: Changelog]
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / fan: avoid null pointer deference error

Fix a null pointer deference by acpi_driver_data() if device is
null.  We should only set cdev and check this is OK after we are
sure device is not null.

Smatch analysis:

drivers/acpi/fan.c:179 acpi_fan_remove() warn: variable dereferenced
  before check 'device' (see line 177)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / processor_thermal: avoid null pointer deference error

Fix a null pointer deference by acpi_driver_data() if device is
null.  We should only set pr and check this is OK after we are
sure device is not null.

Smatch analysis:

drivers/acpi/processor_thermal.c:223 processor_get_max_state() warn:
  variable dereferenced before check 'device' (see line 221)
drivers/acpi/processor_thermal.c:237 processor_get_cur_state() warn:
  variable dereferenced before check 'device' (see line 235)
drivers/acpi/processor_thermal.c:255 processor_set_cur_state() warn:
  variable dereferenced before check 'device' (see line 251)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-assorted-next' into bleeding-edge

* acpi-assorted-next:
  ACPI / processor_thermal: avoid null pointer deference error
  ACPI / fan: avoid null pointer deference error
Merge branch 'pm-sleep-next' into bleeding-edge

* pm-sleep-next:
  PM: invalidate TEST_CPUS and TEST_CORE support for freeze state
  PM: add TEST_PLATFORM support for freeze state