ACPI / processor: Return specific error value when mapping lapic id

Usually, 0 is returned for success in int-returning functions and
negative value are returned on failure, but in processor_core.c, some
function return 1 for success and 0 for failure which causes confusion
to happen sometimes, so modify the functions in question to follow the
common convention..

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / scan: reduce log level of "ACPI: \_PR_.CPU4: failed to get CPU APIC ID"

Commit b981513f806d (ACPI / scan: bail out early if failed to parse
APIC ID for CPU) emits an error message if ACPI processor driver fails
to query APIC ID for the CPU.

Originally it's designed to catch BIOS bugs for CPU hot-addition. But
it accidently reveals another type of BIOS bug that:
 1) BIOS implements ACPI objects for all possible instead of present
    CPUs. (It's valid to do that per ACPI specification.)
 2) BIOS doesn't implement the _STA method for CPU objects. OSPM assumes
    that all CPU objects are present and functioning and attempts to
    use those CPU objects for CPU enumeration, which then triggers the
    error message. According to ACPI spec, BIOS should implement _STA
    for those absent CPUs at least.

Though it's a BIOS bug in essential, there are some BIOSes in the fields
which are implmented in this way. So reduce the log level from ERR to
DEBUG to accommodate these existing BIOSes.

Fixes: b981513f806d (ACPI / scan: bail out early if failed to parse APIC ID for CPU)
Reported-and-tested-by: Jörg Otte <jrg.otte@gmail.com>
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / PM: Use ACPI_COMPANION() to get ACPI companions of devices

The ACPI device PM code in device_pm.c uses a special function,
acpi_dev_pm_get_node(), to obtain an ACPI companion object of a given
device.  However, that is not necessary any more after recent changes
that introduced the ACPI_COMPANION() macro serving exactly the same
purpose, but working in a much more straightforward way.  For this
reason, drop acpi_dev_pm_get_node() and use ACPI_COMPANION() instead
of it everywhere.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
PM / devfreq: Disable Exynos4 driver build on multiplatform

Exynos4 devfreq driver uses mach/map.h which is not available on
multiplatform. Hence disable build on multiplatform for now.
Without this patch we get the following build errors:
drivers/devfreq/exynos/exynos4_bus.h:15:22: fatal error: mach/map.h: No such file or directory

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPICA: Remove bool usage from ACPICA.

The use of "bool" is not safe for ACPICA code where it is originally using
a "BOOLEAN" defined as "unsigned char".

This patch removes the only "bool" usage from kernel source tree to reduce
the source code differences between Linux and ACPICA upstream.

This patch is required by future acpidump release automation.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
acpi-cpufreq: De-register CPU notifier and free struct msr on error.

If cpufreq_register_driver() fails we would free the acpi driver
related structures but not free the ones allocated
by acpi_cpufreq_boost_init() function. This meant that as
the driver error-ed out and a CPU online/offline event came
we would crash and burn as one of the CPU notifiers would point
to garbage.

Fixes: cfc9c8ed03e4 (acpi-cpufreq: Adjust the code to use the common boost attribute)
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API

There is currently no facility in ACPI to express the hookup of voltage
regulators, the expectation is that the regulators that exist in the
system will be handled transparently by firmware if they need software
control at all. This means that if for some reason the regulator API is
enabled on such a system it should assume that any supplies that devices
need are provided by the system at all relevant times without any software
intervention.

Tell the regulator core to make this assumption by calling
regulator_has_full_constraints(). Do this as soon as we know we are using
ACPI so that the information is available to the regulator core as early
as possible. This will cause the regulator core to pretend that there is
an always on regulator supplying any supply that is requested but that has
not otherwise been mapped which is the behaviour expected on a system with
ACPI.

Should the ability to specify regulators be added in future revisions of
ACPI then once we have support for ACPI mappings in the kernel the same
assumptions will apply. It is also likely that systems will default to a
mode of operation which does not require any interpretation of these
mappings in order to be compatible with existing operating system releases
so it should remain safe to make these assumptions even if the mappings
exist but are not supported by the kernel.

Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / scan: Clear match_driver flag in acpi_bus_trim()

Drivers should not bind to struct acpi_device objects that
acpi_bus_trim() has been called for, so make that function
clear flags.match_driver for those objects.

If that is not done, an ACPI driver may theoretically try to operate
a device that is not physically present.

Fixes: 202317a573b2 (ACPI / scan: Add acpi_device objects for all device nodes in the namespace)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Merge branches 'acpi-processor', 'acpi-hotplug', 'acpi-init', 'acpi-pm' and 'acpica'

* acpi-processor:
  ACPI / scan: reduce log level of "ACPI: \_PR_.CPU4: failed to get CPU APIC ID"
  ACPI / processor: Return specific error value when mapping lapic id

* acpi-hotplug:
  ACPI / scan: Clear match_driver flag in acpi_bus_trim()

* acpi-init:
  ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API

* acpi-pm:
  ACPI / PM: Use ACPI_COMPANION() to get ACPI companions of devices

* acpica:
  ACPICA: Remove bool usage from ACPICA.
Merge branches 'pm-cpufreq' and 'pm-devfreq'

* pm-cpufreq:
  acpi-cpufreq: De-register CPU notifier and free struct msr on error.

* pm-devfreq:
  PM / devfreq: Disable Exynos4 driver build on multiplatform