Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE6A1C00140 for ; Mon, 8 Aug 2022 21:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234943AbiHHVRp (ORCPT ); Mon, 8 Aug 2022 17:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238401AbiHHVRo (ORCPT ); Mon, 8 Aug 2022 17:17:44 -0400 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 A69711AF37 for ; Mon, 8 Aug 2022 14:17:42 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id s11-20020a1cf20b000000b003a52a0945e8so3235566wmc.1 for ; Mon, 08 Aug 2022 14:17:42 -0700 (PDT) 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; bh=xT3U7Fcq666IjZnpP4Hd9cAsdG9vkr6FYDlzUI0n/OE=; b=ECongWXKH2gwPuWgmxYdr6guRMPl4jAF8wszWyuDEt5/3rpg1VhdodvEh3b0QBJjMu jGuXiG3uAJrZY2JzewgWe+wqpjTOPR5nMCDJUoBHV71Wu31SoMOUZSGcUU+V/BgGTuoy iVb6OREEZ4TfbdQdQqMHPScwgu2CXEsFtz4WSM90RaGHcMVscynjwcqz6Pyx/I7NK/TI zT/kzTU86DoKMKXH5cCVDZiAL1O5h6QNpKCMMH9MPqLwM/TjTMEnWa0yh1zmJ4LaADHI kzYBPFYPlmtlKKcbEVAmF6tKXgF52bwvvAz7j8ELzRCOEsd+XYWyWY7oGbauIVyZh6Hv UCgw== 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; bh=xT3U7Fcq666IjZnpP4Hd9cAsdG9vkr6FYDlzUI0n/OE=; b=X5m7vQaqy8Qr0Ari7EA5J1+6kbu8nshNEYiQBdfryC2VavaiIKj/2MHI2c1xPlPz8j RvKBpFe2oID9lOx/U+QHMwuV92a1h2eFkGGOb2XW6eYKPaJ0nGBe/zHdZB5uS2+qIUMv BSkUluGIySpQYTc9YYCjd03eCeu/Jvi1n1aFebSQj8zfuLU8yz7LTQ9VZOsotOVge3d3 Z7FM1vFw/FZKcyztt71G1QUJwXLOzUdTQVCFoHviogBu4uZh8LJNlXp1uB3p6D5Jkg8d hdR1k+FNyZI/Tx3DkeMHrEb4AxKvSI1oZs29LWdrPhq5BU6s4fYa8iSmtmkETVFWsHC/ hIYg== X-Gm-Message-State: ACgBeo2HKjKUFj9hvKmXRoSm5at15INTI39W7+QqQ08jF99VNUMXcBqC Iu75XlpkfrrGhQYHCnHDEOyOBA== X-Google-Smtp-Source: AA6agR4jZ2+M0qSdbkYF7IST0XVTX3X/Zm/eeDM106HX5oBGSVSsAfRVMOsrJ4HYtT1spomRLZEnUg== X-Received: by 2002:a05:600c:1ca0:b0:3a5:3703:2a97 with SMTP id k32-20020a05600c1ca000b003a537032a97mr6409480wms.23.1659993461134; Mon, 08 Aug 2022 14:17:41 -0700 (PDT) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id o6-20020a05600c4fc600b003a32490c95dsm20358062wmq.35.2022.08.08.14.17.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Aug 2022 14:17:39 -0700 (PDT) Message-ID: Date: Mon, 8 Aug 2022 23:17:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/4] thermal/of: Return -ENODEV instead of -EINVAL if registration fails Content-Language: en-US To: Michael Walle , Guenter Roeck Cc: rafael@kernel.org, dan.carpenter@oracle.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria , Zhang Rui References: <20220808180915.446053-1-daniel.lezcano@linaro.org> <20220808180915.446053-2-daniel.lezcano@linaro.org> From: Daniel Lezcano In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 08/08/2022 21:05, Michael Walle wrote: > Am 2022-08-08 20:35, schrieb Guenter Roeck: >> On 8/8/22 11:09, Daniel Lezcano wrote: >>> The previous version of the OF code was returning -ENODEV if no >>> thermal zones description was found or if the lookup of the sensor in >>> the thermal zones was not found. >>> >>> The backend drivers are expecting this return value as an information >>> about skipping the sensor initialization and considered as normal. >>> >>> Fix the return value by replacing -EINVAL by -ENODEV >>> >>> Signed-off-by: Daniel Lezcano >>> --- >>>   drivers/thermal/thermal_of.c | 4 ++-- >>>   1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c >>> index 368eb58e97cf..4210c18ef7b2 100644 >>> --- a/drivers/thermal/thermal_of.c >>> +++ b/drivers/thermal/thermal_of.c >>> @@ -329,7 +329,7 @@ static struct device_node >>> *of_thermal_zone_find(struct device_node *sensor, int >>>       np = of_find_node_by_name(NULL, "thermal-zones"); >>>       if (!np) { >>>           pr_err("Unable to find thermal zones description\n"); >> >> I really don't like that error message: People will see it (and complain) >> whenever a sensor registers and there is no thermal zone, even though >> that >> is perfectly normal (see description above). > > I can second that, and there actually two error messages: > > [    6.156983] thermal_sys: Unable to find thermal zones description > [    6.163125] thermal_sys: Failed to find thermal zone for hwmon id=0 Yeah, I can check: np = of_thermal_zone_find(sensor, id); And print the error if PTR_ERR(np) != ENODEV, otherwise silently return. > On the sl28 board with the qoriq_thermal driver: > [    1.917940] thermal_sys: Failed to find thermal zone for tmu id=2 > [    1.929231] thermal_sys: Failed to find thermal zone for tmu id=3 > [    1.940519] thermal_sys: Failed to find thermal zone for tmu id=4 > [    1.951814] thermal_sys: Failed to find thermal zone for tmu id=5 > [    1.963109] thermal_sys: Failed to find thermal zone for tmu id=6 > [    1.974399] thermal_sys: Failed to find thermal zone for tmu id=7 > [    1.985690] thermal_sys: Failed to find thermal zone for tmu id=8 > [    1.996980] thermal_sys: Failed to find thermal zone for tmu id=9 > [    2.008274] thermal_sys: Failed to find thermal zone for tmu id=10 > [    2.019656] thermal_sys: Failed to find thermal zone for tmu id=11 > [    2.031037] thermal_sys: Failed to find thermal zone for tmu id=12 > [    2.048942] thermal_sys: Failed to find thermal zone for tmu id=13 > [    2.060320] thermal_sys: Failed to find thermal zone for tmu id=14 > [    2.071700] thermal_sys: Failed to find thermal zone for tmu id=15 > > Btw. the driver seems to always register 16 sensors regardless how > many the actual hardware has (or rather: are described in the DT). Yes, it may be nicer to rely on the compatible string to figure out the sensors of the platform and call with full knowledge the registering function. But anyway ... -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog