Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp249956rdb; Thu, 22 Feb 2024 02:30:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXIIwTVuH4CznFFi90lSv5q5+g61SmlvygvgdDg4z0Dm15rtlihHK+gjgxxc9SQuVWcwHSUGzTqS9ZT/67z0Rbv2DOlgxnZgVDxglrq6g== X-Google-Smtp-Source: AGHT+IF8N/2eNGrgy2mBBgsvg8tzlNOQseHz3/2lFNYjRGwWC7BrkYdUWQ5znukN02ObvDTe4i9a X-Received: by 2002:a05:6808:1482:b0:3c1:7001:8ab8 with SMTP id e2-20020a056808148200b003c170018ab8mr4252144oiw.34.1708597810840; Thu, 22 Feb 2024 02:30:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708597810; cv=pass; d=google.com; s=arc-20160816; b=kkUtFMzQ3US+jrw7//R3u2nGVZ47TwJSQH2p3+wjFEqtKmKZRXL3L1iCyqBD+vPSIo goaZeas4DsX7RtnetOfx+dWxAjJBT+UCMXOh2HUXphZsIdUb8obzAopzqCreGAGDWzb4 2u/IBXq561NojCsiUmKoVPZ5Fbj6HqyJyJsmlUZBeHKm9pDCfObp6AD1vTVCSXXDLatU SDRj/+8JG7cQpdef+C0DVJXFk8wfhgV4QlP/ebqpugSzsZSkAmnwkmhw03YEvWvRFUEn Ex38zR03jCWrzKaupt0kqdrbgEHebHh9R8zKqgJTL24RylEz1Exgnf57PFRTu/cM3PHl bKtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=d925I0YAHDj2GZWLKYoS1jiCNk6oVmkUOHEhEtnAKiU=; fh=O7YQZzYSYnLyXkBgux3mD1v0R80UylxkPZmYxkC/iek=; b=LrXCG+bFu74LPhIG2Sh3EsfAMuWtUpLT2c7gq7YubH5pKZ8KLfpSO/AOAQhddv7N3F EjQPFZJwBPB1ZNbg553oT9rDOW0/wwQ1Od0vr6G8IPcfSDAMcIhrfEtG6QWpljPhaGYP IfrqAHrrBQZk9PVaYn1e6atyQ9WhvW0dlHdplEsTnCMQsecrPg+g9vZKE/sVfmpvPBGp riX66qQBoiEh/L10TfZ4ziEoVCeDrtc4QZT0xPosoIYcE4DFowXxx27xh8Bw6VL+Q7r7 A0z8OtwAv/sDav9uRaADSTZTVG44EUDqC9wdUXseKeA3S1HFa5btNHcnRXhm/xu23NWH wX7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w/Ki3FuM"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-76330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cc11-20020a056a02074b00b005e3cdc24c26si5960864pgb.467.2024.02.22.02.30.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="w/Ki3FuM"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-76330-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 06DF3B213F9 for ; Thu, 22 Feb 2024 10:28:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E3BD3FB27; Thu, 22 Feb 2024 10:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w/Ki3FuM" Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA9473F8E0 for ; Thu, 22 Feb 2024 10:27:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708597636; cv=none; b=gwcAmkgRb7pLkdAaONXbB1c3b514qTpdGTZpDMVVQ69g2uraeETxFuDgCOajkU4ilp2IjkidlVBbh9k2g6LsDkfzohn6kfEAz347JVplnHYwLTW9OugffQkNxabsu957YhZdVeSMd4MZOQgusOHz/GTMnf77jdazTq+hHaIVPAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708597636; c=relaxed/simple; bh=AuqW1p0Dy4zpNfbaCup5tl6BSsuquCZ6fqdQhLH0cyI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nU4J5tZqLrtmHp+Df+RhEkXqQbJ6QFBdUa9QkqcD3yaHgAY4x1ipYRz3zvJygH1TjI9UwjBW0grgkvSSOrmHtfWvtUdDWZiccPFkcTS6wXGUsz89TAfg6t3JVY9Crs6lK2NYRqSlREJP2WnTqY01ssWDSmE6ep+aOQYJVrktAS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=w/Ki3FuM; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-33d6bd39470so781469f8f.3 for ; Thu, 22 Feb 2024 02:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708597631; x=1709202431; 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=d925I0YAHDj2GZWLKYoS1jiCNk6oVmkUOHEhEtnAKiU=; b=w/Ki3FuMg/jZmgp7/r0B/daomaPDoXojmfhJ6B6Htgi1CHYvf9PrpvzrcvOuvOZxOo Af0CGmptWLfPm/JeUmqM29sQ+NJJi2RDZYlZ/+GjoMzF7U6OqR/SVt5ND/+ZHn80NWv0 RHkeh5y/GdVUgzho0t+HfGCspN2+XrN+LUvZ7QPCI5TUsVECRu4BD6o92BD2DosUvnS9 9kbt/XEyB2SMJSNxPOyqCGNSgMzo8V47w6x5ZvognLIVyz7v3jj/3yiUOy6pOuSlrDCu XW2Xv5jWHGG2nE8SenJY5fhs6APDd7rha1yJ50dFN4aQZ33UBmDK0vexQ1dpwFQ3jPDL 2GHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708597631; x=1709202431; 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=d925I0YAHDj2GZWLKYoS1jiCNk6oVmkUOHEhEtnAKiU=; b=r6LZ92E1Iw5oWyLlzn071oEB15JYSXQikFxEmN7adEodd1SfIpuZg5d2EE9xJX5SgP SH/CNUtxEo1/O/YmSnWKKN6k6AwLVFOfeB5wSi2Mxd5o8ye1tnVcJHiLj//SFtNYlzyy cE8jgzh7GANljuWOuP9hrk2PQjQqvFUWJWaqrdorz8znM25kjY6zJ2eDiBGYskVUiqwG 8kliMyXLTwWpHcn2gx/O8SroHNX1S+8lWcbd5RXb9DJWNnkOKyG1YbXHWLCN8UL9VBQn UGwVt7TDEr+By8yXMavFrEbMj8ZdA3G9+bI+kfjwsAHIfAUrrs6/Vgxhpjpfj2ObNQx8 9w8Q== X-Gm-Message-State: AOJu0YzFyJ5Wg08QSpBCD38jA7SZHqBy56MCDCItiDeFFx8qRbtByrKJ Z+E8pPhiPJcXhQ0CJLinwhyz2IfQh6dFhP1teZRTnjGw+L6oaYyBOlT0ujaugHY= X-Received: by 2002:a5d:5487:0:b0:33d:3ee3:cc0a with SMTP id h7-20020a5d5487000000b0033d3ee3cc0amr7845937wrv.0.1708597631025; Thu, 22 Feb 2024 02:27:11 -0800 (PST) Received: from [192.168.10.46] (146725694.box.freepro.com. [130.180.211.218]) by smtp.googlemail.com with ESMTPSA id bx9-20020a5d5b09000000b0033d202abf01sm5124036wrb.28.2024.02.22.02.27.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Feb 2024 02:27:10 -0800 (PST) Message-ID: <79b872a5-4a46-47f8-9b13-010bccb5a80b@linaro.org> Date: Thu, 22 Feb 2024 11:27:09 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/6] thermal: core: Store zone trips table in struct thermal_zone_device Content-Language: en-US To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Linux ACPI , Lukasz Luba , Zhang Rui , Srinivas Pandruvada , Stanislaw Gruszka , AngeloGioacchino Del Regno , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team References: <4551531.LvFx2qVVIh@kreacher> <1883976.tdWV9SEqCh@kreacher> From: Daniel Lezcano In-Reply-To: <1883976.tdWV9SEqCh@kreacher> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 14/02/2024 13:28, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > The current code expects thermal zone creators to pass a pointer to a > writable trips table to thermal_zone_device_register_with_trips() and > that trips table is then used by the thermal core going forward. > > Consequently, the callers of thermal_zone_device_register_with_trips() > are required to hold on to the trips table passed to it until the given > thermal zone is unregistered, at which point the trips table can be > freed, but at the same time they are not expected to access that table > directly. This is both error prone and confusing. > > To address it, turn the trips table pointer in struct thermal_zone_device > into a flex array (counted by its num_trips field), allocate it during > thermal zone device allocation and copy the contents of the trips table > supplied by the zone creator (which can be const now) into it, which > will allow the callers of thermal_zone_device_register_with_trips() to > drop their trip tables right after the zone registration. > > This requires the imx thermal driver to be adjusted to store the new > temperature in its internal trips table in imx_set_trip_temp(), because > it will be separate from the core's trips table now and it has to be > explicitly kept in sync with the latter. > > Signed-off-by: Rafael J. Wysocki > Reviewed-by: Stanislaw Gruszka Reviewed-by: Daniel Lezcano -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog