Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4541331rdb; Tue, 12 Dec 2023 02:29:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGS/2/XWoSlC2Hhh7q7BR9/wYekov9hAHUQAUkcIaLbU64GE57uPCPVGjG9OdEJQ1MRKoL X-Received: by 2002:a05:6e02:b22:b0:35d:59a2:2bd with SMTP id e2-20020a056e020b2200b0035d59a202bdmr9018554ilu.93.1702376952454; Tue, 12 Dec 2023 02:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702376952; cv=none; d=google.com; s=arc-20160816; b=PTo6UzBeqxzsb/Kp6aYbIMwikt7HPhBsz0aWjgbGIDRzufba2ioXk3WUdyKNoox9zZ B4DaGvxOOrKlgsNgW7cuI59UxPeoxZVmjozHbVhoj6GP2byD7BxxwJwjo5Yqs6rPhubl gZVZOW2/upjNjQxGBxtjm1dndQemTWyROi//ztE5sCUWvJ2ma41SHT3ORjD0Vd81BrVB rRKRcuNVbWrgEKffvfg2vITlt4a6+yLWNm2etty/0boXeKUHIJgf8zevgjvcuJG4axhf iqzerh9rqcA+x/gZbxQYfB8dOiYv1IW1gPu0napYFKZrAJJBcrR2Q1ah+Npi8gGuaBPI 8Y6w== 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=SeaHyhX4qasj2Fu/2Tzw0gDqXLK0DSDWi5tqGB7yRow=; fh=LBoYCTwcnc4aGCO1Ky9m5KD26cM4ZwLGFt7YdcTzbHo=; b=axyjzWLQx6R3ax2r7gvf8aLyyNsSfXwhY/omgdVNCg1aQvybOW4ev5Ycroym98gdNd 2xseKonS0QoOY1LXi3/oInN3EYFEBKqX/zv1s1HM6nZnJu1fwyhPYvLTt9mkLbl+aaGi si7PT6szh0vqw6AJA10Xymiq3vU1CoFDxe5RVadBPZL42914b7pRv6MK+QsAE1E2UDqT CV2Ei6KpXfZh8SN06Iq5wbmm5+kZ1Ku4y3OqqB7op/HNT7wVR4OxSRrGIz1Uf/t4pTcm rNip+KDPAwIDN50GiqULymBH0x8yZ8tfjqXzp/IOTJ7YeXwBEr2JLxpFBLyPYb+Qx4eB iXPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWSJc2xF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id p20-20020a170902ead400b001d1d8f578ebsi7352881pld.647.2023.12.12.02.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pWSJc2xF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B9B838054B5C; Tue, 12 Dec 2023 02:29:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230508AbjLLK2z (ORCPT + 99 others); Tue, 12 Dec 2023 05:28:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjLLK2y (ORCPT ); Tue, 12 Dec 2023 05:28:54 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02C5A6 for ; Tue, 12 Dec 2023 02:29:00 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40c339d2b88so41067255e9.3 for ; Tue, 12 Dec 2023 02:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702376939; x=1702981739; darn=vger.kernel.org; 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=SeaHyhX4qasj2Fu/2Tzw0gDqXLK0DSDWi5tqGB7yRow=; b=pWSJc2xFCXZLrPuMMxxRCC9WamSLAAVlaaXps9vZi3jeKCNwbPOk/mlQihc7Kk8B/I Y110Nhjf3FX9MsCR7rlUcwwdYNmYdTCOeykrD/lo8ALEcE1baU7nnhqcduWjrYt9Ioo9 5pE/R3wfoTi/7UrmKyPvaZscU8f7f96JCrZxToWW5V0OLLSh820y+zwmOk68LCOiBHy/ xCmIYw/aN3IAaNnWVLWtZREFbJawncfqTsAocTku6UAQTS4qtXlqgPxCgh/QhdV6g5Pd fslPcjm9XQ5D/cUkf/9aIaBODH962YSJODqpJePKf//p81xSl6KGKHaorFhlc1Mb36/t YgPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702376939; x=1702981739; 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=SeaHyhX4qasj2Fu/2Tzw0gDqXLK0DSDWi5tqGB7yRow=; b=CdPjbT67Ngf+5JYsNGL6oAL65/osp2fAdqKc1YV8lmszCKI4sBBxkN3MdN1XZpLf1G NnczEo1rdfN4YcOGRp5sO0isfB0uWVMjEByh7jgTh0temAjReiCLN5PHgivzzxbvqgrj t6zi8+cpeTUrWGtVxAr7vI7KbmfT0lcb3hElUPk6yVCb+tbtTCByaleMQkpzad+CxlfA Ss+mh2tXbLRUVIkCeCKYkwmgqbWvQSJIeYLAyEU2qB4S9/LJiDBBYeH/ynuXaI6R+T1+ UU04Lxx6LlVT8b3lm51kxZHntzQJIYoxQ1AAxRrcrfin/M2m9M7EM9wmZjP/7bU8abDQ R/KA== X-Gm-Message-State: AOJu0YyVGaqZBUZr7fS25u2dUTPnazg31bPp3S0H5p7a9usp8NXrcLzv sYAyH3bhy4Fh/EgeBjsrsesjq+KkEESP7JizAI4= X-Received: by 2002:a05:600c:1686:b0:40c:2992:716e with SMTP id k6-20020a05600c168600b0040c2992716emr3176778wmn.129.1702376939137; Tue, 12 Dec 2023 02:28:59 -0800 (PST) Received: from ?IPV6:2a05:6e02:1041:c10:c49e:e1a5:3210:b8c0? ([2a05:6e02:1041:c10:c49e:e1a5:3210:b8c0]) by smtp.googlemail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm18366061wmb.27.2023.12.12.02.28.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Dec 2023 02:28:58 -0800 (PST) Message-ID: <727a776d-43bc-479b-bd63-80a0985f99c8@linaro.org> Date: Tue, 12 Dec 2023 11:28:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 3/3] thermal: core: Rework thermal zone availability check Content-Language: en-US To: "Rafael J. Wysocki" , Linux PM Cc: Srinivas Pandruvada , Zhang Rui , Linux ACPI , LKML , Lukasz Luba References: <1880915.tdWV9SEqCh@kreacher> <2258035.iZASKD2KPV@kreacher> From: Daniel Lezcano In-Reply-To: <2258035.iZASKD2KPV@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:29:09 -0800 (PST) On 08/12/2023 20:20, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > In order to avoid running __thermal_zone_device_update() for thermal > zones going away, the thermal zone lock is held around device_del() > in thermal_zone_device_unregister() and thermal_zone_device_update() > passes the given thermal zone device to device_is_registered(). > This allows thermal_zone_device_update() to skip the > __thermal_zone_device_update() if device_del() has already run for > the thermal zone at hand. > > However, instead of looking at driver core internals, the thermal > subsystem may as well rely on its own data structures for this > purpose. Namely, if the thermal zone is not present in > thermal_tz_list, it can be regarded as unavailable, which in fact is > already the case in thermal_zone_device_unregister(). Accordingly, > the device_is_registered() check in thermal_zone_device_update() can > be replaced with checking whether or not the node list_head in struct > thermal_zone_device is empty, in which case it is not there in > thermal_tz_list. > > To make this work, though, it is necessary to initialize tz->node > in thermal_zone_device_register_with_trips() before registering the > thermal zone device and it needs to be added to thermal_tz_list and > deleted from it under its zone lock. > > After the above modifications, the zone lock does not need to be > held around device_del() in thermal_zone_device_unregister() any more. > > Signed-off-by: Rafael J. Wysocki > --- Acked-by: Daniel Lezcano -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog