From patchwork Mon Aug 26 16:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13778173 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 DE353197A7B; Mon, 26 Aug 2024 16:42:40 +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=1724690562; cv=none; b=TUQcYY4WVOWKA2umOdCHhlNEEk7OWRnACisKz+Xed7mSOtwUHjt8eXDUMAur8s3PvDgTOHvGJuaC3LINJ8HATr3sTh571YxfAit+89YNGYRwbDTaaZ/v96EgtMWyAIkq4DPj4BNFgUKHnEe3rDNkd8l/rLlugN/dccrRKNpH3FM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724690562; c=relaxed/simple; bh=yjDrcAP6qTSEx6Q/HdDxHt9ilmkpo2bKge5/Yiqn7Cg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iXUPpkKkX+rQUWvO0dzb6wfcBSxp7HD8J17RC/kuqW5R5cHpHeYLPjHrypAMTLYcdMaEKddPUBvy2K6d7Epq6VtMnJosX11KzWvSGVduqgBzEZr2IATm0j/ln2cvmHg1att1b2FUe03iF5cVspelRmjy90p4ns6CI1uqFixXnRk= 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=qwFsMVXN; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="qwFsMVXN" 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.2.0) id 42adb13f24de3ae9; Mon, 26 Aug 2024 18:42:39 +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 7907C921951; Mon, 26 Aug 2024 18:42:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1724690558; bh=yjDrcAP6qTSEx6Q/HdDxHt9ilmkpo2bKge5/Yiqn7Cg=; h=From:Subject:Date; b=qwFsMVXNgrDNm/fqHYbXcgUlUaJCZiq3HviQwpqTZiIWtiy81AuJwXwBnW02Ei/iN 8q9cUZFnQTacM/DKRQhTDZf39JyME3o9GkZjXJkj/XTK5PoWvp0Ue9ZM+XlA2pCciT w3J7i7fzXN3wtzNbXA169nCCHu0JTeibKLJW88cM0/QruzKumLRRNnSHw1xUQNcvCe K9zA4PYFvQ/e9VuJN5i0vLRZrFxw/9pKn2ldVuUi0+cL60BJaZO5iW0xBD/ovmsSzy Nh+mCqkX+gtC58JJGOBEoTnTdhBwY9XjXYb4UcHU/0m0MYruJp4Kaq8+5ZgVoAwtsY +eZw+ViT48Bgg== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Zhang Rui , Huisong Li Subject: [PATCH v1 1/4] thermal: core: Drop redundant lockdep_assert_held() Date: Mon, 26 Aug 2024 18:30:42 +0200 Message-ID: <3341369.44csPzL39Z@rjwysocki.net> In-Reply-To: <2979211.e9J7NaK4W3@rjwysocki.net> References: <2979211.e9J7NaK4W3@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedguddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegoufhprghmkfhpucdlfedttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucfuphgrmhfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehlihhhuhhishhonhhgsehhuhgrfigvihdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=18 Fuz1=18 Fuz2=18 From: Rafael J. Wysocki Along the lines of commit 24aad192c671 ("thermal: core: Drop redundant checks from thermal_bind_cdev_to_trip()") notice that thermal_unbind_cdev_from_trip() is only called by thermal_zone_cdev_unbind() under the thermal zone lock, so it need not use lockdep_assert_held() for that lock. No functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 2 -- 1 file changed, 2 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -891,8 +891,6 @@ static void thermal_unbind_cdev_from_tri { struct thermal_instance *pos, *next; - lockdep_assert_held(&tz->lock); - mutex_lock(&cdev->lock); list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) { if (pos->trip == trip && pos->cdev == cdev) { From patchwork Mon Aug 26 16:31:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13778172 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 27789195805; Mon, 26 Aug 2024 16:39:23 +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=1724690366; cv=none; b=uRaG9CPzD2JDzA0U93998zOkKjcfRP+doWByl/MT4LahhldE7pmXK79nJcgLGlT6g939Xm/S+Q6siy4yBq4So7wEBDal1BdSPCNuzWTJDWFEJjs9iOqE475ukNL/JUu8tJ00/GxncWnzJrtEj0EZbNVcCRqawgjKLwKHqCDRqUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724690366; c=relaxed/simple; bh=zmx6kFpyVT5IfRf2UW1B3t25cvlhZfOlajPkJYOuAnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tDmfPiH3WaLZR1IqR4egQksbEmBCEZZ5rBr5vFtx8q12kCOq/1cXj1i7CooE/icFz8lWt310f8Ke8+fvF+RpnO9+OEyJUWOMLsOF3PPSs9LEEvSsIbCXjsrmQJqSIA3yhsJt+9hiikMFTcSL5/reof8LliTk01Al6pdP1YBfDyc= 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=fail (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=UAQev5N9 reason="signature verification failed"; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="UAQev5N9" 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.2.0) id 12cef64563457834; Mon, 26 Aug 2024 18:39:22 +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 ACCA5921952; Mon, 26 Aug 2024 18:39:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1724690362; bh=zmx6kFpyVT5IfRf2UW1B3t25cvlhZfOlajPkJYOuAnY=; h=From:Subject:Date; b=UAQev5N9VpAsG0fSPW/6cig7AD3yU1pX39UqcbC84dl8UtytslaR1HwTQbgP8GSuL 97VRI+2YBn/pDrnja86uTJPKWJnv9J9pDBpwcID209/5EZTi+3AIoSmDlfUABgdp9r vy6lG6UixgWdSMkHC8m5CAVHyhpYCnNIC/jXp8rJSGLNdiolM6V5CRI1x3RdqDLstA ysm0xE76rGFaVdhDH9p2tVkNle0PaKJ3A57lhk1qVUWdt/I9jI/VWVHTUihAuqM1Wi 22aNIKzF/WbXipbsMpuUdTVhCEA1LGgApZYH7xlNxN13wY9ENRIaHMhpjJYmal4h8Y ohhs8/hia1c6w== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Zhang Rui , Huisong Li Subject: [PATCH v1 2/4] thermal: core: Drop dead code from monitor_thermal_zone() Date: Mon, 26 Aug 2024 18:31:32 +0200 Message-ID: <10547425.nUPlyArG6x@rjwysocki.net> In-Reply-To: <2979211.e9J7NaK4W3@rjwysocki.net> References: <2979211.e9J7NaK4W3@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedguddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegoufhprghmkfhpucdlfedttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucfuphgrmhfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehlihhhuhhishhonhhgsehhuhgrfigvihdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=12 Fuz1=12 Fuz2=12 From: Rafael J. Wysocki Since monitor_thermal_zone() is only called when the given thermal zone has been enabled, as per the thermal_zone_device_is_enabled() check in __thermal_zone_device_update(), the tz->mode check in it always evaluates to "false" and the thermal_zone_device_set_polling() invocation depending on it is dead code, so drop it. No functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -364,9 +364,7 @@ static void thermal_zone_recheck(struct static void monitor_thermal_zone(struct thermal_zone_device *tz) { - if (tz->mode != THERMAL_DEVICE_ENABLED) - thermal_zone_device_set_polling(tz, 0); - else if (tz->passive > 0) + if (tz->passive > 0) thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies); else if (tz->polling_delay_jiffies) thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies); From patchwork Mon Aug 26 16:32:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13778171 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 334D65476B; Mon, 26 Aug 2024 16:39:22 +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=1724690365; cv=none; b=iIW9PYKOyUNWlKg6ka/wFEYkWfNcEnB57KePa0Uq6QfrLPYzBJc+8OBQ3FpOdGR/TQqFS77G4Kb/ym7nI6kYcYUalAvYApTEcbvHArXijHo2Wi1kDc0nbPAwJxUFB0PpqzpMQYrnUTIXEpe3goJOJDe3HadhoyanWOf27KXmPpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724690365; c=relaxed/simple; bh=c06AXLQtSCDEtudeOfQinE8psYkbBOM3p1kMOn0vIh4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QlDNziLQfaZ5rbBoSyjzqRHcXUcXYRZ7UfM+7FkAYUpxP975iZanhWlKqmCjwsKzE7DAn39ru2/a+FbPMQqeViKRJTWaAhPqqt2kCCoRAOEEIr1ikc5VD+lzGfJPbz5+a6xJ5lMr3WSoVziQQl7ZpBdm385Qpd6NLk0Mp6WIyJ0= 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=fail (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b=hZDdeeg5 reason="signature verification failed"; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="hZDdeeg5" 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.2.0) id f92a6affd5e871ed; Mon, 26 Aug 2024 18:39:21 +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 A8DED921952; Mon, 26 Aug 2024 18:39:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1724690361; bh=c06AXLQtSCDEtudeOfQinE8psYkbBOM3p1kMOn0vIh4=; h=From:Subject:Date; b=hZDdeeg5AFPGnvKAL9WJ7VhS1jvXYbnI8GfoSy6HQlojFiIGDGQ+BGSoAQrkMMwf4 DtNxgg7bTHU8qYCOY8PI4dmFIMkSQNkdk55rg65kLopqUKVWGJ4oVIVGEU5LcmNoR5 cSBKnnAloQwxCwQhYeNX+aQJPyZGKf+ZCsCYbLtGVY9ZnKe+H0znaJz+2m1KR4Taor XhbvaL1B+rUmb8PB503w4jpToNh8A1RbHo+WZ8xCgjiQFo3yN435ZGuWIqmdMfpHEK zegoGGSwy41JgpDq9KPTFch/tZ8MZWGnc5boQNedRCRI/OjN1/OvOtvwDlUSKoRG8b i5pnBlU/pSjzA== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Zhang Rui , Huisong Li Subject: [PATCH v1 3/4] thermal: core: Check passive delay in monitor_thermal_zone() Date: Mon, 26 Aug 2024 18:32:36 +0200 Message-ID: <2004353.PYKUYFuaPT@rjwysocki.net> In-Reply-To: <2979211.e9J7NaK4W3@rjwysocki.net> References: <2979211.e9J7NaK4W3@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedguddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegoufhprghmkfhpucdlfedttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucfuphgrmhfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehlihhhuhhishhonhhgsehhuhgrfigvihdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=12 Fuz1=12 Fuz2=12 From: Rafael J. Wysocki The only case in which thermal_zone_device_set_polling() is called with its second argument equal to zero is when passive cooling is under way and passive_delay_jiffies is 0, which only happens when the given thermal zone is not polled at all. If monitor_thermal_zone() is modified to check passive_delay_jiffies directly, the check of the thermal_zone_device_set_polling() second argument against 0 can be dropped and a passive_delay check can be dropped from thermal_zone_device_register_with_trips(), so change the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -323,11 +323,6 @@ static void thermal_zone_broken_disable( static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, unsigned long delay) { - if (!delay) { - cancel_delayed_work(&tz->poll_queue); - return; - } - if (delay > HZ) delay = round_jiffies_relative(delay); @@ -364,7 +359,7 @@ static void thermal_zone_recheck(struct static void monitor_thermal_zone(struct thermal_zone_device *tz) { - if (tz->passive > 0) + if (tz->passive > 0 && tz->passive_delay_jiffies) thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies); else if (tz->polling_delay_jiffies) thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies); @@ -1411,13 +1406,8 @@ thermal_zone_device_register_with_trips( if (num_trips > 0 && !trips) return ERR_PTR(-EINVAL); - if (polling_delay) { - if (passive_delay > polling_delay) - return ERR_PTR(-EINVAL); - - if (!passive_delay) - passive_delay = polling_delay; - } + if (polling_delay && passive_delay > polling_delay) + return ERR_PTR(-EINVAL); if (!thermal_class) return ERR_PTR(-ENODEV); From patchwork Mon Aug 26 16:37:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 13778159 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 EDDF8143C7D; Mon, 26 Aug 2024 16:37:26 +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=1724690249; cv=none; b=XWf1z89q10arTJWUKkUxb20OlDZxSwUIgRFR5h+pX24l+FU6Hoogiuqv79HQfmALuVcc3yw4Z31BH7Qi0rhKkA5Ath+I7i8u6moGM0y92Kko9jFvrrK4XYvylisoMs8TS5wPtm4GVd6zs0/n8qSnmwW9CELG9Ql1s8+tvDhPfGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724690249; c=relaxed/simple; bh=7YZKPwCtQxcL4xgnfnjvMt8lmgcWeXktoVDEPvRCGb4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j5Z66PE1J0jvwtmEuHKFqIRmz18hivEkW0Ztk4AkTSl/tPuIOhIQs0alEZx1OjP+4i5Jvd7/VyjQnOIwmYltiir8ZzDP5YWFO04D9PdM8JiGTgsSANrPmZ9p2yN0fCSEdnIdkqvL0y9j5GzCt3G8geJLZwcXabsfNDnFv2epZNw= 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=kxbYTWBz; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rjwysocki.net header.i=@rjwysocki.net header.b="kxbYTWBz" 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.2.0) id e4d1ef758a5236b4; Mon, 26 Aug 2024 18:37:25 +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 7E119921952; Mon, 26 Aug 2024 18:37:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1724690245; bh=7YZKPwCtQxcL4xgnfnjvMt8lmgcWeXktoVDEPvRCGb4=; h=From:Subject:Date; b=kxbYTWBzzEOnfQ5iRA02urCV+HL3RrCNSldCKtYTh38kjmczu9V4sl3uFIOQOId6n VJe6fj5eoI4sRt2fYr9z64Ct7fg+OAyGu6zK2/2Yjq785uUNRThGk7dgPB54kUGzFx CA/lFis87rDBUp6Zap0vv4TdcqjeBKVCkxF+HB+4AMehkpZqfW0WDPKY9iy9QDReDa 3pL87zzabqkdMQRrQ2A9WFSPoWJQVNlWTooVZXibTUwWQUGceVJyM8Fc7I0G0CGDGT xO9ICfDIreF4+8+8I288/rLoOSS0MikY7nCGOmIWQpkWuPsA4aK1cgCxlTghxfLa3R U8C9NMQF463Wg== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Zhang Rui , Huisong Li Subject: [PATCH v1 4/4] thermal: core: Drop thermal_zone_device_is_enabled() Date: Mon, 26 Aug 2024 18:37:16 +0200 Message-ID: <9353673.CDJkKcVGEf@rjwysocki.net> In-Reply-To: <2979211.e9J7NaK4W3@rjwysocki.net> References: <2979211.e9J7NaK4W3@rjwysocki.net> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: spam:low X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddruddvkedguddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegoufhprghmkfhpucdlfedttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucfuphgrmhfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgtphhtthhopehlihhhuhhishhonhhgsehhuhgrfigvihdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 From: Rafael J. Wysocki There are only two callers of thermal_zone_device_is_enabled() and one of them call is under the zone lock and the other one uses lockdep_assert_held() on that lock. Thus the lockdep_assert_held() in thermal_zone_device_is_enabled() is redundant and it could be dropped, but then the function would merely become a wrapper around a simple tz->mode check that is more convenient to do directly. Accordingly, drop thermal_zone_device_is_enabled() altogether and update its callers to check tz->mode directly as appropriate. While at it, combine the tz->mode and tz->suspended checks in __thermal_zone_device_update() because they are of a similar category and if any of them evaluates to "true", the outcome is the same. No intentinal functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 12 +----------- drivers/thermal/thermal_core.h | 3 --- drivers/thermal/thermal_sysfs.c | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -547,10 +547,7 @@ void __thermal_zone_device_update(struct int low = -INT_MAX, high = INT_MAX; int temp, ret; - if (tz->suspended) - return; - - if (!thermal_zone_device_is_enabled(tz)) + if (tz->suspended || tz->mode != THERMAL_DEVICE_ENABLED) return; ret = __thermal_zone_get_temp(tz, &temp); @@ -652,13 +649,6 @@ int thermal_zone_device_disable(struct t } EXPORT_SYMBOL_GPL(thermal_zone_device_disable); -int thermal_zone_device_is_enabled(struct thermal_zone_device *tz) -{ - lockdep_assert_held(&tz->lock); - - return tz->mode == THERMAL_DEVICE_ENABLED; -} - static bool thermal_zone_is_present(struct thermal_zone_device *tz) { return !list_empty(&tz->node); Index: linux-pm/drivers/thermal/thermal_core.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.h +++ linux-pm/drivers/thermal/thermal_core.h @@ -284,7 +284,4 @@ thermal_cooling_device_stats_update(stru unsigned long new_state) {} #endif /* CONFIG_THERMAL_STATISTICS */ -/* device tree support */ -int thermal_zone_device_is_enabled(struct thermal_zone_device *tz); - #endif /* __THERMAL_CORE_H__ */ Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -53,7 +53,7 @@ mode_show(struct device *dev, struct dev int enabled; mutex_lock(&tz->lock); - enabled = thermal_zone_device_is_enabled(tz); + enabled = tz->mode == THERMAL_DEVICE_ENABLED; mutex_unlock(&tz->lock); return sprintf(buf, "%s\n", enabled ? "enabled" : "disabled");