tools/power/acpi: Minor bugfixes

 - bindir is created, but sbindir is used -> fix that
 - the debug parts are there twice (copy paste bug?). Remove one of the
   exact same parts

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPICA: Fix buffer allocation issue for generic_serial_bus region accesses.

The size of the buffer allocated for generic_serial_bus region access
is not correct.  This patch introduces acpi_ex_get_serial_access_length()
to be invoked to obtain correct data buffer length.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reported by: Lan Tianyu <tianyu.lan@intel.com>
Acked-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
intel_idle: fix IVT idle state table setting

Ivy Town idle state table will not be set as intended. Fix it.

Picked up by Coverity - CID 1201420/1201421.

Fixes: 0138d8f075 ("intel_idle: fine-tune IVT residency targets")
Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PM / suspend: Make cpuidle work in the "freeze" state

The "freeze" system sleep state introduced by commit 7e73c5ae6e79
(PM: Introduce suspend state PM_SUSPEND_FREEZE) requires cpuidle
to be functional when freeze_enter() is executed to work correctly
(that is, to be able to save any more energy than runtime idle),
but that is impossible after commit 8651f97bd951d (PM / cpuidle:
System resume hang fix with cpuidle) which caused cpuidle to be
paused in dpm_suspend_noirq() and resumed in dpm_resume_noirq().

To avoid that problem, add cpuidle_resume() and cpuidle_pause()
to the beginning and the end of freeze_enter(), respectively.

Reported-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
cpufreq: unicore32: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq, powernv: Fix build failure on UP

Paul Gortmaker reported the following build failure of the powernv cpufreq
driver on UP configs:

drivers/cpufreq/powernv-cpufreq.c:241:2: error: implicit declaration of
function 'cpu_sibling_mask' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[3]: *** [drivers/cpufreq/powernv-cpufreq.o] Error 1
make[2]: *** [drivers/cpufreq] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

The trouble here is that cpu_sibling_mask is defined only in <asm/smp.h>,
and <linux/smp.h> includes <asm/smp.h> only in SMP builds.

So fix this build failure by explicitly including <asm/smp.h> in the driver,
so that we get the definition of cpu_sibling_mask even in UP configurations.

Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: ppc: Fix integer overflow in expression

On 32-bit, "12 * NSEC_PER_SEC" doesn't fit in "unsigned long"
(NSEC_PER_SEC is a "long" constant), causing an integer overflow:

drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init':
drivers/cpufreq/ppc-corenet-cpufreq.c:211:9: warning: integer overflow in expression [-Woverflow]

Force the intermediate to be 64-bit by adding an "ULL" suffix to the
constant multiplier to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: highbank: fix ARM_HIGHBANK_CPUFREQ dependency warning

When make ARCH=arm multi_v7_defconfig, we get the following warnings:

warning: (ARM_HIGHBANK_CPUFREQ) selects GENERIC_CPUFREQ_CPU0 which has
unmet direct dependencies (ARCH_HAS_CPUFREQ && CPU_FREQ && HAVE_CLK
&& REGULATOR && OF && THERMAL && CPU_THERMAL)

To fix this, make ARM_HIGHBANK_CPUFREQ depend on ARCH_HAS_CPUFREQ and
REGULATOR instead of selecting them, PM_OPP will be selected by ARCH_HAS_CPUFREQ.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branches 'acpica' and 'acpi-tools'

* acpica:
  ACPICA: Fix buffer allocation issue for generic_serial_bus region accesses.

* acpi-tools:
  tools/power/acpi: Minor bugfixes
Merge branches 'pm-sleep', 'pm-cpuidle' and 'pm-cpufreq'

* pm-sleep:
  PM / suspend: Make cpuidle work in the "freeze" state

* pm-cpuidle:
  intel_idle: fix IVT idle state table setting

* pm-cpufreq:
  cpufreq: highbank: fix ARM_HIGHBANK_CPUFREQ dependency warning
  cpufreq: ppc: Fix integer overflow in expression
  cpufreq, powernv: Fix build failure on UP
  cpufreq: unicore32: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO
Merge branch 'acpica-next' into linux-next

* acpica-next: (28 commits)
  ACPICA: Update version to 20140325.
  ACPICA: acpidump: Update man page.
  ACPICA: acpidump: Remove old acpidump source.
  ACPICA: acpidump: Update Makefile to build acpidump from ACPICA.
  ACPICA: acpidump: Update new structures and add missing file.
  ACPICA: acpidump: Add support to generate acpidump release.
  ACPICA: Table Manager: Split tbinstal.c into two files.
  ACPICA: Table Manager: Misc cleanup and renames, no functional change.
  ACPICA: Tables: Add acpi_install_table() API for early table installation.
  ACPICA: Tables: Avoid SSDT installation with acpi_gbl_disable_ssdt_table_load.
  ACPICA: Tables: Cleanup ACPI_TABLE_ORIGIN_xxx flags.
  ACPICA: Tables: Fix table checksums verification before installation.
  ACPICA: Tables: Fix unbalanced table validations.
  ACPICA: Tables: Clean up split INSTALLED/VALIDATED table state logics.
  ACPICA: Tables: Fix multiple ACPI_FREE()s around acpi_tb_add_table().
  ACPICA: Tables: Fix the issues in handling virtual addressed tables.
  ACPICA: Remove indent divergences to reduce maintenance overhead.
  ACPICA: Add a missing field for debug dump of mutex objects.
  ACPICA: Linux-specific header: Add support for PPC64 compilation.
  ACPICA: Clean up comment divergences in aclinux.h
  ...