From patchwork Thu Aug 10 19:14:49 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: 134210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp654380vqi; Thu, 10 Aug 2023 13:02:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxN/oLpbodHUoH1z2S45bmg5rnKx3T1VZKV+BANqyFlO6mqaG3akE3wkI1NS6091KN5umD X-Received: by 2002:a05:6402:799:b0:51d:95f2:ee76 with SMTP id d25-20020a056402079900b0051d95f2ee76mr11999edy.27.1691697765621; Thu, 10 Aug 2023 13:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691697765; cv=none; d=google.com; s=arc-20160816; b=hvdOrZuBs3moMZUnf/DlMIJqsln+UnPmjJfuL+m5EsOByqHu95fNduq27ujFWbZVGL 58iCVG5ZNmVn7Z6irqUxlVKjqktArmGmEkmZuMP2uVNjk905P4uSGfdspXd347GoH9Ln YdoKHjSIe/KfCgl3TqEmFFF7WIvXdRLNnTZFDo5+lOr+n6+S3ip9HgQ3m0goLKpWfNGc wUUdh7RdPO1GTjMxsSnIq712I/faDmuhlM41dw6gjAhMl2iqhn3Fmu13j0b8yKd5MCNF x0T5zUdSi/ZplHkXA3Gqpjz+7kBtaOzei2fsKBvZUk03OCn4wP2xa+bCI9TayRXZQn9u l1tQ== 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=ZhzALKAeB+WpQCdXbMENj9FqdnE4p8jmSZS4rEeDous=; fh=aK1D4KsZYozI75a+KCLuU03FxwQ8tTCKnM2T8GQ5ByU=; b=guDW3F1vVCOwl1UqvAfAJoIHcDq8ZuHmG1KglhQrg21p1Mdos0WDayYFWrRDTQUHe9 FPiKMKLbttauN77qLG7b83CemzSc2fLvk5oFiGT2jQHP3pevx+094ZhlZ4cZ3l67mQ9b 0HVEFL/dVj1YQ7JOgE35NGGBKKtwwuEi+x9RzX2mCc5qnOU8cNVYGFRymP8qL/w9MsXj GqaqIGVvdsPykdahyeutrmHeJ706TK4tksC8xJBrHFE0Bkjv6gh+tSRSAv7MmxBJnzBk Wc14y0jVUA8GqliLNMqn8RZF7SNrBC7CoUqIel+x4WTfPXwiv/ozDQGTpItOn5w5gby/ J2BA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a056402185400b005231db4d83csi2053720edy.245.2023.08.10.13.02.21; Thu, 10 Aug 2023 13:02:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236334AbjHJTRv (ORCPT + 99 others); Thu, 10 Aug 2023 15:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236309AbjHJTRs (ORCPT ); Thu, 10 Aug 2023 15:17:48 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843442702; Thu, 10 Aug 2023 12:17:47 -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 c27bbe5e6baaffc0; Thu, 10 Aug 2023 21:17:46 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=) 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 8591E662742; Thu, 10 Aug 2023 21:17:45 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada , Zhang Rui , Daniel Lezcano Subject: [PATCH v1 5/7] thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points Date: Thu, 10 Aug 2023 21:14:49 +0200 Message-ID: <3258210.aeNJFYEL58@kreacher> In-Reply-To: <5713357.DvuYhMxLoT@kreacher> References: <5713357.DvuYhMxLoT@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: gggruggvucftvghtrhhoucdtuddrgedviedrleeigddufeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohephedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdp rhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773873676510117424 X-GMAIL-MSGID: 1773873676510117424 From: Rafael J. Wysocki Because trip points are reset for each sensor in two places in the same way, add a helper function for that to reduce code duplication a bit. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/intel_soc_dts_iosf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) Index: linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_soc_dts_iosf.c +++ linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -369,6 +369,12 @@ void intel_soc_dts_iosf_interrupt_handle } EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_interrupt_handler); +static void dts_trips_reset(struct intel_soc_dts_sensors *sensors, int dts_index) +{ + configure_trip(&sensors->soc_dts[dts_index], 0, 0, 0); + configure_trip(&sensors->soc_dts[dts_index], 1, 0, 0); +} + struct intel_soc_dts_sensors *intel_soc_dts_iosf_init( enum intel_soc_dts_interrupt_type intr_type, int read_only_trip_count) { @@ -424,10 +430,8 @@ err_remove_zone: remove_dts_thermal_zone(&sensors->soc_dts[i]); err_reset_trips: - for (i = 0; i < SOC_MAX_DTS_SENSORS; i++) { - configure_trip(&sensors->soc_dts[i], 0, 0, 0); - configure_trip(&sensors->soc_dts[i], 1, 0, 0); - } + for (i = 0; i < SOC_MAX_DTS_SENSORS; i++) + dts_trips_reset(sensors, i); kfree(sensors); return ERR_PTR(ret); @@ -440,8 +444,7 @@ void intel_soc_dts_iosf_exit(struct inte for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { remove_dts_thermal_zone(&sensors->soc_dts[i]); - configure_trip(&sensors->soc_dts[i], 0, 0, 0); - configure_trip(&sensors->soc_dts[i], 1, 0, 0); + dts_trips_reset(sensors, i); } kfree(sensors); }