Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp822575lqt; Fri, 19 Apr 2024 11:22:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwraCyNQSvyGdHY6hBG6C5ee5Upii/ciYpAL+fm/4wsGIPudK+rXlUAJP5Wej+yKyJaMcohXicdjXQg+H7Zn9lp6hN/DtJ9NFkUXhwGQ== X-Google-Smtp-Source: AGHT+IHBLwUbBfj1LsIoEfbs8Prz///NSreeNPV/9ghghn0BvDnlJGON01W4q9ltAkdTuczUuj3A X-Received: by 2002:a50:f60e:0:b0:568:aa14:37a9 with SMTP id c14-20020a50f60e000000b00568aa1437a9mr2384856edn.24.1713550931765; Fri, 19 Apr 2024 11:22:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713550931; cv=pass; d=google.com; s=arc-20160816; b=RFoUdDbtCcAFJNpgCMFOyOBZa65Hi52C8d6p1yxXSdOuMuuKTX3CRfzCazqkazWjEV 9yuDSqiByj9iD6gyrL4sovx4b8EieNqDPWYvfA9uMlYR9kouUj5bobgKx5NnLsYZxeJ8 SoPFBPX328P4i3AAYiochaUZsgDEDXhJS1apCAhqLu3MkfCP2Dj84lOnR4TYBGeiFGi9 ZtwfOdC0HNE1l1QL1cl/iJsrrJa0Y8TCG9jmwHjO9NilwZ/V00bYs0CTtypB21glD45Y qe+qU27znSfZ4K+fjqL2a2up3DUVsOQIPpYhmr0pzjs+zgTb4DSe4teh38iHhnj98dEP uG+w== 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=fbnJtqDMaXghOjgUQTvmlkElU4OK9cjeg6v7Ynhi9+A=; fh=NWbihT0n2LVGI0eIabKMMzs0D4KhesRC0I1HJGdvI0I=; b=CUvIW3q2VDU5wBvEkcHP+SXvQjbMSxT+xPr61TT0/zukThfV4g7CtCgoHeEF5kyb40 r0f0FBHYvTN1V7QX7toGFzK3+OK4YCmb50XW8p87YQiNLr138rMCnXMl3cfoUjX9puFC cgF4X+uv7FCDd6OTWO+VmclncrmfoDSVxKEF16QlduoVgjYsLELOkwZ4SKAorc2DfXWM IChDazQydU4//lgQ1fVAhb+QTNjGtF+Fj7zpuhyN7mKU2IeRiRTLaDs/sw5WqFgnAbM7 8KTUfxk6l46/sXRHIKp6C/lirSgeeW3i+Km9FGL3KIStyqQXJ4rmfJxzb5k325b4Zf1B lKXw==; 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-151865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151865-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p27-20020a50cd9b000000b00571bf101974si2213108edi.74.2024.04.19.11.22.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 11:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-151865-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151865-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 79A471F22AE9 for ; Fri, 19 Apr 2024 18:22:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D281013C3E4; Fri, 19 Apr 2024 18:21:53 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EC358004E; Fri, 19 Apr 2024 18:21:50 +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=1713550913; cv=none; b=kAmS41l0pyEmwnz5eaBotE0f1Pk4i5l05MN8JRPUuMK5HSqLH9XIUDRCrDq38IamZByqu9nIJm8yzYUVHIu2Of+AE6vbN6jC1al2qO6cFO5YjTVVV8LPSrRFaZgCsHGbrHkkkfVWnaeIa9xZgFd2Bz7fwVuLBO4WM9IDRv5AGsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713550913; c=relaxed/simple; bh=HJqGs58SwQcHskZ/zUCCkx/SDgDbJpe0+oBP1ApuyA8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EqVqm9lM3hB67Mk1uZ3vMVggUM1RaZOp4x2uFx1scKOfasgC0C1tSlnjHZjdqlfRm4jEM/orLpEsDqo9r+pG2OX+fQPRcn1Hv9cfNJuMizqFMtDUCwS66jE9c6r4hk0EU7r0OaF+pOJMj1V74vFQgOexMGJlf92RvHvaXaPdJCc= 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 A5CAF2F; Fri, 19 Apr 2024 11:22:18 -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 4D7DC3F792; Fri, 19 Apr 2024 11:21:49 -0700 (PDT) Message-ID: Date: Fri, 19 Apr 2024 19:21:55 +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 10/16] thermal: gov_step_wise: Clean up thermal_zone_trip_update() To: "Rafael J. Wysocki" Cc: LKML , Linux PM , Daniel Lezcano , Srinivas Pandruvada References: <13515747.uLZWGnKmhe@kreacher> <1883063.atdPhlSkOF@kreacher> Content-Language: en-US From: Lukasz Luba In-Reply-To: <1883063.atdPhlSkOF@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/10/24 17:44, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Do some assorted cleanups in thermal_zone_trip_update(): > > * Compute the trend value upfront. > * Move old_target definition to the block where it is used. > * Adjust white space around diagnositc messages and locking. s/diagnositc/diagnostic/ > * Use suitable field formatting in a message to avoid an explicit > cast to int. > > Signed-off-by: Rafael J. Wysocki > --- > drivers/thermal/gov_step_wise.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > Index: linux-pm/drivers/thermal/gov_step_wise.c > =================================================================== > --- linux-pm.orig/drivers/thermal/gov_step_wise.c > +++ linux-pm/drivers/thermal/gov_step_wise.c > @@ -65,13 +65,10 @@ static void thermal_zone_trip_update(str > const struct thermal_trip *trip, > int trip_threshold) > { > + enum thermal_trend trend = get_tz_trend(tz, trip); > int trip_id = thermal_zone_trip_id(tz, trip); > - enum thermal_trend trend; > struct thermal_instance *instance; > bool throttle = false; > - int old_target; > - > - trend = get_tz_trend(tz, trip); > > if (tz->temperature >= trip_threshold) { > throttle = true; > @@ -82,13 +79,16 @@ static void thermal_zone_trip_update(str > trip_id, trip->type, trip_threshold, trend, throttle); > > list_for_each_entry(instance, &tz->thermal_instances, tz_node) { > + int old_target; > + > if (instance->trip != trip) > continue; > > old_target = instance->target; > instance->target = get_target_state(instance, trend, throttle); > - dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", > - old_target, (int)instance->target); > + > + dev_dbg(&instance->cdev->device, "old_target=%d, target=%ld\n", > + old_target, instance->target); > > if (instance->initialized && old_target == instance->target) > continue; > @@ -104,6 +104,7 @@ static void thermal_zone_trip_update(str > } > > instance->initialized = true; > + > mutex_lock(&instance->cdev->lock); > instance->cdev->updated = false; /* cdev needs update */ > mutex_unlock(&instance->cdev->lock); > > > LGTM w/ spelling fixed. Reviewed-by: Lukasz Luba