]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
11 years agoMerge branch 'acpi-dev-pm-next' into linux-next
Rafael J. Wysocki [Sat, 10 Nov 2012 21:49:14 +0000 (22:49 +0100)]
Merge branch 'acpi-dev-pm-next' into linux-next

* acpi-dev-pm-next:
  ACPI / PM: Fix build problem related to acpi_target_system_state()

11 years agoACPI / PM: Fix build problem related to acpi_target_system_state()
David Rientjes [Sat, 10 Nov 2012 21:48:33 +0000 (22:48 +0100)]
ACPI / PM: Fix build problem related to acpi_target_system_state()

Commit b87b49cd0efd ("ACPI / PM: Move device PM functions related to sleep
states") declared acpi_target_system_state() for CONFIG_PM_SLEEP whereas
it is only defined for CONFIG_ACPI_SLEEP, resulting in the following link
error:

drivers/built-in.o: In function `acpi_pm_device_sleep_wake':
drivers/acpi/device_pm.c:342: undefined reference to `acpi_target_system_state'
drivers/built-in.o: In function `acpi_dev_suspend_late':
drivers/acpi/device_pm.c:501: undefined reference to `acpi_target_system_state'
drivers/built-in.o: In function `acpi_pm_device_sleep_state':
drivers/acpi/device_pm.c:221: undefined reference to `acpi_target_system_state'

Define it only for CONFIG_ACPI_SLEEP and fallback to a dummy definition
for other configs.

[rjw: The problem only occurs for exotic .configs in which
 HIBERNATE_CALLBACKS is selected by XEN_SAVE_RESTORE and neither
 SUSPEND nor HIBERNATION is set.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoMerge branch 'pm-qos-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 12:29:30 +0000 (13:29 +0100)]
Merge branch 'pm-qos-next' into linux-next

* pm-qos-next:
  PM / QoS: Document request manipulation requirement for flags

11 years agoMerge branch 'acpi-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 12:29:12 +0000 (13:29 +0100)]
Merge branch 'acpi-next' into linux-next

* acpi-next:
  ACPI: add newline in power.c message
  ACPI: Make seemingly useless check in osl.c more understandable

11 years agoACPI: add newline in power.c message
Randy Dunlap [Mon, 29 Oct 2012 17:25:19 +0000 (17:25 +0000)]
ACPI: add newline in power.c message

Add newline to printk so that the message is on a line
by itself and not merged with something unrelated to it.

Reported-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / QoS: Document request manipulation requirement for flags
Rafael J. Wysocki [Fri, 2 Nov 2012 12:10:09 +0000 (13:10 +0100)]
PM / QoS: Document request manipulation requirement for flags

In fact, the callers of dev_pm_qos_add_request(),
dev_pm_qos_update_request() and dev_pm_qos_remove_request() for
requests of type DEV_PM_QOS_FLAGS need to ensure that the target
device is not RPM_SUSPENDED before using any of these functions (or
be prepared for the new PM QoS flags to take effect after the device
has been resumed).  Document this in their kerneldoc comments.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Make seemingly useless check in osl.c more understandable
Rafael J. Wysocki [Fri, 2 Nov 2012 12:09:08 +0000 (13:09 +0100)]
ACPI: Make seemingly useless check in osl.c more understandable

There is a seemingly useless check in drivers/acpi/osl.c added by
commit bc73675 (ACPI: fixes a false alarm from lockdep), which really
is necessary to avoid false positive lockdep complaints.  Document
this and rearrange the code related to it so that it makes fewer
checks.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
11 years agoMerge branch 'fixes-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:12:22 +0000 (11:12 +0100)]
Merge branch 'fixes-next' into linux-next

* fixes-next:
  cpufreq / powernow-k8: Change maintainer's email address

11 years agoMerge branch 'pm-sleep-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:12:13 +0000 (11:12 +0100)]
Merge branch 'pm-sleep-next' into linux-next

* pm-sleep-next:
  driver core / PM: move the calling to device_pm_remove behind the calling to bus_remove_device
  PM / Hibernate: use rb_entry
  PM / sysfs: replace strict_str* with kstrto*

11 years agoMerge branch 'pm-runtime-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:12:04 +0000 (11:12 +0100)]
Merge branch 'pm-runtime-next' into linux-next

* pm-runtime-next:
  base: power - use clk_prepare_enable and clk_prepare_disable

11 years agoMerge branch 'pm-opp-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:11:54 +0000 (11:11 +0100)]
Merge branch 'pm-opp-next' into linux-next

* pm-opp-next:
  PM / OPP: using kfree_rcu() to simplify the code
  PM / OPP: predictable fail results for opp_find* functions, v2
  PM / OPP: Export symbols for module usage.
  PM / OPP: RCU reclaim

11 years agoMerge branch 'pm-devfreq-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:11:41 +0000 (11:11 +0100)]
Merge branch 'pm-devfreq-next' into linux-next

* pm-devfreq-next:
  PM / devfreq: make devfreq_class static
  PM / devfreq: fix sscanf handling for writable sysfs entries
  PM / devfreq: kernel-doc typo corrections
  PM / devfreq: Add current freq callback in device profile
  PM / devfreq: Add suspend and resume apis
  PM / devfreq: Core updates to support devices which can idle

11 years agoMerge branch 'pm-cpuidle-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 10:11:30 +0000 (11:11 +0100)]
Merge branch 'pm-cpuidle-next' into linux-next

* pm-cpuidle-next:
  cpuidle: support multiple drivers
  cpuidle: prepare the cpuidle core to handle multiple drivers
  cpuidle: move driver checking within the lock section
  cpuidle: move driver's refcount to cpuidle
  cpuidle: fixup device.h header in cpuidle.h
  cpuidle / sysfs: move structure declaration into the sysfs.c file
  cpuidle: Get typical recent sleep interval
  cpuidle: Set residency to 0 if target Cstate not enter
  cpuidle: Quickly notice prediction failure in general case
  cpuidle: Quickly notice prediction failure for repeat mode
  cpuidle / sysfs: move kobj initialization in the syfs file
  cpuidle / sysfs: change function parameter

11 years agocpuidle: support multiple drivers
Daniel Lezcano [Wed, 31 Oct 2012 16:44:48 +0000 (16:44 +0000)]
cpuidle: support multiple drivers

With the tegra3 and the big.LITTLE [1] new architectures, several cpus
with different characteristics (latencies and states) can co-exists on the
system.

The cpuidle framework has the limitation of handling only identical cpus.

This patch removes this limitation by introducing the multiple driver support
for cpuidle.

This option is configurable at compile time and should be enabled for the
architectures mentioned above. So there is no impact for the other platforms
if the option is disabled. The option defaults to 'n'. Note the multiple drivers
support is also compatible with the existing drivers, even if just one driver is
needed, all the cpu will be tied to this driver using an extra small chunk of
processor memory.

The multiple driver support use a per-cpu driver pointer instead of a global
variable and the accessor to this variable are done from a cpu context.

In order to keep the compatibility with the existing drivers, the function
'cpuidle_register_driver' and 'cpuidle_unregister_driver' will register
the specified driver for all the cpus.

The semantic for the output of /sys/devices/system/cpu/cpuidle/current_driver
remains the same except the driver name will be related to the current cpu.

The /sys/devices/system/cpu/cpu[0-9]/cpuidle/driver/name files are added
allowing to read the per cpu driver name.

[1] http://lwn.net/Articles/481055/

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoMerge branch 'pm-cpufreq-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:13:04 +0000 (02:13 +0100)]
Merge branch 'pm-cpufreq-next' into linux-next

* pm-cpufreq-next:
  cpufreq: Remove unnecessary initialization of a local variable
  cpufreq: Make sure target freq is within limits
  cpufreq: Avoid calling cpufreq driver's target() routine if target_freq == policy->cur
  cpufreq: Fix sparse warning by making local function static
  cpufreq: Fix sparse warnings by updating cputime64_t to u64
  cpufreq: governors: remove redundant code
  cpufreq: return early from __cpufreq_driver_getavg()
  cpufreq: fix jiffies/cputime mixup in conservative/ondemand governors
  cpufreq: Improve debug prints
  cpufreq: Move common part from governors to separate file, v2
  cpufreq / core: Fix printing of governor and driver name
  cpufreq / core: Fix typo in comment describing show_bios_limit()

11 years agoMerge branch 'acpica-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:12:48 +0000 (02:12 +0100)]
Merge branch 'acpica-next' into linux-next

* acpica-next: (26 commits)
  ACPICA: Update version to 20121018
  ACPICA: AcpiGetObjectInfo: Add support for ACPI 5 _SUB method
  ACPICA: Update for 64-bit generation of recent error message changes
  ACPICA: Fix externalize name to complete migration to ACPI_MOVE_NAME
  ACPICA: Add starting offset parameter to common dump buffer routine
  ACPICA: Deploy ACPI_MOVE_NAME across ACPICA source base
  ACPICA: Update support for ACPI 5 MPST table
  ACPICA: Enhance error reporting for invalid opcodes and bad ACPI_NAMEs
  ACPICA: Add ACPI_MOVE_NAME macro to optimize 4-byte ACPI_NAME copies
  ACPICA: AcpiExec: Improve algorithm for tracking memory leaks
  ACPICA: Add debug print message for mutex objects that are force-released
  ACPICA: Resource Mgr: Small fix for buffer size calculation
  ACPICA: Remove extra spaces after periods in the Intel license
  ACPICA: Remove extra spaces after periods within comments
  ACPICA: Update local C library module comments for ASCII table
  ACPICA: Fix for predefined name loop during ACPICA initialization
  ACPICA: Fix some typos in comments
  ACPICA: ACPICA core: Cleanup empty lines at file start and end
  ACPICA: Audit/update for ACPICA return macros and debug depth counter
  ACPICA: Fix unmerged acmacros.h divergences.
  ...

11 years agoMerge branch 'acpi-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:12:28 +0000 (02:12 +0100)]
Merge branch 'acpi-next' into linux-next

* acpi-next:
  ACPI / memory-hotplug: add memory offline code to acpi_memory_device_remove()
  ACPI / memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device
  ACPI / memory-hotplug: call acpi_bus_trim() to remove memory device
  ACPI: Add ACPI CPU hot-remove support
  ACPI: Export functions for hot-remove
  ACPI: Add user space interface for identification objects
  ACPI: Add _UID support for ACPI devices.
  ACPI: move acpi_no_s4_hw_signature() declaration into #ifdef CONFIG_HIBERNATION
  ACPI / Sleep: add acpi_sleep=nonvs_s3 parameter
  ACPI: Remove unused lockable in acpi_device_flags
  ACPI: Fix stale pointer access to flags.lockable
  ACPI: Fix a hard coding style when determining if a device is a container, v3
  ACPI / x86: Add quirk for "CheckPoint P-20-00" to not use bridge _CRS_ info
  ACPI / processor: prevent cpu from becoming online
  ACPI: strict_strtoul() and printk() cleanup in acpi_pad
  ACPI: dock: Remove redundant ACPI NS walk
  ACPI / EC: Don't count a SCI interrupt as a false one
  ACPI / EC: Add more debug info and trivial code cleanup
  ACPI / EC: Cleanup the member name for spinlock/mutex in struct

11 years agoMerge branch 'acpi-enumeration-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:12:11 +0000 (02:12 +0100)]
Merge branch 'acpi-enumeration-next' into linux-next

* acpi-enumeration-next:
  ACPI: Add support for platform bus type
  ACPI / ia64: Export acpi_[un]register_gsi()
  ACPI / x86: Export acpi_[un]register_gsi()
  ACPI: Provide generic functions for matching ACPI device nodes
  driver core / ACPI: Move ACPI support to core device and driver types

11 years agoMerge branch 'acpi-dev-pm-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:12:00 +0000 (02:12 +0100)]
Merge branch 'acpi-dev-pm-next' into linux-next

* acpi-dev-pm-next:
  ACPI / PM: Provide ACPI PM callback routines for subsystems
  ACPI / PM: Move device PM functions related to sleep states
  ACPI / PM: Provide device PM functions operating on struct acpi_device
  ACPI / PM: Split device wakeup management routines
  ACPI / PM: Move runtime remote wakeup setup routine to device_pm.c
  ACPI / PM: Move device power state selection routine to device_pm.c
  ACPI / PM: Move routines for adding/removing device wakeup notifiers
  ACPI / PM: Fix device PM kernedoc comments and #ifdefs

11 years agoMerge branch 'pm-qos-next' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:11:10 +0000 (02:11 +0100)]
Merge branch 'pm-qos-next' into linux-next

* pm-qos-next:
  PM / QoS: Fix a free error in the dev_pm_qos_constraints_destroy()

11 years agoMerge branch 'pm-qos' into linux-next
Rafael J. Wysocki [Fri, 2 Nov 2012 01:10:58 +0000 (02:10 +0100)]
Merge branch 'pm-qos' into linux-next

* pm-qos:
  PM / QoS: Fix the return value of dev_pm_qos_update_request()
  PM / ACPI: Take device PM QoS flags into account
  PM / Domains: Check device PM QoS flags in pm_genpd_poweroff()
  PM / QoS: Make it possible to expose PM QoS device flags to user space
  PM / QoS: Introduce PM QoS device flags support
  PM / QoS: Prepare struct dev_pm_qos_request for more request types
  PM / QoS: Introduce request and constraint data types for PM QoS flags
  PM / QoS: Prepare device structure for adding more constraint types

11 years agoACPI / memory-hotplug: add memory offline code to acpi_memory_device_remove()
Yasuaki Ishimatsu [Fri, 2 Nov 2012 01:02:04 +0000 (02:02 +0100)]
ACPI / memory-hotplug: add memory offline code to acpi_memory_device_remove()

The memory device can be removed by 2 ways:
 1. send eject request by SCI
 2. echo 1 >/sys/bus/pci/devices/PNP0C80:XX/eject

In the 1st case, acpi_memory_disable_device() will be called.
In the 2nd case, acpi_memory_device_remove() will be called.
acpi_memory_device_remove() will also be called when we unbind the
memory device from the driver acpi_memhotplug or a driver initialization
fails.

acpi_memory_disable_device() has already implemented a code which
offlines memory and releases acpi_memory_info struct. But
acpi_memory_device_remove() has not implemented it yet.

So the patch move offlining memory and releasing acpi_memory_info struct
codes to a new function acpi_memory_remove_memory(). And it is used by both
acpi_memory_device_remove() and acpi_memory_disable_device().

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device
Wen Congyang [Fri, 2 Nov 2012 01:01:54 +0000 (02:01 +0100)]
ACPI / memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device

The memory device can be removed by 2 ways:
 1. send eject request by SCI
 2. echo 1 >/sys/bus/pci/devices/PNP0C80:XX/eject

This 2 events may happen at the same time, so we may touch
acpi_memory_device.res_list at the same time. This patch
introduce a lock to protect this list.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / memory-hotplug: call acpi_bus_trim() to remove memory device
Wen Congyang [Fri, 2 Nov 2012 01:01:42 +0000 (02:01 +0100)]
ACPI / memory-hotplug: call acpi_bus_trim() to remove memory device

The memory device has been ejected and powoffed, so we can call
acpi_bus_trim() to remove the memory device from acpi bus.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Provide ACPI PM callback routines for subsystems
Rafael J. Wysocki [Fri, 2 Nov 2012 00:41:01 +0000 (01:41 +0100)]
ACPI / PM: Provide ACPI PM callback routines for subsystems

Some bus types don't support power management natively, but generally
there may be device nodes in ACPI tables corresponding to the devices
whose bus types they are (under ACPI 5 those bus types may be SPI,
I2C and platform).  If that is the case, standard ACPI power
management may be applied to those devices, although currently the
kernel has no means for that.

For this reason, provide a set of routines that may be used as power
management callbacks for such devices.  This may be done in three
different ways.

 (1) Device drivers handling the devices in question may run
     acpi_dev_pm_attach() in their .probe() routines, which (on
     success) will cause the devices to be added to the general ACPI
     PM domain and ACPI power management will be used for them going
     forward.  Then, acpi_dev_pm_detach() may be used to remove the
     devices from the general ACPI PM domain if ACPI power management
     is not necessary for them any more.

 (2) The devices' subsystems may use acpi_subsys_runtime_suspend(),
     acpi_subsys_runtime_resume(), acpi_subsys_prepare(),
     acpi_subsys_suspend_late(), acpi_subsys_resume_early() as their
     power management callbacks in the same way as the general ACPI
     PM domain does that.

 (3) The devices' drivers may execute acpi_dev_suspend_late(),
     acpi_dev_resume_early(), acpi_dev_runtime_suspend(),
     acpi_dev_runtime_resume() from their power management callbacks
     as appropriate, if that's absolutely necessary, but it is not
     recommended to do that, because such drivers may not work
     without ACPI support as a result.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Move device PM functions related to sleep states
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:53 +0000 (01:40 +0100)]
ACPI / PM: Move device PM functions related to sleep states

