ACPI: Clean up incorrect inclusion of an ACPICA header

Since drivers/acpi/nvs.c includes <linux/acpi.h> and is only compiled
for CONFIG_ACPI set, it doesn't need to include <acpi/acpiosxf.h>
directly, which is formally incorrect.  Remove the <acpi/acpiosxf.h>
inclusion from that file.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
SFI / ACPI: Fix warnings reported during builds with W=1

The following warnings can be seen in W=1 builds, because the original
sfi_acpi.[ch] header inclusions are incorrect:

include/linux/sfi_acpi.h:72:2: error: implicit declaration of function 'acpi_table_parse' [-Werror=implicit-function-declaration]
drivers/sfi/sfi_acpi.c:154:5: warning: no previous prototype for 'sfi_acpi_table_parse' [-Wmissing-prototypes]

Fix linux/sfi_acpi.h and modify drivers/sfi/sfi_acpi.c accordingly.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h>

To avoid build problems and breaking dependencies between ACPI header
files, <acpi/acpi.h> should not be included directly by code outside
of the ACPI core subsystem.  However, that is possible if
<linux/acpi_io.h> is included, because that file contains
a direct inclusion of <acpi/acpi.h>.

For this reason, remove the direct <acpi/acpi.h> inclusion from
<linux/acpi_io.h>, move that file from include/linux/ to include/acpi/
and make <linux/acpi.h> include it for CONFIG_ACPI set along with the
other ACPI header files.  Accordingly, Remove the inclusions of
<linux/acpi_io.h> from everywhere.

Of course, that causes the contents of the new <acpi/acpi_io.h> file
to be available for CONFIG_ACPI set only, so intel_opregion.o that
depends on it should also depend on CONFIG_ACPI (and it really should
not be compiled for CONFIG_ACPI unset anyway).

References: https://01.org/linuxgraphics/sites/default/files/documentation/acpi_igd_opregion_spec.pdf
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module

To avoid build problems and breaking dependencies between ACPI header
files, <acpi/acpi.h> should not be included directly by code outside
of the ACPI core subsystem, but this is done by the ACPI iSCSI
Boot Firmware code.

The iBFT specification doesn't mention whether or not it can appear
on a non-ACPI platform, but is says that ACPI 3.0b defines the
mechanism.  The current CONFIG_ISCSI_IBFT_FIND code doesn't use the
ACPI tables API to locate the table, so it doesn't rely on CONFIG_ACPI
directly.

However, since iBFT is is an ACPI-based mechanism (please refer to
the documentation link below for more information), it should be
correct to make CONFIG_ISCSI_IBFT_FIND depend on CONFIG_ACPI (even
though the table location can be implemented without using ACPI
tables API).

After that change, include/linux/iscsi_ibft.h can be modified to
include <linux/acpi.h> instead of <acpi/acpi.h> as appropriate.

References: http://www.microsoft.com/whdc/system/platform/firmware/ibft.mspx
Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
Cc: Peter Jones <pjones@redhat.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: remove trailing whitespace

Minor cleanup: remove some extra trailing white space.

Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / table: Replace '1' with specific error return values

After commit 7f8f97c3cc (ACPI: acpi_table_parse() now returns
success/fail, not count), acpi_table_parse() returns '1' when it is
unable to find the table, but it should return a negative error code
in that case.  Make it return -ENODEV instead.

Fix the same problem in acpi_table_init() analogously.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / dock: Drop redundant acpi_disabled check

acpi_dock_init() is only called from acpi_scan_init() and the
code logic shows that it doesn't need to check acpi_disabled:

acpi_init();
	if (acpi_disabled) return;
	acpi_scan_init();
		acpi_dock_init();
			if (acpi_disabled) /* redundant */
				return;

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / sleep: Drop redundant acpi_disabled check

acpi_sleep_init() is only called from acpi_bus_init() and the
code logic shows that it doesn't need to check acpi_disabled:

acpi_init();
	if (acpi_disabled) return;
	acpi_bus_init();
		acpi_sleep_init();
			if (acpi_disabled)
				return 0;

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[rjw: Subject and changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI: correct minor typos

Correct "coolign" to "cooling" and "*_ptg" to "*_pctg" as intended.

This changes comment text only.

Signed-off-by: Al Stone <al.stone@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
ACPI / processor: use ACPI_COMPANION() to get ACPI device

Use ACPI_COMPANION() to get an ACPI device instead of
acpi_bus_get_device() in the processor driver.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-cleanup' into bleeding-edge

* acpi-cleanup:
  ACPI / processor: use ACPI_COMPANION() to get ACPI device
  ACPI: correct minor typos
  ACPI / sleep: Drop redundant acpi_disabled check
  ACPI / dock: Drop redundant acpi_disabled check
  ACPI / table: Replace '1' with specific error return values
  ACPI: remove trailing whitespace
  ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module
  ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h>
  SFI / ACPI: Fix warnings reported during builds with W=1
  ACPI: Clean up incorrect inclusion of an ACPICA header

Conflicts:
	drivers/acpi/nvs.c
ACPI / blacklist: disable Win8 mode for ThinkPad X201 and Latitude E6230

Both ThinkPad X201 and Latitude E6230 have problems in the Win8 mode,
so blacklist the Win8 mode for them.

References: https://bugzilla.kernel.org/show_bug.cgi?id=60697
Reported-and-tested-by: Jeffery To <jeffery.to@gmail.com>
Reported-and-tested-by: Wouter Depypere <wouter.depypere@ugent.be>
Cc: 3.8+ <stable@vger.kernel.org> # 3.8+
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Merge branch 'acpi-blacklist' into bleeding-edge

* acpi-blacklist:
  ACPI / blacklist: disable Win8 mode for ThinkPad X201 and Latitude E6230