Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] acpid: Only read cpuinfo_{min,max}_freq when needed
@ 2024-02-21  7:34 zevweiss
  2024-02-21 23:14 ` classabbyamp
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zevweiss @ 2024-02-21  7:34 UTC (permalink / raw)
  To: ml

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-23  3:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21  7:34 [PR PATCH] acpid: Only read cpuinfo_{min,max}_freq when needed zevweiss
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

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).