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 From patchwork Fri Feb 9 14:06:16 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: 198906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp885229dyd; Fri, 9 Feb 2024 06:21:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGB4shX+6GQQ99+4wL6lptrtaU7Jzz5b+9z34ai2CC/UUz6cinQ3kjvMuzR9aXpEaMXNUMErBFfGSY9Cc3OVeVIzrBtw== X-Google-Smtp-Source: AGHT+IGVTBT+Av0L2e30RczB+C4q6OR2aZBofw095/1I8XlLpFvYTKTOH0pkAd5GljQRDFLgtGoE X-Received: by 2002:a17:906:1c12:b0:a38:98ee:698c with SMTP id k18-20020a1709061c1200b00a3898ee698cmr1402807ejg.63.1707488502802; Fri, 09 Feb 2024 06:21:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488502; cv=pass; d=google.com; s=arc-20160816; b=eusCELJCgjBEdOX/Jv8aazko+b4Fs58f90cpKbX+FzET7uKnRy5Qgza9MzIAkhlwJJ sNM9XPzWkxzALneRweZFE9nIQ19kQZpZw8kquIgKZ6Aj59/Qy02IZ4iAnmjWbjacNZAy MUc6XwaptQuS/6Bprl3qzXb1Iki/Nsna2IO/8aLbbbfO83JridECnUfRnlYN1QYinfVe 3ZzBxomUzOu/sqp6Rcc/uh0oIuQIYchZJ9hn86Eo/sn50GulcWLGeN+A1dzOhWHApuZJ QfiFgQORwV6UakphSM5ILL2u5ogwVszAYJR26ajfBtBBi7skg8IpJJt3O200HmmAVOHn fLUw== 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=ztfp5tqTcLe/yikbyo98hSJA4XQpMBA3EvuXBQbIpL4=; fh=GlczbyBQiC0A1tWBe/zm4zOWE36Ok4RQqgQ74kPrxeg=; b=lTGbkmLsXJmBXoVBpWH8MibVqq9esD8AXHhviN2dr9ZkuEmGqEYfJy1e7zmIhdVdXF hcpgXW+WonrF2VmcklY2seBtQEIT9rb7Pa3HkWh/l7i3DA/EsJearU1cb5N5LErsaVpj 6GvnR93uT4ESY/SgKBUb7lBYXqrHVF/IXYyMNPaV5Rz2yedLv382CTW2muXox/vZo2t+ 2F2v/B0RLKU+CsGlhi5GDinRSE8g/XG7ES0zwRcPkOauWx0qPa7yGRIrid/9OEzhngQY 6yUi2Fu5ve/oGgv5bS/qlBSnpW5pU03lMKHBOQBSSDm+huFU2/li/CAjEpOc73qcaadz rlLA==; 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-59439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59439-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXMM8QeTUgaKZdMBib4lZfcl8bJB20qJVNW2f0csuwgFXOLKjHVZu58c55JKB0Y7VB9ObK2l1uutYwKgBwB9Xcz4Y/Ezg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id nc18-20020a1709071c1200b00a388d071e2csi931039ejc.623.2024.02.09.06.21.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59439-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-59439-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59439-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 3E1B21F21BE9 for ; Fri, 9 Feb 2024 14:21:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5DD380C08; Fri, 9 Feb 2024 14:14:55 +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 74FE47867D; 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=1707488092; cv=none; b=GFAxptUVTRP+ML8qep92bi+6VcIsmWfPy5e+ewAeQmv2fI2jiSe/ao1LCFR7cHIcoYo4TC8nnEnyq6Ev/JNp9VU+yLpiRMNjRadg55YWClOLNlMhymY9RCKTk+wP5wB9HIi90EyITzABgP7I4YCQDbNjBTnLZTOjldicwb07HUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488092; c=relaxed/simple; bh=iyvlwc3EOmpZ2lJqDjD3YbtFrwjtOtM4CH3EkmXDNX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WzssANl7/BtvX+m2dFsYv/bkHStK9hoJ+Ad4tkxojeMS9CAxGAbDVyHuajy8VjDJZD1QWjEWrfoLuEq6yDh+bzrzhYBZN68i0Z0tt+US01gxs4kq9UOl9Zf8OLZQxpfdU7T4bg2fn2H/bGSzO+/o9QWFx6xby3AKKgi/4pwupGo= 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 a66302ca18b67ebd; Fri, 9 Feb 2024 15:14:47 +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 F0013669C4D; Fri, 9 Feb 2024 15:14:46 +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 2/9] thermal: core: Add flags to struct thermal_trip Date: Fri, 09 Feb 2024 15:06:16 +0100 Message-ID: <2002876.usQuhbGJ8B@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeiudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431464678987896 X-GMAIL-MSGID: 1790431464678987896 From: Rafael J. Wysocki In order to allow thermal zone creators to specify the writability of trip point temperature and hysteresis on a per-trip basis, add a flags field to struct thermal_trip and define flags to represent the desired trip properties. Also make thermal_zone_device_register_with_trips() set the THERMAL_TRIP_WRITABLE_TEMP flag for all trips covered by the writable trips mask passed to it and modify the thermal sysfs code to look at the trip flags instead of using the writable trips mask directly or checking the presence of the .set_trip_hyst() zone callback. Additionally, make trip_point_temp_store() and trip_point_hyst_store() fail with an error code if the trip passed to one of them has THERMAL_TRIP_WRITABLE_TEMP or THERMAL_TRIP_WRITABLE_HYST, respectively, clear in its flags. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 12 +++++++++++- drivers/thermal/thermal_core.h | 2 +- drivers/thermal/thermal_sysfs.c | 28 +++++++++++++++++++--------- include/linux/thermal.h | 7 +++++++ 4 files changed, 38 insertions(+), 11 deletions(-) Index: linux-pm/include/linux/thermal.h =================================================================== --- linux-pm.orig/include/linux/thermal.h +++ linux-pm/include/linux/thermal.h @@ -64,15 +64,22 @@ enum thermal_notify_event { * @threshold: trip crossing notification threshold miliCelsius * @type: trip point type * @priv: pointer to driver data associated with this trip + * @flags: flags representing binary properties of the trip */ struct thermal_trip { int temperature; int hysteresis; int threshold; enum thermal_trip_type type; + u8 flags; void *priv; }; +#define THERMAL_TRIP_WRITABLE_TEMP BIT(0) +#define THERMAL_TRIP_WRITABLE_HYST BIT(1) + +#define THERMAL_TRIP_WRITABLE (THERMAL_TRIP_WRITABLE_TEMP | THERMAL_TRIP_WRITABLE_HYST) + struct thermal_zone_device_ops { int (*bind) (struct thermal_zone_device *, struct thermal_cooling_device *); Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -1356,13 +1356,23 @@ thermal_zone_device_register_with_trips( tz->devdata = devdata; tz->trips = trips; tz->num_trips = num_trips; + if (num_trips > 0) { + struct thermal_trip *trip; + + for_each_trip(tz, trip) { + if (mask & 1) + trip->flags |= THERMAL_TRIP_WRITABLE_TEMP; + + mask >>= 1; + } + } thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay); thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay); /* sys I/F */ /* Add nodes that are always present via .groups */ - result = thermal_zone_create_device_groups(tz, mask); + result = thermal_zone_create_device_groups(tz); if (result) goto remove_id; Index: linux-pm/drivers/thermal/thermal_core.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.h +++ linux-pm/drivers/thermal/thermal_core.h @@ -131,7 +131,7 @@ void thermal_zone_trip_updated(struct th int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); /* sysfs I/F */ -int thermal_zone_create_device_groups(struct thermal_zone_device *, int); +int thermal_zone_create_device_groups(struct thermal_zone_device *tz); void thermal_zone_destroy_device_groups(struct thermal_zone_device *); void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *); void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev); Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -122,6 +122,11 @@ trip_point_temp_store(struct device *dev trip = &tz->trips[trip_id]; + if (!(trip->flags & THERMAL_TRIP_WRITABLE_TEMP)) { + ret = -EPERM; + goto unlock; + } + if (temp != trip->temperature) { if (tz->ops->set_trip_temp) { ret = tz->ops->set_trip_temp(tz, trip_id, temp); @@ -173,6 +178,11 @@ trip_point_hyst_store(struct device *dev trip = &tz->trips[trip_id]; + if (!(trip->flags & THERMAL_TRIP_WRITABLE_HYST)) { + ret = -EPERM; + goto unlock; + } + if (hyst != trip->hysteresis) { if (tz->ops->set_trip_hyst) { ret = tz->ops->set_trip_hyst(tz, trip_id, hyst); @@ -392,17 +402,16 @@ static const struct attribute_group *the /** * create_trip_attrs() - create attributes for trip points * @tz: the thermal zone device - * @mask: Writeable trip point bitmap. * * helper function to instantiate sysfs entries for every trip * point and its properties of a struct thermal_zone_device. * * Return: 0 on success, the proper error value otherwise. */ -static int create_trip_attrs(struct thermal_zone_device *tz, int mask) +static int create_trip_attrs(struct thermal_zone_device *tz) { + const struct thermal_trip *trip; struct attribute **attrs; - int indx; /* This function works only for zones with at least one trip */ if (tz->num_trips <= 0) @@ -437,7 +446,9 @@ static int create_trip_attrs(struct ther return -ENOMEM; } - for (indx = 0; indx < tz->num_trips; indx++) { + for_each_trip(tz, trip) { + int indx = thermal_zone_trip_id(tz, trip); + /* create trip type attribute */ snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, "trip_point_%d_type", indx); @@ -458,7 +469,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 (mask & (1 << indx)) { + if (trip->flags & THERMAL_TRIP_WRITABLE_TEMP) { tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_temp_attrs[indx].attr.store = trip_point_temp_store; @@ -473,7 +484,7 @@ 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 (trip->flags & THERMAL_TRIP_WRITABLE_HYST) { tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; tz->trip_hyst_attrs[indx].attr.store = trip_point_hyst_store; @@ -505,8 +516,7 @@ static void destroy_trip_attrs(struct th kfree(tz->trips_attribute_group.attrs); } -int thermal_zone_create_device_groups(struct thermal_zone_device *tz, - int mask) +int thermal_zone_create_device_groups(struct thermal_zone_device *tz) { const struct attribute_group **groups; int i, size, result; @@ -522,7 +532,7 @@ int thermal_zone_create_device_groups(st groups[i] = thermal_zone_attribute_groups[i]; if (tz->num_trips) { - result = create_trip_attrs(tz, mask); + result = create_trip_attrs(tz); if (result) { kfree(groups); From patchwork Fri Feb 9 14:06:59 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: 198912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp891301dyd; Fri, 9 Feb 2024 06:30:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgC1RO1/FUXz4BLlprCQ6DdPYYy5Q/n3+lONhQztaNMoj+d08u6Hw6d2Fa05NELsRQnsGu X-Received: by 2002:a05:6a20:ce47:b0:19e:3a94:6309 with SMTP id id7-20020a056a20ce4700b0019e3a946309mr2050631pzb.5.1707489050919; Fri, 09 Feb 2024 06:30:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489050; cv=pass; d=google.com; s=arc-20160816; b=KbX1fHqkXR35rxndxeOx1w78lNA3C/VhKAZDY8svFxx0BpaHJFB13HEQj7EYzSE1PD JS39BUCCYamcLwiNDBo6HaXXtz/GRXuE6xYeQ283MHMnovp62AR1D9ms2vbuPbpukoSV dyQ6+5kBtIjogKI/AfcNHdcqukRBZCBp66lLc5VEnv2Q6CM98Akgk6FEWTuLd8VWZp7T ZQv4eTaJrR0SMqMFXCDmsm3zKexh2nvSVCbFwiNayxf8cDR4VnKkeOw2TZZTBgtVPklP WzNMQLU0nuhG31zV5BCam8/844ppavsPIGCnQOMkqWDbwwSuMYkZjQP/HILQDuVU7sV/ eMpw== 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=gqrKyb09EMlzsd8qpeJUuqbiJbFXw67MrVTmVPwKFho=; fh=kdOsjFVDdvv3XmqgN6UmBWnAgwg6QUD9DzGFoqmp56E=; b=MnBGgWTZZFy1cQwoMXg6hiSPpfmpFjR2IqAZCqo82xbavo6D70ZqRV5ohJTuhZk/lh Zpb2hT9d9UIfpHduyaUvLcjDEDOdeHyKqkDnLPIDD2/CENyz2cIH9GhoZxqhYJHIkbC3 yhz6Bgq4/+sRumdBlIfhwG6J4N67/kQ6Nn4hZQz7nDa+OlaDRfPzfr2pwAOoLvUMauSw DCwqM8bb0NUm+KjahGgXfDtEwghZYFaZvANMU4wzMgh+YcrK2Lmimtz0BaVITygM1kDi 6N3fPcXBOoqlzz7NtwS8RYV8mvxqSBDkxzNNWW4XVkzjsTxE8LFA1PEp3rjuf+W5lJtt cw9A==; 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-59438-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59438-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXiv5QVSDOEkqrKMRNPaPJQ+S+28NqnNPhg3i2gy7nwoUPiQY9m5wPL9R/TiaXCMRiL7l13UboKOCzPA/H+jhaUE8iPZg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx24-20020a056a02051800b005d8be4f9ef2si1917170pgb.105.2024.02.09.06.30.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:30:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59438-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59438-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59438-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4229C28B13C for ; Fri, 9 Feb 2024 14:20:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A3667BB19; Fri, 9 Feb 2024 14:14: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 C024669959; Fri, 9 Feb 2024 14:14:48 +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=1707488091; cv=none; b=saeXv8eYp4QfB4WM3ambCmT7TqXNXdpj7XlocLKZwjp1b3mQ9/TBqu+6/XtMKG4Wh2/DJfGEE52enrRLk8VdkMIpgkgFSHSqZUIJYLglPCaZpdpDve12Tyl9daelGcTFkRxyoTV5hDPiNCmUYpMm5vtFBNYdJnEC7j/uDkxiEFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488091; c=relaxed/simple; bh=8RyrzeKlVNhzQRM5WE8ThMfxfRzaAZCqRSMjBI1at8Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pg8zNufB1QAbIP8t3Ntq5jRYlDXhUlc/4AJ1JiL/MQu9gHBSLckC3rYe9W9SIOBnmBM5NDp4qFO1tgsbQ8DN+zntMSCcKDSfLegOQ7fY7sa5zu+xqEtGq1dbNE3c2BH/2KMEpbkN13ao24aH9Ssl4nYwGIL35dpX7LBjo69o1X8= 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 51079e6e3f905612; Fri, 9 Feb 2024 15:14:46 +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 281B1669C4D; Fri, 9 Feb 2024 15:14:46 +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 3/9] thermal: core: Drop the .set_trip_hyst() thermal zone operation Date: Fri, 09 Feb 2024 15:06:59 +0100 Message-ID: <1907326.CQOukoFCf9@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432039206909096 X-GMAIL-MSGID: 1790432039206909096 From: Rafael J. Wysocki None of the users of the thermal core provides a .set_trip_hyst() thermal zone operation, so drop that callback from struct thermal_zone_device_ops and update trip_point_hyst_store() accordingly. No functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_sysfs.c | 6 ------ include/linux/thermal.h | 1 - 2 files changed, 7 deletions(-) Index: linux-pm/drivers/thermal/thermal_sysfs.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_sysfs.c +++ linux-pm/drivers/thermal/thermal_sysfs.c @@ -184,12 +184,6 @@ trip_point_hyst_store(struct device *dev } if (hyst != trip->hysteresis) { - if (tz->ops->set_trip_hyst) { - ret = tz->ops->set_trip_hyst(tz, trip_id, hyst); - if (ret) - goto unlock; - } - trip->hysteresis = hyst; thermal_zone_trip_updated(tz, trip); Index: linux-pm/include/linux/thermal.h =================================================================== --- linux-pm.orig/include/linux/thermal.h +++ linux-pm/include/linux/thermal.h @@ -90,7 +90,6 @@ struct thermal_zone_device_ops { int (*change_mode) (struct thermal_zone_device *, enum thermal_device_mode); int (*set_trip_temp) (struct thermal_zone_device *, int, int); - int (*set_trip_hyst) (struct thermal_zone_device *, int, int); int (*get_crit_temp) (struct thermal_zone_device *, int *); int (*set_emul_temp) (struct thermal_zone_device *, int); int (*get_trend) (struct thermal_zone_device *, From patchwork Fri Feb 9 14:07:48 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: 198905 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp885173dyd; Fri, 9 Feb 2024 06:21:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2Z6x9Xuu+QhnR7zuBsVk9YEus2+STY2HmT5U8TuW3VbNKwKVJjf7da1j14kf7krVrIxH5 X-Received: by 2002:a0c:e303:0:b0:68c:a48b:1837 with SMTP id s3-20020a0ce303000000b0068ca48b1837mr1796145qvl.56.1707488495684; Fri, 09 Feb 2024 06:21:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488495; cv=pass; d=google.com; s=arc-20160816; b=peQ6y/OVJWjlkOmwVIBy0IZo2Yz62s98WMmV4Rek63ewf7oytgn8PVWe+GrdLOVwCy BNXXDG6z/Jig9lf12/ICmKk9YgncHhXsUE28Z+z0Vlc2aZOHv3hoVNNYc0btqGQFogTO bKWbweeSy799Jmz95lPHZgd+SSimmlZzhtiz8IjJ6EpG6NLJgV+r7+b2n+gBEiPuxkSe fY/t4LYucLakL5S/y2ogb9cEQR+T8dZmG9zj5v1Ucs5Ro3oqqx2itfM/iyWPC6GuR2J3 sNolERY3jxvV/SXHP6sFEyJ8xiZPC7Q7Ri98s3w/TR2LPE9+TFsO6QumY5S723324o2Y aQGg== 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=BEX9LkRdmYCq7OW3ghJMJdDOXaOO1YgYtJu7dr+CJgE=; fh=WcGhyvxtjwO7GsFZb9tkTyj3UKWSZcAW+IRAQBtjJos=; b=RYuyGY9gcy3spsc61GZnm6shbFAd4OGhggLv12IoJauvm6aEMjarfqAcJLZqF5UJM6 fBDZyLQ9aqPblXuCQjAAnbsgXJLYMalS6ycDUAA0HyziOdnqFs5NZY6Q2gvvtFEKbWzE vZKbQ+mvTL1BS2rdhADetm+vK3zJ6iwUH40sX9n2Fx6wIy08grQqWJVfgp1mvAYb7aBA ICBqdgDdyVP2oIKEMBFnbcPe7hpa76f/2BykBHwxd9Uq68vQOwlh4omY6StnOijYhDL6 qyMTV9oCrHh8c1sOu19oouoDz1WA5tU5X0c49eHPI1aV02swVzPLTAXAkCJlUsk/Xo0c tUqw==; 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-59437-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59437-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUSRoX0kdvG9pyyKq3ys05EhskHE5UlDdlpzvfnRI/EuyiWqPzjByIs7QsztZ75tJaG502/RQaDcGuPMSZw+Y/CF+PlCw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 4-20020ad45ba4000000b0068ca6f337f7si2056910qvq.426.2024.02.09.06.21.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:21:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59437-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-59437-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59437-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 6AF7C1C21305 for ; Fri, 9 Feb 2024 14:21:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8877D80BF2; Fri, 9 Feb 2024 14:14:55 +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 E026A76030; Fri, 9 Feb 2024 14:14:47 +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=1707488091; cv=none; b=iIc9OP4zGRWic6WH6vgulM8m7ww6KOMjPzFtslPg62oOLfg3zDLCkq34UqNmseWBF4OfLdA/xug2ibPRx3TIL9HKC4Q1Iqqr0rCfDwYT2mu7w4AhjXrZEgaVcRkQW+8CSCGfZ1p/x5OeQ4C6P/vLMcp93KKUwNYSoQu7G+qh6YE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488091; c=relaxed/simple; bh=+KbFPLKFarXbzcGKuv+nofQctSKPrpZXPXB6iN4Pydk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tLl/hZ7dFrEj2lsiN/D2Wwp3JuawQWnMormPc5eBGx1wzHEYfoCkLG4g5LTdcTUus7fO8t06vpE5JD1CgaEGqvZWglcAOgyb5P1ANrWRUrsrAZTD7JVW89lv+gjR+cTn1GQInDWrej33WFebNZawaNLnY7x0l0ztjmWwnidQj8o= 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 84c3107030d7e6c7; Fri, 9 Feb 2024 15:14:45 +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 39131669C4D; Fri, 9 Feb 2024 15:14:45 +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 4/9] thermal: intel: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:07:48 +0100 Message-ID: <2619930.Lt9SDvczpP@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431457004361508 X-GMAIL-MSGID: 1790431457004361508 From: Rafael J. Wysocki Some Intel thermal drivers need/want the temperature of their trip points to be set by user space via sysfs and so they pass nonzero writable trip masks during thermal zone registration for this purpose. It is now possible to achieve the same result by setting the THERMAL_TRIP_WRITABLE_TEMP trip flag directly, so modify the drivers in question to do that instead of using a nonzero writable trips mask. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 8 - drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c | 3 drivers/thermal/intel/intel_quark_dts_thermal.c | 20 -- drivers/thermal/intel/intel_soc_dts_iosf.c | 73 ++++------ drivers/thermal/intel/intel_soc_dts_iosf.h | 1 drivers/thermal/intel/x86_pkg_temp_thermal.c | 4 6 files changed, 43 insertions(+), 66 deletions(-) Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -130,7 +130,6 @@ struct int34x_thermal_zone *int340x_ther struct thermal_trip *zone_trips; unsigned long long trip_cnt = 0; unsigned long long hyst; - int trip_mask = 0; acpi_status status; int i, ret; @@ -151,10 +150,8 @@ struct int34x_thermal_zone *int340x_ther int34x_zone->ops->get_temp = get_temp; status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt); - if (ACPI_SUCCESS(status)) { + if (ACPI_SUCCESS(status)) int34x_zone->aux_trip_nr = trip_cnt; - trip_mask = BIT(trip_cnt) - 1; - } zone_trips = kzalloc(sizeof(*zone_trips) * (trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT), GFP_KERNEL); @@ -166,6 +163,7 @@ struct int34x_thermal_zone *int340x_ther for (i = 0; i < trip_cnt; i++) { zone_trips[i].type = THERMAL_TRIP_PASSIVE; zone_trips[i].temperature = THERMAL_TEMP_INVALID; + zone_trips[i].flags |= THERMAL_TRIP_WRITABLE_TEMP; } trip_cnt = int340x_thermal_read_trips(adev, zone_trips, trip_cnt); @@ -186,7 +184,7 @@ struct int34x_thermal_zone *int340x_ther int34x_zone->zone = thermal_zone_device_register_with_trips( acpi_device_bid(adev), zone_trips, trip_cnt, - trip_mask, int34x_zone, + 0, int34x_zone, int34x_zone->ops, &int340x_thermal_params, 0, 0); Index: linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -235,6 +235,7 @@ static int get_trip_temp(struct proc_the static struct thermal_trip psv_trip = { .type = THERMAL_TRIP_PASSIVE, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }; static struct thermal_zone_device_ops tzone_ops = { @@ -290,7 +291,7 @@ static int proc_thermal_pci_probe(struct psv_trip.temperature = get_trip_temp(pci_info); pci_info->tzone = thermal_zone_device_register_with_trips("TCPU_PCI", &psv_trip, - 1, 1, pci_info, + 1, 0, pci_info, &tzone_ops, &tzone_params, 0, 0); if (IS_ERR(pci_info->tzone)) { Index: linux-pm/drivers/thermal/intel/intel_quark_dts_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_quark_dts_thermal.c +++ linux-pm/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -93,10 +93,6 @@ /* Quark DTS has 2 trip points: hot & catastrophic */ #define QRK_MAX_DTS_TRIPS 2 -/* If DTS not locked, all trip points are configurable */ -#define QRK_DTS_WR_MASK_SET 0x3 -/* If DTS locked, all trip points are not configurable */ -#define QRK_DTS_WR_MASK_CLR 0 #define DEFAULT_POLL_DELAY 2000 @@ -323,7 +319,6 @@ static struct soc_sensor_entry *alloc_so struct soc_sensor_entry *aux_entry; int err; u32 out; - int wr_mask; aux_entry = kzalloc(sizeof(*aux_entry), GFP_KERNEL); if (!aux_entry) { @@ -337,13 +332,7 @@ static struct soc_sensor_entry *alloc_so if (err) goto err_ret; - if (out & QRK_DTS_LOCK_BIT) { - aux_entry->locked = true; - wr_mask = QRK_DTS_WR_MASK_CLR; - } else { - aux_entry->locked = false; - wr_mask = QRK_DTS_WR_MASK_SET; - } + aux_entry->locked = !!(out & QRK_DTS_LOCK_BIT); /* Store DTS default state if DTS registers are not locked */ if (!aux_entry->locked) { @@ -360,6 +349,9 @@ static struct soc_sensor_entry *alloc_so &aux_entry->store_ptps); if (err) goto err_ret; + + trips[QRK_DTS_ID_TP_CRITICAL].flags |= THERMAL_TRIP_WRITABLE_TEMP; + trips[QRK_DTS_ID_TP_HOT].flags |= THERMAL_TRIP_WRITABLE_TEMP; } aux_entry->trips[QRK_DTS_ID_TP_CRITICAL].temperature = get_trip_temp(QRK_DTS_ID_TP_CRITICAL); @@ -371,8 +363,8 @@ static struct soc_sensor_entry *alloc_so aux_entry->tzone = thermal_zone_device_register_with_trips("quark_dts", aux_entry->trips, QRK_MAX_DTS_TRIPS, - wr_mask, - aux_entry, &tzone_ops, + 0, aux_entry, + &tzone_ops, NULL, 0, polling_delay); if (IS_ERR(aux_entry->tzone)) { err = PTR_ERR(aux_entry->tzone); Index: linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_soc_dts_iosf.c +++ linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -129,22 +129,6 @@ err_restore_ptps: return status; } -static int configure_trip(struct intel_soc_dts_sensor_entry *dts, - int thres_index, enum thermal_trip_type trip_type, - int temp) -{ - int ret; - - ret = update_trip_temp(dts->sensors, thres_index, temp); - if (ret) - return ret; - - dts->trips[thres_index].temperature = temp; - dts->trips[thres_index].type = trip_type; - - return 0; -} - static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp) { @@ -217,16 +201,10 @@ static void remove_dts_thermal_zone(stru thermal_zone_device_unregister(dts->tzone); } -static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts, - bool critical_trip) +static int add_dts_thermal_zone(int id, struct intel_soc_dts_sensor_entry *dts) { - int writable_trip_cnt = SOC_MAX_DTS_TRIPS; char name[10]; - unsigned long trip; - int trip_mask; - unsigned long ptps; u32 store_ptps; - unsigned long i; int ret; /* Store status to restor on exit */ @@ -237,27 +215,21 @@ static int add_dts_thermal_zone(int id, dts->id = id; - if (critical_trip) - writable_trip_cnt--; - - trip_mask = GENMASK(writable_trip_cnt - 1, 0); - /* Check if the writable trip we provide is not used by BIOS */ ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ, SOC_DTS_OFFSET_PTPS, &store_ptps); - if (ret) - trip_mask = 0; - else { - ptps = store_ptps; - for_each_set_clump8(i, trip, &ptps, writable_trip_cnt * 8) - trip_mask &= ~BIT(i / 8); + if (!ret) { + int i; + + for (i = 0; i <= 1; i++) { + if (store_ptps & (0xFFU << i * 8)) + dts->trips[i].flags &= ~THERMAL_TRIP_WRITABLE_TEMP; + } } - dts->trip_mask = trip_mask; snprintf(name, sizeof(name), "soc_dts%d", id); dts->tzone = thermal_zone_device_register_with_trips(name, dts->trips, SOC_MAX_DTS_TRIPS, - trip_mask, - dts, &tzone_ops, + 0, dts, &tzone_ops, NULL, 0, 0); if (IS_ERR(dts->tzone)) { ret = PTR_ERR(dts->tzone); @@ -315,8 +287,16 @@ EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_int static void dts_trips_reset(struct intel_soc_dts_sensors *sensors, int dts_index) { - configure_trip(&sensors->soc_dts[dts_index], 0, 0, 0); - configure_trip(&sensors->soc_dts[dts_index], 1, 0, 0); + update_trip_temp(sensors, 0, 0); + update_trip_temp(sensors, 1, 0); +} + +static void set_trip(struct thermal_trip *trip, enum thermal_trip_type type, + u8 flags, int temp) +{ + trip->type = type; + trip->flags = flags; + trip->temperature = temp; } struct intel_soc_dts_sensors * @@ -346,29 +326,36 @@ intel_soc_dts_iosf_init(enum intel_soc_d for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { enum thermal_trip_type trip_type; + u8 trip_flags; int temp; sensors->soc_dts[i].sensors = sensors; - ret = configure_trip(&sensors->soc_dts[i], 0, - THERMAL_TRIP_PASSIVE, 0); + ret = update_trip_temp(sensors, 0, 0); if (ret) goto err_reset_trips; + set_trip(&sensors->soc_dts[i].trips[0], THERMAL_TRIP_PASSIVE, + THERMAL_TRIP_WRITABLE_TEMP, 0); + if (critical_trip) { trip_type = THERMAL_TRIP_CRITICAL; + trip_flags = 0; temp = sensors->tj_max - crit_offset; } else { trip_type = THERMAL_TRIP_PASSIVE; + trip_flags = THERMAL_TRIP_WRITABLE_TEMP; temp = 0; } - ret = configure_trip(&sensors->soc_dts[i], 1, trip_type, temp); + ret = update_trip_temp(sensors, 1, temp); if (ret) goto err_reset_trips; + + set_trip(&sensors->soc_dts[i].trips[1], trip_type, trip_flags, temp); } for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { - ret = add_dts_thermal_zone(i, &sensors->soc_dts[i], critical_trip); + ret = add_dts_thermal_zone(i, &sensors->soc_dts[i]); if (ret) goto err_remove_zone; } Index: linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.h =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_soc_dts_iosf.h +++ linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.h @@ -28,7 +28,6 @@ struct intel_soc_dts_sensors; struct intel_soc_dts_sensor_entry { int id; u32 store_status; - u32 trip_mask; struct thermal_trip trips[SOC_MAX_DTS_TRIPS]; struct thermal_zone_device *tzone; struct intel_soc_dts_sensors *sensors; Index: linux-pm/drivers/thermal/intel/x86_pkg_temp_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ linux-pm/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -302,6 +302,7 @@ static struct thermal_trip *pkg_temp_the tj_max - thres_reg_value * 1000 : THERMAL_TEMP_INVALID; trips[i].type = THERMAL_TRIP_PASSIVE; + trips[i].flags |= THERMAL_TRIP_WRITABLE_TEMP; pr_debug("%s: cpu=%d, trip=%d, temp=%d\n", __func__, cpu, i, trips[i].temperature); @@ -345,8 +346,7 @@ static int pkg_temp_thermal_device_add(u INIT_DELAYED_WORK(&zonedev->work, pkg_temp_thermal_threshold_work_fn); zonedev->cpu = cpu; zonedev->tzone = thermal_zone_device_register_with_trips("x86_pkg_temp", - zonedev->trips, thres_count, - (thres_count == MAX_NUMBER_OF_TRIPS) ? 0x03 : 0x01, + zonedev->trips, thres_count, 0, zonedev, &tzone_ops, &pkg_temp_tz_params, 0, 0); if (IS_ERR(zonedev->tzone)) { err = PTR_ERR(zonedev->tzone); From patchwork Fri Feb 9 14:08:43 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: 198914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp891922dyd; Fri, 9 Feb 2024 06:31:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXaLwGVmHrk/6Tyav6VW2EBI3Aer6x+4kf/GOuv4PUwMfNulGisUqa6M6ScXc3xePocBNhyCo3ahR3tMHUsTAnNfaElgg== X-Google-Smtp-Source: AGHT+IHj7d/8SHfAA0wnie559HtnlggRxxqTGQwu5KM2yYXGaYQUnN/VIyttUXZ1TnurvserttkG X-Received: by 2002:a17:903:11d1:b0:1d9:dcd:c726 with SMTP id q17-20020a17090311d100b001d90dcdc726mr2089022plh.17.1707489098475; Fri, 09 Feb 2024 06:31:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489098; cv=pass; d=google.com; s=arc-20160816; b=zx+LVjjlONVMeOxmkQwu7gP72CufyuDlvazLd6dJrtwBZ3hjN3zUotAqWAWkivEq36 YqyAQvEW1AQTrDwDEMO4Vi8cpx9cwdYlWw0oNY7ncYbeyczrEmgL+QQvSAOvzeywlP6S s/Lt5fM5cE4IWvmJ/qfZQXomKA0axd3bDx2JDElEzVF/dxgolaXLPpHZdjnF8kaf0KWs 57uX1uJh40JuLr76LlIZge6GrPzYWvri16pO+xFty8bF6wZ6cm+rs5Fc7tqONu6fRNQw sqPoHUMtSqRYV3Obv9kXkBKjvfGvJnY6tFh7CK7CfEO5cPfFaVsSURyFhe5YdxP31CyJ JmIQ== 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=m3JGOk+ppSmrXVSSN+/PI5xOeH56cNd38B9gqRpKvYM=; fh=0GYVDx+kAK0z8n310YVfxh7+EXp4BpYvieAgXZVRqlI=; b=j4zQW+3uieRvdyKP5jBVoQ2pN2Ln8Iui+leN55SL2bGvCuAAKAPL+3tTzbjiJ1mVst bAsKSPYKSXHxGJVVrQuG8GcToZk5SALbY8LplRFq9S+bppOOo5untdZ1NtaJeUNKGyhI IKaFSo39GsIc/59hSynIutFI+g5ppMuZlW7/51ldlvFYRk55h9ElqR/omE0XTX9vWwQv EVoqkuaRsjaGu/ONwBgd+NcCDgkTFhfHy+4J/+McUuZzIJ5tbQfwcN7FZESiE44BsVIJ UDlwMQJ5OM11/goicE/LkUTtq8TWumV1N1JSC/+xsEPoD+pNGFTyC1+7rDAbNVf4/a5x csMQ==; 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-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXrQM8iizSQifbzOSrxIo3tVE6ootw3WEEFQpjLB9QhwD2eUB9sdwt9ctFtXlmzcaLYmcMr26TiUc7h9Nc8c91bu83qPA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u14-20020a170903124e00b001d92e40f68asi1767614plh.69.2024.02.09.06.31.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:31:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59436-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8760628A341 for ; Fri, 9 Feb 2024 14:19:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C79827AE68; Fri, 9 Feb 2024 14:14:51 +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 DBC9F6F074; Fri, 9 Feb 2024 14:14:46 +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=1707488089; cv=none; b=UNYANfu8Smrqz1AySm/EHZJ/fpF5rk9q6yeEjPg3u8juAj09wFFJ+BhvcniA1Cb6Zev/VT2DKlT4TgGa8psC3jjkNh/37BlREXSjB49C+PvT3HGzC8wOPF3n8HdEu+osf9TZtlM8lI85UU9rdjgKtjQMUXkMOjl//d6maA3YFdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488089; c=relaxed/simple; bh=8HqmpFd0rysCcXybj+zUxgCCZN4PfgLB3WDz4Z60m3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SyrLjhR3JS2ovBNgA1vu3dMhPBHEDsSboh/qPkFLNCkxNVchMNeSdSkeODnHUva0HBxV5N2jJ7GVYydHGLXVx+DXDTqC4yxg5T6gmpo+QLQzxR6IGSNnmCXSmbJcLFJqhAm9p3m78Dj7Fu2XRtgtzrw/z0Og6g748Ws3YVuCmhw= 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 251588209d90e162; Fri, 9 Feb 2024 15:14:44 +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 3472D669C4D; Fri, 9 Feb 2024 15:14:44 +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 5/9] mlxsw: core_thermal: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:08:43 +0100 Message-ID: <2206820.Mh6RI2rZIc@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432089105298346 X-GMAIL-MSGID: 1790432089105298346 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the mlxsw code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) Index: linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c =================================================================== --- linux-pm.orig/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -44,16 +44,19 @@ static const struct thermal_trip default .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_ASIC_TEMP_NORM, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_ASIC_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_ASIC_TEMP_HOT, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, }; @@ -62,16 +65,19 @@ static const struct thermal_trip default .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_MODULE_TEMP_NORM, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_MODULE_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_MODULE_TEMP_HOT, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, }; @@ -92,9 +98,6 @@ static const struct mlxsw_cooling_states #define MLXSW_THERMAL_NUM_TRIPS ARRAY_SIZE(default_thermal_trips) -/* Make sure all trips are writable */ -#define MLXSW_THERMAL_TRIP_MASK (BIT(MLXSW_THERMAL_NUM_TRIPS) - 1) - struct mlxsw_thermal; struct mlxsw_thermal_module { @@ -420,7 +423,7 @@ mlxsw_thermal_module_tz_init(struct mlxs module_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, module_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, module_tz, &mlxsw_thermal_module_ops, &mlxsw_thermal_params, @@ -548,7 +551,7 @@ mlxsw_thermal_gearbox_tz_init(struct mlx gearbox_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, gearbox_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, gearbox_tz, &mlxsw_thermal_gearbox_ops, &mlxsw_thermal_params, 0, @@ -773,7 +776,7 @@ int mlxsw_thermal_init(struct mlxsw_core thermal->tzdev = thermal_zone_device_register_with_trips("mlxsw", thermal->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, thermal, &mlxsw_thermal_ops, &mlxsw_thermal_params, 0, From patchwork Fri Feb 9 14:10:24 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: 198910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp890137dyd; Fri, 9 Feb 2024 06:29:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYlUNx+kaYVZBAu/26I9PkKTELQ0mRtlqDxrKPdJdHL+pEFCenIbsHS+s0iJYO570Ay+6h95Rg+4ODlavkVUv+jXxafA== X-Google-Smtp-Source: AGHT+IFCp+yfOssD38MS/wApULArW3gfBZEYE9uFdwCmU9mdoTdrGoGf37EMHHNZpKCn/+cmtF7A X-Received: by 2002:a05:6a20:6f03:b0:19e:a1ae:7a95 with SMTP id gt3-20020a056a206f0300b0019ea1ae7a95mr2424536pzb.47.1707488958408; Fri, 09 Feb 2024 06:29:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488958; cv=pass; d=google.com; s=arc-20160816; b=Uqa3KCP332ptKdnPA8rrrdKHq54/e0FbERfY3qQAFGApOEIPX0B8yVvVaUovJMlYc/ XoeQdjmfIOuF+TaBohPDJReoLg3Ix8KFcR6bYueAr793Q3f4CHBhN+st3AxoJPesrcbN VVdEWFrUJRNU0Tex9DfaoFpKks28vzbp6mcr/z5YmE3dO/rpRztHR1mzXBpr54EweYSB ISGtrVWugomZUaZOuL1k0BO6V/xrj1CbUVCJIgkJgCeVvuXlVq8gEVEsp50Dm899TE5Q GZVg39OGb6yabgWnh1IrbOEX8p9Et773XsiG5npQK+f9r4BlOHWKSXq/HmmQ/RlMmdr1 9TjA== 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=MOc1M3ygDN6ML6O+0sPr9x+vEhgMnbhq1ZlrGHXuXKo=; fh=KjbTJ52onQYTuZrCw+iaPZknS6ZazRsgslW1ps/xwzY=; b=PVYMbKaAmWo3fCowdoKbgv275qzNbtnJpSf686GZOEbSqWa5A+bTt119wCZdQYKhTf TwRPkmSxcFz0PN1sFyEc8xLZPRY8wSR/bSdUGW/wX+eYRbwcPzX7g5RWrbwI+TN+5vPL jDC572jpDDVzeO/uzP3jtFAs6Ytduzm2MRVHKsKouFaCEUx4YkbIQDOrvjjuv0j9NpnD OCvqoJJM8UljH5t/qspCC9ZxJ61xMNmGo8DEDG0/mMn/JA4UGki7GbE3ZgLNKiGJm1pP tZYHEDyV/m7+yo6CQ7Z8yAUdNHQqrB9JeywZObyaAZAIDt8IhatRS7uE+RXFVFeOL7AY yB0w==; 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-59435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59435-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVJWeiuGOg0bpI8rL9vY/dMIsnOzDGF6RFzssLtpsO+ZQV/t7VohFdOdrwRYycYF3YvRE4uoGI2bKo8Mxf8NhMEm70rpg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d6-20020aa78e46000000b006e045c176fcsi379497pfr.324.2024.02.09.06.29.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:29:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59435-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59435-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D00C7289727 for ; Fri, 9 Feb 2024 14:19:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3F8979DA9; Fri, 9 Feb 2024 14:14:50 +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 01DFB6DD11; Fri, 9 Feb 2024 14:14:45 +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=1707488088; cv=none; b=Nr+OnwbpWbo5mp/TvEwpc9CJWxPiGI9a3EUG9da+7/Nj+YFBk2ns4TMvi3ds70JQa5HmNffGHpaZdUN/ZoFEacO5i0MFoI8GuhYgwXN+Cb2BfgEfENQgkqz8c87z1lkUgxeBYBSOcLkLAyAZGRHZbWELWof9gZzEvl9/H4RWD5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488088; c=relaxed/simple; bh=Ssul7hc7kbACnmZvX9krmTTLWenMYtCPw+q2NatOvlc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GQYAa82UcJgGzU/XbafaYU/vipOegskFBKOcMwppSCU8z0wpdfkNA6Xa2aKnx3PLpZISb81JHYxqJRqKVULDjUZByptVr18IOf0GtJSKpBd1Pd7eFVJm5Rse+xdWwJ+UMJdkOCx1Cd56zvIXeocDvYNPa4ymF0JMR2L/FN/COAE= 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 951de1a746e31c75; Fri, 9 Feb 2024 15:14:43 +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 42D3C669C4D; Fri, 9 Feb 2024 15:14:43 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM , Miri Korenblit Cc: Lukasz Luba , LKML , Daniel Lezcano , Stanislaw Gruszka , Srinivas Pandruvada , Zhang Rui , netdev@vger.kernel.org, Ido Schimmel , Petr Machata , linux-wireless@vger.kernel.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Manaf Meethalavalappu Pallikunhi Subject: [PATCH v1 6/9] iwlwifi: mvm: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:10:24 +0100 Message-ID: <3757041.MHq7AAxBmi@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeefudduuedtuefgleffudeigeeitdeufeelvdejgefftdethffhhfethfeljefgteenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhirhhirghmrdhrrggthhgvlhdrkhhorhgvnhgslhhithesihhnthgvlhdrtghomhdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghl sehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgrnhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431941726655566 X-GMAIL-MSGID: 1790431941726655566 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the iwlwifi code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki --- This patch obviously depends on https://patchwork.kernel.org/project/linux-pm/patch/8346768.T7Z3S40VBb@kreacher/ which has been queued up for 6.9 already. --- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c =================================================================== --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -667,9 +667,6 @@ static struct thermal_zone_device_ops t .set_trip_temp = iwl_mvm_tzone_set_trip_temp, }; -/* make all trips writable */ -#define IWL_WRITABLE_TRIPS_MSK (BIT(IWL_MAX_DTS_TRIPS) - 1) - static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) { int i, ret; @@ -692,11 +689,12 @@ static void iwl_mvm_thermal_zone_registe for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; } mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, mvm->tz_device.trips, IWL_MAX_DTS_TRIPS, - IWL_WRITABLE_TRIPS_MSK, + 0, mvm, &tzone_ops, NULL, 0, 0); if (IS_ERR(mvm->tz_device.tzone)) { From patchwork Fri Feb 9 14:11:35 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: 198908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp887419dyd; Fri, 9 Feb 2024 06:25:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqRyeeiA+N7PhDwus7pSCb70t0D60kxtb66Y9i4eIConOoJpZarRwd1DNVxZfQ8yhoDBZQ X-Received: by 2002:a17:90a:bb95:b0:296:25d0:3bf2 with SMTP id v21-20020a17090abb9500b0029625d03bf2mr1543742pjr.6.1707488701099; Fri, 09 Feb 2024 06:25:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488701; cv=pass; d=google.com; s=arc-20160816; b=un6W3izcIV+nBgwNy7+lCzCSLyRew1p29HZYw1gTqKcVAd5ttvDA0jzmqNyYe5gd/t FsUt+QJnUPiikRK42f7wJhjT2jHaOxqr7WL/hXVV46MmBvXiCyoKPoUzHCY1rn2gXbF0 rHgM7B8F7p1/1L2tQuM3RZjDy+I4Ef43PWH2myi5milyYjcn6ffteIzzCMm5yjc7CszC Dk82eyTPkBBTsNwT7MBKoS/6kKvoUVqRGD7d2i/RmaW8Ny7T84DzR071eGda090CTWw2 /cv4SsGxAKUm78XgTz2SgwhY+Fu/Bmrj9j4NBRjRmKjw4YeUhK5yI+U0M7mqbM2KWpyl /jAA== 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=EnAKdqX/HOFIasl6bT7Gj4SkUKS+CIUD/eN7YjnlkKg=; fh=8vh71qxAuhiVG06QHt5M7k6RQKo7CqUDc+NgKTiYHAk=; b=K7GmGCx1n4XlZ9sEvzaY9HZfQN2aBhJFkaF/dD0B8R61iZXoW4VUX4t232BwXLCdsg MtzzhgvCM1JjbthpFZuKKb03KtW+HFhRPiUGPcbBhwZXsdxknPKGfwLpW5zKTu0/IjY9 U0EpAAX8kDOCbwEHOIpMphJc1ONBnQ1JENFCfCgswXM8AolsNmJ8DeG0aNApAK587/Sx o+RgK41quAXcFEEhSWSLJUxxijjQjXkMUCfKoinNdm0PQBSWrI8MgppKRNyJgYqT0cVD /Z9ddCZCWzxcl4Yc2/6gosfHxvpKuBhybWO0PpV1Oijazs6LJX5saJDA3fyG3/qEmxOQ 4YtA==; 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-59434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59434-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUJnMvWjNLJxdNnjBZOL+pJE31Yu6qw5bEIvzJcfoBWdoZ/4ZfG+0jSuS93ezkfiZ08b910dTLZe1DAvggbRdfnTbU3dQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id qa5-20020a17090b4fc500b00296421430c4si1774875pjb.109.2024.02.09.06.25.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:25:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59434-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E00A284BA2 for ; Fri, 9 Feb 2024 14:18:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55EF478669; Fri, 9 Feb 2024 14:14:49 +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 E812A4EB4E; Fri, 9 Feb 2024 14:14:44 +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=1707488087; cv=none; b=jS9qgeNcc2ZO9zGNElYyfwG7QVqz6CkCQyBUea8eWp0gb4rTiooDMuHYq5pcBVqSMmonZqOZnJIJqhQWDyE6onUA32fFg/7c/6Ph6SK7waVN6ikCraNROVJIbFxAmsgP41wxKsHAgXma286o2qJqoCyzuls+RmkOsRXloD3c6Uw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488087; c=relaxed/simple; bh=z2NqA3M75BY0RdOVHbZES1UzBP+LkWRriEpfg2cwIXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MarBvxwh9xNzG76uuMJ+jnKtnKEzUdMggpxdUr/2j8XJK+jSvC1W2ExPC6hLoeBA47UjBfy+5WngQQ4LOAvjLPhgpY6QlhLpnJlXDsQBlRRbSnBVtIKhuMpsQR5wQWYDginwKE43cBojQRJvHGS46yRsrUWyhYgTRtF53R6FGFA= 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 4107c00f6cba97a2; Fri, 9 Feb 2024 15:14:42 +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 59C75669C4D; Fri, 9 Feb 2024 15:14:42 +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 7/9] thermal: imx: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:11:35 +0100 Message-ID: <1876832.atdPhlSkOF@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431672362527934 X-GMAIL-MSGID: 1790431672362527934 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the imx thermal code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/imx_thermal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Index: linux-pm/drivers/thermal/imx_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/imx_thermal.c +++ linux-pm/drivers/thermal/imx_thermal.c @@ -115,7 +115,8 @@ struct thermal_soc_data { }; static struct thermal_trip trips[] = { - [IMX_TRIP_PASSIVE] = { .type = THERMAL_TRIP_PASSIVE }, + [IMX_TRIP_PASSIVE] = { .type = THERMAL_TRIP_PASSIVE, + .flags = THERMAL_TRIP_WRITABLE_TEMP }, [IMX_TRIP_CRITICAL] = { .type = THERMAL_TRIP_CRITICAL }, }; @@ -699,7 +700,7 @@ static int imx_thermal_probe(struct plat data->tz = thermal_zone_device_register_with_trips("imx_thermal_zone", trips, ARRAY_SIZE(trips), - BIT(IMX_TRIP_PASSIVE), data, + 0, data, &imx_tz_ops, NULL, IMX_PASSIVE_DELAY, IMX_POLLING_DELAY); From patchwork Fri Feb 9 14:12:55 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: 198902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp883104dyd; Fri, 9 Feb 2024 06:18:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWSb+qasPIIUWGSMvPjy1a4DIy2r7+WYZ5PmTUzRSHoeoRXUNXM437bT8dpkRuUUIEREriuph9ElZYd3Md9Ebj9v+hvpQ== X-Google-Smtp-Source: AGHT+IGd9RHqP12NBxFgscgqaCbCA2/nNxJ+u6JqcOLpbIReEij1ys5bAtFwRTjMFwRdLzc22KHI X-Received: by 2002:a05:6a20:d485:b0:19e:9d92:492e with SMTP id im5-20020a056a20d48500b0019e9d92492emr1765582pzb.44.1707488312357; Fri, 09 Feb 2024 06:18:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488312; cv=pass; d=google.com; s=arc-20160816; b=MjVFXogww07hW2eSgA+wRrAROyMSyfc3Yqe9tWfwAtY+WXZnKR5dv48ZxMug0A5obo 7r608gQ8MQ5ArxzBEgMJU5olL45V3/nQJYTMOL5XLD4ZNAZoxKwE0dXZ4xfOjD5UKGFJ nxAWg3J0VbLbFkxDPaqroKhCnUyl9Y591iO893W6QxlExk7Ca0T17pTO8zOycake3UdM JfsLZb+kA09sqDs01idq0ukwxp4NRVgM3/29n12ddl81iUuhOTOvVsWW9dHuMePv3ITz zdt/eExYdB/PEwIZwGBOy+UUpbEUsxpEcMxiXJ0Dt1RHS1QY2uxwBrIXEtRpR9IZC3Rw RxtA== 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=lMn/KqWPRmaGp59A/yWVCDAX1D8RbK+KvFBIqIddImE=; fh=CL2Aey1s4JpC0PXVgY4Y7mjxzNDecUqTtbPRoAJeYsY=; b=SOuUz6E6IQ/kZfWZta8F2Ol92KKpVEzIBEmo0XT1IG90NICdKtXjY5WQQdV2cS/0z5 r6Vfea0aaJx8EbHB2lgJ3nZGgEO2OxK6eAqhYT2wgTWi3dzFHoT1E1MuTiLB4G7aRKl4 8YPXo7gzih5d1wW25zR8gywXHJSgS/4ZghVPNkDobGuXghqhqD/A5gQBsg9XZx6Myh5q y1nxypNiRmGQN4HsgLtO9tC1IGIjf+0QrJMaFngJcFKUOfNTuveDGtJ9vIS5y5b4QEKG PasfG1xNaeJxz4EsbEJW/TkeECErUEVg4RMSunjePdWcWX7Pg/uw8hO1Dpq8zuN/oyFq q3Zg==; 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-59433-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59433-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXiw98KTVSWqiY1SXQF68Qruktf5Q9tzMaBHGC3ArrbgMgncPgF9cnacR7QqQbxVUHCSG/LzJ1g1IaAAKNy3AV3WUPEHA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l190-20020a6388c7000000b005d8b44e7961si1714695pgd.599.2024.02.09.06.18.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:18:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59433-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59433-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59433-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 272B8280C1A for ; Fri, 9 Feb 2024 14:18:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F306E7691D; Fri, 9 Feb 2024 14:14:48 +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 3ED5365BBC; Fri, 9 Feb 2024 14:14:43 +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=1707488087; cv=none; b=Cyd/WK9gvNF0td89ycBUC0a7PovpVOniSSf7N6Wd4T2VFwT1c5y5gUBb/FRYljRBquDNqapwMv3cDz95oSe6YDEt3UTAaRPMT5XKzn/qnngfbpG+nCUEQNxhAP6bxAAACJoHvK5QQoRPHdhOO5+6wvO5bR4WFnKXoLEMfC0VlC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488087; c=relaxed/simple; bh=0aV/S+3kFjqWSHlmNGQrAPqW+jmdMdKldoo/BBfTj9Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pUr1OKzlf9SFOxxDeeKZT20OMop/9Ace2DAAhanOH9v65hFXPmIR68EflJ9px+w807OyHia/YS6VUdmG30hp4qzrDjSmCU7ZQrala4RzBrkxiMkJclX5xQiMvX/kV4HvpIfH/CQPrmqjL6Qx2i3oBhu8hHYtXCNH0Ut2jRfDGlo= 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 3bbb5adbc2281c63; Fri, 9 Feb 2024 15:14:42 +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 6DA10669C4D; Fri, 9 Feb 2024 15:14:41 +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 8/9] thermal: of: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:12:55 +0100 Message-ID: <2209601.Icojqenx9y@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431265093450272 X-GMAIL-MSGID: 1790431265093450272 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the OF thermal code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_of.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Index: linux-pm/drivers/thermal/thermal_of.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_of.c +++ linux-pm/drivers/thermal/thermal_of.c @@ -117,6 +117,8 @@ static int thermal_of_populate_trip(stru return ret; } + trip->flags = THERMAL_TRIP_WRITABLE_TEMP; + return 0; } @@ -477,7 +479,7 @@ static struct thermal_zone_device *therm struct device_node *np; const char *action; int delay, pdelay; - int ntrips, mask; + int ntrips; int ret; of_ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); @@ -510,15 +512,13 @@ static struct thermal_zone_device *therm of_ops->bind = thermal_of_bind; of_ops->unbind = thermal_of_unbind; - mask = GENMASK_ULL((ntrips) - 1, 0); - ret = of_property_read_string(np, "critical-action", &action); if (!ret) if (!of_ops->critical && !strcasecmp(action, "reboot")) of_ops->critical = thermal_zone_device_critical_reboot; tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, - mask, data, of_ops, &tzp, + 0, data, of_ops, &tzp, pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); From patchwork Fri Feb 9 14:14:10 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: 198903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp883874dyd; Fri, 9 Feb 2024 06:19:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJ2wRwSyqdQ00yL4/YKkrmvPifqwGsfStMXgqJrrtWuwZsGkbV/sb9M0VZrWaKtJS1OaoHvTZ7lel3GnjUVytoC/p4ZA== X-Google-Smtp-Source: AGHT+IG8G15u1bEUV3XWiQcMVcIEeDbojFI4RkyA9nCrFUr59Pt8JN+03N5se+zi/pXxX73mlHJd X-Received: by 2002:a2e:7411:0:b0:2d0:d3d8:a44d with SMTP id p17-20020a2e7411000000b002d0d3d8a44dmr1298404ljc.41.1707488377590; Fri, 09 Feb 2024 06:19:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707488377; cv=pass; d=google.com; s=arc-20160816; b=jFEnbtmnfQZ5OfoGRj02mKM7rizXsTe21DLPTSFNdCAi2dBvMjdy1FyDTSllwr7xuJ ouIvu7x9GQZZzI6pEKcx+OqljOfr0lPbuWbG/QENxRFvJlK62cAFSoIYM+S3cFXW7SEW cMNUydxUJR5fcjDVa5zJrEW4L5SRyKZYrP7XsBrSjLVB7JrE+QvVMS9WKY/o3/DJXE70 Fx40RW09Ff23gbX31AVPpWSymjyCHK/dxBoLI/nyi8BGzHVOtRAk7eqiR4u1NlPMqMgN LG8KBgONhSQ1ET/VF8wWeNwh03VbFtbcygOTBJ6x9QZ/V52TXMZXijo/YloiSmkrQIy9 1SXQ== 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=etmCRvtLafboREaonDUevmboVV4izVDabFSw5UbgDqY=; fh=J0gwy9k/byGuTzSA7G32XMZa/wb9Vx9ACJPz6M5WmQI=; b=kTMcIWHetLjsuCWIpNpHKRc2aWFdDV2wlljSe+wMaDc/xhIhervSdevP7vrE+UjIBL YNZ93JafScsbRz81ZiLHDl9VLkmGapNLH1kdzfveioGijT9Eo8SjyWqbVMhrAlRloH3S hptfxaCmxJjT69ibWGt3ljKc+UGq/QSbwi9Vgl4GaUpfgiLBeFhpP5uqut+gvyrYpGmr JmA5ctGPQ36HVeO42l1YmMzIkgMBDzyIF1ZdHMj080vMdDxK7+Q9MxWbeYWEwVc3Lrzi 448JrBB77ZrdxCHfU5JB2NnXpo1sCFLzKFOcMTxxp7533i8VsDZtiswOk6/EpYz8RmGR YxVg==; 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-59432-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59432-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWKIpHdR84d4We9p0e5g3mUhza4gk/fIl5f0NTOnczosCaakLldDJJfg/tt/BRyDuLY7ZiwADvtvSUca5V0F2X4iAoBdw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m7-20020aa7c2c7000000b0055fea5dd2b9si901463edp.402.2024.02.09.06.19.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:19:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59432-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-59432-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59432-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 0746A1F21904 for ; Fri, 9 Feb 2024 14:19:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4333479DC4; Fri, 9 Feb 2024 14:14:51 +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 D4E2A69971; Fri, 9 Feb 2024 14:14:42 +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=1707488086; cv=none; b=u19bxAJaKJzlurQOvErGju53dAd8DdgC0biYH83s6f+dCtxbd2kn7DF6/+ybXlE8x4BnY51SBqREvETvhCLNjSZOh51ZjlgGCk+4Aqag5dk97bFDniIwauIC/KPnuCyG36Tc/m/ZwErOxb/MHHfrlfbrHHF/ICWQ1jwmn8XRtNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488086; c=relaxed/simple; bh=JCRIRi/ahdTVjHOVuAFtDP5BXnRzKIpZ4pHG+X6RGvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lmA9FIhb8h+vzsBl2Sl1mH2rWLrjHz1SbHcWVRpuu5SFxScag2MrXcq0HySlc9fpOiIHV5FECxbKT6kynD542tAo0xWP7rqiPorOR4VFkT13g7hqtDpc5ZzZQkTI3DwxjH2KmTszSSR814aGlUGu/gM0ibnjMCeRz6M18Q/zDvQ= 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 e8469aef8d66b243; Fri, 9 Feb 2024 15:14:40 +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 930B8669C52; Fri, 9 Feb 2024 15:14:39 +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 9/9] thermal: core: Eliminate writable trip points masks Date: Fri, 09 Feb 2024 15:14:10 +0100 Message-ID: <2475159.jE0xQCEvom@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: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790431332904582086 X-GMAIL-MSGID: 1790431332904582086 From: Rafael J. Wysocki All of the thermal_zone_device_register_with_trips() callers pass zero writable trip points masks to it, so drop the mask argument from that function and update all of its callers accordingly. This also removes the artificial trip points per zone limit of 32, related to using writable trip points masks. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 2 drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 3 - drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 1 drivers/platform/x86/acerhdf.c | 2 drivers/thermal/da9062-thermal.c | 2 drivers/thermal/imx_thermal.c | 2 drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 2 drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c | 2 drivers/thermal/intel/intel_pch_thermal.c | 2 drivers/thermal/intel/intel_quark_dts_thermal.c | 2 drivers/thermal/intel/intel_soc_dts_iosf.c | 2 drivers/thermal/intel/x86_pkg_temp_thermal.c | 2 drivers/thermal/rcar_thermal.c | 2 drivers/thermal/st/st_thermal.c | 2 drivers/thermal/thermal_core.c | 30 +--------- drivers/thermal/thermal_of.c | 2 include/linux/thermal.h | 6 -- 18 files changed, 19 insertions(+), 49 deletions(-) Index: linux-pm/include/linux/thermal.h =================================================================== --- linux-pm.orig/include/linux/thermal.h +++ linux-pm/include/linux/thermal.h @@ -322,8 +322,7 @@ int thermal_zone_get_crit_temp(struct th struct thermal_zone_device *thermal_zone_device_register_with_trips( const char *type, struct thermal_trip *trips, - int num_trips, int mask, - void *devdata, + int num_trips, void *devdata, struct thermal_zone_device_ops *ops, const struct thermal_zone_params *tzp, int passive_delay, int polling_delay); @@ -382,8 +381,7 @@ void thermal_zone_device_critical(struct static inline struct thermal_zone_device *thermal_zone_device_register_with_trips( const char *type, struct thermal_trip *trips, - int num_trips, int mask, - void *devdata, + int num_trips, void *devdata, struct thermal_zone_device_ops *ops, const struct thermal_zone_params *tzp, int passive_delay, int polling_delay) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -1251,7 +1251,6 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_ * @type: the thermal zone device type * @trips: a pointer to an array of thermal trips * @num_trips: the number of trip points the thermal zone support - * @mask: a bit string indicating the writeablility of trip points * @devdata: private device data * @ops: standard thermal zone device callbacks * @tzp: thermal zone platform parameters @@ -1272,7 +1271,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_get_crit_ * IS_ERR*() helpers. */ struct thermal_zone_device * -thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *trips, int num_trips, int mask, +thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *trips, int num_trips, void *devdata, struct thermal_zone_device_ops *ops, const struct thermal_zone_params *tzp, int passive_delay, int polling_delay) @@ -1293,20 +1292,7 @@ thermal_zone_device_register_with_trips( return ERR_PTR(-EINVAL); } - /* - * Max trip count can't exceed 31 as the "mask >> num_trips" condition. - * For example, shifting by 32 will result in compiler warning: - * warning: right shift count >= width of type [-Wshift-count- overflow] - * - * Also "mask >> num_trips" will always be true with 32 bit shift. - * E.g. mask = 0x80000000 for trip id 31 to be RW. Then - * mask >> 32 = 0x80000000 - * This will result in failure for the below condition. - * - * Check will be true when the bit 31 of the mask is set. - * 32 bit shift will cause overflow of 4 byte integer. - */ - if (num_trips > (BITS_PER_TYPE(int) - 1) || num_trips < 0 || mask >> num_trips) { + if (num_trips < 0) { pr_err("Incorrect number of thermal trips\n"); return ERR_PTR(-EINVAL); } @@ -1356,16 +1342,6 @@ thermal_zone_device_register_with_trips( tz->devdata = devdata; tz->trips = trips; tz->num_trips = num_trips; - if (num_trips > 0) { - struct thermal_trip *trip; - - for_each_trip(tz, trip) { - if (mask & 1) - trip->flags |= THERMAL_TRIP_WRITABLE_TEMP; - - mask >>= 1; - } - } thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay); thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay); @@ -1450,7 +1426,7 @@ struct thermal_zone_device *thermal_trip struct thermal_zone_device_ops *ops, const struct thermal_zone_params *tzp) { - return thermal_zone_device_register_with_trips(type, NULL, 0, 0, devdata, + return thermal_zone_device_register_with_trips(type, NULL, 0, devdata, ops, tzp, 0, 0); } EXPORT_SYMBOL_GPL(thermal_tripless_zone_device_register); Index: linux-pm/drivers/acpi/thermal.c =================================================================== --- linux-pm.orig/drivers/acpi/thermal.c +++ linux-pm/drivers/acpi/thermal.c @@ -670,7 +670,7 @@ static int acpi_thermal_register_thermal tz->thermal_zone = thermal_zone_device_register_with_trips("acpitz", tz->trip_table, trip_count, - 0, tz, + tz, &acpi_thermal_zone_ops, NULL, passive_delay, Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -184,7 +184,7 @@ struct int34x_thermal_zone *int340x_ther int34x_zone->zone = thermal_zone_device_register_with_trips( acpi_device_bid(adev), zone_trips, trip_cnt, - 0, int34x_zone, + int34x_zone, int34x_zone->ops, &int340x_thermal_params, 0, 0); Index: linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -291,7 +291,7 @@ static int proc_thermal_pci_probe(struct psv_trip.temperature = get_trip_temp(pci_info); pci_info->tzone = thermal_zone_device_register_with_trips("TCPU_PCI", &psv_trip, - 1, 0, pci_info, + 1, pci_info, &tzone_ops, &tzone_params, 0, 0); if (IS_ERR(pci_info->tzone)) { Index: linux-pm/drivers/thermal/intel/intel_pch_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_pch_thermal.c +++ linux-pm/drivers/thermal/intel/intel_pch_thermal.c @@ -235,7 +235,7 @@ read_trips: ptd->tzd = thermal_zone_device_register_with_trips(board_names[board_id], ptd->trips, nr_trips, - 0, ptd, &tzd_ops, + ptd, &tzd_ops, NULL, 0, 0); if (IS_ERR(ptd->tzd)) { dev_err(&pdev->dev, "Failed to register thermal zone %s\n", Index: linux-pm/drivers/thermal/intel/intel_quark_dts_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_quark_dts_thermal.c +++ linux-pm/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -363,7 +363,7 @@ static struct soc_sensor_entry *alloc_so aux_entry->tzone = thermal_zone_device_register_with_trips("quark_dts", aux_entry->trips, QRK_MAX_DTS_TRIPS, - 0, aux_entry, + aux_entry, &tzone_ops, NULL, 0, polling_delay); if (IS_ERR(aux_entry->tzone)) { Index: linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/intel_soc_dts_iosf.c +++ linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -229,7 +229,7 @@ static int add_dts_thermal_zone(int id, snprintf(name, sizeof(name), "soc_dts%d", id); dts->tzone = thermal_zone_device_register_with_trips(name, dts->trips, SOC_MAX_DTS_TRIPS, - 0, dts, &tzone_ops, + dts, &tzone_ops, NULL, 0, 0); if (IS_ERR(dts->tzone)) { ret = PTR_ERR(dts->tzone); Index: linux-pm/drivers/thermal/intel/x86_pkg_temp_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ linux-pm/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -346,7 +346,7 @@ static int pkg_temp_thermal_device_add(u INIT_DELAYED_WORK(&zonedev->work, pkg_temp_thermal_threshold_work_fn); zonedev->cpu = cpu; zonedev->tzone = thermal_zone_device_register_with_trips("x86_pkg_temp", - zonedev->trips, thres_count, 0, + zonedev->trips, thres_count, zonedev, &tzone_ops, &pkg_temp_tz_params, 0, 0); if (IS_ERR(zonedev->tzone)) { err = PTR_ERR(zonedev->tzone); Index: linux-pm/drivers/thermal/thermal_of.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_of.c +++ linux-pm/drivers/thermal/thermal_of.c @@ -518,7 +518,7 @@ static struct thermal_zone_device *therm of_ops->critical = thermal_zone_device_critical_reboot; tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips, - 0, data, of_ops, &tzp, + data, of_ops, &tzp, pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); Index: linux-pm/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c =================================================================== --- linux-pm.orig/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +++ linux-pm/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c @@ -60,7 +60,7 @@ int cxgb4_thermal_init(struct adapter *a snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name); ch_thermal->tzdev = thermal_zone_device_register_with_trips(ch_tz_name, &trip, num_trip, - 0, adap, + adap, &cxgb4_thermal_ops, NULL, 0, 0); if (IS_ERR(ch_thermal->tzdev)) { Index: linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c =================================================================== --- linux-pm.orig/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -423,7 +423,6 @@ mlxsw_thermal_module_tz_init(struct mlxs module_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, module_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - 0, module_tz, &mlxsw_thermal_module_ops, &mlxsw_thermal_params, @@ -551,7 +550,6 @@ mlxsw_thermal_gearbox_tz_init(struct mlx gearbox_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, gearbox_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - 0, gearbox_tz, &mlxsw_thermal_gearbox_ops, &mlxsw_thermal_params, 0, @@ -776,7 +774,6 @@ int mlxsw_thermal_init(struct mlxsw_core thermal->tzdev = thermal_zone_device_register_with_trips("mlxsw", thermal->trips, MLXSW_THERMAL_NUM_TRIPS, - 0, thermal, &mlxsw_thermal_ops, &mlxsw_thermal_params, 0, Index: linux-pm/drivers/platform/x86/acerhdf.c =================================================================== --- linux-pm.orig/drivers/platform/x86/acerhdf.c +++ linux-pm/drivers/platform/x86/acerhdf.c @@ -678,7 +678,7 @@ static int __init acerhdf_register_therm return -EINVAL; thz_dev = thermal_zone_device_register_with_trips("acerhdf", trips, ARRAY_SIZE(trips), - 0, NULL, &acerhdf_dev_ops, + NULL, &acerhdf_dev_ops, &acerhdf_zone_params, 0, (kernelmode) ? interval*1000 : 0); if (IS_ERR(thz_dev)) Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c =================================================================== --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -694,7 +694,6 @@ static void iwl_mvm_thermal_zone_registe mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, mvm->tz_device.trips, IWL_MAX_DTS_TRIPS, - 0, mvm, &tzone_ops, NULL, 0, 0); if (IS_ERR(mvm->tz_device.tzone)) { Index: linux-pm/drivers/thermal/da9062-thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/da9062-thermal.c +++ linux-pm/drivers/thermal/da9062-thermal.c @@ -197,7 +197,7 @@ static int da9062_thermal_probe(struct p mutex_init(&thermal->lock); thermal->zone = thermal_zone_device_register_with_trips(thermal->config->name, - trips, ARRAY_SIZE(trips), 0, thermal, + trips, ARRAY_SIZE(trips), thermal, &da9062_thermal_ops, NULL, pp_tmp, 0); if (IS_ERR(thermal->zone)) { Index: linux-pm/drivers/thermal/imx_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/imx_thermal.c +++ linux-pm/drivers/thermal/imx_thermal.c @@ -700,7 +700,7 @@ static int imx_thermal_probe(struct plat data->tz = thermal_zone_device_register_with_trips("imx_thermal_zone", trips, ARRAY_SIZE(trips), - 0, data, + data, &imx_tz_ops, NULL, IMX_PASSIVE_DELAY, IMX_POLLING_DELAY); Index: linux-pm/drivers/thermal/rcar_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/rcar_thermal.c +++ linux-pm/drivers/thermal/rcar_thermal.c @@ -489,7 +489,7 @@ static int rcar_thermal_probe(struct pla &rcar_thermal_zone_ops); } else { priv->zone = thermal_zone_device_register_with_trips( - "rcar_thermal", trips, ARRAY_SIZE(trips), 0, priv, + "rcar_thermal", trips, ARRAY_SIZE(trips), priv, &rcar_thermal_zone_ops, NULL, 0, idle); Index: linux-pm/drivers/thermal/st/st_thermal.c =================================================================== --- linux-pm.orig/drivers/thermal/st/st_thermal.c +++ linux-pm/drivers/thermal/st/st_thermal.c @@ -203,7 +203,7 @@ int st_thermal_register(struct platform_ trip.type = THERMAL_TRIP_CRITICAL; sensor->thermal_dev = - thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, 0, sensor, + thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor, &st_tz_ops, NULL, 0, polling_delay); if (IS_ERR(sensor->thermal_dev)) { dev_err(dev, "failed to register thermal zone device\n");