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

* Re: acpid: Only read cpuinfo_{min,max}_freq when needed
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: classabbyamp @ 2024-02-21 23:14 UTC (permalink / raw)
  To: ml

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

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/48864#issuecomment-1958285082

Comment:
needs an increment to the revision in the template

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

* Re: [PR PATCH] [Updated] acpid: Only read cpuinfo_{min,max}_freq when needed
  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 ` zevweiss
  2024-02-21 23:17 ` zevweiss
  2024-02-23  3:00 ` [PR PATCH] [Merged]: " classabbyamp
  3 siblings, 0 replies; 5+ messages in thread
From: zevweiss @ 2024-02-21 23:17 UTC (permalink / raw)
  To: ml

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

There is an updated 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: 2135 bytes --]

From 5a1141024b0ffcd25ef2f7f6a8ea0b9a9374c9d6 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 ++++----
 srcpkgs/acpid/template         | 2 +-
 2 files changed, 5 insertions(+), 5 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
diff --git a/srcpkgs/acpid/template b/srcpkgs/acpid/template
index 1c498a2333225d..4adf3f24bb8c42 100644
--- a/srcpkgs/acpid/template
+++ b/srcpkgs/acpid/template
@@ -1,7 +1,7 @@
 # Template file for 'acpid'
 pkgname=acpid
 version=2.0.34
-revision=2
+revision=3
 build_style=gnu-configure
 short_desc="ACPI Daemon (acpid) With Netlink Support"
 maintainer="Enno Boland <gottox@voidlinux.org>"

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

* Re: acpid: Only read cpuinfo_{min,max}_freq when needed
  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
  3 siblings, 0 replies; 5+ messages in thread
From: zevweiss @ 2024-02-21 23:17 UTC (permalink / raw)
  To: ml

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

New comment by zevweiss on void-packages repository

https://github.com/void-linux/void-packages/pull/48864#issuecomment-1958295944

Comment:
Ack, thanks -- now fixed.

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

* Re: [PR PATCH] [Merged]: acpid: Only read cpuinfo_{min,max}_freq when needed
  2024-02-21  7:34 [PR PATCH] acpid: Only read cpuinfo_{min,max}_freq when needed zevweiss
                   ` (2 preceding siblings ...)
  2024-02-21 23:17 ` zevweiss
@ 2024-02-23  3:00 ` classabbyamp
  3 siblings, 0 replies; 5+ messages in thread
From: classabbyamp @ 2024-02-23  3:00 UTC (permalink / raw)
  To: ml

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

There's a merged pull request on the void-packages repository

acpid: Only read cpuinfo_{min,max}_freq when needed
https://github.com/void-linux/void-packages/pull/48864

Description:
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**


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