From patchwork Tue Mar 25 10:49:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 27024 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 50C3220539 for ; Tue, 25 Mar 2014 10:50:47 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf405051qae.11 for ; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=T3p/RHnv+AFu5X4dTvG9Zsx5gfoVv6d58SEuxO+eP7w=; b=H/C177UHoUJy4LXB8aW9qnveO/R7HywC+O3ZBZvyJxvrLLzaiLxaEZH9oJaYTFD0Ar BFDcfb5MyA02DvOnGJaeRHfWqOFMAfoUJhkhtdZblcudZwznWj4WMaIy9zaRqG4viJtt XM/T1MpNDpHAV+pODxJMF9qGa0e6M4VsJ0EVDUjGu+1E1lgFnWKQqqSGXNhEjaWHvcp0 VXA7pu3CvW+6wv0fFCOZ6NEovSZ/0gS7tSAjBYYq4tqkPZa8g9n6Xxmomc70XF/YhVRJ VQp+mM7SxmmmQ8s4puNqqspLRKl6UEJvcv/+dw6aM1k14OYXEYXbwL2LxjHm89pbKUMR 5tBg== X-Gm-Message-State: ALoCoQkrJO7sDjoH/Rd1gz6lwlzFl25IFN49jqdVie7I3Ecp6+rxA4px6a3eAyp9pHg2JHkJ5gDK X-Received: by 10.58.255.65 with SMTP id ao1mr17414093ved.11.1395744646952; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.81 with SMTP id 75ls159995qgg.75.gmail; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) X-Received: by 10.52.69.146 with SMTP id e18mr46635496vdu.15.1395744646860; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id dl6si3644014veb.73.2014.03.25.03.50.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 03:50:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id cz12so289781veb.2 for ; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) X-Received: by 10.220.88.204 with SMTP id b12mr54437441vcm.3.1395744646752; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp293782vck; Tue, 25 Mar 2014 03:50:46 -0700 (PDT) X-Received: by 10.68.235.6 with SMTP id ui6mr76052288pbc.45.1395744645845; Tue, 25 Mar 2014 03:50:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bs8si11278382pad.422.2014.03.25.03.50.45; Tue, 25 Mar 2014 03:50:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753636AbaCYKuK (ORCPT + 26 others); Tue, 25 Mar 2014 06:50:10 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:44492 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753385AbaCYKuE (ORCPT ); Tue, 25 Mar 2014 06:50:04 -0400 Received: by mail-pd0-f170.google.com with SMTP id v10so269432pde.15 for ; Tue, 25 Mar 2014 03:50:03 -0700 (PDT) X-Received: by 10.68.52.132 with SMTP id t4mr77573024pbo.102.1395744602893; Tue, 25 Mar 2014 03:50:02 -0700 (PDT) Received: from localhost.localdomain ([162.243.130.63]) by mx.google.com with ESMTPSA id db3sm42987987pbb.10.2014.03.25.03.49.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 03:50:02 -0700 (PDT) From: Alex Shi To: mark.hambleton@broadcom.com, mark.brown@linaro.org, eduardo.valentin@ti.com, mporter@linaro.org, lsk-interest@linaro.org, linaro-kernel@linaro.org Cc: David Woodhouse , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Zhang Rui , Alex Shi Subject: [PATCH 03/19] drivers: thermal: make usage of CONFIG_THERMAL_HWMON optional Date: Tue, 25 Mar 2014 18:49:16 +0800 Message-Id: <1395744572-20014-4-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1395744572-20014-1-git-send-email-alex.shi@linaro.org> References: <1395744572-20014-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.shi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Eduardo Valentin When registering a new thermal_device, the thermal framework will always add a hwmon sysfs interface. This patch adds a flag to make this behavior optional. Now when registering a new thermal device, the caller can optionally inform if hwmon interface is desirable. This can be done by means of passing a thermal_zone_params.no_hwmon == true. In order to keep same behavior as of today, all current calls will by default create the hwmon interface. Cc: David Woodhouse Cc: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: Zhang Rui Suggested-by: Wei Ni Signed-off-by: Eduardo Valentin (cherry picked from commit ccba4ffd9eff6120a20cc7656458ac554aec4b0c) Signed-off-by: Alex Shi --- Documentation/thermal/sysfs-api.txt | 5 +++++ drivers/thermal/thermal_core.c | 8 +++++--- include/linux/thermal.h | 8 ++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt index a71bd5b..37c5486 100644 --- a/Documentation/thermal/sysfs-api.txt +++ b/Documentation/thermal/sysfs-api.txt @@ -142,6 +142,11 @@ temperature) and throttle appropriate devices. This is an optional feature where some platforms can choose not to provide this data. .governor_name: Name of the thermal governor used for this zone + .no_hwmon: a boolean to indicate if the thermal to hwmon sysfs interface + is required. when no_hwmon == false, a hwmon sysfs interface + will be created. when no_hwmon == true, nothing will be done. + In case the thermal_zone_params is NULL, the hwmon interface + will be created (for backward compatibility). .num_tbps: Number of thermal_bind_params entries for this zone .tbp: thermal_bind_params entries diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a3d1976..4f4b788 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1460,9 +1460,11 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, mutex_unlock(&thermal_governor_lock); - result = thermal_add_hwmon_sysfs(tz); - if (result) - goto unregister; + if (!tz->tzp || !tz->tzp->no_hwmon) { + result = thermal_add_hwmon_sysfs(tz); + if (result) + goto unregister; + } mutex_lock(&thermal_list_lock); list_add_tail(&tz->node, &thermal_tz_list); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index a386a1c..b4a975f 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -214,6 +214,14 @@ struct thermal_bind_params { /* Structure to define Thermal Zone parameters */ struct thermal_zone_params { char governor_name[THERMAL_NAME_LENGTH]; + + /* + * a boolean to indicate if the thermal to hwmon sysfs interface + * is required. when no_hwmon == false, a hwmon sysfs interface + * will be created. when no_hwmon == true, nothing will be done + */ + bool no_hwmon; + int num_tbps; /* Number of tbp entries */ struct thermal_bind_params *tbp; };