Introduce helper function returning the target sleep state of the
system and use it to move the remaining device power management
functions from sleep.c to device_pm.c.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Provide device PM functions operating on struct acpi_device
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:45 +0000 (01:40 +0100)]
ACPI / PM: Provide device PM functions operating on struct acpi_device

If the caller of acpi_bus_set_power() already has a pointer to the
struct acpi_device object corresponding to the device in question, it
doesn't make sense for it to go through acpi_bus_get_device(), which
may be costly, because it involves acquiring the global ACPI
namespace mutex.

For this reason, export the function operating on struct acpi_device
objects used internally by acpi_bus_set_power(), so that it may be
called instead of acpi_bus_set_power() in the above case, and change
its name to acpi_device_set_power().

Additionally, introduce two inline wrappers for checking ACPI PM
capabilities of devices represented by struct acpi_device objects.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Split device wakeup management routines
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:36 +0000 (01:40 +0100)]
ACPI / PM: Split device wakeup management routines

Two device wakeup management routines in device_pm.c and sleep.c,
acpi_pm_device_run_wake() and acpi_pm_device_sleep_wake(), take a
device pointer argument and use it to obtain the ACPI handle of the
corresponding ACPI namespace node.  That handle is then used to get
the address of the struct acpi_device object corresponding to the
struct device passed as the argument.

