Github messages for voidlinux
 help / color / mirror / Atom feed
From: zevweiss <zevweiss@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] acpid: Only read cpuinfo_{min,max}_freq when needed
Date: Wed, 21 Feb 2024 08:34:10 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-48864@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

There is a new pull request by zevweiss against master on the void-packages repository

https://github.com/zevweiss/void-packages acpid-tweak
https://github.com/void-linux/void-packages/pull/48864

acpid: Only read cpuinfo_{min,max}_freq when needed
Previously handler.sh would unconditionally fork/exec 'cat' twice to read these files on any invocation, though their values are only used for ac_adapter events.  Tidy it up to only read them when handling that case.

#### Testing the changes
- I tested the changes in this PR: **briefly**


A patch file from https://github.com/void-linux/void-packages/pull/48864.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-acpid-tweak-48864.patch --]
[-- Type: text/x-diff, Size: 1701 bytes --]

From 2d999ec50679772aa9617366e010885fb58c4dfe Mon Sep 17 00:00:00 2001
From: Zev Weiss <zev@bewilderbeest.net>
Date: Tue, 20 Feb 2024 21:00:04 -0800
Subject: [PATCH] acpid: Only read cpuinfo_{min,max}_freq when needed

Previously handler.sh would unconditionally fork/exec 'cat' twice to
read these files on any invocation, though their values are only used
for ac_adapter events.  Tidy it up to only read them when handling
that case.
---
 srcpkgs/acpid/files/handler.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/acpid/files/handler.sh b/srcpkgs/acpid/files/handler.sh
index 1ff368bc1ebe05..1b55e09fe2b852 100644
--- a/srcpkgs/acpid/files/handler.sh
+++ b/srcpkgs/acpid/files/handler.sh
@@ -14,8 +14,8 @@ step_backlight() {
     done
 }
 
-minspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
-maxspeed=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
+minspeed="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
+maxspeed="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
 setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
 
 
@@ -44,11 +44,11 @@ case "$1" in
             AC|ACAD|ADP0)
                 case "$4" in
                     00000000)
-                        printf '%s' "$minspeed" >"$setspeed"
+                        cat "$minspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode start
                     ;;
                     00000001)
-                        printf '%s' "$maxspeed" >"$setspeed"
+                        cat "$maxspeed" >"$setspeed"
                         #/etc/laptop-mode/laptop-mode stop
                     ;;
                 esac

             reply	other threads:[~2024-02-21  7:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21  7:34 zevweiss [this message]
2024-02-21 23:14 ` classabbyamp
2024-02-21 23:17 ` [PR PATCH] [Updated] " zevweiss
2024-02-21 23:17 ` zevweiss
2024-02-23  3:00 ` [PR PATCH] [Merged]: " classabbyamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-48864@inbox.vuxu.org \
    --to=zevweiss@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).