Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp515455lqt; Fri, 19 Apr 2024 02:41:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVuLr9YNdoWg132mc8wxnvs7fUwfE0eDcD5teVLHChcSbHy5WqgLC2SKL1zGEYwpLnuqaSVaUOoEM+Y9qEkkFxKIy0cNmDhwe0Oq9ydDA== X-Google-Smtp-Source: AGHT+IGZ2wVhQmnm01Pt75YiNpqMuMKkAdRWP1HgprCStNFiBRMgI49uChcgVxmEXiU2Qui21F95 X-Received: by 2002:a50:c05c:0:b0:56f:e426:e5d1 with SMTP id u28-20020a50c05c000000b0056fe426e5d1mr1205867edd.31.1713519697478; Fri, 19 Apr 2024 02:41:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713519697; cv=pass; d=google.com; s=arc-20160816; b=Es0CW128M/lx6LuucaLtP21o9n8lCPhYQOLDeaIuMcm7O5cx/FfgIEwjBxPzh8MGzD AlZ1E3wlTsjPIwf+CKsaxtMSoXaYRDpwLOOBz6IbqsRRbOK6QRHpmqdJMzyKpN9KhG41 2RhMfWjJRh0z4EVSRBi3q/Jx5492ailkq3EI6IppkRfUKrQCDUQfhhBW/mljX/KFGpDL 1L6epvshprEFTBFF+6gkcunCBtlJ3TF2yAgEW0tNk570fI85aR8R7gyObp9BRD4lkHb4 Ve+MdLdwM7ofVFAB7KqgLcoI/Pjy6aJ5SyhhyRpzSDomctYaSFFFvozSkoAUo6IpUKNi pL7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=OhVTQSWtGGFFYyW6VTQV++kc58NCosLZ/O/VSzkgkVw=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=OUMQQ3KjljA1+dX+5x5WgE3ub/ZrsElzqtRJKqhSdefC+PvjTgcOWfoBBgHvS9ZEsX 1Zdy/ug6BLHkaARDfV8E19TAa1n3y50KfjJLZvAJ46keRxe/ytKl/87KSf8aaXfU6waA 35LncmW1h+3mxZLxOdp4qTyMLFCMbDvqDC+DPg4oH+PFQUxz7PqCxciqgXITYbaOwcSZ aW7PhC7Jru16FeIgSFLgu7QY2aSV60EXZvNS1wObcBlDtpHBATdVX8bryM2i8bi46Tf3 GWCD/MxXAfG7bRUN48KXHhzxj7kUt1xYurliRX1q98MIKxZ8ixPysGvM2mPWer9ch2nW B5bA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h6-20020a50ed86000000b00571b76d8cd4si1883902edr.43.2024.04.19.02.41.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:41:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-151241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id EF95D1F222C8 for ; Fri, 19 Apr 2024 09:41:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD5AB7C08D; Fri, 19 Apr 2024 09:41:23 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC04679B87; Fri, 19 Apr 2024 09:41:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713519683; cv=none; b=NNWOxvStQ0bV39go+Bi/4sVf6w3GR+7zlOeEGwGX2jrqpUDeSInXtpQHyIJyaxRndlw1aCsmjaR7RXk9e1AXiogxAbvSEq8Vtoi05h+3/CjYeZ9zjuA4NiA+DZAY009Hhcqt71Cf4ul1JCXdk2QoTgU6K0lAvREncty6fwdVWKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713519683; c=relaxed/simple; bh=piOLTlZ9jEPVrKKjrjmWxxPg1/3uUX0Kmj4uQ0YMG8g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=clH+S/hujRc5W9zNqBVskEkstkA2PKG/AObvPUexNnKLsJiJ4DY0dUWTafpqVFt1k8l7EFhygEN7E88MGEqElrw01gnnY/NaGCRpm/qpV6RGcu/fwT9UiRq+D/Kodn14xgSB8xrSQx16n57lr8wK0DjKnvCPUmfCLwcbzwO4BBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 828B42F; Fri, 19 Apr 2024 02:41:49 -0700 (PDT) Received: from [10.57.77.69] (unknown [10.57.77.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 49F483F792; Fri, 19 Apr 2024 02:41:20 -0700 (PDT) Message-ID: <74de6868-770e-4fd1-8856-4ae327f1bbbe@arm.com> Date: Fri, 19 Apr 2024 10:41:27 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 03/16] thermal: gov_bang_bang: Clean up thermal_zone_trip_update() To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <22273122.EfDdHjke4D@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <22273122.EfDdHjke4D@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:05, Rafael J. Wysocki wrote: > 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 */ > > > LGTM Reviewed-by: Lukasz Luba