Unfortunately, that last operation may be costly, because it involves
taking the global ACPI namespace mutex, so it shouldn't be carried
out too often.  However, the callers of those routines usually call
them in a row with acpi_pm_device_sleep_state() which also takes that
mutex for the same reason, so it would be more efficient if they ran
acpi_bus_get_device() themselves to obtain a pointer to the struct
acpi_device object in question and then passed that pointer to the
appropriate PM routines.

To make that possible, split each of the PM routines mentioned above
in two parts, one taking a struct acpi_device pointer argument and
the other implementing the current interface for compatibility.

Additionally, change acpi_pm_device_run_wake() to actually return
an error code if there is an error while setting up runtime remote
wakeup for the device.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Move runtime remote wakeup setup routine to device_pm.c
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:28 +0000 (01:40 +0100)]
ACPI / PM: Move runtime remote wakeup setup routine to device_pm.c

The ACPI function for setting up devices to do runtime remote
wakeup is now located in drivers/acpi/sleep.c, but
drivers/acpi/device_pm.c is a more logical place for it, so move it
there.

No functional changes should result from this modification.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Move device power state selection routine to device_pm.c
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:18 +0000 (01:40 +0100)]
ACPI / PM: Move device power state selection routine to device_pm.c

The ACPI function for choosing device power state is now located
in drivers/acpi/sleep.c, but drivers/acpi/device_pm.c is a more
logical place for it, so move it there.

However, instead of moving the function entirely, move its core only
under a different name and with a different list of arguments, so
that it is more flexible, and leave a wrapper around it in the
original location.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Move routines for adding/removing device wakeup notifiers
Rafael J. Wysocki [Fri, 2 Nov 2012 00:40:09 +0000 (01:40 +0100)]
ACPI / PM: Move routines for adding/removing device wakeup notifiers

ACPI routines for adding and removing device wakeup notifiers are
currently defined in a PCI-specific file, but they will be necessary
for non-PCI devices too, so move them to a separate file under
drivers/acpi and rename them to indicate their ACPI origins.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Add ACPI CPU hot-remove support
Toshi Kani [Thu, 1 Nov 2012 14:42:13 +0000 (14:42 +0000)]
ACPI: Add ACPI CPU hot-remove support

Added support of CPU hot-remove via an ACPI eject notification.
It calls acpi_bus_hot_remove_device(), which shares the same code
path with the sysfs eject operation.  acpi_os_hotplug_execute()
runs the hot-remove operation in kacpi_hotplug_wq and serializes
it between ACPI hot-remove and sysfs eject requests.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Tested-by: IgorMammedov <imammedo@redhat.com>
Tested-by: Vijay Mohan Pandarathil <vijaymohan.pandarathil@hp.com>
Tested-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Export functions for hot-remove
Toshi Kani [Thu, 1 Nov 2012 14:42:12 +0000 (14:42 +0000)]
ACPI: Export functions for hot-remove

Exported acpi_os_hotplug_execute() and acpi_bus_hot_remove_device()
so that they can be called from modules for hot-remove operations.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Add user space interface for identification objects
Lv Zheng [Tue, 30 Oct 2012 13:43:26 +0000 (14:43 +0100)]
ACPI: Add user space interface for identification objects

