From patchwork Fri Feb 9 14:05:25 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: 198907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp885294dyd; Fri, 9 Feb 2024 06:21:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrc0A7rkgtYQ7hspcRx3b39e0W4wp9oj4eFwrIk0QAM19fIEvGfXQgRnPkFZb0W4j4wp7fkq1rPFIeM8PE64iaIvkcPA== X-Google-Smtp-Source: AGHT+IHxvcLuX7TPRm1LjpEJUHGin6IPN+jITTMDX7UGR3wIH+GcXGvyoASsD0NlKZrLUnEYZaTt X-Received: by 2002:a05:622a:3cd:b0:42c:4826:7f04 with SMTP id k13-20020a05622a03cd00b0042c48267f04mr1774411qtx.29.1707488510324; Fri, 09 Feb 2024 06:21:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488510; cv=pass; d=google.com; s=arc-20160816; b=EKACtVAd9cr9lY/22ebBDZFc6Gld0E25d9xYn9fj8FpnVCmvCdjhiUachatsT9T5kx rfClBUSyF92a8NDbKU29ZeFyLOGT64wpyZiAg6IPYnZHF99piLgAqLZpbfLEFSl2qDTF Se9tBHyjFD0gl1Yh7y4M0NbKPZMZGFv3XsfTZtYuSXPbz6pO+JM52eDpVfXWyqepTTd6 pxiPCzCBeyRulADCOHTc/3kIbf/iJdso0dOphjUKzZW91G9czdXnznAPmt0H5D/Lni8U PbHlUcPSUigVGNYBq6vWpb1tizWsZxnWNBhx0jvQ8cceQX5a/U8pszs6Gl6J0JIjDFG4 zvoQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=jFbbNh54CPpnu/J6dK8QOO8WgMJbCL8MsJmI0lZubHw=; fh=qar63TrNsSqB3/JoSeFJSWeW+6j3h/DMl874bKLIoe8=; b=bSYEGWkZ7gcdnNXpGeTRuvDyZVVC30qz/NCj4P3LhJ/Rp/Daojl1WqGKe3p5g3bOhR yZAjP0nqGujHR87srlD3VZu0BWnUtuOnweXBmSy1lzAMb4FSGL905q1EebyUZxuaNa7/ y+JphafWk13s+Kv3JhroVPxBY+sVHIIGonWJeym1HGXSzYTej8KzxfpgR/VSDPITGtWy TugoVKe2AMCQXUVPf86FXrHrqK30QbBIl7xeL5Z7/pyPtgNoAcUrjq0vQW9HJpz8b8tR kufz4CA1hjoaaPNZr0UMgW5aLsFcuOEOFPFgz5AMQhnVZmzUvW7pC/8wjgm7ZdtMadPF 66tg==; 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-59440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59440-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVzGZX61zWS5t3+72HlIiq5dIPZK+BXd2M74/A8clzbgdreMk9kiFjhlHUq2/vwxNjbTbBcln2qZq+kk0PKp1yHLlQjXw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g5-20020ac87f45000000b0042bea9f793esi1976652qtk.608.2024.02.09.06.21.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:21:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59440-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 061201C22683 for ; Fri, 9 Feb 2024 14:21:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6120280C0C; Fri, 9 Feb 2024 14:14:56 +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 5653B79941; Fri, 9 Feb 2024 14:14: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=1707488093; cv=none; b=tzlA8DMQEwHP6OK3JhcXlheBXT522+P8n8kmysO4m027DaUZ24u39qLLod1kLjF6hR7J4qstabZnYwhA4/m2vsE9dXNCtkUTbqht38q4FkmldqUqNeVpDMZv21ZYgLLlRd3DIYqYc7dmX9QgO+Z2XECd7Nj3lv5QVDCdc8wDV/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488093; c=relaxed/simple; bh=7P1hI9/Ao5J67cYY+F3SHkarvsguRNc1kwQUZSw4MpI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Aa8BDgQAVuhVnpG0D09r0kSWccrWTkyr/xqKKqdp7qxKZH4cHITFtAuN2wCCBYlAOd9GHRE1ZUxdvlwoQPFuU9MxnwlqQWTghv2r0kf6paNeN/F1Cs9B2c/Q3yY2n8L5KHUVw7j5CWWLKsouKQyobIOQOj2MN9qY9+U1XRjoBkQ= 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 4bb44e534049fc2e; Fri, 9 Feb 2024 15:14:48 +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 DDFB6669C4D; Fri, 9 Feb 2024 15:14:47 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Lukasz Luba , LKML , Daniel Lezcano , Stanislaw Gruszka , Srinivas Pandruvada , Zhang Rui , netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Miri Korenblit , linux-wireless@vger.kernel.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Manaf Meethalavalappu Pallikunhi Subject: [PATCH v1 1/9] thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPS Date: Fri, 09 Feb 2024 15:05:25 +0100 Message-ID: <1809389.VLH7GnMWUR@kreacher> In-Reply-To: <3232442.5fSG56mABF@kreacher> References: <3232442.5fSG56mABF@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431472176244035 X-GMAIL-MSGID: 1790431472176244035 From: Rafael J. Wysocki The only difference made by CONFIG_THERMAL_WRITABLE_TRIPS is whether or not the writable trips mask passed during thermal zone registration will take any effect, but whoever passes a non-zero writable trips mask to thermal_zone_device_register_with_trips() can be forgiven thinking that it will always work. Moreover, some thermal drivers expect user space to set trip temperature values, so they select CONFIG_THERMAL_WRITABLE_TRIPS, possibly overriding a manual choice to unset it and going against the design purportedly allowing system integrators to decide on the writability of trip points for the given kernel build. It is also set in one platform's defconfig. Forthermore, CONFIG_THERMAL_WRITABLE_TRIPS only affects trip temperature, because trip hysteresis is writable as long as the thermal zone provides a callback to update it, regardless of the CONFIG_THERMAL_WRITABLE_TRIPS value. The above means that the symbol in question is used inconsistently and its purpose is at least moot, so remove it and always take the writable trip mask passed to thermal_zone_device_register_with_trips() into account. Signed-off-by: Rafael J. Wysocki --- arch/arm/configs/imx_v6_v7_defconfig | 1 - drivers/thermal/Kconfig | 11 ----------- drivers/thermal/intel/Kconfig | 2 -- drivers/thermal/thermal_sysfs.c | 8 +++----- 4 files changed, 3 insertions(+), 19 deletions(-) Index: linux-pm/drivers/thermal/Kconfig =================================================================== --- linux-pm.orig/drivers/thermal/Kconfig +++ linux-pm/drivers/thermal/Kconfig @@ -83,17 +83,6 @@ config THERMAL_OF Say 'Y' here if you need to build thermal infrastructure based on device tree. -config THERMAL_WRITABLE_TRIPS - bool "Enable writable trip points" - help - This option allows the system integrator to choose whether - trip temperatures can be changed from userspace. The - writable trips need to be specified when setting up the - thermal zone but the choice here takes precedence. - - Say 'Y' here if you would like to allow userspace tools to - change trip temperatures. - choice prompt "Default Thermal governor" default THERMAL_DEFAULT_GOV_STEP_WISE Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -458,8 +458,7 @@ static int create_trip_attrs(struct ther tz->trip_temp_attrs[indx].name; tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; - if (IS_ENABLED(CONFIG_THERMAL_WRITABLE_TRIPS) && - mask & (1 << indx)) { + if (mask & (1 << indx)) { tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_temp_attrs[indx].attr.store = trip_point_temp_store; Index: linux-pm/drivers/thermal/intel/Kconfig =================================================================== --- linux-pm.orig/drivers/thermal/intel/Kconfig +++ linux-pm/drivers/thermal/intel/Kconfig @@ -23,7 +23,6 @@ config X86_PKG_TEMP_THERMAL tristate "X86 package temperature thermal driver" depends on X86_THERMAL_VECTOR select THERMAL_GOV_USER_SPACE - select THERMAL_WRITABLE_TRIPS select INTEL_TCC default m help @@ -47,7 +46,6 @@ config INTEL_SOC_DTS_THERMAL tristate "Intel SoCs DTS thermal driver" depends on X86 && PCI && ACPI select INTEL_SOC_DTS_IOSF_CORE - select THERMAL_WRITABLE_TRIPS help Enable this to register Intel SoCs (e.g. Bay Trail) platform digital temperature sensor (DTS). These SoCs have two additional DTSs in Index: linux-pm/arch/arm/configs/imx_v6_v7_defconfig =================================================================== --- linux-pm.orig/arch/arm/configs/imx_v6_v7_defconfig +++ linux-pm/arch/arm/configs/imx_v6_v7_defconfig @@ -228,7 +228,6 @@ CONFIG_SENSORS_IIO_HWMON=y CONFIG_SENSORS_PWM_FAN=y CONFIG_SENSORS_SY7636A=y CONFIG_THERMAL_STATISTICS=y -CONFIG_THERMAL_WRITABLE_TRIPS=y CONFIG_CPU_THERMAL=y CONFIG_IMX_THERMAL=y CONFIG_WATCHDOG=y