ACPI: Cache battery status instead of re-evaluating AML
authorVladimir Lebedev <vladimir.p.lebedev@intel.com>
Tue, 20 Feb 2007 12:48:06 +0000 (15:48 +0300)
committerLen Brown <len.brown@intel.com>
Wed, 7 Mar 2007 06:48:07 +0000 (01:48 -0500)
commitb6ce4083ed8e2a01a3a59301eabe0fc1e68a8a84
treef332faa4712841a76a61c885c304662e3b6e4a59
parenta1f0eff21edac1bd87e397f56c4258b9611b5a50
ACPI: Cache battery status instead of re-evaluating AML

/proc exports _BST in a single file, and _BST is re-evaulated
whenever that file is read.

Sometimes user-space reads this file frequently, and on some
systems _BST takes a long time to evaluate due to a slow EC.

Further, when we move to sysfs, the values returned from _BST
will be in multiple files, and evaluating _BST for each
file read would make matters worse.

Here code is added to support caching the results of _BST.
A new module parameter "update_time" tells how many seconds the
cached _BST should be used before it is re-evaluated.
Currently, update_time defaults to 0, and so the
existing behaviour of re-evaluating on each read retained.

Signed-off-by: Vladimir Lebedev <vladimir.p.lebedev@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/battery.c