ACPI devices are glued with physical devices through _ADR object, ACPI
enumerated devices are identified with _UID object.  Currently we can
observe _HID/_CID through sysfs interfaces (hid/modalias), but there's
no way for us to check _ADR/_UID from user space.  This patch closes
this gap for ACPI developers and users.

[rjw: Modified the subject and changelog slightly.]
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Add _UID support for ACPI devices.
Lv Zheng [Tue, 30 Oct 2012 13:41:07 +0000 (14:41 +0100)]
ACPI: Add _UID support for ACPI devices.

The _UID object is optional, but is required when the device has no
other way to report a persistent unique device ID.
This patch is required for ACPI 5.0 ACPI enumerated IP cores.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rui Zhang <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / PM: Fix device PM kernedoc comments and #ifdefs
Rafael J. Wysocki [Fri, 26 Oct 2012 11:40:04 +0000 (13:40 +0200)]
ACPI / PM: Fix device PM kernedoc comments and #ifdefs

The kerneldoc comments for acpi_pm_device_sleep_state(),
acpi_pm_device_run_wake(), and acpi_pm_device_sleep_wake() are
outdated or otherwise inaccurate and/or don't follow the common
kerneldoc patterns, so fix them.

Additionally, notice that acpi_pm_device_run_wake() should be under
CONFIG_PM_RUNTIME rather than under CONFIG_PM_SLEEP, so fix that too.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: prepare the cpuidle core to handle multiple drivers
Daniel Lezcano [Wed, 31 Oct 2012 16:44:47 +0000 (16:44 +0000)]
cpuidle: prepare the cpuidle core to handle multiple drivers

This patch is a preparation for the multiple cpuidle drivers support.

As the next patch will introduce the multiple drivers with the Kconfig
option and we want to keep the code clean and understandable, this patch
defines a set of functions for encapsulating some common parts and splits
what should be done under a lock from the rest.

[rjw: Modified the subject and changelog slightly.]
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: move driver checking within the lock section
Daniel Lezcano [Wed, 31 Oct 2012 16:44:46 +0000 (16:44 +0000)]
cpuidle: move driver checking within the lock section

The code is racy and the check with cpuidle_curr_driver should be
done under the lock.

I don't find a path in the different drivers where that could happen
because the arch specific drivers are written in such way it is not
possible to register a driver while it is unregistered, except maybe
in a very improbable case when "intel_idle" and "processor_idle" are
competing. One could unregister a driver, while the other one is
registering.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: move driver's refcount to cpuidle
Daniel Lezcano [Wed, 31 Oct 2012 16:44:45 +0000 (16:44 +0000)]
cpuidle: move driver's refcount to cpuidle

We want to support different cpuidle drivers co-existing together.
In this case we should move the refcount to the cpuidle_driver
structure to handle several drivers at a time.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpufreq: Remove unnecessary initialization of a local variable
Jingoo Han [Wed, 31 Oct 2012 05:49:13 +0000 (05:49 +0000)]
cpufreq: Remove unnecessary initialization of a local variable

Remove an unnecessary initializer for the 'ret' variable in
__cpufreq_set_policy().

[rjw: Modified the subject and changelog slightly.]
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: move acpi_no_s4_hw_signature() declaration into #ifdef CONFIG_HIBERNATION
Yuanhan Liu [Fri, 26 Oct 2012 11:39:24 +0000 (13:39 +0200)]
ACPI: move acpi_no_s4_hw_signature() declaration into #ifdef CONFIG_HIBERNATION

acpi_no_s4_hw_signature is defined in #ifdef CONFIG_HIBERNATION block,
but the current code put the declaration in #ifdef CONFIG_PM_SLEEP block.

I happened to meet this issue when I turned off PM_SLEEP config manually:
arch/x86/kernel/acpi/sleep.c:100:4: error: implicit declaration of function ‘acpi_no_s4_hw_signature’ [-Werror=implicit-function-declaration]

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / Sleep: add acpi_sleep=nonvs_s3 parameter
Kristen Carlson Accardi [Fri, 26 Oct 2012 11:39:15 +0000 (13:39 +0200)]
ACPI / Sleep: add acpi_sleep=nonvs_s3 parameter

The ACPI specificiation would like us to save NVS at hibernation time,
but makes no mention of saving NVS over S3.  Not all versions of
Windows do this either, and it is clear that not all machines need NVS
saved/restored over S3.  Allow the user to improve their suspend/resume
time by disabling the NVS save/restore at S3 time, but continue to do
the NVS save/restore for S4 as specified.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Remove unused lockable in acpi_device_flags
Toshi Kani [Fri, 26 Oct 2012 11:39:06 +0000 (13:39 +0200)]
ACPI: Remove unused lockable in acpi_device_flags

Removed lockable in struct acpi_device_flags since it is no
longer used by any code. acpi_bus_hot_remove_device() cannot
use this flag because acpi_bus_trim() frees up its acpi_device
object. Furthermore, the dock driver calls _LCK method without
using this lockable flag.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Fix stale pointer access to flags.lockable
Toshi Kani [Fri, 26 Oct 2012 11:38:57 +0000 (13:38 +0200)]
ACPI: Fix stale pointer access to flags.lockable

During hot-remove, acpi_bus_hot_remove_device() calls ACPI _LCK
method when device->flags.lockable is set. However, this device
pointer is stale since the target acpi_device object has been
already kfree'd by acpi_bus_trim().

The flags.lockable indicates whether or not this ACPI object
implements _LCK method. Fix the stable pointer access by replacing
it with acpi_get_handle() to check if _LCK is implemented.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Fix a hard coding style when determining if a device is a container, v3
Tang Chen [Fri, 26 Oct 2012 11:38:16 +0000 (13:38 +0200)]
ACPI: Fix a hard coding style when determining if a device is a container, v3

"ACPI0004","PNP0A05" and "PNP0A06" are all defined in array
container_device_ids[], so use it, but not the hard coding style.

Also, introduce a new API is_container_device() to determine if a
device is a container device.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / x86: Add quirk for "CheckPoint P-20-00" to not use bridge _CRS_ info
Feng Tang [Mon, 22 Oct 2012 23:31:14 +0000 (01:31 +0200)]
ACPI / x86: Add quirk for "CheckPoint P-20-00" to not use bridge _CRS_ info

This is to fix a regression https://bugzilla.kernel.org/show_bug.cgi?id=47981

The CheckPoint P-20-00 works ok before new machines (2008 and later) are
forced to use the bridge _CRS info by default in 2.6.34. Add this quirk
to restore its old way of working: not using bridge _CRS info.

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / processor: prevent cpu from becoming online
Yasuaki Ishimatsu [Mon, 22 Oct 2012 23:30:54 +0000 (01:30 +0200)]
ACPI / processor: prevent cpu from becoming online

Even if acpi_processor_handle_eject() offlines cpu, there is a chance
to online the cpu after that. So the patch closes the window by using
get/put_online_cpus().

Why does the patch change _cpu_up() logic?

The patch cares the race of hot-remove cpu and _cpu_up(). If the patch
does not change it, there is the following race.

hot-remove cpu                         |  _cpu_up()
------------------------------------- ------------------------------------
call acpi_processor_handle_eject()     |
     call cpu_down()                   |
     call get_online_cpus()            |
                                       | call cpu_hotplug_begin() and stop here
     call arch_unregister_cpu()        |
     call acpi_unmap_lsapic()          |
     call put_online_cpus()            |
                                       | start and continue _cpu_up()
     return acpi_processor_remove()    |
