From patchwork Wed Jan 31 18:44:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 194898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2089051dyb; Wed, 31 Jan 2024 10:45:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoqnPCAJKsX0TYBsA09WF5753gbvK9BsTR0qsqNkfcRXnyo9R0OuH0gAZPt1SA8EGwa/eC X-Received: by 2002:a17:906:3545:b0:a35:53e8:c5d4 with SMTP id s5-20020a170906354500b00a3553e8c5d4mr1770786eja.73.1706726710374; Wed, 31 Jan 2024 10:45:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706726710; cv=pass; d=google.com; s=arc-20160816; b=X85fvepG+yAoHEKfaAn2EfdwOmwU5PMbx9cElArM0TX542pNpCDoyerccaKZwZ5Hrf qMcloBe0zOJDCyVJN9h9vrvzILtkN8V++R3bbl0P/E7z0XPhTiGC9lS9+q7oKfaiCztU gjgU9yCYWEfoqfUCMkCxvmi/LbQi/yfvbKYtFYg1tZlwIThxW5JnOau8hYmGIslzQUKA 33si7NUIPAPMpnM1tJkLra8cX+8XtHZCs9pPSqKdbK7f1zLJ4ZNMMSphuzR7BYjIXigy NOAxxsdEzNmbkG9NyyCcHjxdnibOYhcVuuwiEYFzlh//iVWOfPtGmmKTm1zYRebNF584 p7Kw== 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=IOudyL6/0H8TUUcyPlX6q10/BgpDOzjUwjbLVV+QYNk=; b=zKkVYSZNuA3Q0KcYVMzt5489mUMJzQ88OSILcbiutFRzJg1zaljRNUh4eyK/omEmXU s3luQSKYzBVxlriWijjlIm89S/w67VIXKc3n4k1cyi7IYhT240h23xlng1S0AH7gO5ij q6L4AcrGqqF1cXcqyF9sXo3jq7CeGS5Cbd92hq3qIOcKSGxFGkeMOOsAtCXPBgLjI/hy jZ8hPkZHqmdfSLswByVo1tcWtuJnkozFEC0i7AZdwa8FUf5vcOUsFDrk3Wr/FFlbj6ua aVFmpmPjH04hILgRyj+cQOV4i3zEzoyaGpk66m34DReb05JjOG1Y0/4DrMZNOIrIpXPl 3I5w==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46981-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXhru+YKy5d3gH6uTDyABouv8dPPQUfZjX4SNq+GAwxXtEtFEGgxbhtoDZOUIiGWRoUyGylIZHVdqqI94eAsfrIqIbklw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c21-20020a170906341500b00a35b8079ca4si3433237ejb.851.2024.01.31.10.45.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:45:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46981-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-46981-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46981-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC37A1F277C0 for ; Wed, 31 Jan 2024 18:45:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2586833CF5; Wed, 31 Jan 2024 18:44:54 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789632667135723289 X-GMAIL-MSGID: 1789632667135723289 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 Acked-by: Daniel Lezcano --- 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;