Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1844930rdb; Wed, 31 Jan 2024 10:45:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHwALoJJ8BJgd5fFYahl7kWL21Ygu19R8WGgaOgyR2c3+PrT0Y2ItvP4EQnZq0RJeQjneO X-Received: by 2002:a25:2681:0:b0:dc6:c2b2:c039 with SMTP id m123-20020a252681000000b00dc6c2b2c039mr2155458ybm.41.1706726701332; Wed, 31 Jan 2024 10:45:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706726701; cv=pass; d=google.com; s=arc-20160816; b=lnMF/h5ajsZI42wNpWd63awvQKe6kAab2+YSG+7nk26TjvJNViUowQMUW8D3ahkHbB aL2OaF3ktpu1JMo8zx5pzJCFuhAFofaC4oP5uOfzsVI16mOJeUZMOnRQhWxo3ltSEqQ8 pPhiEGJaZFp7/RceoJaK+9iHO6k2kg+T7NC3Pccy+DI1I7tRTmJITeC1hXJDuRr0nHKG VCwe2QMgZUAwNVDjnqdjemFbhRjXNe3tULNkpymTZrsNiUkZ2CCr7cAp5QBJ7O/wU7YE jvwILVABWEratH+Le2n7Ato02o8WpL/jWAJmV5nh3hHf7wjbfJdOsfOfXp96LWwkyMFx uMjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=a8QpYVzPNA3K89zgE/1Ikg6Z1GKDn7+upQiv+b65PfU=; fh=Zae3afk8NrTjaO8nJP5SGh8UNJ2RUFSSETxHn1V5L4c=; b=IWtgTrlDg54HNCch+mC04ecbb4jAYDOKDEjADnAMu9luCl5X7kUUm5cYJA23tTlAFg Z2oyZbcRMxx8wa6sne5S1d0OPWYS4xTKbkyMqc8dA9LsFyCJdxkLxmXl5Ljc38LSGepI ddB6YfMfFX5BxLHEx8aehjqpj+Ofj41lZa3t97rvIYdDylg+vUAM/dZXI8/Ta76VkEjN QkCZz0evLlz268hOQVO4aBnoE7t3dLVlXvupJPWS0GcSPZRd0RKqiFz3Y74escERJ8A/ +KbTEXKJ7586kbEmjWDUbo0WK9h5Ah0OwJ5sT7C59jjpMZYJIg3xbGCIMArTpdBa6Fx0 MAUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-46981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46981-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWzex9MLjgdhZahHoO60WNAEn+LPnHz4Be7tK0EqzmXoPvFPxiOkJIn68JSsJ0da7MKa6Zx7PSgxWHwqxCgjmkzGB6a/NjTdcGUtfh3DQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m1-20020ad44b61000000b0068c74c895b1si570264qvx.426.2024.01.31.10.45.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:45:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-46981-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46981-linux.lists.archive=gmail.com@vger.kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 18CBC1C20DF8 for ; Wed, 31 Jan 2024 18:45:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2233721350; Wed, 31 Jan 2024 18:44:53 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27515210E2; Wed, 31 Jan 2024 18:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706726692; cv=none; b=A+lZQ5sXBkxA6cHG+PBnwL8xp/qSUtg8JeQDXJRzz8lo4JKLZ664HbSNRVyccWp77vhIrF0IAjG1xZQImTkuoj+WgQh8oI5SkOiuiWhwW3lYq30RMSAghMJUGPeMirl7jBk1T0GyHaMpgQ4bMHs14bNbAVZkvL3RW+KDz44geY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706726692; c=relaxed/simple; bh=SJZuasp/X4n93SOO7Po6QJRn7g8k6HYJr2z+rfpIdK0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ejg9w8oMqztPv0E5ckJNJc0EAy3Ylox6WuO2SoRfyI6dXmPPBC4NoZdvl/J6UQer2724SaNYYJ3/F0GAkfu6VHE5RqnEweUeZbwkpInoxmtF1YvpbeKMQU5TlLrY3J3bfZ7mprRWVYYr5yLKU0AIRvY4Ej8cAvXeZFNaGhGsPS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 1bfd71f8478315fd; Wed, 31 Jan 2024 19:44:41 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 1AEA266982B; Wed, 31 Jan 2024 19:44:41 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM , Daniel Lezcano Cc: LKML , Lukasz Luba , Zhang Rui , Srinivas Pandruvada , Manaf Meethalavalappu Pallikunhi Subject: [PATCH v2] thermal: sysfs: Make trip hysteresis writable along with trip temperature Date: Wed, 31 Jan 2024 19:44:40 +0100 Message-ID: <2731410.mvXUDI8C0e@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtledguddufecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeegfffhudejlefhtdegffekteduhfethffhieettefhkeevgfdvgfefieekiefgheenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepjedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrges rghrmhdrtghomhdprhgtphhtthhopehruhhirdiihhgrnhhgsehinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 From: Rafael J. Wysocki Trip point temperature can be modified via sysfs if CONFIG_THERMAL_WRITABLE_TRIPS is enabled and the thermal zone creator requested that the given trip be writable in the writable trips mask passed to the registration function. However, trip point hysteresis is treated differently - it is only writable if the thermal zone has a .set_trip_hyst() operation defined and neither CONFIG_THERMAL_WRITABLE_TRIPS, nor the writable trips mask supplied by the zone creator has any bearing on this. That is inconsistent and confusing, and it generally does not meet user expectations. For this reason, modify create_trip_attrs() to handle trip point hysteresis in the same way as trip point temperature, so they both are writable at the same time regardless of what trip point operations are defined for the thermal zone. Link: https://lore.kernel.org/linux-pm/20240106191502.29126-1-quic_manafm@quicinc.com Signed-off-by: Rafael J. Wysocki --- v1 -> v2: Fix patch corruption (Daniel). --- drivers/thermal/thermal_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -474,7 +474,8 @@ static int create_trip_attrs(struct ther tz->trip_hyst_attrs[indx].name; tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; - if (tz->ops->set_trip_hyst) { + if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) && + mask & (1 << indx)) { tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_hyst_attrs[indx].attr.store = trip_point_hyst_store;