continue hot-remove the cpu            |

So _cpu_up() can continue to itself. And hot-remove cpu can also continue
itself. If the patch changes _cpu_up() logic, the race disappears as below:

hot-remove cpu                         | _cpu_up()
-----------------------------------------------------------------------
call acpi_processor_handle_eject()     |
     call cpu_down()                   |
     call get_online_cpus()            |
                                       | call cpu_hotplug_begin() and stop here
     call arch_unregister_cpu()        |
     call acpi_unmap_lsapic()          |
          cpu's cpu_present is set     |
          to false by set_cpu_present()|
     call put_online_cpus()            |
                                       | start _cpu_up()
                                       | check cpu_present() and return -EINVAL
     return acpi_processor_remove()    |
continue hot-remove the cpu            |

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Reviewed-by: Toshi Kani <toshi.kani@hp.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: strict_strtoul() and printk() cleanup in acpi_pad
Josh [Mon, 22 Oct 2012 23:30:40 +0000 (01:30 +0200)]
ACPI: strict_strtoul() and printk() cleanup in acpi_pad

Replace a few calls to strict_strtoul() in acpi_pad.c with kstrtoul()
and use pr_warn() instead of printk() in the same file.

[rjw: Modified the subject and changelog.]
Signed-off-by: Josh Taylor <joshua.taylor0@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: dock: Remove redundant ACPI NS walk
Toshi Kani [Mon, 22 Oct 2012 23:30:26 +0000 (01:30 +0200)]
ACPI: dock: Remove redundant ACPI NS walk

Combined two ACPI namespace walks, which look for dock stations
and then bays separately, into a single walk.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / EC: Don't count a SCI interrupt as a false one
Feng Tang [Mon, 22 Oct 2012 23:30:12 +0000 (01:30 +0200)]
ACPI / EC: Don't count a SCI interrupt as a false one

Currently when advance_transaction() is called in EC interrupt handler,
if there is nothing driver can do with the interrupt, it will be taken
as a false one.

But this is not always true, as there may be a SCI EC interrupt fired
during normal read/write operation, which should not be counted as a
false one. This patch fixes the problem.

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / QoS: Fix a free error in the dev_pm_qos_constraints_destroy()
Lan,Tianyu [Thu, 1 Nov 2012 21:45:30 +0000 (22:45 +0100)]
PM / QoS: Fix a free error in the dev_pm_qos_constraints_destroy()

Free a wrong point to struct dev_pm_qos->latency which suppose to
be the point to struct dev_pm_qos. The patch is to fix the issue.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Update version to 20121018
Bob Moore [Wed, 31 Oct 2012 02:28:46 +0000 (02:28 +0000)]
ACPICA: Update version to 20121018

Version 20121018.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: AcpiGetObjectInfo: Add support for ACPI 5 _SUB method
Bob Moore [Wed, 31 Oct 2012 02:28:38 +0000 (02:28 +0000)]
ACPICA: AcpiGetObjectInfo: Add support for ACPI 5 _SUB method

Now calls _SUB in addition to the other ID methods: _HID, _CID,
and _UID.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Update for 64-bit generation of recent error message changes
Bob Moore [Wed, 31 Oct 2012 02:28:27 +0000 (02:28 +0000)]
ACPICA: Update for 64-bit generation of recent error message changes

Fix for errors on printf changes on 64-bit platforms and gcc.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix externalize name to complete migration to ACPI_MOVE_NAME
Bob Moore [Wed, 31 Oct 2012 02:28:19 +0000 (02:28 +0000)]
ACPICA: Fix externalize name to complete migration to ACPI_MOVE_NAME

Fix for name segment copy and validation.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Add starting offset parameter to common dump buffer routine
Bob Moore [Wed, 31 Oct 2012 02:28:11 +0000 (02:28 +0000)]
ACPICA: Add starting offset parameter to common dump buffer routine

Rename the dump buffer routines. Offset parameter can specify the
buffer starting offset that is used when displaying each line of
the buffer.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Deploy ACPI_MOVE_NAME across ACPICA source base
Bob Moore [Wed, 31 Oct 2012 02:28:03 +0000 (02:28 +0000)]
ACPICA: Deploy ACPI_MOVE_NAME across ACPICA source base

Replaces instances of strncpy(...,4) for ACPI_NAMEs.
ACPI_MOVE_NAME optimizes these to a single 32-bit copy on machines
that support misaligned transfers.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Update support for ACPI 5 MPST table
Bob Moore [Wed, 31 Oct 2012 02:27:56 +0000 (02:27 +0000)]
ACPICA: Update support for ACPI 5 MPST table

Fixes some problems introduced by late changes to the table as it
was added to the ACPI 5.0 specification.  Both the table compiler
and the disassembler and the main header support for the table.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Enhance error reporting for invalid opcodes and bad ACPI_NAMEs
Bob Moore [Wed, 31 Oct 2012 02:27:48 +0000 (02:27 +0000)]
ACPICA: Enhance error reporting for invalid opcodes and bad ACPI_NAMEs

For disassembler, dump the 48 bytes surrounding the invalid
opcode.  Fix incorrect table offset reported for invalid opcodes.
Report original 32-bit value for bad ACPI_NAMEs.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Add ACPI_MOVE_NAME macro to optimize 4-byte ACPI_NAME copies
Bob Moore [Wed, 31 Oct 2012 02:27:40 +0000 (02:27 +0000)]
ACPICA: Add ACPI_MOVE_NAME macro to optimize 4-byte ACPI_NAME copies

Resolves to a 32-bit move for the normal case, strncpy on machines
that do not support misaligned transfers.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: AcpiExec: Improve algorithm for tracking memory leaks
Bob Moore [Wed, 31 Oct 2012 02:27:32 +0000 (02:27 +0000)]
ACPICA: AcpiExec: Improve algorithm for tracking memory leaks

Add some intelligence to the code that maintains the global
list of allocated memory. The list is now ordered by allocated
memory address, significantly improving performance.  When running
AcpiExec on the ASLTS test suite, speed improvements of 3X to 5X
are seen, depending on the platform and/or the environment.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Add debug print message for mutex objects that are force-released
Bob Moore [Wed, 31 Oct 2012 02:27:24 +0000 (02:27 +0000)]
ACPICA: Add debug print message for mutex objects that are force-released

At control method termination, any currently acquired mutex
objects are force-released. Add a new message for each one that
is released.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Resource Mgr: Small fix for buffer size calculation
Feng Tang [Wed, 31 Oct 2012 02:27:15 +0000 (02:27 +0000)]
ACPICA: Resource Mgr: Small fix for buffer size calculation

Fixes a one byte error in the output buffer calculation.
Feng Tang - ACPICA BZ 849:
https://www.acpica.org/bugzilla/show_bug.cgi?id=849

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Remove extra spaces after periods in the Intel license
Bob Moore [Wed, 31 Oct 2012 02:27:04 +0000 (02:27 +0000)]
ACPICA: Remove extra spaces after periods in the Intel license

