Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp302106lqj; Wed, 10 Apr 2024 10:48:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3Y9LtjurEhK4MEdP6IyRcUZiRTM0xgGF1hD20NgK0Jf5R2ZOLKzGhaEftpcdy3v+N1URedx2g+rBz8yKxWlaEop/BT46klRqmDL7U8g== X-Google-Smtp-Source: AGHT+IHJw7Is6u3CKWj3utlBL9aF942tb3D5ptbyriaf2FtUJ3uHM7+/mW7kyLY0XhcUIj3ahC1H X-Received: by 2002:ac8:5196:0:b0:434:fdef:c2cd with SMTP id c22-20020ac85196000000b00434fdefc2cdmr2574685qtn.0.1712771339018; Wed, 10 Apr 2024 10:48:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712771339; cv=pass; d=google.com; s=arc-20160816; b=Gemnac81yYo13zlMQUoW6ly3uK1UHybanBVMaDoQUGab/g3kYx0wLcC5QChP91tptw pKve8UVYGZzjPrGJmbAWhPRySykRc5fcvZ2Yw5F4ppRJ+wC7GLOOCeanVpNFLNtGATEM uK/OCBp/2nfkl59fZaaPMc/BwtQ74jZwYLduYzcMyrLY1z99alBszZTXTHzThEqr3SBb 3D0zvp/Qee4e5AVrUVgC0BZEkwrprQIXpIajUdMV6TVrXxS3ofpvu+ODyAmdQheiwmCo 5Z2w4pksMQVAnZJchzuGZrUOEsy1hOkjigouS/VCvs/kYefq3KKwtrLYB/riQCImFNQa talQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=A6ynOHAk4Tf4GJRlINTLi1zIfJs+Fq7o4QR3/BbmnCY=; fh=0I/rqIlL4373pOps8oaBYF1ECx5xbCzL9wLU5PgpMhU=; b=qYRqLzKYDa/EEeksymKwIFI0kMY56fe6yJDWDl/age3BdmCdDC/FRQus1J/ddsP5S0 A/2e+opETAHOBpKRxqNoDJA3hRZHwxIzm3qIeT8grO6J9MorJQQzME4cCyajC4FwGSDa Xw4343i9KQXT1EAT92BQdhD40Vi671n4g5AB4Stz8cm9/awcHey/dksj2C6kX0uzOSLG rHDD+jeT+pEWKbvLeH5aKjrDk6C9jrP6P7zxSUpl/W0IbamiW2ifKmcI/zVjymCKkoUJ +27N3y6i6G5/lJ1SSvudNMCNtG13n+P2Hk4z17toQuPw7C7Z5Y9EvrW2rGHMrQ2Mpk90 Fo1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=Gy7gmy0E; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-139137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139137-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f5-20020a05622a1a0500b00432d998f862si1783758qtb.634.2024.04.10.10.48.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 10:48:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=Gy7gmy0E; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-139137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139137-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 758E41C212F0 for ; Wed, 10 Apr 2024 17:48:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5513199EB9; Wed, 10 Apr 2024 17:45:07 +0000 (UTC) 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="Gy7gmy0E" 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 E1C97181339; Wed, 10 Apr 2024 17:45:01 +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=1712771104; cv=none; b=Xaer4+RZCLZCt4wlPQ+kJhFZgvyq7E4EqS4l4o4W6kmHLbatVX0PlO31PUDrizJF0zCQx/lxWJuN5t6A7mC66f89FrIAPPJNhpoXexrckwVlk+7sAB1IZ5rTc02O3k9lA42lPGuu/K0xceYv0kJJ799XzTZQcr50RQf2RNVaFoQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712771104; c=relaxed/simple; bh=S3GudwWSPWDgCp0Uz2WARPZEeLaa6Uxnwns5ZDR22LY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=seKIvrge4V8B7OCGwOFJ/K9XgBeQPmn7QPBXAMxUbQs8j2ZnrSTt1tiP94RME8KPrLkfpibocXRsYHoinQELP/XgNSr/qTAxlOZm6ET5+zUDdpStQ21MJ7JEfmMS9oOKAuax/u7Dn5xUubzRRS+vo/yHiBr5DVtzbhXXX7aX8IA= 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=Gy7gmy0E 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 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 ad53043102c6b081; Wed, 10 Apr 2024 19:44:59 +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 5982266C66F; Wed, 10 Apr 2024 19:44:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1712771099; bh=S3GudwWSPWDgCp0Uz2WARPZEeLaa6Uxnwns5ZDR22LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Gy7gmy0EsJ4Mhd3c3IPn7pXYRr3r7D7JsIaEVxbzXvws4yT8hX4K4bxTaAgDmuxVN KT5l8O95R8ZH04uRIPvPwR6979n4jzvolj5JqXBGAtlU/SmSuzUzYCJraQtqfV/eig jHRK2l87eX5dsgpFLRESJjb5G2G28Oc+6TCG2B3xf8qMuHVYFdQaCYIVa6b5zaEPUe tVJ+Z2pgTPNxfsHx7e16VsbvNixKribRCTJq/K1L+aZOu0sb5CfPdsL+Nl7yKgR0Vo i6jpmhf7NnitOBmLbI5WoMfi2eh/HTsCQL2TeLtKHXpgwweNymDVUT67+/dJuboukP Oiy+iYKO4yLYA== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano , Lukasz Luba , Srinivas Pandruvada Subject: [PATCH v1 03/16] thermal: gov_bang_bang: Clean up thermal_zone_trip_update() Date: Wed, 10 Apr 2024 18:05:44 +0200 Message-ID: <22273122.EfDdHjke4D@kreacher> In-Reply-To: <13515747.uLZWGnKmhe@kreacher> References: <13515747.uLZWGnKmhe@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: gggruggvucftvghtrhhoucdtuddrgedvledrudehiedguddufecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtohepshhr ihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 From: Rafael J. Wysocki Do the following cleanups in thermal_zone_trip_update(): * Drop the useless "zero hysteresis" message. * Eliminate the trip_index local variable that is redundant. * Drop 2 comments that are not useful. * Downgrade a diagnostic message from pr_warn() to pr_debug(). * Use consistent field formatting in diagnostic messages. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/gov_bang_bang.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) Index: linux-pm/drivers/thermal/gov_bang_bang.c =================================================================== --- linux-pm.orig/drivers/thermal/gov_bang_bang.c +++ linux-pm/drivers/thermal/gov_bang_bang.c @@ -17,29 +17,23 @@ static void thermal_zone_trip_update(str const struct thermal_trip *trip, bool crossed_up) { - int trip_index = thermal_zone_trip_id(tz, trip); struct thermal_instance *instance; - if (!trip->hysteresis) - dev_info_once(&tz->device, - "Zero hysteresis value for thermal zone %s\n", tz->type); - dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n", - trip_index, trip->temperature, tz->temperature, - trip->hysteresis); + thermal_zone_trip_id(tz, trip), trip->temperature, + tz->temperature, trip->hysteresis); list_for_each_entry(instance, &tz->thermal_instances, tz_node) { if (instance->trip != trip) continue; - /* in case fan is in initial state, switch the fan off */ if (instance->target == THERMAL_NO_TARGET) instance->target = 0; - /* in case fan is neither on nor off set the fan to active */ if (instance->target != 0 && instance->target != 1) { - pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n", - instance->name, instance->target); + pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", + instance->target, instance->name); + instance->target = 1; } @@ -52,8 +46,7 @@ static void thermal_zone_trip_update(str else if (instance->target == 1 && !crossed_up) instance->target = 0; - dev_dbg(&instance->cdev->device, "target=%d\n", - (int)instance->target); + dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); mutex_lock(&instance->cdev->lock); instance->cdev->updated = false; /* cdev needs update */