Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1843704rwb; Fri, 5 Aug 2022 08:41:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7cGWmk6XL9TWt7vBvUEIzmd7hUIj1sNL/V3Gq0EiRbubcVXhY1qfeOv26bNhuIBN0RlH/3 X-Received: by 2002:a17:90b:1e0f:b0:1f5:37f5:159c with SMTP id pg15-20020a17090b1e0f00b001f537f5159cmr8153426pjb.189.1659714070954; Fri, 05 Aug 2022 08:41:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659714070; cv=none; d=google.com; s=arc-20160816; b=j1rvkjiAM/h8/I9ZxdD9YJHBdr+rorOCV/7sdetU5JW5Wx9kzOIDh8biVzX+o0UgFl xM7DV9qexZFQbGv5F4K/t6rTPAAlXBRM9mFk5PqnlZadaVbvlfCZFk11gP27VjIaugO5 /gJz4ygp6/aFoMMjx+ytNj8JbljRc52QnSfe6TT0pnFNjN926cW6ewawkbRzVM2u5O9N rLutC4nAzfuQ8sFUhULkqu6Z0i/9e5pJGFsK6opRMaA5gy4GGmwYehBx4SJHspMAj68j Eb4L3hhYsbuEFh8iM2x8yy9Ud7ttb35xRxUVfWZdvmXJ5/hp3krVa1rnmHjsGxM/7gBG vDxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aBvzMW7h3alEgW99ErQv4+ny+IZdZS0VnELxUm//1vE=; b=eUYABSRbRba33SL908iaiXUCrlslTtrXy7RAQh9x23CHqRTJOkkx1Ms/0B+LT0rLTp mx86CUJpPJg2uEZf5Ra0CAsw9j3NlRbZ/vliMeGcFqIMOqK64dnubCttdkb+jq0mBxp6 lp9+fNNWIZxA6snb4yFu20QWQirBR8LqIgDjTkpvXeg+J38WCl6KtBvBNaRIoZq2JlVY 2uEj1uoj0uskTi4kuXLXqwIqi9cLGbSnSLHn4oHZC7V7XMWlcHy4WKbC8IAf3WKtMrf/ LfoS5tAw9+WvSb5THqQKdm/muiODvtsLfcp8s7lto8Te93la/aBt0A5QNwPzgDHN75np pATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bJploTn1; 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 k9-20020a17090a9d8900b001f212bee4a8si7643091pjp.146.2022.08.05.08.40.56; Fri, 05 Aug 2022 08:41:10 -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=bJploTn1; 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 S238506AbiHEPit (ORCPT + 99 others); Fri, 5 Aug 2022 11:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237817AbiHEPir (ORCPT ); Fri, 5 Aug 2022 11:38:47 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5C2237F7 for ; Fri, 5 Aug 2022 08:38:46 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id z16so3618013wrh.12 for ; Fri, 05 Aug 2022 08:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=aBvzMW7h3alEgW99ErQv4+ny+IZdZS0VnELxUm//1vE=; b=bJploTn1ZE5XHYS0BVPysP7rl5RlcHPt9cxUX1IVE6+RhYPxMWgrfU5DpKNg/cqYTz 84njdSjxidKNs4jPiLtI8tJ2SLTx/N43CjhvJCshuTVqF2R3rsO2q8yUzklN33kq/0jP sXPng9EMCrg7FIRTD0yjlie9OSPyIhN1jNpTIfC8dllrvJIBoWiADfVbhGV+dWlg4FQT rMiU4hnxyenVGwzGqoZdfYUtnhBfXeE4Sc8ohFCncwcBnzEHkXvbhgeWQS2vZClG43eL nIPAe+aLeX5Fkvf9CeIxFdKyNx325MDaT4g2h6J7X8Scxfe/+PlkwJ46fc9EXAV2oC2l N3tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=aBvzMW7h3alEgW99ErQv4+ny+IZdZS0VnELxUm//1vE=; b=KNugSdk7gQ+cwYZYyewxjKT1sVSjNS7pw+zoz6K4r+JC+IWzrzcQZ4DU+5zgXfXKaW YVDnORTZp/x0pa6ZxEowiH6H4CmfjXb9ud1eCfgBY2mTOfd7iH2vD2OG6YmhHD9zvZel tfhxAB8Trngtw/AFwWzQfOlJlqt/8fGFTvFWh4aOJXChrwTYtYhb/GaUnqz1rQu24RdW IpLF6N0vg46CglYLD3HaM1Rzq0yfiA4iga50E9wRuJNd1SnX+Eb5SpVkUC11KzxOcIc/ 0skEJYxZppESiCh2LUSgPhlYY9OcKBWU2NXVA72HBD7XNtETnRIOrUGLEd0SHh+EX/Nx 3O1w== X-Gm-Message-State: ACgBeo2dIJegtuYKhokXNkeqjuo/6nTVojR2ZzqnLRRTAhMaw2XBRi04 /SL7lNTP2TfQnfyX52ms9iZkbg== X-Received: by 2002:adf:e282:0:b0:21e:5546:5a26 with SMTP id v2-20020adfe282000000b0021e55465a26mr4901672wri.77.1659713924862; Fri, 05 Aug 2022 08:38:44 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:aef0:8606:da6b:79ef]) by smtp.gmail.com with ESMTPSA id h14-20020a5d430e000000b002217540b222sm1721025wrq.58.2022.08.05.08.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 08:38:44 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria Subject: [PATCH 1/5] thermal/core: Rearm the monitoring only one time Date: Fri, 5 Aug 2022 17:38:30 +0200 Message-Id: <20220805153834.2510142-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current code calls monitor_thermal_zone() inside the handle_thermal_trip() function. But this one is called in a loop for each trip point which means the monitoring is rearmed several times for nothing (assuming there could be several passive and active trip points). Move the monitor_thermal_zone() function out of the handle_thermal_trip() function and after the thermal trip loop, so the timer will be disabled or rearmed one time. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index b4c68410c158..4e1a83987b99 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -383,11 +383,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_critical_trips(tz, trip, trip_temp, type); else handle_non_critical_trips(tz, trip); - /* - * Alright, we handled this trip successfully. - * So, start monitoring again. - */ - monitor_thermal_zone(tz); } static void update_temperature(struct thermal_zone_device *tz) @@ -503,6 +498,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, for (count = 0; count < tz->num_trips; count++) handle_thermal_trip(tz, count); + + monitor_thermal_zone(tz); } EXPORT_SYMBOL_GPL(thermal_zone_device_update); -- 2.25.1