For consistency with the rest of the source code.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Remove extra spaces after periods within comments
Bob Moore [Wed, 31 Oct 2012 02:26:55 +0000 (02:26 +0000)]
ACPICA: Remove extra spaces after periods within comments

This makes all comments consistent.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Update local C library module comments for ASCII table
Bob Moore [Wed, 31 Oct 2012 02:26:47 +0000 (02:26 +0000)]
ACPICA: Update local C library module comments for ASCII table

Improve the commenting of the table.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix for predefined name loop during ACPICA initialization
Robert Moore [Wed, 31 Oct 2012 02:26:36 +0000 (02:26 +0000)]
ACPICA: Fix for predefined name loop during ACPICA initialization

If a name cannot be created, simply continue on to the next name.
Do not attempt to use the name, do not abort.  With assistance
from Colin Ian King.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix some typos in comments
Bob Moore [Wed, 31 Oct 2012 02:26:23 +0000 (02:26 +0000)]
ACPICA: Fix some typos in comments

No functional changes.  Some small fixes within commments. Colin
Ian King.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: ACPICA core: Cleanup empty lines at file start and end
Bob Moore [Wed, 31 Oct 2012 02:26:11 +0000 (02:26 +0000)]
ACPICA: ACPICA core: Cleanup empty lines at file start and end

Maintenance for source code consistency.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Audit/update for ACPICA return macros and debug depth counter
Bob Moore [Wed, 31 Oct 2012 02:26:01 +0000 (02:26 +0000)]
ACPICA: Audit/update for ACPICA return macros and debug depth counter

1) Ensure that all functions that use the various TRACE macros
   also use the appropriate ACPICA return macros.
2) Ensure that all normal return statements surround the return
   expression (value) with parens.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix unmerged acmacros.h divergences.
Lv Zheng [Wed, 31 Oct 2012 02:25:52 +0000 (02:25 +0000)]
ACPICA: Fix unmerged acmacros.h divergences.

The 20121018 release depends on some unmerged acmaros.h fixes.
This patch includes the fixes made on acmaros.h that will not affect
the generated vmlinux binary.

This patch will not affect the generated vmlinux binary.
This will decrease 157 lines of 20120913 divergence.diff.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix indent caused divergences.
Lv Zheng [Wed, 31 Oct 2012 02:25:45 +0000 (02:25 +0000)]
ACPICA: Fix indent caused divergences.

New version of "indent" program will generate different outputs that
will lead to the divergences between the Linux and the ACPICA.
This patch fixes such divergences caused by the "indent" program.
The version of the "indent" used for this patch is "GNU indent 2.2.11".

This patch will not affect the generated vmlinux binary.
This will decrease 581 lines of 20120913 divergence.diff.

Signed-off-by: Robert Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix AcpiSrc caused divergences.
Lv Zheng [Wed, 31 Oct 2012 02:25:36 +0000 (02:25 +0000)]
ACPICA: Fix AcpiSrc caused divergences.

There are definitions that can been converted into new styles by
the recent AcpiSrc while they remain the old styles in the Linux.
This patch fixes those definitions that will be converted by the
AcpiSrc.

This patch will not affect the generated vmlinux binary.
This will decrease 97 lines of 20120913 divergence.diff.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix divergences of definition conflicts.
Lv Zheng [Wed, 31 Oct 2012 02:25:24 +0000 (02:25 +0000)]
ACPICA: Fix divergences of definition conflicts.

There are conflicts in the "acpi_device_id*" definitions between the
Linux and the ACPICA.  The definitions of acpi_device_id* in ACPICA
have been changed to the "acpi_pnp_device_id*".  This patch changes
the corresponding "acpica_device_id*" definitiions in the Linux.

This patch will not affect the generated vmlinx binary.
This will decrease 298 lines of 20120913 divergence.diff.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix unmerged debugger divergences.
Lv Zheng [Wed, 31 Oct 2012 02:25:15 +0000 (02:25 +0000)]
ACPICA: Fix unmerged debugger divergences.

Debugger improvements in ACPICA are always ignored by ACPICA Linux
release.  This will lead to divergences between Linux and ACPICA.
This patch fixes such unmerged debugger updates.

Following patches are included:
1. Fixed a couple compiler warnings for extra extern
   Wed, 14 Mar 2007 21:12:19 +0000
2. Cleanup for internal Reference Object.
   Wed, 27 Aug 2008 10:11:30 -0700
3. Debugger: Lock method args for multithread command.
   Fri, 24 Apr 2009 12:28:49 -0700
4. Debugger: Add max count argument for Batch command.
   Tue, 29 Sep 2009 12:31:58 -0700
5. Add new host interfaces for _OSI support.
   Thu, 5 Aug 2010 14:18:28 -0700
6. Increase debugger buffer size for method return objects.
   Wed, 17 Nov 2010 13:48:30 -0800
7. Debugger: Add command to display status of global handlers.
   Tue, 25 Jan 2011 13:47:58 -0800
8. Debugger: Split large dbcmds.c file.
   Wed, 26 Jan 2011 13:03:41 -0800
9. Debugger/AcpiExec: Add support to pass complex args to methods.
   Tue, 17 May 2011 13:33:39 -0700
10.Debugger: Add Template command to dump resource templates.
   Fri, 28 Oct 2011 14:18:51 -0700
11.Support for custom ACPICA build for ACPI 5.0 reduced hardware.
   Wed, 1 Feb 2012 13:18:17 -0800
12.Debugger: Improve command help support.
   Wed, 15 Feb 2012 07:59:26 -0800
13.Update ACPI_HW_DEPENDENT* macro invocations.
   Wed, 15 Feb 2012 08:14:08 -0800
14.Debugger: Rename function to simplify source code conversion.
   Wed, 13 Jun 2012 14:23:06 -0700
15.Debugger: Enhance "Tables" and "Unload" commands.
   Fri, 29 Jun 2012 13:10:58 -0700
16.Debugger: update prototype for AcpiDbSleep function.
   Fri, 17 Aug 2012 13:43:02 -0700

This patch will not affect the generated vmlinx binary.
This will decrease 264 lines of 20120913 divergence.diff.

Signed-off-by: Robert Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPICA: Fix unmerged utility divergences.
Lv Zheng [Wed, 31 Oct 2012 02:25:05 +0000 (02:25 +0000)]
ACPICA: Fix unmerged utility divergences.

Utility improvements in ACPICA are partial ignored by ACPICA Linux
release.  This will lead to divergences between Linux and ACPICA.
This patch ports the entire "utility" into Linux and makes them
igored in the compilation stage by "ACPI_FUTURE_USAGE".
The following "Utility" files have been ported into the Linux:
  drivers/acpi/uttrack.c
  drivers/acpi/utcache.c
  drivers/acpi/utids.c

This patch will not affect the generated vmlinx binary.
This will decrease 274 lines of 20120913 divergence.diff.

Signed-off-by: Robert Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoCleanup of invalid ACPI name handling and repair
Bob Moore [Wed, 31 Oct 2012 02:24:51 +0000 (02:24 +0000)]
Cleanup of invalid ACPI name handling and repair

 Implemented a change/cleanup for the handling of invalid ACPI names.
 Names are now validated and repaired only when
 1) entering a new name into the namespace and
 2) disassembling a named AML opcode. A warning is only displayed in
    debug mode or when the interpreter is in "strict" mode, since some
    working machines do in fact contain invalid ACPI names.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Add support for platform bus type
