Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp423571rdg; Thu, 12 Oct 2023 09:22:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPIsm4iFzL5FQCyNd6+9rF66lnfl018CW+js9/7pmvJk37Y9bx9MFowPprDR74d3eh14Y0 X-Received: by 2002:a17:902:bb84:b0:1c4:5c05:c3d3 with SMTP id m4-20020a170902bb8400b001c45c05c3d3mr21514498pls.14.1697127735366; Thu, 12 Oct 2023 09:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697127734; cv=none; d=google.com; s=arc-20160816; b=yKeEvakUahhYLm8K/RLFRym0pn0fzJl/wyo8UgetNBaQrxBED8Nm4h4DnitmHV01PK 3zh6R+c6NTb/ZSSmxquU5e6CpEM5vY5PqY8RK94b7ecpXEBQLKER3+10OsNNTUUUaCMJ UafaFjEQyI3z11ZsW9aOnmxBk/AQkVm8EQQBwwGtBrpS4yd6FD4Th17QxCUXyp/VWWq7 W6skXqrLUxdaSBL+cklI8towfeIYurdfKuV6Bc+EEapDgsuc83j3IGqZJ4A6MV9FQGr3 jhSNKvgp835pvJDeH+7ZU2Vy80AJYEOL+ZiX75RcM2AWPjka1Ii/Xh0ovLKycrsbOWAZ paqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=B/aH9DudEQWnJnBesytoOuuJihInDHIOXNKvgJO5Q88=; fh=RjkRc/FhKx0ouKQ9JcARy/W3YEos4nBH55yWPTBs/m8=; b=W9nHF/akz23oty95LxmEsrdy3Ozm3wmmJZjfti86AakvFjZ45sw4KPkiFqAb4se09+ gKA2Pauo10zq6A+dpY2E8ow8lKqmD7iL2q0EM+B6pVh2OSx1yjhfB7ShVZAoxCESjPXt xrGzGLd9bi9N5TFG+NNub9YSwO5YUfDXpmVB8V2H1FfBgikqE4CgZThypHEqkK4SN/Lm fDzwwGvB1zGsrpiDrBsPhF+IRzFkxBJ/YpWnmSyJ/5JmqB15ITkk+PWfHI+i2tdHhGmF 9M1Z+SRfkOeA7uJ2eg9zNIvewHsbyPo8zaOiQSdhFYajYAhRBJaKOOs3XBI+BUT+jzZ+ qgWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b13-20020a170902d50d00b001c73d73f163si2675048plg.505.2023.10.12.09.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 09:22:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 356BF805ECDE; Thu, 12 Oct 2023 09:21:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347334AbjJLQVX convert rfc822-to-8bit (ORCPT + 99 others); Thu, 12 Oct 2023 12:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347319AbjJLQVV (ORCPT ); Thu, 12 Oct 2023 12:21:21 -0400 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3661D8; Thu, 12 Oct 2023 09:21:19 -0700 (PDT) Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-57ddba5ba84so124139eaf.0; Thu, 12 Oct 2023 09:21:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697127679; x=1697732479; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fghx/3ez5n58sg38991FNjnRDD8UbfxWtztsAcswAE8=; b=cZOwT7QKDoD5LPE6pZwbu9oHivlESZotA1GUIOH9rKijipk5a0fTEYrr62Nxmwc5hY ElEHqL6YzRXo++MWDYYHnUCLzJQ4YrfQ7viDAzRFQjCHKZW/xAMTs2HbAsfzafdahsch T9tfsW9LcXXaLThtgxlsv+mXJWVrv/vkNd7t6jLuw/fFL/0/LANC+d5bVzOQdkPEoUcz sDPN4OPcUCJFRvLk1/zwfj2ajrB+tHAi9fMiUIhIXfFc9tVilpHWhkbcW4W9exQK0AVu 2guPZFmkp1EADTZExurtdGtmbkdQCb1PaOev3AdIVshmAXtwcHDgV+jra9I9lYMaGEn5 fZPg== X-Gm-Message-State: AOJu0YxGpkMgr+9CwDiQP+TQEm0DeYXas0kzfO/y4WODoXPQLoXagVYr STU+8PJI1lE1uZA3QOwmb/cF/oDf16xBB9TzT+z3g51JVI0= X-Received: by 2002:a4a:b588:0:b0:578:c2af:45b5 with SMTP id t8-20020a4ab588000000b00578c2af45b5mr22923283ooo.0.1697127679100; Thu, 12 Oct 2023 09:21:19 -0700 (PDT) MIME-Version: 1.0 References: <13365827.uLZWGnKmhe@kreacher> <3256881.aeNJFYEL58@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 12 Oct 2023 18:21:08 +0200 Message-ID: Subject: Re: [PATCH v1 1/6] thermal: trip: Simplify computing trip indices To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui , Lukasz Luba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 12 Oct 2023 09:21:35 -0700 (PDT) On Thu, Oct 12, 2023 at 4:27 PM Daniel Lezcano wrote: > > On 06/10/2023 19:40, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > A trip index can be computed right away as a difference between the > > value of a trip pointer pointing to the given trip object and the > > start of the trips[] table in the thermal zone containing the trip, so > > change thermal_zone_trip_id() accordingly. > > > > No intentional functional impact (except for some speedup). > > > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/thermal/thermal_trip.c | 13 +++++-------- > > 1 file changed, 5 insertions(+), 8 deletions(-) > > > > Index: linux-pm/drivers/thermal/thermal_trip.c > > =================================================================== > > --- linux-pm.orig/drivers/thermal/thermal_trip.c > > +++ linux-pm/drivers/thermal/thermal_trip.c > > @@ -175,14 +175,11 @@ int thermal_zone_set_trip(struct thermal > > int thermal_zone_trip_id(struct thermal_zone_device *tz, > > const struct thermal_trip *trip) > > { > > - int i; > > - > > lockdep_assert_held(&tz->lock); > > > > - for (i = 0; i < tz->num_trips; i++) { > > - if (&tz->trips[i] == trip) > > - return i; > > - } > > - > > - return -ENODATA; > > + /* > > + * Assume the trip to be located within the bounds of the thermal > > + * zone's trips[] table. > > + */ > > + return trip - tz->trips; > > Shouldn't be divided by sizeof(*trip) ? No, it's in sizeof(*trip) units already.