Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2740321rwl; Sat, 1 Apr 2023 13:50:32 -0700 (PDT) X-Google-Smtp-Source: AKy350bkbo7b/6J6XCQujd0jpofAIe8Q6AeMXH901FaHgHSkniXka+/MpTwxKNwE5DFKIk6fe/EN X-Received: by 2002:a17:902:e84e:b0:1a0:41eb:fdb3 with SMTP id t14-20020a170902e84e00b001a041ebfdb3mr37289087plg.10.1680382232728; Sat, 01 Apr 2023 13:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680382232; cv=none; d=google.com; s=arc-20160816; b=EoFF1RqFv0XbhuU7R8+lpfgJ8d7BJZc/RBJbhxQq+/z7hwMMi2PBmfQrcwprLYivO8 alfiUm+aDXpbjWZtVCGuVfASADdVQ7uezcQDzRU7zphS8PzknVwFubtNcbC96G8ACvjs apc7tFywgegHC7JqbyeX6WON1a0DspOh62io+zgQslQDfgDkg9ehar5juR6lYGysREfT K/uZtWeb6AenNEBIwaKHTL32G3gUiLwqW8VPagtAy1CZVJrWe2A6R3kAOH9d3eDoe216 9k5zxBwZJxpLnHePVhqBaz32IkwFmNjnGX+v75RaOs1Ryl+4uXs7nDR9nfLK8f1y90GS vh9Q== 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=KONinrexyPA8SiAQ6l9QCfRBjG7yQZ71bHl8TR878bs=; b=uyM/d1ptC8vMQwl+1F+n4PRZr4KPghCiPOEYRi1enlLbnfUfRRtiMW3yNCRYmpZZas hAExyFyBX/p/BsAFp4ih1ZRVS9Guq/NOF8ouhp1ZLGvSvNf/ko5SQuvD7Gni6c6lt1CC PgfCT+55JzIMEabbErBEN+Yjye6VpJ+sNOTkgCjlvTXkIngXT/iWXo3Saj6hUeCGdJAp koi2MPwWt9fO+n/gb9pVT5AoY6fAL9gFLSFOjtzYQs2Z06VPAWRpxFtDKWqKiDbubhQ/ PTIemEj4vl8cmX8icMfEoIc8PqNaKcwgvADx/xmERz7DJhJyVVLvCw1jbTfK/bd3qaTG lM8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wUx6wdia; 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 g5-20020a170902934500b001a1fe40a8d7si4832839plp.520.2023.04.01.13.50.20; Sat, 01 Apr 2023 13:50:32 -0700 (PDT) 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=wUx6wdia; 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 S229788AbjDAUpD (ORCPT + 99 others); Sat, 1 Apr 2023 16:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjDAUpC (ORCPT ); Sat, 1 Apr 2023 16:45:02 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251671A964 for ; Sat, 1 Apr 2023 13:45:01 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id y14so25671661wrq.4 for ; Sat, 01 Apr 2023 13:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680381899; 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=KONinrexyPA8SiAQ6l9QCfRBjG7yQZ71bHl8TR878bs=; b=wUx6wdiaq+ifAjSRUHV71Nk0jQv97vVjCIkEYOV6vDYw4kjF0OkhX9yZ3WfGootrJd QiHF4QKJkaYU9eEEvWBywj7a+CPipzKhkJZunmL48GKtWQx6XtNFlBeeuhVqFb6ZxYe/ 5TdDbOq7k+bWktvmviGlmrDPoFyB89NpJrxW/v5nc1fU4MlqaMsFRK5E2BOlE9MgqJij d93fXcGUgnB8TDPKqyhshl4nlNiA1hoMVXISicMS4AsBCw1CDGEBfVgx2tOyh5OcX6Yk oGb73f1sY3CesYOmbBh0ut+Camc8fOCOqdXuAqrPcZx44VePabOzerEhmc/3uSHP0a+o jcLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680381899; 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=KONinrexyPA8SiAQ6l9QCfRBjG7yQZ71bHl8TR878bs=; b=tIAcdDJka/ESDvpLyE6cfFPQmuYsc3W2DeTLFGNAQzUTMFRa1WzOwcI0MWOKbYQZHn +iAqMcqVPxBUwtAisIdMYYWebVRk4dS5pGiYGxR3ygl5nugzRu8vKfNSl3GnSx2Pnvu9 Nnfqe22cJkh09PrkhYO4NpGwuO3ljgQPAOHIu4q3kbtn30SDYZ3VQirBmoA+4R4TJ9Q4 K4yLTRRVLjXo7ejFhOPdSDiFi1sPm9Zq3NBR0kjQyjP/Ww0Pzq8EzFqWHMpLk58smQAM bVnqBrq/YtwYNLcItH0G1OoNtJ/fXZCrMz1b/ncOzoRKqGRSzCO9h7B+ia1q1xMWoU2K VJ4g== X-Gm-Message-State: AAQBX9el97RpkVxahZ7LgcmEqCABfiihRcK5Z89agjEN186CscP6oYB4 79k/AaMTihYooN1hHZ1SnPzB4Q== X-Received: by 2002:a05:6000:1b92:b0:2e5:820b:9289 with SMTP id r18-20020a0560001b9200b002e5820b9289mr5530780wru.64.1680381899523; Sat, 01 Apr 2023 13:44:59 -0700 (PDT) Received: from ?IPV6:2a05:6e02:1041:c10:b36a:1186:309c:1f9a? ([2a05:6e02:1041:c10:b36a:1186:309c:1f9a]) by smtp.googlemail.com with ESMTPSA id c13-20020adffb0d000000b002e5e7ee11besm5232558wrr.94.2023.04.01.13.44.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 01 Apr 2023 13:44:59 -0700 (PDT) Message-ID: <3dbb630f-abf9-4d09-f1fd-b2b05013c5dd@linaro.org> Date: Sat, 1 Apr 2023 22:44:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v1] thermal: core: Clean up thermal_list_lock locking Content-Language: en-US To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Zhang Rui , Srinivas Pandruvada References: <2696911.mvXUDI8C0e@kreacher> From: Daniel Lezcano In-Reply-To: <2696911.mvXUDI8C0e@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 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 22/03/2023 20:34, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Once thermal_list_lock has been acquired in > __thermal_cooling_device_register(), it is not necessary to drop it > and take it again until all of the thermal zones have been updated, > so change the code accordingly. > > No expected functional impact. > > Signed-off-by: Rafael J. Wysocki > --- Looks good to me, shall I pick it in my branch ? > drivers/thermal/thermal_core.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > Index: linux-pm/drivers/thermal/thermal_core.c > =================================================================== > --- linux-pm.orig/drivers/thermal/thermal_core.c > +++ linux-pm/drivers/thermal/thermal_core.c > @@ -826,8 +826,6 @@ static void bind_cdev(struct thermal_coo > const struct thermal_zone_params *tzp; > struct thermal_zone_device *pos = NULL; > > - mutex_lock(&thermal_list_lock); > - > list_for_each_entry(pos, &thermal_tz_list, node) { > if (!pos->tzp && !pos->ops->bind) > continue; > @@ -854,8 +852,6 @@ static void bind_cdev(struct thermal_coo > tzp->tbp[i].weight); > } > } > - > - mutex_unlock(&thermal_list_lock); > } > > /** > @@ -933,17 +929,17 @@ __thermal_cooling_device_register(struct > > /* Add 'this' new cdev to the global cdev list */ > mutex_lock(&thermal_list_lock); > + > list_add(&cdev->node, &thermal_cdev_list); > - mutex_unlock(&thermal_list_lock); > > /* Update binding information for 'this' new cdev */ > bind_cdev(cdev); > > - mutex_lock(&thermal_list_lock); > list_for_each_entry(pos, &thermal_tz_list, node) > if (atomic_cmpxchg(&pos->need_update, 1, 0)) > thermal_zone_device_update(pos, > THERMAL_EVENT_UNSPECIFIED); > + > mutex_unlock(&thermal_list_lock); > > return cdev; > > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog