From patchwork Thu Sep 21 17:50:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 142968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5186323vqi; Thu, 21 Sep 2023 15:46:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHILOi/f7UvCBVUdIzCZMZMV0l9Ky+oJvlYdgZj2U4QEtMn9sRBILNhssxEq52ZKxByhABs X-Received: by 2002:a17:902:ea0f:b0:1bf:557c:5a2c with SMTP id s15-20020a170902ea0f00b001bf557c5a2cmr7464358plg.44.1695336368792; Thu, 21 Sep 2023 15:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695336368; cv=none; d=google.com; s=arc-20160816; b=AlT6RzRMSLoS8Ad1GGqncx4aI4deQRcZrGIijWIcrW1fBM32Gv8S4vH3SI7lLqJg0P e+mYnVFOwscSOU8ASHOvZi3IqkPrMJxnuj/+17h1XekKYDoPfWv9DbboR9BBN8N+fJzU Rw1EmGZQhe71E3/hTtQK0sMds+SsVjij+J2fOkdk/xKkP+nlzt4qDx4MzfLr5JVkG34h YjW77TJk/MgBzzfvAmjWIRRNTQQK3NepmNM0Gwl2KceBcDzfJG1B/Hn3DdtSkPijhHSO ZTIbLNOvEDgOT3tG4KmH7nf80y2J0niDoTgqjdm9MPWdPfabYXYsJR192E7h6yXWdYO4 wc5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=P6HOP+eKk467rzNGwCQzpmBpBX5+/nitfU4sBMqppnM=; fh=M3Xj0cy8L+JeZSSd0Q6EHM9/xVzlLsbYrLkDMv02gfM=; b=zWHPGvZb9zAdtYdFCJ2nSc3G3vr7L/IPOpexx9trimyARZJbmdawEyvuezTT1Bi14s MglB3qSl737M4+g8XHqCEiwUvTqrxxZ1Utgk4STyuSDln+PQ2pIXnfSiztJPqy5lstSV r8VZYmXWUw0y5HoyHzeS3gk4n3yTlDhfsI/sRDVkYpVTfc529bkJFOPECwSTRkhMsjVA TGTkbpXTmFWGsdSpYR2P4fWif90WdsVpmixx4kYbiQ0oW170g8Oaoub+N1DCl3ACtCQZ nhvi8MChP+rFxMWj8y441gDc6Y6nJvSq+cCqaWpq5fGZGxmI1GcwZ40PJhC60NcpZYH+ 459w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u16-20020a170903125000b001bda57935fasi2534098plh.64.2023.09.21.15.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:46:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 44A638086835; Thu, 21 Sep 2023 14:00:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbjIUVAQ (ORCPT + 29 others); Thu, 21 Sep 2023 17:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232439AbjIUU7o (ORCPT ); Thu, 21 Sep 2023 16:59:44 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A72AF957; Thu, 21 Sep 2023 11:07:32 -0700 (PDT) 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 5.2.0) id bfbd3e583f736223; Thu, 21 Sep 2023 20:07:30 +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 v370.home.net.pl (Postfix) with ESMTPSA id 2DCAD664EBE; Thu, 21 Sep 2023 20:07:30 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Linux ACPI , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano , Lukasz Luba , "Rafael J. Wysocki" Subject: [PATCH v1 03/13] ACPI: thermal: Collapse trip devices update function wrappers Date: Thu, 21 Sep 2023 19:50:08 +0200 Message-ID: <3198428.5fSG56mABF@kreacher> In-Reply-To: <1957441.PYKUYFuaPT@kreacher> References: <1957441.PYKUYFuaPT@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudekiedguddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeekpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=8 Fuz1=8 Fuz2=8 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:00:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777689028175857442 X-GMAIL-MSGID: 1777689028175857442 From: Rafael J. Wysocki In order to reduce code duplicationeve further, merge acpi_thermal_update_passive/active_devices() into one function called acpi_thermal_update_trip_devices() that will be used for updating both the passive and active trip points. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Daniel Lezcano --- drivers/acpi/thermal.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) Index: linux-pm/drivers/acpi/thermal.c =================================================================== --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -233,14 +233,16 @@ static bool update_trip_devices(struct a return true; } -static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz) +static void acpi_thermal_update_trip_devices(struct acpi_thermal *tz, int index) { - struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip; + struct acpi_thermal_trip *acpi_trip; + acpi_trip = index == ACPI_THERMAL_TRIP_PASSIVE ? + &tz->trips.passive.trip : &tz->trips.active[index].trip; if (!acpi_thermal_trip_valid(acpi_trip)) return; - if (update_trip_devices(tz, acpi_trip, ACPI_THERMAL_TRIP_PASSIVE, true)) { + if (update_trip_devices(tz, acpi_trip, index, true)) { return; } @@ -283,20 +285,6 @@ static void acpi_thermal_update_active_t ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state"); } -static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int index) -{ - struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip; - - if (!acpi_thermal_trip_valid(acpi_trip)) - return; - - if (update_trip_devices(tz, acpi_trip, index, true)) - return; - - acpi_trip->temperature = THERMAL_TEMP_INVALID; - ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state"); -} - static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data) { struct acpi_thermal_trip *acpi_trip = trip->priv; @@ -324,9 +312,9 @@ static void acpi_thermal_adjust_thermal_ for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) acpi_thermal_update_active_trip(tz, i); } else { - acpi_thermal_update_passive_devices(tz); + acpi_thermal_update_trip_devices(tz, ACPI_THERMAL_TRIP_PASSIVE); for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) - acpi_thermal_update_active_devices(tz, i); + acpi_thermal_update_trip_devices(tz, i); } for_each_thermal_trip(tz->thermal_zone, acpi_thermal_adjust_trip, tz);