ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpi

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: avoid gcc warnings in ACPI mutex debug code

32bit vs 64 bit issues.  sizeof(sizeof) and sizeof(pointer) is variable,
but we're trying to print it as unsigned int or u32.

Casts to unsigned long are used because type acpi_thread_id can be any one of

typedef u64 acpi_native_uint;
typedef u32 acpi_native_uint;
typedef u16 acpi_native_uint;
#define acpi_thread_id struct task_struct *

Signed-off-by: Martin J. Bligh <mbligh@google.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: uninline ACPI global locking functions

- Fixes a build problem with CONFIG_M386=y (include file dependencies get
  messy).

- Share the implementation between x86 and x86_64

- These are too big to inline anyway.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: acpi-cpufreq: remove unused data when !CONFIG_SMP

acpi-cpufreq.c, speedstep-centrino.c: warning: 'sw_any_bug_dmi_table' defined but not used

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: ibm_acpi: Add support for the generic backlight device

Add support for the generic backlight interface below /sys/class/backlight.
The patch keeps the procfs brightness handling for backward compatibility.

Add two generic functions brightness_get and brightness_set
to be used both by the procfs related and the sysfs related methods.

[apw@shadowen.org: backlight users need to select BACKLIGHT_CLASS_DEVICE]

Signed-off-by: Holger Macht <hmacht@suse.de>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: asus_acpi: Add support for the generic backlight device

Add support for the generic backlight interface below /sys/class/backlight.
Keep the procfs brightness handling for backward compatibility.

[apw@shadowen.org: backlight users need to select BACKLIGHT_CLASS_DEVICE]

Signed-off-by: Holger Macht <hmacht@suse.de>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: toshiba_acpi: Add support for the generic backlight device

Add support for the generic backlight interface below /sys/class/backlight.
Keep the procfs brightness handling for backward compatibility.

To achive this, add two generic functions get_lcd and set_lcd
to be used both by the procfs related and the sysfs related methods.

[apw@shadowen.org: backlight users need to select BACKLIGHT_CLASS_DEVICE]

Signed-off-by: Holger Macht <hmacht@suse.de>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: make ec_transaction not extern

Fix sparse warning:
drivers/acpi/ec.c:372:12: warning: function 'ec_transaction' with external linkage has definition

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: optimize pci_rootbridge search

acpi_get_pci_rootbridge_handle() walks the ACPI name space
searching for seg, bus and the PCI_ROOT_HID_STRING --
returning the handle as soon as if find the match.

But the current codes always parses through the whole namespace because
the user_function find_pci_rootbridge() returns status=AE_OK when it finds the match.

Make the find_pci_rootbridge() return AE_CTRL_TERMINATE when it finds the match.
This reduces the ACPI namespace walk for acpi_get_pci_rootbridge_handle().

Signed-off-by: Justin Chen <justin.chen@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: dock: use mutex instead of spinlock

http://bugzilla.kernel.org/show_bug.cgi?id=7303

Use a mutex instead of a spinlock for locking the
hotplug list because we need to call into the ACPI
subsystem which might sleep.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: S4: Use "platform" rather than "shutdown" mode by default

It has been reported that on some systems the functionality after a resume
from disk is limited if the system is simply powered off during the suspend
instead of using the ACPI S4 suspend (aka platform mode).

Unfortunately the default is currently to power off the system during the
suspend so the users of these systems experience problems after the resume
if they don't switch to the platform mode explicitly.  This patch makes swsusp
use the platform mode by default to avoid such situations.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Stefan Seyfried <seife@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: Get rid of 'unused variable' warning in acpi_ev_global_lock_handler()

Fix this warning :
  drivers/acpi/events/evmisc.c: In function `acpi_ev_global_lock_handler':
  drivers/acpi/events/evmisc.c:334: warning: unused variable `status'

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: update comment

Fixing wrong description for acpi_gpe_sleep_prepare().

acpi_gpe_sleep_prepare() had only used on power off and was changed
to also used on entering some sleep state. However its description
isn't changed yet.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: button: register with input layer

In addition to signalling button/lid events through /proc/acpi/event,
create separate input devices and report KEY_POWER, KEY_SLEEP and
SW_LID through input layer.  Also remove unnecessary casts and variable
initializations, clean up formatting.

Sleep button may autorepeat but userspace will have to filter duplicate
sleep requests anyway (and discard unprocessed events right after
wakeup).

Unlike /proc/acpi/event interface input device corresponding to LID
switch reports true lid state instead of just a counter. SW_LID is
active when lid is closed.

The driver now depends on CONFIG_INPUT.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: ibm-acpi: new ibm-acpi maintainer

I will be taking care of ibm-acpi maintenance for now on, with Borislav's
blessing.  Many thanks to Borislav Deianov for writing this driver and for
the many years he took care of it: his efforts made our ThinkPads much nicer
devices to run Linux on, and are very much appreciated.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Borislav Deianov <borislav@users.sourceforge.net>
Signed-off-by: Len Brown <len.brown@intel.com>
ACPI: ibm-acpi: do not use / in driver names

ibm-acpi uses sub-device names like ibm/hotkey, which get in the way of
a sysfs conversion.  Fix it to use ibm_hotkey instead.  Thanks to Zhang
Rui for noticing this.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
ACPI: ibm-acpi: trivial Lindent cleanups

This patch just makes drives/acpi/ibm-acpi.c Lindent-clean, as requested by
Len Brown.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
ACPI: ibm-acpi: Use a enum to select the thermal sensor reading strategy

This patch consolidades all decisions regarding the strategy to be used to
read thinkpad thermal sensors into a single enum, and refactors the
thermal sensor reading code to use a much more readable (and easier to
extend) switch() construct, in a separate function.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
ACPI: ibm-acpi: Implement direct-ec-access thermal reading modes for up to 16 sensors

This patch extends ibm-acpi to support reading thermal sensors directly
through ACPI EC register access.  It uses a DMI match to detect ThinkPads
with a new-style embedded controller, that are known to have forward-
compatible register maps and use 0x00 to fill in non-used registers and
export thermal sensors at EC offsets 0x78-7F and 0xC0-C7.

Direct ACPI EC register access is implemented for 8-sensor and 16-sensor
new-style ThinkPad controller firmwares as an experimental feature.  The
code does some limited sanity checks on the temperatures read through EC
access, and will default to the old ACPI TMP0-7 mode if anything is amiss.

Userspace ABI is not changed for 8 sensors, but /proc/acpi/ibm/thermal is
extended for 16 sensors if the firmware supports 16 sensors.

A documentation update is also provided.

The information about the ThinkPad register map was determined by studying
ibm-acpi "ecdump" output from various ThinkPad models, submitted by
subscribers of the linux-thinkpad mailinglist.  Futher information was
gathered from the DSDT tables, as they describe the EC register map in
recent ThinkPads.

DSDT source shows that TMP0-7 access and direct register access are
actually the same thing on these firmwares, but unfortunately IBM never
did update their DSDT EC register map to export TMP8-TMP15 for the second
range of sensors.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
ACPI: ibm-acpi: document thermal sensor locations for the A31

The A31 has a very atypical layout, so I separated its thermal sensors
location in a separate patch.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>