Mika Westerberg [Wed, 31 Oct 2012 21:45:02 +0000 (22:45 +0100)]
ACPI: Add support for platform bus type

With ACPI 5 it is now possible to enumerate traditional SoC
peripherals, like serial bus controllers and slave devices behind
them.  These devices are typically based on IP-blocks used in many
existing SoC platforms and platform drivers for them may already
be present in the kernel tree.

To make driver "porting" more straightforward, add ACPI support to
the platform bus type.  Instead of writing ACPI "glue" drivers for
the existing platform drivers, register the platform bus type with
ACPI to create platform device objects for the drivers and bind the
corresponding ACPI handles to those platform devices.

This should allow us to reuse the existing platform drivers for the
devices in question with the minimum amount of modifications.

This changeset is based on Mika Westerberg's and Mathias Nyman's
work.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / ia64: Export acpi_[un]register_gsi()
Mika Westerberg [Wed, 31 Oct 2012 21:44:55 +0000 (22:44 +0100)]
ACPI / ia64: Export acpi_[un]register_gsi()

These functions might be called from modules as well so make sure
they are exported.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI / x86: Export acpi_[un]register_gsi()
Andy Shevchenko [Wed, 31 Oct 2012 21:44:48 +0000 (22:44 +0100)]
ACPI / x86: Export acpi_[un]register_gsi()

These functions might be called from modules as well so make sure
they are exported.

In addition, implement empty version of acpi_unregister_gsi() and
remove the one from pci_irq.c.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoACPI: Provide generic functions for matching ACPI device nodes
Mika Westerberg [Wed, 31 Oct 2012 21:44:41 +0000 (22:44 +0100)]
ACPI: Provide generic functions for matching ACPI device nodes

Introduce function acpi_match_device() allowing callers to match
struct device objects with populated acpi_handle fields against
arrays of ACPI device IDs.  Also introduce function
acpi_driver_match_device() using acpi_match_device() internally and
allowing callers to match a struct device object against an array of
ACPI device IDs provided by a device driver.

Additionally, introduce macro ACPI_PTR() that may be used by device
drivers to escape pointers to data structures whose definitions
depend on CONFIG_ACPI.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agodriver core / ACPI: Move ACPI support to core device and driver types
Mika Westerberg [Wed, 31 Oct 2012 21:44:33 +0000 (22:44 +0100)]
driver core / ACPI: Move ACPI support to core device and driver types

With ACPI 5 we are starting to see devices that don't natively support
discovery but can be enumerated with the help of the ACPI namespace.
Typically, these devices can be represented in the Linux device driver
model as platform devices or some serial bus devices, like SPI or I2C
devices.

Since we want to re-use existing drivers for those devices, we need a
way for drivers to specify the ACPI IDs of supported devices, so that
they can be matched against device nodes in the ACPI namespace.  To
this end, it is sufficient to add a pointer to an array of supported
ACPI device IDs, that can be provided by the driver, to struct device.

Moreover, things like ACPI power management need to have access to
the ACPI handle of each supported device, because that handle is used
to invoke AML methods associated with the corresponding ACPI device
node.  The ACPI handles of devices are now stored in the archdata
member structure of struct device whose definition depends on the
architecture and includes the ACPI handle only on x86 and ia64. Since
the pointer to an array of supported ACPI IDs is added to struct
device_driver in an architecture-independent way, it is logical to
move the ACPI handle from archdata to struct device itself at the same
time.  This also makes code more straightforward in some places and
follows the example of Device Trees that have a poiter to struct
device_node in there too.

This changeset is based on Mika Westerberg's work.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agodriver core / PM: move the calling to device_pm_remove behind the calling to bus_remo...
LongX Zhang [Wed, 24 Oct 2012 22:21:28 +0000 (00:21 +0200)]
driver core / PM: move the calling to device_pm_remove behind the calling to bus_remove_device

We hit an hang issue when removing a mmc device on Medfield Android phone by sysfs interface.

device_pm_remove will call pm_runtime_remove which would disable
runtime PM of the device. After that pm_runtime_get* or
pm_runtime_put* will be ignored. So if we disable the runtime PM
before device really be removed, drivers' _remove callback may
access HW even pm_runtime_get* fails. That is bad.

Consider below call sequence when removing a device:
device_del => device_pm_remove
             => class_intf->remove_dev(dev, class_intf)  => pm_runtime_get_sync/put_sync
             => bus_remove_device => device_release_driver => pm_runtime_get_sync/put_sync

remove_dev might call pm_runtime_get_sync/put_sync.
Then, generic device_release_driver also calls pm_runtime_get_sync/put_sync.
Since device_del => device_pm_remove firstly, later _get_sync wouldn't really wake up the device.

I git log -p to find the patch which moves the calling to device_pm_remove ahead.
It's below patch:

commit  775b64d2b6ca37697de925f70799c710aab5849a
Author: Rafael J. Wysocki <rjw@sisk.pl>
Date:   Sat Jan 12 20:40:46 2008 +0100

     PM: Acquire device locks on suspend

     This patch reorganizes the way suspend and resume notifications are
     sent to drivers.  The major changes are that now the PM core acquires
     every device semaphore before calling the methods, and calls to
     device_add() during suspends will fail, while calls to device_del()
     during suspends will block.

     It also provides a way to safely remove a suspended device with the
     help of the PM core, by using the device_pm_schedule_removal() callback
     introduced specifically for this purpose, and updates two drivers (msr
     and cpuid) that need to use it.

As device_pm_schedule_removal is deleted by another patch, we need also revert other parts of the patch,
i.e. move the calling of device_pm_remove after the calling to bus_remove_device.

Signed-off-by: LongX Zhang <longx.zhang@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / Hibernate: use rb_entry
Davidlohr Bueso [Mon, 22 Oct 2012 23:21:09 +0000 (01:21 +0200)]
PM / Hibernate: use rb_entry

Since the software suspend extents are organized in an rbtree, use rb_entry
instead of container_of, as it is semantically more appropriate in order to
get a node as it is iterated.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / sysfs: replace strict_str* with kstrto*
Daniel Walter [Mon, 22 Oct 2012 23:20:35 +0000 (01:20 +0200)]
PM / sysfs: replace strict_str* with kstrto*

Replace strict_strtoul() with kstrtoul() in pm_async_store() and
pm_qos_power_write().

[rjw: Modified subject and changelog.]

Signed-off-by: Daniel Walter <sahne@0x90.at>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agobase: power - use clk_prepare_enable and clk_prepare_disable
Murali Karicheri [Mon, 22 Oct 2012 23:18:40 +0000 (01:18 +0200)]
base: power - use clk_prepare_enable and clk_prepare_disable

When PM runtime is enabled in DaVinci and the machine migrates to
common clk framework, the clk_enable() gets called without
clk_prepare(). This patch is to fix this issue so that PM run
time can inter work with common clk framework.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / OPP: using kfree_rcu() to simplify the code
Wei Yongjun [Wed, 31 Oct 2012 00:29:17 +0000 (01:29 +0100)]
PM / OPP: using kfree_rcu() to simplify the code

