From: Brian Norris <computersforpeace@gmail.com>
To: Zhang Rui <rui.zhang@intel.com>, Eduardo Valentin <edubezval@gmail.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Brian Norris <computersforpeace@gmail.com>
Subject: [PATCH] thermal: user_space: add trip point number to uevent data
Date: Wed, 1 Apr 2015 17:55:43 -0700 [thread overview]
Message-ID: <1427936143-26508-1-git-send-email-computersforpeace@gmail.com> (raw)
A user-space thermal governor does not currently know which trip point
caused a uevent to trigger. Let's add this information to the payload.
This is just an RFC, because this patch (on its own) is not very useful.
The only current caller of the .throttle callback is in
thermal_zone_device_update(), which loops over *all* trip points. This
seems very counter-intuitive and unhelpful, but maybe I'm just clueless.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/thermal/user_space.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/user_space.c b/drivers/thermal/user_space.c
index 10adcddc8821..9fc03d3271d6 100644
--- a/drivers/thermal/user_space.c
+++ b/drivers/thermal/user_space.c
@@ -22,6 +22,8 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
+#include <linux/kernel.h>
+#include <linux/slab.h>
#include <linux/thermal.h>
#include "thermal_core.h"
@@ -34,9 +36,18 @@
*/
static int notify_user_space(struct thermal_zone_device *tz, int trip)
{
+ char *envp[] = { NULL, NULL };
+
+ envp[0] = kasprintf(GFP_KERNEL, "TRIPNUM=%u", trip);
+ if (!envp[0])
+ return -ENOMEM;
+
mutex_lock(&tz->lock);
- kobject_uevent(&tz->device.kobj, KOBJ_CHANGE);
+ kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, envp);
mutex_unlock(&tz->lock);
+
+ kfree(envp[0]);
+
return 0;
}
--
1.9.1
reply other threads:[~2015-04-02 0:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1427936143-26508-1-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
/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
Powered by JetHome