From patchwork Thu Apr 2 00:55:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 6143481 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E09809F399 for ; Thu, 2 Apr 2015 00:56:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 119752035B for ; Thu, 2 Apr 2015 00:56:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3730F2034F for ; Thu, 2 Apr 2015 00:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752267AbbDBA4F (ORCPT ); Wed, 1 Apr 2015 20:56:05 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:34607 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751576AbbDBA4D (ORCPT ); Wed, 1 Apr 2015 20:56:03 -0400 Received: by pdbni2 with SMTP id ni2so71926886pdb.1; Wed, 01 Apr 2015 17:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CgN0ABcf2G3B7QiI7slCfIw0Eg6BqcO8F3D1obqwlkc=; b=F9I0CjPsSyiEhxDGuQawoBuO5pWhNsrg4mSTRRAGDOUab3dCcveiYyf14vj5cOhA2H Pl2q+jNcuA+sX0ataJTsj9FUC7Puv0GgLznybgI6ZWaxSmx9BNxxRVUT6vTPl/6015Ov js3jaX0HIv9Yj6ooCixvq2vGquisPVwgucOBFq89Fy3hD6/RRHapCUNsImTZ28oZkumA GahZkSOTLN5s01lAP9TLyC4cnz0HWJDF+DgFR4YBRhKyMY/NIV1ZYfXORw+hM4rzs4Ms aStotUTtso53SvEilvg38feHyT5EdLhklvgiLMnnNwKLr0SMGrC6hciQ+nESYwgBKz7h OlHg== X-Received: by 10.70.38.136 with SMTP id g8mr71021971pdk.80.1427936163006; Wed, 01 Apr 2015 17:56:03 -0700 (PDT) Received: from ld-irv-0074.broadcom.com (5520-maca-inet1-outside.broadcom.com. [216.31.211.11]) by mx.google.com with ESMTPSA id tz4sm3324627pac.46.2015.04.01.17.56.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Apr 2015 17:56:02 -0700 (PDT) From: Brian Norris To: Zhang Rui , Eduardo Valentin Cc: , , Brian Norris Subject: [PATCH] thermal: user_space: add trip point number to uevent data Date: Wed, 1 Apr 2015 17:55:43 -0700 Message-Id: <1427936143-26508-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 +#include #include #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; }