Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3086883rwb; Fri, 20 Jan 2023 11:01:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXvSEmCYNvBOEKGERkRUvI1O+6ndTWEP/OBq5G8HnRjo9CQAF2Gsn6azoXPyxR5MQWEGceAW X-Received: by 2002:a17:907:2106:b0:7c1:32:3574 with SMTP id qn6-20020a170907210600b007c100323574mr18574213ejb.12.1674241275931; Fri, 20 Jan 2023 11:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674241275; cv=none; d=google.com; s=arc-20160816; b=zUioa/08bFzyK6I6vWtXQzUkkQ0tYndf3LnKhn0sS4fKUYdTKeCn3HpOO2ejB5HMBd tklztGMr5B+nwsyT/pJXCbFgQ9dpj4FdKkCI0XsluDVqcj7h0elfFZIbM7okLdjXYyRa lxhNOR2EvkL+nvlzjHX4qPyvIj0wlz+3zQI59bKnLO27ZtWGCckCB7EvmvUdC5LcyOmj 2mBuGdJHslDzSoGCXBzXzQK0Np3ltceUt4fhYkkuYp2bWZKmaie2cTvm0+cCo6TDGtkZ BHL2mLcVkwBn2wGHlvU0Z90NvLHUyWbPlncqYhf2v2u6+5z4rqWqiMwI/qi2Ut+SYsuw 0NkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nuasAerLyMAB7lmncOQjek4k4Iwh+6TryNOLU8S7QOw=; b=u1Fom5E51a9lc3EwOX24yhxbkYfafIhvGhtXPUaDfQAoMAQcc+eDt606J7B032rJzi lmSpPZHmSFPTfCG6sh6OhK1uJCGKUCBG1gaZYlJ3MDnbtBq5QEWd3/LKYIH5jQEmURZv ZKsAOS00nrv7UeWBblDhvkB3kei1EsAJnLbvCWaHGQxxvBBkS7A92dwGkTQN9p8EbtJ7 6D1HsEbM5lLHh3Yi5n6YslIJF/TNSWRt1mjBK8w+o6dc+FxcyC/NYvssqRAPrgJhCWid I3IJDqyjK8NASn7K50/zhQhIVY6dqSotrdq0lA5u42kBCdzOsl7pkbOG4fa+e3OxAaCX Tosg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K2yEleRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd13-20020a1709069b8d00b0085b4d436b57si36384587ejc.1000.2023.01.20.11.00.58; Fri, 20 Jan 2023 11:01:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K2yEleRI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjATS16 (ORCPT + 52 others); Fri, 20 Jan 2023 13:27:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230072AbjATS14 (ORCPT ); Fri, 20 Jan 2023 13:27:56 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9255A817 for ; Fri, 20 Jan 2023 10:27:53 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id c10-20020a05600c0a4a00b003db0636ff84so4369865wmq.0 for ; Fri, 20 Jan 2023 10:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nuasAerLyMAB7lmncOQjek4k4Iwh+6TryNOLU8S7QOw=; b=K2yEleRIORu15GkMOtwomVOmNAMQq3NeZZi5OWs1VRC38jr8Nk8Ylq6S/gSJS9XPUB iQoIKC6UdZNJEa5dOcg8SegDACg2bktFWiGEZRC3xlc9GdZlhBTOpLu3msIqnHJwX6v1 nzgGGjy7IQz2cIXa0ig74RtgQDvcL0yZ42bqKuZ6x7m4yJ9BfHCtaBBFsBU4doeMoOCk RAVX5TEt0H9nGJ1/aLWTuo8yLSAxtT320ra3tPpQRw9taQM/8PbPy6vdH++hcK0DWQ4a bF74tEWMUHhOIqS6/ULL9jLthvip21G1MBhwgLBs70ilfocu8rlJ0aL4BuQjFeuzaSET GeYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nuasAerLyMAB7lmncOQjek4k4Iwh+6TryNOLU8S7QOw=; b=DfGBSgElPEBjoxFVj+HYfbrW2VntTwBvkmSTTj5IFZDuyt1bu1EetxJq14l7T8fDfv ARzLiwbx/620q2eNVqesSL2u7RtTh+ZxfyVx6IOThX6mO64UWQuH3T5Fem5gxavOG0RR ceAbGsPiH8F1x7A7AwH81zcjb0TGfbcYtmLJtGAaRzBjUCOrHYQnlN/ciBVw1LkOLSuW LLQIXmtB53o1ppYuz85MiVE9d3612UmV6SOjiPWmt+REwu3vOOH1+tICIz4zH69bXBKt SK/5GOqRJA8ll9UphORmLAn0tD3jvzyNRu1ZKq7N0XDe1QZZEQmvekwSh2guG8HMtASF JnFw== X-Gm-Message-State: AFqh2kouQKAbQE8XAeTPhBSIIheFBrWhf8zfjpmssuxOacoXMrLfDwP1 3D8giEcAHa7HAjFqho+TpOrChQ== X-Received: by 2002:a05:600c:ccf:b0:3db:f34:e9e0 with SMTP id fk15-20020a05600c0ccf00b003db0f34e9e0mr11936402wmb.35.1674239272427; Fri, 20 Jan 2023 10:27:52 -0800 (PST) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id l15-20020a05600c4f0f00b003d9df9e59c4sm3300334wmq.37.2023.01.20.10.27.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Jan 2023 10:27:51 -0800 (PST) Message-ID: Date: Fri, 20 Jan 2023 19:27:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v5 1/3] thermal/acpi: Add ACPI trip point routines Content-Language: en-US To: "Rafael J. Wysocki" Cc: srinivas.pandruvada@linux.intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, rui.zhang@intel.com, christophe.jaillet@wanadoo.fr References: <20230113180235.1604526-1-daniel.lezcano@linaro.org> <20230113180235.1604526-2-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/01/2023 19:15, Rafael J. Wysocki wrote: > On Fri, Jan 20, 2023 at 7:08 PM Daniel Lezcano > wrote: >> >> >> Hi Rafael, >> >> >> On 19/01/2023 14:15, Rafael J. Wysocki wrote: >> >> [ ... ] >> >>>> +static int thermal_acpi_get_temperature_object(struct acpi_device *adev, >>>> + char *object, int *temperature) >>> >>> So this would become thermal_acpi_get_temp_object(). or even >>> thermal_acpi_get_temp() because it really returns the temperature >>> value. >>> >>> I also don't particularly like returning values via pointers, which is >>> entirely avoidable here, because the temperature value obtained from >>> the ACPI control methods must be a positive number. >>> >>> So I would make it >>> >>> static int thermal_acpi_get_temp(struct acpi_device *adev, char *object_name) >>> { >> >> We are converting decikelvin -> millicelsius. Even it is very unlikely, >> the result could be less than zero (eg. -1°C). We won't be able to >> differentiate -ENODATA with a negative value, no ? >> >> In the future, it is possible we will have to deal with cold trip points >> in order to warm a board. May be we should don't care for now ? > > My point is that the ACPI specification mandates that the return > values be in deciK and so always non-negative. I understand that but the code does: static int thermal_acpi_get_temp(struct acpi_device *adev, char *object_name) { ... return deci_kelvin_to_millicelsius(temp); } All the callers do: ... ret = thermal_acpi_get_temp(adev, name); if (ret < 0) return ret; /* This could be an error * or negative millicelsius temperature */ /* here we already have millicelsius */ trip->temperature = ret; ... So I guess we want to do: ... ret = thermal_acpi_get_temp(adev, name); if (ret < 0) return ret; /* we convert here instead in thermal_acpi_get_temp() */ trip->temperature = deci_kelvin_to_millicelsius(ret); ... Sounds good ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog