Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp562351rdb; Thu, 30 Nov 2023 11:51:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkWocQwO7EmHGPKKTC4QdAi58PtJPPaARPbnOJyY8q9NaRxQGybiz0ZlNDHAjjKz2VfBja X-Received: by 2002:a05:6a21:a583:b0:187:636d:a61e with SMTP id gd3-20020a056a21a58300b00187636da61emr27857431pzc.42.1701373896484; Thu, 30 Nov 2023 11:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701373896; cv=none; d=google.com; s=arc-20160816; b=L3ZXEw8iWSS9dO6dvsy7IeY2enBxUuL8cAsdaL79xIfdu3GvXL8gCr31XkKW3lXLPg JAumGORPoUFCBdXr3ixEtq4zdvejZazx/w8A1UuaxEF3neAP6rh6iwkoGnjDCWbAAn4p drALzZLbhk7XPzbTAah/YnR3EBucnSQOAVG4WpMDcQTM5eqM8UkOltWegNsA/N5BJiit tBstMtLp3lVs1TGulkcEuFbBpcOb87/HUoLaY3o54iKHlxKIr3T/ZbawLayIDtPjO2uY p2zpIaqhm/ToAV6+0Ybp8uxEgbpyDd5o1okZEHpOwY+i/GtVYm3x+MmkK4FWj5rb42HK n0nA== 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=x/XSBSepHddSBjeUlTFJ+L7cAPql05qYJPF7fjAm4mg=; fh=hQqXPxg301G2vy5Z4webupsJLc0/EEbcY0z7ZSklO2g=; b=DO3DcwLbnKvoG5zmR5/wZUqAShRm2axyOYfYZf3kz1OrjMNfrzWoD2I6mT/bBiLttr tEL/2ehS8Z+EbEdCpmEP8V5iTzLU+6WsTXFruExaetYh9WkKaZxGhAlNPl0usm2c8jCf SczHB4MWgHUML8mgNR/087E/pYOBTGZbH0+WT4YPIDlNse9v1ffuZ1tNLD90DCy7m3S+ NKa7jgW5GvjVTdHZJjtwdCo2mxbl7MsbhDt3GMeDbZJEd4FYqagHaKys9p7itbvGy/rG AS5HJQnK8A+BR9DnRQkaRQmvZ5zmrQA+sj0h3YbyTDutJXAGFIQNcbGrYj5LsbwqSO63 F7GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id r7-20020a635d07000000b005ae05010bc4si1941773pgb.235.2023.11.30.11.51.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 11:51:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id ACA56802852D; Thu, 30 Nov 2023 11:51:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376554AbjK3TvT convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Nov 2023 14:51:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbjK3TvR (ORCPT ); Thu, 30 Nov 2023 14:51:17 -0500 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA5EE10D9; Thu, 30 Nov 2023 11:51:20 -0800 (PST) Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-5a0dc313058so136471a12.0; Thu, 30 Nov 2023 11:51:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701373880; x=1701978680; 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=mJU5RuE0x+xF9mko7R10DFPHzyAQ5KB1GOFj2cnT57k=; b=rwtPNW3zhV8z9RabPkiekD+P4kifiy4FHJUC4v+8gGp8bev10lRyFr/HOcDWeYund/ 8TJQMNPgC4UOL9fQpj4PFfv8rU6SMQ7ym3v6vHv1JGjtF2y8ACPuF7qC2Qn5TQnq11Zh 0qr0XqyfSz4+GjpALilSDEEGNNvHQ/JpDOj9Wpp/uyPTp3z41Cd1ZLvt+wRHnX54+3FO QKAJtlpBZDRVs1CAKqyvd8loDE0x/Sy9sPMYYMHb0iXRd86b2MOf2H+I/OECkfxUOeBq 2xz+XUPNeyhXgwN9NSDVK4LA+BCH4IuRPDWHzIuiQfavCuaOMhuYNP3FfEH5QlhrrJFe B1Yw== X-Gm-Message-State: AOJu0Yzk6TTRODk83id9uUwjMy6OswjLdKHtYZpn9bcQUlCPYHB6HSmM SpXL1kBiMS0zuGNTi6uQzr9I6VGB1raPFKZdcuI= X-Received: by 2002:a05:6a20:da91:b0:187:df59:5c43 with SMTP id iy17-20020a056a20da9100b00187df595c43mr29063050pzb.2.1701373880126; Thu, 30 Nov 2023 11:51:20 -0800 (PST) MIME-Version: 1.0 References: <5754079.DvuYhMxLoT@kreacher> <12355894.O9o76ZdvQC@kreacher> In-Reply-To: <12355894.O9o76ZdvQC@kreacher> From: "Rafael J. Wysocki" Date: Thu, 30 Nov 2023 20:51:08 +0100 Message-ID: Subject: Re: [PATCH v1.1 2/2] thermal: sysfs: Simplifications of trip point attribute callbacks To: "Rafael J. Wysocki" Cc: Daniel Lezcano , Lukasz Luba , Linux PM , LKML , Srinivas Pandruvada , Zhang Rui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 30 Nov 2023 11:51:33 -0800 (PST) Wrong subject, sorry for the noise. Will resend. On Thu, Nov 30, 2023 at 8:42 PM Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > The _show() callback functions of the trip point sysfs attributes, > temperature, hysteresis and type, need not use thermal zone locking, > because the layout of the data structures they access does not change > after the thermal zone registration. > > Namely, they all need to access a specific entry in the thermal > zone's trips[] table that is always present for non-tripless thermal > zones and its size cannot change after the thermal zone has been > registered. Thus it is always safe to access the trips[] table of a > registered thermal zone from each of the sysfs attributes in question. > > Moreover, the type of a trip point does not change after registering its > thermal zone, and while its temperature and hysteresis can change, for > example due to a firmware-induced thermal zone update, holding the zone > lock around reading them is pointless, because it does not prevent stale > values from being returned to user space. For example, a trip point > temperature can always change ater trip_point_temp_show() has read it > and before the function's return statement is executed, regardless of > whether or not zone locking is used. > > For this reason, drop the zone locking from trip_point_type_show(), > trip_point_temp_show(), and trip_point_hyst_show().