From patchwork Mon Mar 24 17:29:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 3883281 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B31BFBF540 for ; Mon, 24 Mar 2014 17:31:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9B372026D for ; Mon, 24 Mar 2014 17:31:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C656920263 for ; Mon, 24 Mar 2014 17:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753541AbaCXRar (ORCPT ); Mon, 24 Mar 2014 13:30:47 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:56518 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753434AbaCXRap (ORCPT ); Mon, 24 Mar 2014 13:30:45 -0400 Received: by mail-la0-f53.google.com with SMTP id b8so3854273lan.26 for ; Mon, 24 Mar 2014 10:30:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Iisn2/FSsL1LKunROimZPBTHH4ruyJSyH9eIJ71rTQo=; b=dFonJZk9Ir7IgpS9WYHFuDsGq3fMxfdx/AcUgFeYXuAmyNCaJmtbp/NFGLPlBAi0B7 DKwn4OHTORftAbTlRp0lZ9L0YQL+/0KgcGUd2BcaK7heaRGpewm7bchmqvBMrGeBv4lb yvSbFukI8qJA+ETKKPeSojmPj6+nChIjvvwVHdz0VVeXB9xbmpkcmmWTYUfNigJsVR+t HDlEvmfr4wPDDbyVa63ITotBENhSQET2DxiC3t4XDJzDcddTntgrynUrojCXFrUiyoaC X4EXRerZ6Odj9x+MDGKnwjADlnRnfIPCqUx3vbMcBtEPswx7k7EVJH2Mzu5TybcMlR+W b5tQ== X-Gm-Message-State: ALoCoQnqUR1u/0knJcd+iCQZdQCxljGVCGPb1ohzdnTUky0pvp3ROlDIfEVuNQHEbWDd4WaZd0Z7 X-Received: by 10.112.125.66 with SMTP id mo2mr32779lbb.82.1395682243848; Mon, 24 Mar 2014 10:30:43 -0700 (PDT) Received: from localhost.localdomain (ip-22-166.bnaa.dk. [84.238.22.166]) by mx.google.com with ESMTPSA id el7sm14190071lac.10.2014.03.24.10.30.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Mar 2014 10:30:42 -0700 (PDT) From: Rasmus Villemoes To: Zhang Rui , Len Brown , "Rafael J. Wysocki" , Corentin Chary , Matthew Garrett , Sujith Thomas , Eduardo Valentin , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org Cc: Rasmus Villemoes Subject: [PATCH] linux/thermal.h: Rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS Date: Mon, 24 Mar 2014 18:29:09 +0100 Message-Id: <1395682149-16563-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 1.8.4.rc3.2.g61bff3f Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The macros KELVIN_TO_CELSIUS and CELSIUS_TO_KELVIN actually work on decikelvins, so rename them to reflect their actual semantics. Signed-off-by: Rasmus Villemoes --- drivers/acpi/thermal.c | 12 ++++++------ drivers/platform/x86/asus-wmi.c | 2 +- drivers/platform/x86/intel_menlow.c | 8 ++++---- include/linux/thermal.h | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 08626c8..3742e64 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -313,7 +313,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) if (crt == -1) { tz->trips.critical.flags.valid = 0; } else if (crt > 0) { - unsigned long crt_k = CELSIUS_TO_KELVIN(crt); + unsigned long crt_k = CELSIUS_TO_DECI_KELVIN(crt); /* * Allow override critical threshold */ @@ -349,7 +349,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) if (psv == -1) { status = AE_SUPPORT; } else if (psv > 0) { - tmp = CELSIUS_TO_KELVIN(psv); + tmp = CELSIUS_TO_DECI_KELVIN(psv); status = AE_OK; } else { status = acpi_evaluate_integer(tz->device->handle, @@ -429,7 +429,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) break; if (i == 1) tz->trips.active[0].temperature = - CELSIUS_TO_KELVIN(act); + CELSIUS_TO_DECI_KELVIN(act); else /* * Don't allow override higher than @@ -437,9 +437,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) */ tz->trips.active[i - 1].temperature = (tz->trips.active[i - 2].temperature < - CELSIUS_TO_KELVIN(act) ? + CELSIUS_TO_DECI_KELVIN(act) ? tz->trips.active[i - 2].temperature : - CELSIUS_TO_KELVIN(act)); + CELSIUS_TO_DECI_KELVIN(act)); break; } else { tz->trips.active[i].temperature = tmp; @@ -1094,7 +1094,7 @@ static int acpi_thermal_add(struct acpi_device *device) goto free_memory; pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device), - acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature)); + acpi_device_bid(device), DECI_KELVIN_TO_CELSIUS(tz->temperature)); goto end; free_memory: diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c5e082f..2d81d5a 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -1066,7 +1066,7 @@ static ssize_t asus_hwmon_temp1(struct device *dev, if (err < 0) return err; - value = KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000; + value = DECI_KELVIN_TO_CELSIUS((value & 0xFFFF)) * 1000; return sprintf(buf, "%d\n", value); } diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index e8b46d2..0a919d8 100644 --- a/drivers/platform/x86/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c @@ -315,7 +315,7 @@ static ssize_t aux0_show(struct device *dev, result = sensor_get_auxtrip(attr->handle, 0, &value); - return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value)); + return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value)); } static ssize_t aux1_show(struct device *dev, @@ -327,7 +327,7 @@ static ssize_t aux1_show(struct device *dev, result = sensor_get_auxtrip(attr->handle, 1, &value); - return result ? result : sprintf(buf, "%lu", KELVIN_TO_CELSIUS(value)); + return result ? result : sprintf(buf, "%lu", DECI_KELVIN_TO_CELSIUS(value)); } static ssize_t aux0_store(struct device *dev, @@ -345,7 +345,7 @@ static ssize_t aux0_store(struct device *dev, if (value < 0) return -EINVAL; - result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_KELVIN(value)); + result = sensor_set_auxtrip(attr->handle, 0, CELSIUS_TO_DECI_KELVIN(value)); return result ? result : count; } @@ -364,7 +364,7 @@ static ssize_t aux1_store(struct device *dev, if (value < 0) return -EINVAL; - result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_KELVIN(value)); + result = sensor_set_auxtrip(attr->handle, 1, CELSIUS_TO_DECI_KELVIN(value)); return result ? result : count; } diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f7e11c7..c978aa3 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -41,9 +41,9 @@ #define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID /* Unit conversion macros */ -#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ - ((long)t-2732+5)/10 : ((long)t-2732-5)/10) -#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) +#define DECI_KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ + ((long)t-2732+5)/10 : ((long)t-2732-5)/10) +#define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732) /* Adding event notification support elements */ #define THERMAL_GENL_FAMILY_NAME "thermal_event"