Mega ACPI and PMU cleanup

Richard Hughes hughsient at gmail.com
Mon Feb 20 11:11:10 PST 2006


Okay, mega patch enclosed to make acpi and pmu do things a bit
differently, more efficiently.

Lots of times we are calling the functions:

hal_util_grep_{bool|int|string}_elem_from_file

(which saves the value in the hal key)

and then reading this key, then checking stuff, then writing it back.

Okay, this is probably cached, but less efficient than keeping the
variable around and re-using it.

The bigger problem, is whilst checking stuff,  if we end up changing the
values (to fix broken bioses that get the numbers wrong) then the key
will go from one value, to another, then to another. This upsets g-p-m
(and I suspect also battstat-applet) greatly. One such fix is included.

It's more logical to read back the values into a variable, do the
checking, and then save to a key. There's lots of places in the code
that make this very easy to do, and also lets us do more clever error
handling if the key does not exist, rather than not just setting the
key.

Typos and logic errors may have crept in, but I've done my best to check
these. I've also tidied up trailing spaces, and got rid of some code
duplication in util.c.

It's a big diff, but if you use something like meld, you'll see there
are not that many changes, and hardly any regarding program logic.

Comments please.

Thanks, Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-cleanup-acpi-pmu.patch
Type: text/x-patch
Size: 22139 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20060220/2a7c1215/hal-cleanup-acpi-pmu-0001.bin


More information about the hal mailing list