Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp386356lqt; Thu, 6 Jun 2024 06:43:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKc6MGH7xm6VSrUA7HMFqyTdnVUTnyNzkSAxFxfUoSA+npQoQEJPlY8ucfiumpP2LUfUwhAky/c5mkEGgjpmvoYbWHY5MqUlncs85JPw== X-Google-Smtp-Source: AGHT+IF81C+ZTQifwaxn/mxVqc7Obmnn4/GDJJD4MUWoh63zyGObiV0xYwV8J8z/jJewxrvz/QM0 X-Received: by 2002:a05:622a:5c7:b0:43f:f168:ae45 with SMTP id d75a77b69052e-4402b66f2bfmr58109811cf.48.1717681400567; Thu, 06 Jun 2024 06:43:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717681400; cv=pass; d=google.com; s=arc-20160816; b=EhfVdVKZPa8rt83+dMOyvPWGK5tzd80zOgnT5YZI32a0Rd2ivp5zgtGO2Iyafdn6C5 FkPjFN3ryJCwLpUU1LhfRkTZm2lr+sq74oW0KNzxSbwC7foT8BSll7j35MdGDBvzc9TX F92ntMg50rlc7sUpW7udPy2avwXTiSgTqpoN4uohfC7RTv6EMK1RdpugqBeh7l8jR/CU e6/4IY0R8joanRuYucfYjaWOg2SLnrk2QdLZ4wIoV2y+9HDxlFAuL7zXLB7b+mg606fE qmHT9xhdvFGCpUbnji0VlXeI9rjtEKKFfVmkMhv0esHPF6U5+ueA6OjLd966f4+rT7WA Pxdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=kkHPrpprvBmr4j3xKdRnc24ntH7GVFhUKRVTWvuQ+Pw=; fh=PJB6ZRS3WAmhsjC5IgbtXTgkqKwfFkYoyyHVGwXEDzU=; b=urp0Hh0cVAz1eHSc9gx32oeLGCuP3XjrdmlZgSOWnUEOMadzd1DbzfjPzFPfoc+0BT 4r8I96WnAeemPVfhUE9ioDGpV0uNXn/g1LvXFjBI7eivlG9nRXcNFYbFD3obA/DZbqBk Ntx5aCKQstQSB6h4H4F2mBsuE1QCW2B405/uspk1GRjLvTq9ccVm7gCD1wu5mlIeDRYn 09iIbNhfI+M5PJ4Gce5rzwzqpntJaNXiyQCf/wIJQ9u1ChEOFSjsTxVpLLFO3sPBG/z7 g4UJ+SABfQRigaNglzXcvnKLDWAp5Ntn+M4TnPU1Qie4XAsLf2DQbtq8xMEzgxn9RjV5 oClA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WIc05CTM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204389-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b88e96si6207551cf.783.2024.06.06.06.43.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 06:43:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WIc05CTM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-204389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204389-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F0181C21EDB for ; Thu, 6 Jun 2024 13:43:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 769D7196446; Thu, 6 Jun 2024 13:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WIc05CTM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978BA195FFE; Thu, 6 Jun 2024 13:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717681391; cv=none; b=Q1EKqOkU4mANxF6/2hdTS7jtdL27t8LxcNzV6MBt73P1PPWTsVXWiZBn19+eL88LDjVbrIctx6DQBmB1NCusZc6t0fRV8EzvR6G+pCsmrI2xoY7zBQonbE0lqsAarVgsaywVeSaAsIiZZP4Q6LXYAugzG+gyQLFj5Tf2xVnWbnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717681391; c=relaxed/simple; bh=kX1+TUdz8cNcUskmb6NdxdcNtxJMTV95e7OlXyGW47I=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eZyi6m9F4HR6xcfgXp0PTcCksCEJTSiwmFjTI+/oD1MKQDhaXCpp5kwycneSya3GLyYe4c1kgcoL4A7qQoxlhAKAExUdE1B9l/fdvJVaiQyumxfQp36RGKGRE9kwDEGCHU1260QeLtnig02aBIqYAP9dpXEuZCZsvMgtJ4oEoNs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WIc05CTM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C596C4AF07; Thu, 6 Jun 2024 13:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717681391; bh=kX1+TUdz8cNcUskmb6NdxdcNtxJMTV95e7OlXyGW47I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=WIc05CTM9DM8Wlx6/Rn1BWhHD5ovl2CQXMXEBFXrZ89KOhwXp1cXAACCF1B+GvLzj hI2O3ErLmx2uhcXKCEW03IL0y9+7d6WCZpnXCG501cj/7jQFvsHHsP5BPs8XPa/kWq WxLsoeCaIdk2QQGg2Hr02gNwG3Y35gkkbx2dnRmcaWiLk49Z0EH6egckjyHC6pVlky fbCA7SB/KtDF54JrakHBiF2xCSOCHfZh6m4bDOBhyC5eWCbccMmHX5oRakieRCIkl5 0g767rw59SGKOSHObRdiGHDqCqeowAOxTPGg3a1VuswLlvMEGEG6UI24EEIA3S/VDh rzuZiToF+B9ZQ== Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b335681e82so139871eaf.2; Thu, 06 Jun 2024 06:43:11 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVb/qiuHsyCR55cQtvwXAGppqbjruaPWSGPA0VdCjznq21AJzl8R6cESM4lxL8u0b41X9bEj4qE5a6qilEFpFmiYRcoVm3HMKuHp9gwao5KZKGm915yt2j49GF9ka5kd4MCM4vmEEGUnApr04RfVxCE1QxtUyssioaqMTj4XyXphMCL X-Gm-Message-State: AOJu0Yw2gSw1I3Pg7IKvCMsyXBx/9zprKkVxz0nwV+ZRNObaZHBrBmBL o6BasYHgHkBJBzzMXLCpuL+IflQlz9biDGxav3Alu2nKuVqBICeXbCz3JxM6n3gdEWxwoIt2W0H BvZ8+nsfsEDTx9kh8bD0kn4/ZQ1g= X-Received: by 2002:a05:6820:2b02:b0:5b2:7e47:e914 with SMTP id 006d021491bc7-5ba78d3bb71mr334007eaf.0.1717681390197; Thu, 06 Jun 2024 06:43:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <4569763.LvFx2qVVIh@kreacher> <5f93f034-f781-47e0-b8ce-3c8407a709f7@linaro.org> In-Reply-To: <5f93f034-f781-47e0-b8ce-3c8407a709f7@linaro.org> From: "Rafael J. Wysocki" Date: Thu, 6 Jun 2024 15:42:58 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1] thermal: core: Do not fail cdev registration because of invalid initial state To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , Linux ACPI , LKML , Lukasz Luba , Srinivas Pandruvada , Zhang Rui , Laura Nao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 6, 2024 at 3:07=E2=80=AFPM Daniel Lezcano wrote: > > On 05/06/2024 21:17, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > It is reported that commit 31a0fa0019b0 ("thermal/debugfs: Pass cooling > > device state to thermal_debug_cdev_add()") causes the ACPI fan driver > > to fail probing on some systems which turns out to be due to the _FST > > control method returning an invalid value until _FSL is first evaluated > > for the given fan. If this happens, the .get_cur_state() cooling devic= e > > callback returns an error and __thermal_cooling_device_register() fails > > as uses that callback after commit 31a0fa0019b0. > > > > Arguably, _FST should not return an inavlid value even if it is > > evaluated before _FSL, so this may be regarded as a platform firmware > > issue, but at the same time it is not a good enough reason for failing > > the cooling device registration where the initial cooling device state > > is only needed to initialize a thermal debug facility. > > > > Accordingly, modify __thermal_cooling_device_register() to pass a > > negative state value to thermal_debug_cdev_add() instead of failing > > if the initial .get_cur_state() callback invocation fails and adjust > > the thermal debug code to ignore negative cooling device state values. > > > > Fixes: 31a0fa0019b0 ("thermal/debugfs: Pass cooling device state to the= rmal_debug_cdev_add()") > > Closes: https://lore.kernel.org/linux-acpi/20240530153727.843378-1-laur= a.nao@collabora.com > > Reported-by: Laura Nao > > Tested-by: Laura Nao > > Signed-off-by: Rafael J. Wysocki > > As it is a driver issue, it should be fixed in the driver, not in the > core code. The resulting code logic in the core is trying to deal with > bad driver behavior, it does not really seem appropriate. > > The core code has been clean up from the high friction it had with the > legacy ACPI code. It would be nice to continue it this direction. Essentially, you are saying that .get_cur_state() should not return an error even if it gets an utterly invalid value from the platform firmware. What value should it return then?