Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp871351imw; Fri, 15 Jul 2022 14:37:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1snYG7jh9uJ1DNtUY2vxUta21H5hco8ikiFj4XOJfRr/kfSSiyn5UNhm4P22IaIEXg+Jv73 X-Received: by 2002:a17:906:6d98:b0:715:76eb:9e33 with SMTP id h24-20020a1709066d9800b0071576eb9e33mr15826363ejt.729.1657921073788; Fri, 15 Jul 2022 14:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657921073; cv=none; d=google.com; s=arc-20160816; b=YZzPKB92UvPPoFXy1/NHv/8iY/3S/bHuF6kWA83yHI7aWNo7CpxZt+l/99OH0caSy0 GmSVvWT3haDwAi1a5toFyFw7JiJdo0wL1e4U05338ufVMYVzlTSRtyegxrLCzT/Bl8ql pXMW+LlFtm45FE9BsmUmz5s1vG6W5wTp/dwTu8UC8tI1IXsfk1X7lLcXQT+UR5jLIhqv VRWsef/fYDysGjUeDnUyHSbLFGiZtTrLKV8WqLlkkyVz/tuGQjV5elU5hdqs8X28jP9O 8rw0YGJEnzngcV9yj90V2msv8ThQEde4wNx6GoMtdu4den6tImXRE/y1EojX/GzqDrvl xeeg== 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 :dkim-signature; bh=KuR49etHrCUC4nyK2G7BLQAMCLtkwxAEZTehEbHHsZ8=; b=Bw/gJ0GMOnSgj0cBF/ygon6ICBxJhxKZmzVa26RDHCx4FHO7aXMO9iISD2/rZMxGRR J2998UkmM3w3CQx992QYCEOhRgDwaiI2xctvRDO7BHFqXsaGuHiNfPcXBX6KEReJpQ3e PZpyL3HT7+6u+syV/iJ+8v7C0e2M+KRs8xz8PtgAmUaKhrPjSpG7TuLRPWrwyo4QszNP 7ONDZepWp2+3IjjwR+lswYHzxQ5dJOmweYJ08IRm/MB8sG5KHIr3g0cLKonBYjXQwv0E MplKeOzoJ7KBty8LRKR6C5/jenJpXM5M7vdZuF7IWePiD3qCLXfh1YBkmv5QQIaNKx5f NPrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vrTYMEyO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb42-20020a170907162a00b00726abda6121si8448457ejc.533.2022.07.15.14.37.26; Fri, 15 Jul 2022 14:37:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b=vrTYMEyO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbiGOVJZ (ORCPT + 99 others); Fri, 15 Jul 2022 17:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbiGOVJY (ORCPT ); Fri, 15 Jul 2022 17:09:24 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC6110554 for ; Fri, 15 Jul 2022 14:09:18 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id r2so7331562wrs.3 for ; Fri, 15 Jul 2022 14:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KuR49etHrCUC4nyK2G7BLQAMCLtkwxAEZTehEbHHsZ8=; b=vrTYMEyO0VU2Ius0MQsOmHiv+LMWF2wbXfb4qzWDHIDvVx/y3DSrb1ngD2MbWv8khD 3ZDDnGtdvMKq3bkdW2EWM7QXuGg5o3Q64e2ejCzlNJDDsiSFiD2qBTnHBocnecHPbpzJ KzHdRroE00f4WBJ0KjQQMs0RhoAlYt6vaXts3b+SLVbu9EWFmoS/7LtkE8M+rjgGqwMJ 6V12K8wba4wASUUF/ecMtxwilXHmm2SSin+y4A3h7n54sX7oJDIS5lal14Q9ixnBfVXf fgCCVgFwDA8fDurCl1rGMl3XStfkmRT/VltNbTp7/rdgTVkkXFG5zAbnTvdqAewygSNS xQKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KuR49etHrCUC4nyK2G7BLQAMCLtkwxAEZTehEbHHsZ8=; b=Mt8YaxAURduB+u3zXCWYxyvmT6OCrJaXL2iY3fRNSwUMYOh9JN1bEQpHCqA5pWUObs iAnpzZbuVrDUSir2Ydskw/hEVX+kYD1YLj4J4u7KX1Dj3wrrhx3VQ6Nv6hdapKFW1VGS OSbX2TdjEBWuqAxRBnVCsgm36nyTo7OPB+t8iS3pqje+EHPC91g/WcOh0acbB0cUrO/X dT2VpTvJiFlWHFho5mjxpHLj1YWM6+EsJZ3WXXHgUesJVy4O5MtfA6BSn5FT9tQFfXPD lNY2thZNi4xxzhi6Eo2mJ9AGR6C30NS9gdyYYO1cpS2qTvXuPlrPnPeZv4DMUsrpYXOC 2NKg== X-Gm-Message-State: AJIora+qjcGC60kSBbY+FHxjaiM0cjKsY5pkiT7KsUI8oa4e9V+z3fIx cODDyX/1d+ge9D4UMjwTRphwFw== X-Received: by 2002:a5d:47a1:0:b0:21d:a4c6:352b with SMTP id 1-20020a5d47a1000000b0021da4c6352bmr13789167wrb.365.1657919357055; Fri, 15 Jul 2022 14:09:17 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:a223:f4b3:40c9:43fa]) by smtp.gmail.com with ESMTPSA id b14-20020a5d40ce000000b0021a56cda047sm4567752wrq.60.2022.07.15.14.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jul 2022 14:09:16 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: quic_manafm@quicinc.com, rui.zhang@intel.com, amitk@kernel.org, lukasz.luba@arm.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/4] thermal/core: Avoid calling ->get_trip_temp() unnecessarily Date: Fri, 15 Jul 2022 23:09:09 +0200 Message-Id: <20220715210911.714479-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220715210911.714479-1-daniel.lezcano@linaro.org> References: <20220715210911.714479-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 As the trip temperature is already available when calling the function handle_critical_trips(), pass it as a parameter instead of having this function calling the ops again to retrieve the same data. Reviewed-by: Lukasz Luba Signed-off-by: Daniel Lezcano --- v3: - Massaged the patch title and the description --- drivers/thermal/thermal_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d9f771b15ed8..f66036b3daae 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -340,12 +340,8 @@ void thermal_zone_device_critical(struct thermal_zone_device *tz) EXPORT_SYMBOL(thermal_zone_device_critical); static void handle_critical_trips(struct thermal_zone_device *tz, - int trip, enum thermal_trip_type trip_type) + int trip, int trip_temp, enum thermal_trip_type trip_type) { - int trip_temp; - - tz->ops->get_trip_temp(tz, trip, &trip_temp); - /* If we have not crossed the trip_temp, we do not care. */ if (trip_temp <= 0 || tz->temperature < trip_temp) return; @@ -394,7 +390,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) handle_thermal_trip_crossed(tz, trip, trip_temp, hyst, type); if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) - handle_critical_trips(tz, trip, type); + handle_critical_trips(tz, trip, trip_temp, type); else handle_non_critical_trips(tz, trip); /* -- 2.25.1