Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3161520lqt; Tue, 23 Apr 2024 12:01:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5lk7pMKrYLKBcYgmk0mlW8aZJgn0whY/NVmYOXzgz2hGxDWlXEUCgvQ4pf4vzW8O6tZINxVQD1uKE4xv95wnt+3A1DndnlIvXWf6WmA== X-Google-Smtp-Source: AGHT+IH9/c9ghLMVVGobWYeB9TDA6uoEpNkOTPALHIQBatix6kmDDgywlzhrUDBj/I6VXajQgbE1 X-Received: by 2002:a05:622a:5cc:b0:437:b439:3852 with SMTP id d12-20020a05622a05cc00b00437b4393852mr335779qtb.51.1713898889778; Tue, 23 Apr 2024 12:01:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713898889; cv=pass; d=google.com; s=arc-20160816; b=PvHDi3w9eY7XXRExR5fTS9gHM11ESmGLXVVilnEqMivDflOBRbC2ea9TUdj36kSLe3 yolsoYLgeSOZXxg/Gxxujki8gfrT9XGeB0mx1rVQ/3s5HRtjnGOItea7xi04/3rTjIoU 9c56C9wgKeINViI1Rk74miiXjbJZrBhHNRRN9YIru1FBoEua+8CEOT7NBVMJRu6UT8Ic hLUrQjsC54tnn3aSDAm69O8slI7YedisFsXHy/ub20HPDUyZxc335FqWdGXkwYB/iA2y Rk4b4a0czSr8wOxRyAcVnn1+eZOEIj5mNiAMg++eqapYMIOjs1DMWRetZsu+CMNaezji VI8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=rgtUJpfIjNpIDbKgClnjYAuxAWeNltleJ52u4GbsEJ0=; fh=VKmF4EQt81vhK6oTYS62an0yKG1a+ZpCH0rasLrz29U=; b=DeEtkxiCAOTrOQ6+uodpN8/355Gg5C1MWomOH0Cy5QYWruVEg/ZAyTFWFjmCf8S2jg zc6LkPaZpN0f5NotXiJ4ThU21J8VzK49MWulaz+WzQpgkeWfggbSS05jpZm/P18v6cJV Ec3h3QvffySxwdTcehzTrhqoz3njC4ZSFCkqGjPiVqAq3DaVe+8xsZjqoUGLW4KMpHIr WmSc6xvCV4qvQzZNtreoJulJjI6HJ7+WRPtAgfIoOtfMo/DR8UPTOyYUMxom4NnUewUv iPICsofKWRLClwxNwRvYp7EWTI+zcm3WdYeHj6KdmX8VGks8mgee78lzH2lk890bsfpm DDAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rjwysocki.net header.s=dkim header.b="k/Wg5lgZ"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net dkim=pass dkdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-155774-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155774-linux.lists.archive=gmail.com@vger.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 p6-20020a05622a00c600b00439f5294bc2si1929750qtw.497.2024.04.23.12.01.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 12:01:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155774-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=@rjwysocki.net header.s=dkim header.b="k/Wg5lgZ"; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net dkim=pass dkdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-155774-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155774-linux.lists.archive=gmail.com@vger.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 81AFB1C219A3 for ; Tue, 23 Apr 2024 19:01:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6E6B13FD6E; Tue, 23 Apr 2024 19:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="k/Wg5lgZ" Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (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 1CB1822F00; Tue, 23 Apr 2024 19:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713898880; cv=none; b=r+hKRXRZRDBGtAGeV/QB+FpT4UigT8EP3mLj0yfYdVAUWR7wukLNwQHioev0nQ8Tyo9+5IKUVfADdQzmCNhRgvt44C7p1j7S2bLT33y7ZPpAmPnpSJF3sGGWeQlbgs42wjdwIXi+AcWV5rVXykxXrif7Wutj5g7AM42DPK4yR58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713898880; c=relaxed/simple; bh=tkGMGjpcpFko6fk7a+2OyUel2wfyFYBcaIRYqOvd8j4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=GUGtIsq+p8MzFWjZMGSuxQU+W7+98g8l23eBhz1wXRCYhq0bdjv7j3ExCa/McRJTrki3m39AIU8MGlVyM2ZgKwYCFWf/yH5ZHo5iwTNVAaCq/Cko+a9TmbEie6316DlA4rYaBaqo7hgwzNBcm1jafbMVgh5JzIBXZNW5lC1nzUM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=k/Wg5lgZ; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 6.0.0) id 963cb8568aca2043; Tue, 23 Apr 2024 21:01:16 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 8445966DB89; Tue, 23 Apr 2024 21:01:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1713898876; bh=tkGMGjpcpFko6fk7a+2OyUel2wfyFYBcaIRYqOvd8j4=; h=From:To:Cc:Subject:Date; b=k/Wg5lgZMEI9xlmnJYmKdoQ83DZxUokRlMzbEMewF+adSgHS1rUSJXPlQlTsWPCrc giOFs6fCDz4qA0Cr/N4TVJkDYuacEb8RcjQ5ZSiccUq634LQgdkZK1qdONvtvgSH2f fmkq8Xb5Vbye9PgMSwI4DtbfqiGnFIeekexQ8nLvnlyxpzR50BEI7dqlgqDmxtO0/4 xmGdXR3Zbai9SveBIFCXuiGZGpVpSHPwIETPx8/CLiwc1oWJueXckdtNdF3zHyE3ki 6D2+9Dzfnl2nLmjBOxx1ABwRVlJ4uc2+iChKec/C7rfP7QT9aI8wIQn1fClvegKLL5 uh0OzDYonEOvQ== From: "Rafael J. Wysocki" To: Linux PM , Daniel Lezcano Cc: LKML , "Rafael J. Wysocki" , Lukasz Luba Subject: [PATCH v1] thermal: core: Introduce thermal_governor_trip_crossed() Date: Tue, 23 Apr 2024 21:01:15 +0200 Message-ID: <12426299.O9o76ZdvQC@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudeluddgudefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeegfffhudejlefhtdegffekteduhfethffhieettefhkeevgfdvgfefieekiefgheenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgv lhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki Add a wrapper around the .trip_crossed() governor callback invocation to reduce code duplications slightly and improve the code layout in __thermal_zone_device_update(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- As requested in https://lore.kernel.org/linux-pm/3c169af3-e9c3-47c0-b343-48f699680009@linaro.org/ --- drivers/thermal/thermal_core.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -450,6 +450,15 @@ static void thermal_zone_device_init(str pos->initialized = false; } +static void thermal_governor_trip_crossed(struct thermal_governor *governor, + struct thermal_zone_device *tz, + const struct thermal_trip *trip, + bool crossed_up) +{ + if (governor->trip_crossed) + governor->trip_crossed(tz, trip, crossed_up); +} + static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a, const struct list_head *b) { @@ -489,16 +498,14 @@ void __thermal_zone_device_update(struct list_for_each_entry(td, &way_up_list, notify_list_node) { thermal_notify_tz_trip_up(tz, &td->trip); thermal_debug_tz_trip_up(tz, &td->trip); - if (governor->trip_crossed) - governor->trip_crossed(tz, &td->trip, true); + thermal_governor_trip_crossed(governor, tz, &td->trip, true); } list_sort(NULL, &way_down_list, thermal_trip_notify_cmp); list_for_each_entry(td, &way_down_list, notify_list_node) { thermal_notify_tz_trip_down(tz, &td->trip); thermal_debug_tz_trip_down(tz, &td->trip); - if (governor->trip_crossed) - governor->trip_crossed(tz, &td->trip, false); + thermal_governor_trip_crossed(governor, tz, &td->trip, false); } if (governor->manage)