Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp534038lqo; Fri, 10 May 2024 07:21:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV40WkxAGAVrcz5dZu7HcRhmh7LEsPvL6tsxiLrXljlkEZMVCKiB64Wtvxq+BzrkeDnN/wP2TngRSV6b6Ar24/+KG7OKWoPDH+82CMwhg== X-Google-Smtp-Source: AGHT+IHDqhmDyhCg2zT9v4qTf5DozITphK7fptF/bCJ0slhM6s8SX4HXiNt/7ReVtyQdfDjbUYLI X-Received: by 2002:a17:902:f605:b0:1df:f681:3cd8 with SMTP id d9443c01a7336-1ef43d2e288mr35481025ad.12.1715350877790; Fri, 10 May 2024 07:21:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715350877; cv=pass; d=google.com; s=arc-20160816; b=CxWBqNVzv5JXqzYLCE2VxOj82k+0/ZB1pTCh5O43Pwfj5UyUzzeoPC0AtOmRyGukyl V2SuLgeHU4IOuBoRiPIzubuOmK2ktUnqgoGsmKd2X7c9lnAcv2TBkoavggPngR0YupDm Dc3gPgw60zF986ypf73vdH2xzqr5Nh5yP5vY6g/yQbs+C0SrcnRKFf523giHHPDhvf1E ryth3s2dEjaRLljH/QaE1ddoEphQU3Ij+odsD342OyM0/kLGQrfV9LlS0vI04sfPIfDx Zk+G4kGa/r76/NxCaBcPk6ewBvsn7pusC39oI/2FOeHp5joiOI2exde3+DwOMM22Ow85 vr1w== 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=0/cC43wtaah81H/AB+STprNIlBWUNJfe8oP/AKdyEok=; fh=GzCkp9dboMjnsRASvUnR8RkBPyyMxU6lLzxcgnbmqi0=; b=LpV0CAuXonoc/OwjLXV8Kf37oMwVFTiZ60RGPggF/HPtlSh9KwtLijDi5jmqS5c2OX 0+edl9XSr+9iXqsA66IcZ/IA/nCPl8NW495PBoaXzfw/qm4sqrWaPUiyfuilQElnwWNb L9Hu9H+tbDs2EPEXCZlCiGxUjHAokJXXKyhviF0hneRJ0LdiuhneOpflc1k6c7SWy3C1 8w2wRxUmGKwYbfe79f/aXzGsnKH2UQcH0I+1yPpYQTkQisBeHcpyX4kAvTOQ2peAiNFJ 19wGaF0mBcNqnz7t3AjSAS+w0dsv4KT4JAOdpa2/mxKhQ/tRKbR4Sy1vQD3ggWrMxEZO njwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=gpAKfkfL; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-175884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175884-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c255623si38513285ad.553.2024.05.10.07.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 07:21:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=fail header.i=@rjwysocki.net header.s=dkim header.b=gpAKfkfL; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-175884-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175884-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C3BFC2844EE for ; Fri, 10 May 2024 14:20:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B46B16F8FF; Fri, 10 May 2024 14:20:44 +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="gpAKfkfL" 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 8280D12CD84; Fri, 10 May 2024 14:20:41 +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=1715350843; cv=none; b=sLfJA4LcCza2v9QqmwlLpE5yxytjU/y6caficJtsYy47MFDHP31kZiiuV8H5fp14Pr/R4yPGasn5scz4q6oaCSIWb1C01ZUqwEm+qwJjfNIrg4ORsHUuJxKS4qT1kdsvURPhm89TT5HKG8myZUwE2oT8+ir+6feDr+OQ/0A0Cfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715350843; c=relaxed/simple; bh=jX8k0sZA/4NpcGMGcCtPRk72afCKR9YSs6kcGWfY9AA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ObSEqINBmQLFJkIyK6xVWhESBGvSz/Ihx7Lotold1Grehhu2vBfEaII4aJPOPStBh+FHy3sFQ8ItbG9paRUWPi93PP8nfsAHorMKPE/EBTZ4rE7tSUkekDjX7RqVlNCW+AXy8fXHs9upUztuPB4gmqSy8uCGA2ihBF6aOb7weKw= 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=gpAKfkfL 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 9527010a85f4ad71; Fri, 10 May 2024 16:20: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 E19892102F3F; Fri, 10 May 2024 16:20:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rjwysocki.net; s=dkim; t=1715350839; bh=jX8k0sZA/4NpcGMGcCtPRk72afCKR9YSs6kcGWfY9AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gpAKfkfLAtUDGJnYn4LXEue43eipYfwWyXEopoIggcbuTkVBr46nx7tWs7l5l1bWS E6ilDz3lDZHjfRgXsnl4mXXjUr+GV6Fs32U+gqbGU0hlYzl3QSajbS59RRUl9+Qi5A afXH01wQIOiy2rN46RjkYH8gQadBTSyAe741J7jxJvE/IKqML4rGqmEDuHlWprLLdu J6ClL1qskFFBTcalo/2xkbjGRkwGuxN18gOEV0lMO3x0QkHBhtWyU/CDLJvVUURyHg jRygbXoP2riaMdoKBeEJZvbmVp1lGGYEoGYriH/j8W7PyeaBH2qjfbyQ2Nm4mVdeCn LmaYmb7DI99Aw== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , "Rafael J. Wysocki" , Lukasz Luba , Daniel Lezcano , Srinivas Pandruvada , Zhang Rui Subject: [PATCH v1 5/6] thermal: gov_bang_bang: Drop unnecessary cooling device target state checks Date: Fri, 10 May 2024 16:19:32 +0200 Message-ID: <3570512.iIbC2pHGDl@kreacher> In-Reply-To: <13518388.uLZWGnKmhe@kreacher> References: <13518388.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: gggruggvucftvghtrhhoucdtuddrgedvledrvdefkedgjeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigt rghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 From: Rafael J. Wysocki Some cooling device target state checks in bang_bang_control() done before setting the new target state are not necessary after recent changes, so drop them. Also avoid updating the target state before checking it for unexpected values. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/gov_bang_bang.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 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 @@ -57,24 +57,16 @@ static void bang_bang_control(struct the if (instance->trip != trip) continue; - if (instance->target == THERMAL_NO_TARGET) - instance->target = 0; - - if (instance->target != 0 && instance->target != 1) { + if (instance->target != 0 && instance->target != 1 && + instance->target != THERMAL_NO_TARGET) pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", instance->target, instance->name); - instance->target = 1; - } - /* * Enable the fan when the trip is crossed on the way up and * disable it when the trip is crossed on the way down. */ - if (instance->target == 0 && crossed_up) - instance->target = 1; - else if (instance->target == 1 && !crossed_up) - instance->target = 0; + instance->target = crossed_up; dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);