Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4877795rwl; Mon, 3 Apr 2023 10:52:13 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCYrD3EwOM5GhY0dX7DD5saAI3+OzilcfyLwpOoF14bZ/jlPix/CctCFPSupqvaIjk0sQP X-Received: by 2002:a17:907:a091:b0:947:fb7b:2fb5 with SMTP id hu17-20020a170907a09100b00947fb7b2fb5mr8109915ejc.31.1680544333155; Mon, 03 Apr 2023 10:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680544333; cv=none; d=google.com; s=arc-20160816; b=mxXgIXTnx3DGg+iGlYiT/KF2JnX9MrX8+hfnbrwERUxv17U74qR0Pt6JtxIcKDLFBA CUWSnXdMPjF/JvEsSYtAG+n2nBmdFA4M1pKe3nqp6iXNeLbDTETSMU4c7hcvksVeMxDY fKu5zm10SnIQ1p7l6JxB060NnhhhaZ6aijBfc51bwB6qGM3eSjpTpYAkRp5cLNyUly+Q i4wFQqzfR6acMI7Z3KiYTlG1Xm5hXXglYkeh/ke3hbAsoMhQlfih5ayNmRE9KPBa1Ozh BTbewi1R9L5Tnv3Vly03RU93sAC9ny3UeEHs33p58dTzzu8cD9T/M7UvAXMLNEN4agoP Nxow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=trxH/sBOBatI25dxM6p6Iwb7OfyQjjrRJlceiOQEBC4=; b=Tm0fbp8LYYVeSgI7Je5X2h5CEHyN3xJ26KoHtFjNDhmaiQauu2f31fg0ozefUsx9VO 732DCWq2ylcS1H0LdB/PFYd1+DosjjwdKHV6DrWhrCG4RBbsPi5k3Ei6ztXEaMnDg20o 3FUAhSvo1GNzixEw4mfb3Rh/iVk45vbBUm6MBTKJ+EoxF1ug99sGeIoE0xVMHFgudRPG CXXUQ5CeNlKoJzY7y4v0QQTCcLi7gL+t6C7aOeqdfaV/Pyd+ga/DbyilV2o+xE8I36tW 2PvZiKy7DnYtHZ0UMIi07dv6KL1nZ0d9jbTMljezz5XVEZY/5z7LFUxq4ZQ9j/qa2521 mptw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ue3-20020a170907c68300b0093b17cc60d2si1330865ejc.36.2023.04.03.10.51.47; Mon, 03 Apr 2023 10:52:13 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbjDCRvN convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Apr 2023 13:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232564AbjDCRus (ORCPT ); Mon, 3 Apr 2023 13:50:48 -0400 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF1B635AA; Mon, 3 Apr 2023 10:50:17 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id y4so120637365edo.2; Mon, 03 Apr 2023 10:50:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680544194; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=trLwUHvcK3wHkon8F/JeJDMZBlFlnvHVyUuthBunhUo=; b=Vw/Y/IpCrcWQvKyifLHPKXpECid8or3RoecQeZPTA6phtWX/LyzcFRd/IkwnnBIPCE B4bVHj/4j0SXqWUnuAV7RBeyLrfyqX+K/FfT4H6acDWmO4/C0hFW6dGlu3HltvtaG4VS oYYqaMHHW2Zn3xkE30PAUy9Vk+7Au4CefVbNhCQV/0ntxnqmjiZAncyHF8ynbH2RC0v0 AjpXM59gJQGnZzgnC80Kw/a7nKgHKHRLQga77NA8qrIip71eoqwb3iO4hdP8Qur2XbQw HrkwOXmx8BQffZsZApvlp6WR5XIc2vDXQT8NPuFbwFgQy9BFEpz8IUdlETaOb3/lT4CG gpGg== X-Gm-Message-State: AAQBX9eAri3NaENRkXKFb2aWU3EreQGhVEwrRh9cwzGkBbhhp+gu0bH2 sjpMrdimxPBPxfyQLVpZMzRWiLfr3kjhgRfrbqE= X-Received: by 2002:a17:907:3e8b:b0:931:ce20:db6e with SMTP id hs11-20020a1709073e8b00b00931ce20db6emr20289358ejc.2.1680544193791; Mon, 03 Apr 2023 10:49:53 -0700 (PDT) MIME-Version: 1.0 References: <2696911.mvXUDI8C0e@kreacher> <3dbb630f-abf9-4d09-f1fd-b2b05013c5dd@linaro.org> In-Reply-To: <3dbb630f-abf9-4d09-f1fd-b2b05013c5dd@linaro.org> From: "Rafael J. Wysocki" Date: Mon, 3 Apr 2023 19:49:42 +0200 Message-ID: Subject: Re: [PATCH v1] thermal: core: Clean up thermal_list_lock locking To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Zhang Rui , Srinivas Pandruvada Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Sat, Apr 1, 2023 at 10:45 PM Daniel Lezcano wrote: > > 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 ? No, I;ll take care of it myself, thanks! > > 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 >