The callback function of call_rcu() just calls a kfree(), so we
can use kfree_rcu() instead of call_rcu() + callback function.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / OPP: predictable fail results for opp_find* functions, v2
Nishanth Menon [Wed, 24 Oct 2012 20:00:12 +0000 (22:00 +0200)]
PM / OPP: predictable fail results for opp_find* functions, v2

Currently the opp_find* functions return -ENODEV when:
a) it cant find a device (e.g. request for an OPP search on device
   which was not registered)
b) When it cant find a match for the search strategy used

This makes life a little in-efficient for users such as devfreq
to make reasonable judgement before switching search strategies.

So, standardize the return results as following:
 -EINVAL for bad pointer parameters
 -ENODEV when device cannot be found
 -ERANGE when search fails

This has the following benefit for devfreq implementation:
The search fails when an unregistered device pointer is provided.
This is a trigger to change the search direction and search for
a better fit, however, if we cannot differentiate between a valid
search range failure Vs an unregistered device, second search goes
through the same fail return condition. This can be avoided by
appropriate handling of error return code.

With this change, we also fix devfreq for the improved search
strategy with updated error code.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / OPP: Export symbols for module usage.
Liam Girdwood [Mon, 22 Oct 2012 23:27:44 +0000 (01:27 +0200)]
PM / OPP: Export symbols for module usage.

Export the OPP functions for use by driver modules.

Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Kevin Hilman <khilman@ti.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
[nm@ti.com: expansion of functions exported]
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / OPP: RCU reclaim
Vincent Guittot [Mon, 22 Oct 2012 23:21:49 +0000 (01:21 +0200)]
PM / OPP: RCU reclaim

synchronize_rcu() blocks the caller of opp_enable/disbale
for a complete grace period. This blocking duration prevents
any intensive use of the functions. Replace synchronize_rcu()
by call_rcu() which will call our function for freeing the old
opp element.

The duration of opp_enable() and opp_disable() will be no more
dependant of the grace period.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: make devfreq_class static
Nishanth Menon [Thu, 25 Oct 2012 23:50:53 +0000 (01:50 +0200)]
PM / devfreq: make devfreq_class static

devfreq_class is used internally by devfreq and has no
need to be globally available.

This also fixes the following sparse warning:
drivers/devfreq/devfreq.c:30:14: warning: symbol 'devfreq_class' was not declared. Should it be static?

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: fix sscanf handling for writable sysfs entries
Nishanth Menon [Thu, 25 Oct 2012 23:50:43 +0000 (01:50 +0200)]
PM / devfreq: fix sscanf handling for writable sysfs entries

sscanf returns 0 when an invalid parameter like:
echo -n "a">min_freq
is attempted. Returning back the return result(0) will
cause the command not to return back to command
prompt.

Instead, just return -EINVAL when sscanf does not
return 1.

This is done for min_freq, max_freq and polling_interval

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: kernel-doc typo corrections
Nishanth Menon [Thu, 25 Oct 2012 23:50:35 +0000 (01:50 +0200)]
PM / devfreq: kernel-doc typo corrections

Parameter documentation needs a ':' for scripts/kernel-doc
to parse properly.

Minor fixes for ones warned by:
./scripts/kernel-doc -text drivers/devfreq/devfreq.c>/dev/null

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: Add current freq callback in device profile
Rajagopal Venkat [Thu, 25 Oct 2012 23:50:26 +0000 (01:50 +0200)]
PM / devfreq: Add current freq callback in device profile

Devfreq returns governor predicted frequency as current frequency
via sysfs interface. But device may not support all frequencies
that governor predicts. So add a callback in device profile to get
current freq from driver. Also add a new sysfs node to expose
governor predicted next target frequency.

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: Add suspend and resume apis
Rajagopal Venkat [Thu, 25 Oct 2012 23:50:18 +0000 (01:50 +0200)]
PM / devfreq: Add suspend and resume apis

Add devfreq suspend/resume apis for devfreq users. This patch
supports suspend and resume of devfreq load monitoring, required
for devices which can idle.

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agoPM / devfreq: Core updates to support devices which can idle
Rajagopal Venkat [Thu, 25 Oct 2012 23:50:09 +0000 (01:50 +0200)]
PM / devfreq: Core updates to support devices which can idle

Prepare devfreq core framework to support devices which
can idle. When device idleness is detected perhaps through
runtime-pm, need some mechanism to suspend devfreq load
monitoring and resume back when device is online. Present
code continues monitoring unless device is removed from
devfreq core.

This patch introduces following design changes,

 - use per device work instead of global work to monitor device
   load. This enables suspend/resume of device devfreq and
   reduces monitoring code complexity.
 - decouple delayed work based load monitoring logic from core
   by introducing helpers functions to be used by governors. This
   provides flexibility for governors either to use delayed work
   based monitoring functions or to implement their own mechanism.
 - devfreq core interacts with governors via events to perform
   specific actions. These events include start/stop devfreq.
   This sets ground for adding suspend/resume events.

The devfreq apis are not modified and are kept intact.

Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: fixup device.h header in cpuidle.h
Daniel Lezcano [Wed, 31 Oct 2012 00:09:02 +0000 (01:09 +0100)]
cpuidle: fixup device.h header in cpuidle.h

The "struct device" is only used in sysfs.c.

The other .c files including the private header "cpuidle.h"
do not need to pull the entire headers tree from there as they
don't manipulate the "struct device".

This patch fixes this by moving the header inclusion to sysfs.c
and adding a forward declaration for the struct device.

The number of lines generated by the preprocesor:
Without this patch : 17269 loc
With this patch : 16446 loc

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle / sysfs: move structure declaration into the sysfs.c file
Daniel Lezcano [Wed, 31 Oct 2012 00:05:16 +0000 (01:05 +0100)]
cpuidle / sysfs: move structure declaration into the sysfs.c file

The structure cpuidle_state_kobj is not used anywhere except
in the sysfs.c file. The definition of this structure is not
needed in the cpuidle header file. This patch moves it to the
sysfs.c file in order to encapsulate the code a bit more.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: Get typical recent sleep interval
Youquan Song [Fri, 26 Oct 2012 10:27:07 +0000 (12:27 +0200)]
cpuidle: Get typical recent sleep interval

The function detect_repeating_patterns was not very useful for
workloads with alternating long and short pauses, for example
virtual machines handling network requests for each other (say
a web and database server).

Instead, try to find a recent sleep interval that is somewhere
between the median and the mode sleep time, by discarding outliers
to the up side and recalculating the average and standard deviation
until that is no longer required.

This should do something sane with a sleep interval series like:

200 180 210 10000 30 1000 170 200

The current code would simply discard such a series, while the
new code will guess a typical sleep interval just shy of 200.

The original patch come from Rik van Riel <riel@redhat.com>.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
11 years agocpuidle: Set residency to 0 if target Cstate not enter
Youquan Song [Fri, 26 Oct 2012 10:26:59 +0000 (12:26 +0200)]
cpuidle: Set residency to 0 if target Cstate not enter

When cpuidle governor choose a C-state to enter for idle CPU, but it notice that
there is tasks request to be executed. So the idle CPU will not really enter
the target C-state and go to run task.

In this situation, it will use the residency of previous really entered target
C-states. Obviously, it is not reasonable.

So, this patch fix it by set the target C-state residency to 0.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>