[Pm-utils] [PATCH 6/6] Modified acpi_flag setting to use arithmetic expansion.

Michael Biebl mbiebl at gmail.com
Wed Feb 27 22:19:25 PST 2008


2008/2/28, Victor Lowther <victor.lowther at gmail.com>:
> This gets rid of an ugly if statement and makes the code more legible.
>  ---
>   pm/sleep.d/99video |   14 ++++----------
>   1 files changed, 4 insertions(+), 10 deletions(-)
>
>  diff --git a/pm/sleep.d/99video b/pm/sleep.d/99video
>  index 4cb62dc..54fdb66 100755
>  --- a/pm/sleep.d/99video
>  +++ b/pm/sleep.d/99video
>  @@ -53,16 +53,10 @@ resume_fbcon()
>   suspend_video()
>   {
>         # 0=nothing, 1=s3_bios, 2=s3_mode, 3=both
>  -       if [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" -a \
>  -               "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
>  -               sysctl -w kernel.acpi_video_flags=3
>  -       elif [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ]; then
>  -               sysctl -w kernel.acpi_video_flags=1
>  -       elif [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ]; then
>  -               sysctl -w kernel.acpi_video_flags=2
>  -       else
>  -               sysctl -w kernel.acpi_video_flags=0
>  -       fi
>  +       local acpi_flag=0
>  +       [ "${DISPLAY_QUIRK_S3_BIOS}" = "true" ] && acpi_flag=$(($acpi_flag + 1))
>  +       [ "${DISPLAY_QUIRK_S3_MODE}" = "true" ] && acpi_flag=$(($acpi_flag + 2))
>  +       sysctl -w kernel.acpi_video_flags=$acpi_flag
>
>         # We might need to do one or many of these quirks
>         if [ "${DISPLAY_QUIRK_RADEON_OFF}" = "true" ]; then
>
> --
>  1.5.4.3

Looks good to me.

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


More information about the Pm-utils mailing list