RUNTIME_PM_ALL=1: change internal default too.
tlp-{functions,stat}: refactor DISK_DEVICES

set DEFAULT_DISK_DEVICES="sda" in tlp-functions and use that
for setting DISK_DEVICES to its default value in tlp-functions/tlp-stat.

Additionally, eliminate double assignments (VAR=${VAR:=value}).

Signed-off-by: Thomas Koch <linrunner@gmx.net>
tlp-functions: improve handling of DISK_DEVICES

Setting APM/spindown/iosched might misbehave when dealing with missing
disks or disks lacking hdparm cap etc.

Example:

  DISK_DEVICES="ataid-ultrabay-disk ataid-system-disk"
  DISK_APM_LEVEL_ON_$$PWR$$="127 254"

With the existing implementation, TLP would set APM=127 for the system disk
when the ultrabay disk is not present, because the apmlist iterator gets
incremented only if the disk device exists (same for spindown/iosched lists).

The solution is to always remove one item from the apm/spindown/iosched list
when looping over DISK_DEVICES (-> pairwise iteration).

While at it, replace the "%list=$(echo $%list | sed %expr)" commands
with a more readable variant that doesn't involve subprocess/pipes:

   $@ := %list
   for dev in $DISK_DEVICES; do
      # do sth with $dev and $1
      shift
   done

However, this requires to back up parameters, e.g. $1 (_pwrmode).

No functionality change introduced by this commit,
except for pairwise iteration.

Signed-off-by: Thomas Koch <linrunner@gmx.net>
tlp-functions, set_disk_*(): more verbose logging

log about missing disks etc.

Signed-off-by: Thomas Koch <linrunner@gmx.net>
tlp-functions, set_disk_*(): accept "keep" value

Adds a special value(1) to the apm/spindown_timeout/iosched lists
that keeps a disk's apm/spindown/scheduler setting untouched.
Useful when certain disks should appear in tlp-stat, but left as-is otherwise.

(1) either "_" or "keep" is accepted as "keep-as-is" value

Introduces a global variable in tlp-functions, DISK_NOP_WORDS.

Signed-off-by: Thomas Koch <linrunner@gmx.net>
tlp-functions: add $DEFAULT_DISK_IO_SCHEDULER

Make the default io scheduler a constant rather than hardcoding it in
set_disk_io_sched().

Signed-off-by: Thomas Koch <linrunner@gmx.net>
Tag debug log messages for disk functions with "disk" instead of "pm" (Patch from André).
Coding style; comments added.