Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp349444rdg; Thu, 12 Oct 2023 07:28:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOu0UwDMHiGUbH+xjekhFYVj5Mzs4lkbH0SHOj2oCoqfIu/hlSoqJuhnNz/2Uap2knJjsC X-Received: by 2002:a17:902:e5c7:b0:1c6:ec8:4c67 with SMTP id u7-20020a170902e5c700b001c60ec84c67mr25158728plf.18.1697120887571; Thu, 12 Oct 2023 07:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697120887; cv=none; d=google.com; s=arc-20160816; b=u9OmF+7d7nRK0Wfo2Gn6FKKaJwtTvXScrmUniykdDDU/GbopZww/pVmwtMQltf6Emt 3dqQ+GVdtSvTsotSgXIJRauYnjZBkfpjhnIEuw8l8Wngios7LimMp6G907RrDWBxwE9y 5YVIBKLY2WAopysNGJnag9hkJFBRWMzslk+fKcHTlsX32DaQq1+JCAjK1oEp1g3Lhg3P 7aXwKd8DHy5l24vM81q4AqFKpGxELi7k6dmcZZhH3CvqRgSKCtoTYRUhZ7oPWCauYmdn 1tTMv+f8RyZHRj8WIoN1VBcNqo7AxJaDlczbojh3bstDtzokYAtcjGDNAL5Smc/Y2K/S jZig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Z35x2KMCJCXsBIbmy9n6f3au11P/WJPEJir5cY6NYBA=; fh=lwSoWzxFgElz870zfiYjK9IUzI6DgmKcUjvGVkpbGwE=; b=O/AyGuOSj5pU9HICxOxx/Z6HrLWmWZ7e0VF4x6fXkaiAluDxZhDdTjJffqvnTO/9JP +4AMswm/llrs6rv+OALrCoaW7fVsVMQhm48TvNpYbO8uDHlohOzGPZMTGZWoWsGgLFqD gs0tEAbxeKzc2hWv6/J3J5jHQwaRUr8gKHuSQ65u8kGaJAMOV9a7+3ZmrNd+3VXbSB3H PVIV4LakoKMvke05z0o5/z7161a4N66w5Tb+so6kzBx8ZwJOs51k+9gzy8s75R1Nkt6E cn6YqJTAHlWDRPoeDIy0ayhvqx21wauxkzRKf6AeDaxtURUsgn939dY4l/nYbK5d8CSB 4A2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cpEcuOqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id l11-20020a170902f68b00b001c36705bce1si2511478plg.474.2023.10.12.07.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:28:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cpEcuOqt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 361FF8260091; Thu, 12 Oct 2023 07:28:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233710AbjJLO1w (ORCPT + 99 others); Thu, 12 Oct 2023 10:27:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235736AbjJLO1v (ORCPT ); Thu, 12 Oct 2023 10:27:51 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB4691 for ; Thu, 12 Oct 2023 07:27:49 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-32d834ec222so1010169f8f.0 for ; Thu, 12 Oct 2023 07:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697120868; x=1697725668; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Z35x2KMCJCXsBIbmy9n6f3au11P/WJPEJir5cY6NYBA=; b=cpEcuOqtZeBLV93szk1EtBzLksMPNyNvY1ONY2CJISb+/iYT++Uu3Vp2JwzXpqLTxq BiuvAoogMVaofvPfvgdelErAt0LX2LSxKAarHJcUeOVkARPOrSBjSozPON3YqvNw1VyH NyS39Kq8Usu+ub3nriwTX6LnK4+B8ZhJA6GDRRkxibPUpqG6qycYrg/4R6liC8fae/QW 4mC8JDEewYMZmG2hKX8XeaDEyfKNdOWnZ7wYWoeaVPk8MfHUEBywh1V1HHbSBrDaX1wZ 4do8+S9ioLEMs2e+3Ls0s5EHs9qn6XH96LgS1BFGbSYyAQGWVgMDN6CnpBTx3qIQKey+ IoRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697120868; x=1697725668; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z35x2KMCJCXsBIbmy9n6f3au11P/WJPEJir5cY6NYBA=; b=gyLhaur9BtmBZcIlhYfi3l32pMTtcKhLhSeREQlbA6IO+X2LBjO7y0QrZpe2jRvx2p 8HT7qjDgD+VXtwwZYfXZEsqhDTodwPfbzN8/W42NrV27aLmHx9PmxgzG7pzWwd6YlYFF DiFlK5FyyUuW7LxuI8PmeG4sy065iC2CpKZuwbII2s+I+MmOvfTuYc5V/lhr2BbMPoLE mgX2/hd3PUhRszV/6OLelLd8drKzDxbWC0X/PkkaWTblZM6TdYQBLwdIjc9qXw1VtQQu fgWhPnXw3rnyfvGXXnhujqflWUlzuPD/jBzy7QQmQCfhl0uIjz/LS+TxZH/XFRJnXfh5 Y3dg== X-Gm-Message-State: AOJu0Yzzhhk0GF3KRIIg424aE2iKouGwT/yW90MQSz3C4P+wam/7uGWA dZuRWt4zguORRnkcsJEtalCgCw== X-Received: by 2002:a5d:654e:0:b0:31d:db92:31ae with SMTP id z14-20020a5d654e000000b0031ddb9231aemr22318455wrv.44.1697120867810; Thu, 12 Oct 2023 07:27:47 -0700 (PDT) Received: from ?IPV6:2a05:6e02:1041:c10:c49e:e1a5:3210:b8c0? ([2a05:6e02:1041:c10:c49e:e1a5:3210:b8c0]) by smtp.googlemail.com with ESMTPSA id j13-20020adfe50d000000b003196b1bb528sm18458016wrm.64.2023.10.12.07.27.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Oct 2023 07:27:47 -0700 (PDT) Message-ID: Date: Thu, 12 Oct 2023 16:27:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/6] thermal: trip: Simplify computing trip indices Content-Language: en-US To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Srinivas Pandruvada , Zhang Rui , Lukasz Luba References: <13365827.uLZWGnKmhe@kreacher> <3256881.aeNJFYEL58@kreacher> From: Daniel Lezcano In-Reply-To: <3256881.aeNJFYEL58@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 07:28:05 -0700 (PDT) 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) ? > } > > > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog