From patchwork Mon Feb 12 18:26: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: 200004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp113604dyb; Mon, 12 Feb 2024 11:06:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVsmkJRLMAjDaxfqsTV+SNo25lpOK7/nDLy3VL8jgRHn142bZN6fBMfHLfKBdalR68uoyf1n6kpTdPlQzWQHLteHuw+WA== X-Google-Smtp-Source: AGHT+IFm0asjJhCGWfCCPDQey7rUHFyVFIS+2L+BbYCFdqn7KdkLwUaVcHIsQqEHPHrCiIMjxZ55 X-Received: by 2002:a17:90b:155:b0:297:3c67:7763 with SMTP id em21-20020a17090b015500b002973c677763mr1915964pjb.7.1707764810310; Mon, 12 Feb 2024 11:06:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707764810; cv=pass; d=google.com; s=arc-20160816; b=YnMvxpx8k4gqfVfnx7xK8elK8Y7SgCSQmsxY3Xp054/jLDLZb/SIUx6QbfJcr29Gha JuWqxdHu2c9NERXtLqbeuVFk0HjUYEfm+05l1UL9SgThp9Fcldr/iV1Ehh/Yla6A53QL I1N1mWIwMgjeeOMqPfEPmqRR0rXYk+cpbDMgWeIaI37QZe+l21AIXHt9pTwNuyFLPIo1 6Ia+40+aY076zW3aK8WNRy5TVAidd92KXUe6isdtCLiy//h5f3erJFnmY3ZMxCG/WI02 VmzxvTmBChLD2tFtRfWL+iuOm12rhxzJi+0R7XsoPMPMmcp1vnlZ7CRh7aWCqf2lsvOf i25g== 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=ZIIQSbWCUh3cm7UFrLeilfOk83hsde6d1/LgaLxD5WI=; fh=xKCOAJ6PtubQ7jY1b9GtcFOvecoRYi8hth0+0/aHbKM=; b=rcNsS3LyxKAF2Et0VU0Izsf6xVKk4N5F+hrkZxFrEtFcQ3NedLQGxr+lb1oAKVb/43 9I9zRb6+bAT533hPaCp5xas6UOyPTnk6Itxq7ZvNCw0nl+8fXMNeTdfsTDc2/wI91WbT YCjxTSNe1fZia9AiTz9OXy+Jd29zPLu+CGKf2DMfJ0tlDR5b3hfh/eiaK/D17fcX3PME 7k9pQaFknQgZ+Ny6oFxPcpdNxh+GDdqui0rYvCDcGGEvwbpyR/Z2vmlJnGqjX3Ycl37u Vv3DAz/eBIGy8KoPqVs9M5V0FWckvCx+l4AmsDRHjFZe3H5rlwvhascq40ha6xBX3rkp GKOw==; 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-62214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62214-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWMKSLgb8+8qSGWuDukkgvLFRf9zv45tH0tJk3NkrpvTolJfFq5BVg0McyOOjjlaCwXVLkNtoOgGKfMCPXbParJUMSMXA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gv2-20020a17090b11c200b002972f04d56esi666005pjb.147.2024.02.12.11.06.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:06:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-62214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62214-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4F2EFB280AB for ; Mon, 12 Feb 2024 18:46:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98CEB4F60D; Mon, 12 Feb 2024 18:42:40 +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 B8AA7481DA; Mon, 12 Feb 2024 18:42:35 +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=1707763358; cv=none; b=CRwUpA9+m+6qg/iB2zfH+v5fVElA/qSIAITaezlS5Wl9uSt8+peaWfdcXWEaltiw+VNHLS699zBHEidUaiBHVfb+hlyboc5xxX0chYravo8uD133Lc1VPJh3Buw4GT3wsRu8oDndWAXdMqgpRNQFpJ0egdo+YNVN4RlRC6zCZHY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763358; c=relaxed/simple; bh=ruCrcRG0ZxbpdLcx0rWNmfXeUOipHCx6oaOxdYBpTi8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FmNQfk/VYn2CjH4yL32389ZPx0exw9W8G+4kVDgrjOw4guBREOtN/jIM3j4Q2lvDOYt7Sr078yoEzXcD/y+C7UQBvdMGTLdRungEvrnj6iX8O27P0qdVrwsZYTOz+lv2eqSGoQq/KvbuoqvzFi4ekZ73HcMdqP5II+MJUSxtKV8= 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 f4cc19245f191df7; Mon, 12 Feb 2024 19:42:33 +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 3CC00669CF2; Mon, 12 Feb 2024 19:42:33 +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 v2 1/9] thermal: Get rid of CONFIG_THERMAL_WRITABLE_TRIPS Date: Mon, 12 Feb 2024 19:26:25 +0100 Message-ID: <4545870.LvFx2qVVIh@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790721193686921240 X-GMAIL-MSGID: 1790721193686921240 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 Reviewed-by: Daniel Lezcano --- v1 -> v2: No changes --- arch/arm/configs/imx_v6_v7_defconfig | 1 - drivers/thermal/Kconfig | 11 ----------- drivers/thermal/intel/Kconfig | 2 -- drivers/thermal/thermal_sysfs.c | 3 +-- 4 files changed, 1 insertion(+), 16 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 Mon Feb 12 18:31:28 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: 199994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp103666dyb; Mon, 12 Feb 2024 10:47:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0ZmD2hK10j53nPdtIPj2+ea0LELmrAR+MvPHl8F83fyjZQUi+xlXu40GX8w3eBx20B2tR1xBAL5wVj6SW2XlOZu9+/A== X-Google-Smtp-Source: AGHT+IGC9asuKVm4+ljH7+8d3SDaJhDz8tjhP7S1UJxbCZENMMh5ERnidp8Z8r0HpLO5SSULt1Zu X-Received: by 2002:a17:906:cd06:b0:a3c:d535:3977 with SMTP id oz6-20020a170906cd0600b00a3cd5353977mr1374281ejb.7.1707763657005; Mon, 12 Feb 2024 10:47:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763656; cv=pass; d=google.com; s=arc-20160816; b=XCLyyh//NLF7z+CM4g1I4nmR9VRMx8VuXbPDOISP15PYsoMVKsGS/V0qew08ctXLoC iyCpig/7AQ113rSOeIATnvPPPgOXY6eP3cN6CCDzehuWyEq6LBNTpNA9dE3xW/MVENIf PE6NbJp1iUhCiPyZkKLs+ofA6NJiJHvqEXxwI7yT3dDhqdsmGfxE2XKm2XS+G19p3KTn g+k4ikb35Ai3j1/tymAOo9o7Bi0kCLcpbV/m5uO5TwM3KBOjqdU0/pohOO9OBMac3eF3 FHSMmrX5rRhaW2wtHU4iekxRmpyXDTVSeG88ub8viTlk8a2ewfeso/mIOALEPwymhsVb Z7zA== 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=J1e7XlNMzvlJzU2W/K3Jz9Bj4z05oMK5UNarnuq7Y2o=; fh=NFiz2TfHL9mag3aiP6Sb13KLiPiPydgpzLzo7v6qsI4=; b=ltVFR3VcNZE1SPU6daxA28q2AjIGSlJgtiUUuCSRDDxKId7Bp0z7ei4vKS0y17OEtc l+H3UWS15TCFUl/dk67hDKIXdZBs8yBxTJxzW3MSCAlPFeg3YjZlUisZhofY/mUiko2e 502T09vGT2Cgvv6v5y952nBLDZrtKwPQmfVOptoMTPFGMnEhmuBbm1FF5jGHLyJkyRmE CIN5J3BU/QZskOjMj45HRKYtHBXcCaULaX62bFu/1x3zqtbogvikp49AYU1JGc2hLm2e iS6xedWaLSf065nZrl1TfF581PzAqnpE4WNZsfFQTmRD5XmJGy6VQeBDg7PX28VFMqAB TIvw==; 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-62213-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62213-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXobo74KJ6l19AdOamEwPGmUB/MCFTvoJRNL3w7kHpQ3u6HkMHoArGKPFF+s7A0KUcQdv2fqq4FuGmgemosTxnf0sercw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lr19-20020a170906fb9300b00a3c1912fd99si398023ejb.764.2024.02.12.10.47.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:47:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62213-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-62213-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62213-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 E53961F24B00 for ; Mon, 12 Feb 2024 18:46:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98EAE4F610; Mon, 12 Feb 2024 18:42:40 +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 0661F46B80; Mon, 12 Feb 2024 18:42:34 +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=1707763357; cv=none; b=mrHi8YdNn89XSnWRyblASvs42OdU7tFVxE3fOw+tdxCrkruveO4r96KtKk6Ig0m1WQlrkdxSLLmBxOkuXTCOwLzfIzAlIhPbfDAitsq8e8fs4zFwNksTYMuDKzeGOmdAHESYUlV8cBDs7lLruliBP0lWUaS3pCzGGk5mKY+nBxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763357; c=relaxed/simple; bh=wj2ycacNWn0hCZghvwjFNw/BDfk05TWUJ/+mzHxUew0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SMYutbaljkvUsnMYxH9wuOrVPihTOIAyNKJ5X3OFLhrQ0L1qtTCaV55lXIsyyClDnM9MCmeIBqgTSQXzplcxPK2tRCk5oZXiubK/lGpCehF0QJ8PbDHb4rpT3tfpkvwRqPZjnU9+9LJUkKRZmJSh2plcICZhUNYsohUhdhvyguM= 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 2db039505757ed15; Mon, 12 Feb 2024 19:42:33 +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 6B485669CF2; Mon, 12 Feb 2024 19:42:32 +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 v2 2/9] thermal: core: Add flags to struct thermal_trip Date: Mon, 12 Feb 2024 19:31:28 +0100 Message-ID: <2173914.irdbgypaU6@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719984193025481 X-GMAIL-MSGID: 1790719984193025481 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_FLAG_RW_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_FLAG_RW_TEMP or THERMAL_TRIP_FLAG_RW_HYST, respectively, clear in its flags. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- v1 -> v2: * Rename trip flags (Stanislaw). --- 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,23 @@ 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_FLAG_RW_TEMP BIT(0) +#define THERMAL_TRIP_FLAG_RW_HYST BIT(1) + +#define THERMAL_TRIP_FLAG_MASK_RW (THERMAL_TRIP_FLAG_RW_TEMP | \ + THERMAL_TRIP_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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 Mon Feb 12 18:32: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: 199986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp97592dyb; Mon, 12 Feb 2024 10:34:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVWUFIUZjmTc67cnxL3SBvxBmqWWrK/0mZsQ8AxZMCUrqz1hiPNPk52HG7BkW3bOxVzglFB2z0BYp+KasSqtSuV86zm/Q== X-Google-Smtp-Source: AGHT+IE79l+K7GnYyhP/FUDdSQ6cfa+vb3R1wSqpu7WrblwhalcIh3jZEE54R+axh86tvenwCm8w X-Received: by 2002:a05:6122:4a02:b0:4c0:774b:e7b0 with SMTP id ez2-20020a0561224a0200b004c0774be7b0mr2815289vkb.13.1707762856565; Mon, 12 Feb 2024 10:34:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707762856; cv=pass; d=google.com; s=arc-20160816; b=bfWmi615kfBFjAqTcjBLfIB2JJthpxrZEW4MtPnKrnxiEmvgf5q1xxw2NtFWWU7xUy 6Uyp/7lQI+toJ2Zu9olcAoCXPDbaWJHZtZMJsKfcjvaIUeJBy4Fzz71eZW5pV6H9U7N7 +OLWu1ImCuIWN1+YFbbfWPiu2tHTHskTGzd/PzfGCXnDMBxVTMA3NaSPo68yt0QHYTBb glHA355jzHwB21HemFqZc2v6dEscANBD/a1LFeA8Wqyoo2aWg7cu97ByOc2OGsZSZMaB vyWeLc/0RM1Ol94Do1NoJNF6oIGhTQjj2hjKBpIKLMnvFLpyuWBwseSAPd6KHfsTYtTV Kh+A== 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=IiZ0Exc0MIsyF6LGnDtPZownC2ijEUaNVLs4VWvG1oo=; fh=9jA7LfOT8YyArLm2ARFTLl9FjzHhezYV9UFC236xIhQ=; b=Q2fQgnQm69N4CqAPL8ZmJiZ85hS+JuxSRODGJ3noeALzatKIkLhgSquiD5LodaBgPc nfqS+siPvYxXID1qzuVzX6SRxYbeuxgEGJBWa/qDU+jB5oZVN5O27MB4HkB9+4HVl8xt E9AIjuavhSPENnyyyVgVykKERka8IaP8kTr7vT1ypxvyRDaAfBG/IbFVVZ2lIx4tcAKA goLewdXUZpMUVmJJWCF1SzgXIAcXpRxqlw+AY1/gr6hafcSUWiR676BBWwdL+jmsv2k3 zY9xEGqkPTFeKi+TiV80ApumMbTd6o2WU5YhM0dbORM804Xl3lwBxoMjhI2z7QHyPXRz L9nA==; 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-62191-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62191-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUKNW7cTjdDB6/z4RvjTxzessY6lvguJL7F4lz0SQot6lM0KnSsOETNy+7XeJJC0Ipy5TcOhqBY9rmkeqpACF5PgqbfKw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x197-20020a1f7cce000000b004c035017a89si773733vkc.9.2024.02.12.10.34.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:34:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62191-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-62191-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62191-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 5794C1C22261 for ; Mon, 12 Feb 2024 18:34:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A0C9495FD; Mon, 12 Feb 2024 18:32:36 +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 128FF4177B; Mon, 12 Feb 2024 18:32:30 +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=1707762754; cv=none; b=U7jhtK+VTE2jJ4nksy6nTkfVGTigEv8OHmF6Wsuk0/sFNE3FVLUsacn2U12bbodT5qal7KpiMpglg2BiRjusstKnxBFDZdRQJpxQjdYQCEMPXYUFL3N1RO4OIHwhNE/0Zpj/u9zrxnyGUymh0L+uNOGxO4Afp8VOeOF6ir29ej0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707762754; c=relaxed/simple; bh=CAquiAoDz6l8jCWNqD4aTMheP1lm5Iwrax0hj6KxiJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bp0xBdYjA2X9kv+vFPh1Ht2gGOyRQZju9CdUPqNM1DSjTs9q5ceS91Sco9XnDXFCP5R+5YICMr6CzOBSR0umxUEnL5ryaGORprRcQcEHyCDAu0bStWE/4wuAkljv39kZN9uZJ4qWlZKtgiW+/ZHqGwL0bqs+/T25QqnMV/usXtA= 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 d97140acc63546e4; Mon, 12 Feb 2024 19:32:22 +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 39738669CF2; Mon, 12 Feb 2024 19:32:22 +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 v2 3/9] thermal: core: Drop the .set_trip_hyst() thermal zone operation Date: Mon, 12 Feb 2024 19:32:16 +0100 Message-ID: <2923201.e9J7NaK4W3@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduuddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719145375439707 X-GMAIL-MSGID: 1790719145375439707 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 Reviewed-by: Daniel Lezcano --- 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 @@ -91,7 +91,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 Mon Feb 12 18:34: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: 200005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp114040dyb; Mon, 12 Feb 2024 11:07:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXh9Cqb3o/D/Y3RMWrA/PolzKkGAvNJP/vPUxUSE/iM4EG4S3vx5Th/d6sxBy9jl6x7TCUcFLnqQVWWDcfIFUtWkzYapA== X-Google-Smtp-Source: AGHT+IEXzeOT+BN2HM5QLj8GthT6AJBuVT3jqGQzecECcCM2h3LNawd4FPPaMc9Qcbs3X/jsAL2p X-Received: by 2002:a17:902:b70d:b0:1d4:e237:2c3f with SMTP id d13-20020a170902b70d00b001d4e2372c3fmr6303189pls.28.1707764861084; Mon, 12 Feb 2024 11:07:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707764861; cv=pass; d=google.com; s=arc-20160816; b=udW4/YUiuxmTYv1MtKNqaFPKPyIwZSAmvR3rLfgYLc+o8I8EwMs3DKHiJpXKxdk4OQ 4CGn12Wo6awlzHFI5FJhD0GkwZKtBSiuk0r2oe7s09PkkSVTJ0VAbi3uKHTfwRjo9awz dzbWLxMA4giclCSUTkXQnANhrwRRA8XdKG3siHt0Jr4QWRkAUbISgBZIk580nUPh89zB 5GBWy4aeTFcdPIWQ+rd6Gr/0bcOpuYj6GW7gnvIhP8ZjraoV5VLbGgo/Gihsvat+3ly9 M50rHfTkFyunr/+ziUb9ZDmXaHA9cxsnLSQb+mehilX+9ua57INr0SVrl5MjsZToX4jN Sx8w== 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=jmLRNwn9NNG9zBUySTY4Gs+lLEtwfzdaUWi5oXQQgvU=; fh=638tNM25oTJZuGKg1IK0V12pGEu0JWUZpeCFRkrUHpU=; b=au8lxpAFMTzo4wRQyGzLnj/Wra2KiTPPXc6OjprofCosssqvnWuYiN/ABnj3QI0fVC LI7Jexg+0gusZh+TgalHGdMhhsPwNu96uIlXJihl6km3ciBWXibxT7HJwpSquWw++zri 5HpqmHfyQfMvfsWCa5yx+YKQ8QwtGsEGmdkl0WmnEq63tS9eK236EQ5GnARaoxMv8G08 UCaNEIm50Gq15n1jRylTP4sny+0ro3ExzK+0C4Gtetxs9FJFa77T9prWJLkSOeip2WUL Qqy9p9Zz63zrW1UfhK3htU5BOjN3h++PSvzwMCoo0i+XLPjAiLwVMbdwE8QZ2cEfHBL7 kF7w==; 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-62215-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62215-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUP8bOOtEdA3k4l+rSKdzUN3JE1iNh5U52ZnRiZffBwMP3xoeDlazePkLl64dC6x7XuwRFH1SEY5g8CxJVPEw/+RljOBA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jc9-20020a17090325c900b001da326d87c6si623638plb.576.2024.02.12.11.07.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 11:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62215-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-62215-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62215-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 26B3EB248A3 for ; Mon, 12 Feb 2024 18:47:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6CD450A66; Mon, 12 Feb 2024 18:42:42 +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 645114177B; Mon, 12 Feb 2024 18:42:34 +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=1707763358; cv=none; b=TdUAg7y+Qq2BFtZR2dp+2rl/IMS1zylZl7mqmRc42sNzOF8PMN2L/BhVqv3+Um1B9x0Zc+5Tvqwse5YJOTFOn2ZQzG8im/3ExslJ8+CyC5PcfGl24yy0Y1DnRM7SryMVXFdjh1z93MMqlX4KKVnTJ2+eTKq3bApb4UQJvpHeqto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763358; c=relaxed/simple; bh=I0n3eKMbeJmz0hNopSpneoZFlwuzrzp07xsp6t0TQaI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uBz/OtooyKBucB+jPqjZmzfNLVnnLkwYXumMcIVq6twt0oSFFpBBytKvPUdKGn1+z4jP7xH8Wj9htdQbKpza9tkLKaKURWMDP459IbKeDZq8p7Y1YtTgMz0Uj/ZhhrPGSH6iJDkA2hmEBp8E2DjyRFj322ZXUE9LO6Qj1AF4Ynk= 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 7e09b6f7bc94f114; Mon, 12 Feb 2024 19:42:32 +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 A8D2C669CF2; Mon, 12 Feb 2024 19:42:31 +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 v2 4/9] thermal: intel: Set THERMAL_TRIP_FLAG_RW_TEMP directly Date: Mon, 12 Feb 2024 19:34:25 +0100 Message-ID: <3281804.44csPzL39Z@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790721247140724270 X-GMAIL-MSGID: 1790721247140724270 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_FLAG_RW_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 Acked-by: Daniel Lezcano --- v1 -> v2: * Rename trip flags (Stanislaw). * Fix build issue in alloc_soc_dts(). --- 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 | 32 +--- 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, 50 insertions(+), 71 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_FLAG_RW_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_FLAG_RW_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 @@ -321,15 +317,16 @@ static void free_soc_dts(struct soc_sens static struct soc_sensor_entry *alloc_soc_dts(void) { struct soc_sensor_entry *aux_entry; + struct thermal_trip *trips; int err; u32 out; - int wr_mask; aux_entry = kzalloc(sizeof(*aux_entry), GFP_KERNEL); if (!aux_entry) { err = -ENOMEM; return ERR_PTR(-ENOMEM); } + trips = aux_entry->trips; /* Check if DTS register is locked */ err = iosf_mbi_read(QRK_MBI_UNIT_RMU, MBI_REG_READ, @@ -337,13 +334,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,19 +351,22 @@ 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_FLAG_RW_TEMP; + trips[QRK_DTS_ID_TP_HOT].flags |= THERMAL_TRIP_FLAG_RW_TEMP; } - aux_entry->trips[QRK_DTS_ID_TP_CRITICAL].temperature = get_trip_temp(QRK_DTS_ID_TP_CRITICAL); - aux_entry->trips[QRK_DTS_ID_TP_CRITICAL].type = THERMAL_TRIP_CRITICAL; + trips[QRK_DTS_ID_TP_CRITICAL].temperature = get_trip_temp(QRK_DTS_ID_TP_CRITICAL); + trips[QRK_DTS_ID_TP_CRITICAL].type = THERMAL_TRIP_CRITICAL; - aux_entry->trips[QRK_DTS_ID_TP_HOT].temperature = get_trip_temp(QRK_DTS_ID_TP_HOT); - aux_entry->trips[QRK_DTS_ID_TP_HOT].type = THERMAL_TRIP_HOT; + trips[QRK_DTS_ID_TP_HOT].temperature = get_trip_temp(QRK_DTS_ID_TP_HOT); + trips[QRK_DTS_ID_TP_HOT].type = THERMAL_TRIP_HOT; aux_entry->tzone = thermal_zone_device_register_with_trips("quark_dts", - aux_entry->trips, + 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_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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_FLAG_RW_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 Mon Feb 12 18:35:56 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: 199992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp102858dyb; Mon, 12 Feb 2024 10:45:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnFA8eMmw+0OBjWVWCOtmx+ZtRdRLmbcglFEbLdRtACT3niFs1pLDhuTDp57EGy8wLuC6gKKMBYu5uGLQPaSqkDiE6rQ== X-Google-Smtp-Source: AGHT+IG6uQE1kWi80VmkBQvGrGshe5inZoo//fSXiqjDNU5d4pE83s9aoKXCJ2//Sl1V77aTJoHJ X-Received: by 2002:a05:6358:63a2:b0:176:7f77:a2b2 with SMTP id k34-20020a05635863a200b001767f77a2b2mr6613258rwh.5.1707763544812; Mon, 12 Feb 2024 10:45:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763544; cv=pass; d=google.com; s=arc-20160816; b=0LqAIdrT8J/gmgwjE2v3MsbgZxbgWh025ZgedOAa8QueDtNFYSOM9nI6ZOrSJjm4re rkYBaRxIz/gNqfnFWyiFph0RppbcbMLdjPoTjLayz2NX4FXMk4lvECBZPaQDDmDlu1ZC BPrrF6IXkEGZjdFLbu606iqE1vVYMu0TO9PXNDFLxAHveButlCvmy0BETifbJVeSXoc+ 2lUvYlKk1IDaLF0FSvIEPcDbD1GAomD4EXj/SWh7tNsab88EVA/FUq2rnA+PMJNgVZPt EvEKjf/wHn3GXkdAzguzTJHCB4BP74MjZtrJ4Cu0xyn7Gomm66aPA1IBdcM0jqj3WVtF MpYQ== 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=bk3QgvXQpwsG7ZAP15POW3QzTr1LoU7QHwRM+r+EZB0=; fh=KOVqOGPXr0b4ma5o7Q15gisH9KZIx2EbWfCxF49ABi0=; b=ocqcqcWOi4jfZ1lzG49HT6bKwGf52JgJOx1/9GI+BgkU9sV5hlIQFPNNPZdigrpMkI +6WBLs1Ptw9iWsa1XJwlcQBe1TsNm48DWRJv7FmtFiPGmMpr9kxND36N3ri5MsMyfDvI wZErgGK3reqgqS81AmKBQeXK9rmQ7wrysFTJoTMMMCEVDSc+S3q5w/sbD12mPOZaVqGI i2+19Dt7YRlgpyu2/oyuh4qdSGWgC8HOu0DRg8XDReGOg35gPxGaKfemrWt8ZjEaD4d6 XnnBu4uZ43JdFUrfBUVWT6IUonYMp9K7Jiuv/Wdou/yUEpujDKpKU8j0Lef3V1Y09HUa Z0GA==; 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-62212-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62212-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCV+QlO5ZfXHtMDZn/Z8VQjGhhv9DHsHRjRPfiZTcIxsdhyCxDTq6lCtZFbD2Bl53k4a4w6Es5xu5UJIWGOpD4k3CxyWeg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cl15-20020a056a02098f00b005d73546a5dbsi603200pgb.529.2024.02.12.10.45.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:45:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62212-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-62212-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62212-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 F402C284926 for ; Mon, 12 Feb 2024 18:45:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B688D4DA0B; Mon, 12 Feb 2024 18:42:38 +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 8804240BEE; Mon, 12 Feb 2024 18:42:33 +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=1707763356; cv=none; b=OwOGur65AS2LCue2FUemDaxLwkegZaSVg5XgCBTItDKPuNV6Kj6gh48h+nkck6w/o6sA/WG9ZlyDBfqjQr1Km47sSszaBCMN3rYWM53zctxFxlD4TZ6P0Qd8VgpgW7czm5rWYs0pi4jzopm9iG2uzXpvapD1gn4AYeQVQ9JDLIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763356; c=relaxed/simple; bh=hOAifuosbac6a+ahRRhg5YVd6cXd/8T1Y8QRCjzuvWQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PF3P50Q5DEBljR1yTgvA7KFkIBEIY7kEhRTdp+30/V/rGRecaRmr3BrDoSNO97an7dZAQCVkIVJB0o1cHULmCt3eA2yjOu5tzMRHNwirlw5rb0zgq4Ch8s0jQELRDCDyXESXEZ+AqXPJIRpN0OWo8T6/CcNaSSbo0Ie1+eInPEY= 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 e215d587004f3844; Mon, 12 Feb 2024 19:42:31 +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 DB91E669CF2; Mon, 12 Feb 2024 19:42:30 +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 v2 5/9] mlxsw: core_thermal: Set THERMAL_TRIP_FLAG_RW_TEMP directly Date: Mon, 12 Feb 2024 19:35:56 +0100 Message-ID: <10417137.nUPlyArG6x@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719866712014471 X-GMAIL-MSGID: 1790719866712014471 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_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 Reviewed-by: Daniel Lezcano --- v1 -> v2: * Rename trip flag (Stanislaw). * Add R-by from Ido. --- 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_FLAG_RW_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_ASIC_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_FLAG_RW_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_ASIC_TEMP_HOT, + .flags = THERMAL_TRIP_FLAG_RW_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_FLAG_RW_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_MODULE_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_FLAG_RW_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_MODULE_TEMP_HOT, + .flags = THERMAL_TRIP_FLAG_RW_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 Mon Feb 12 18:38:07 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: 199991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp102420dyb; Mon, 12 Feb 2024 10:44:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWcAkuutXYtBpe6azOfgAV2CU47KTmsPT/FnrKwCkRaGY3HiIDZZNJYqzN8U3Ux+t+oYS2V/wBRTDYH0D6pul28eZh6Pg== X-Google-Smtp-Source: AGHT+IGA36QgaLGRV6YN0wFEzjorE993A5oM0dcKb6ZZv9QYwh9souOZBSP6AcovrXIO1k3ViLO1 X-Received: by 2002:a2e:7d11:0:b0:2d0:e4e8:c999 with SMTP id y17-20020a2e7d11000000b002d0e4e8c999mr4476607ljc.3.1707763490803; Mon, 12 Feb 2024 10:44:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763490; cv=pass; d=google.com; s=arc-20160816; b=c6ZjgLSJfdZR6UnkyRutEf3brL6/8Uk8UfFZlSxwfP7TXgK9yQVnGaJNa1w1Zoz8Jy E/HucCrjNbODlSOqwk/UMm7tabGXoOxixp0FU+qVUEkXAU+CGC1naaNtuJnTzA+HHi7E dM1DFE3Kplb0X9883Gbi+diZdK46hWtzWsYC1Pqg5ifvwMNhg6oo06kqx30SLNqUdI00 Qha41GXWk8nYdsjcGImyva3Sn/OO1t21iqGXyS5JU79GAXg4lPdTlnQRjoqmJz3pFW4J Fpj8HX9+QIJqVcMQIlUGmTWOBZJpheYjLfkdBlUKWJ5kQJiFOa35YzwTnuaDorsVlOjD ZJZA== 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=vhY0L/q+gYzWXX9S6sUejlhI+rPSgEyGab12EG2fBqA=; fh=YCvah8plCBl1aXQyX3LpO3L2infw873NM+962Ii7B9o=; b=bjMo/CJULQWDS3vmek9tm58zTYEeGmwGq344HSrtDYYTSoOFcfskH1k3atroZaZ7lp o4ljIosSdztH3yFjJ9OISkmwTMMDcNbR58l9AUiZr1cI6C6O0WRgpxg19nh9wblXa7LI MMZZPRz9sWrlTX3Jh5r77mCeDv54JFKcWH5mCO2PNIdpDEg2VFeCjAdFuWfumYRA5CkE zZgUb5Y+r2HNG6mnGA8+SMAu5XoZSUVfXKtDa/CKAuEM2pmEXnfY125tN/oVtVu4eB12 te9CBHR/egwpDrMH0Ybugb+A2DirzexMIXAd0rcIJU//1fe1zETooibkNzps1ocd0fUG aLvg==; 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-62211-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62211-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXPBU2zIAD6vmag149CVpFV+Ebhurk9L+mhk1usRIg0K3iazNtwsL97DEJUsxNWPZ+n16Waz5jMDRhxiP3TVQUBhzt2TQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e7-20020a056402190700b00561d7e8cf17si448457edz.152.2024.02.12.10.44.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:44:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62211-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-62211-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62211-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 653461F23C74 for ; Mon, 12 Feb 2024 18:44:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2309B4CE06; Mon, 12 Feb 2024 18:42:37 +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 AC21B3FE44; Mon, 12 Feb 2024 18:42:32 +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=1707763355; cv=none; b=kZj2N1GMp61RygJFLN6KheHfv5jwLd5Gu8LoouABzpFn9CsAg5pZ8cPaWL42zkIGzj9PxT1YFaXGfMw7Yg8Xg7OK0fKWWy4Jmu9zHy41UDZ/oJ79cTSqVR6ufya9FIAbNgeRQRdvsZzu3HX0wpNBU8q46XrdIfV0+HR0MIFO0XI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763355; c=relaxed/simple; bh=0fjHyFCgQiCJ7Xf9wqWXnNvGeNJWsCVj3Z7wFx692qc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ogUnMkS7nCblb10QkqU3rySOZBGpWtZ4Rm9oiJlxmMwaIEvbTmac0py1hw4x0MiPz00D8dB/LAu+CGhV+OIdGu4oGLEFmL7qfD8M27e9eI5Q0XcTIEMdGq2xuIOGBmLKcEAnzO3tVhnLrPIT93owoBoKFozxmzPQxl3JTcKiFSw= 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 e1f8ca868e59d311; Mon, 12 Feb 2024 19:42:30 +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 2107C669CF2; Mon, 12 Feb 2024 19:42:30 +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 v2 6/9] wifi: iwlwifi: mvm: Set THERMAL_TRIP_FLAG_RW_TEMP directly Date: Mon, 12 Feb 2024 19:38:07 +0100 Message-ID: <22182690.EfDdHjke4D@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719809841514919 X-GMAIL-MSGID: 1790719809841514919 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_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 Reviewed-by: Daniel Lezcano --- v1 -> v2: * Rename trip flag (Stanislaw). * Fix coding mistake in iwl_mvm_thermal_zone_register(). * Add "wifi:" prefix to the subject (Kalle). --- 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].flags = THERMAL_TRIP_FLAG_RW_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 Mon Feb 12 18:40:34 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: 199990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp102276dyb; Mon, 12 Feb 2024 10:44:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXC1S7kK1N7Lv3Jxdbi44fHqMyfMvsaxjxeWNjgBJgI9lgvpAkcp6MgDAUZNvV/gsUJsznLRrunm7CwdhZ+wlNQ0/ZqNA== X-Google-Smtp-Source: AGHT+IED5hy5spkAHiEThOAAcSHWilhZkPXNe3dEKyeuV3q834UiDgELrN9xlwGYd+XMLvA/WU2+ X-Received: by 2002:a17:906:853:b0:a3c:3612:c2c6 with SMTP id f19-20020a170906085300b00a3c3612c2c6mr5123090ejd.8.1707763467339; Mon, 12 Feb 2024 10:44:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763467; cv=pass; d=google.com; s=arc-20160816; b=T3iJmKdR1B0nYXOn8IJJvwBobq9HxaA4oe2mmvGbPmOVSV3FqaQekv2iTPCsJFRn10 Z9x1wkTeZkYEwgk05HS9Ask5bK2Q+f6iVXVMENzf3MCfrBbV+0uohvi0oPJvMlDrGFB5 fXy/XQgRqUXaf5blIFtijb8CX6pDwa+ZRHuaTed9R/BGhVm1xTNKKtIQQuhOX28y2y/b YUPUtrsjB3F6vk5AJzdvY2TH8vXJR55YdURbhh6Z6bRKQBExCj3PAGxhYniW+eAH4/tK zTeujCPz5qFhyJ3fDajxEHpHaziKLLwx5hxiNJH1/yrEYstMwC4Z3k5UYLCLMq9JsCFB WSnQ== 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=qJ9BAfTEHUYsBR82jgQXCHJtBKONbaGbUj7R5mBp7Sw=; fh=BjgPVHxVFysxdEbdtaGB+dUOZNJlyif2jow3PN0P9mU=; b=hbBuwZ5La/5RQtmrRiHHZCIIPSuxgOBD4pFtSdjyf/cbkW81lzutrKndkRUww6sSAE 9lNZ22AKNGpZ9ZFyYiSHoKDG4pVXNA4Rz3M000R8+QZmPlkfp+LRtiHcQQ7xtp2AFUeW ih48CwOGZAeslDbHf1uEzx1W2tLpPVgN/0HuoN42KoYR8zaQ7iM96/wp2un4fDaLt/If +nkq6QlBsEL149cH3N1n1FpL46Bz0c8nPeC7aahEnx3KrCuesTm16b9f8tcA2NSWAXT4 eKr//0iT8DMxFD0UhwuYBBvqYWzB5tYCjZb63zbpVQw7O3BRvHVtxtHYvqTXXspC7vS2 jJrg==; 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-62209-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62209-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWWQSeyZ2Zvdl1zQViyw2c1PHMb0xb6aKyrnZ5u3NQgVSNuFT1OV84pbT5rn5y4cP5wEfxWCNH3ErF+68wKB1etg4TJ8g== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k27-20020a170906129b00b00a3c98aa5ab6si430443ejb.758.2024.02.12.10.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:44:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62209-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-62209-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62209-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 EEBA01F23C42 for ; Mon, 12 Feb 2024 18:44:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 683CB4C622; Mon, 12 Feb 2024 18:42:36 +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 D23CF3FE36; Mon, 12 Feb 2024 18:42:30 +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=1707763354; cv=none; b=c8ZZycxkYQ+g0ZOla0f+i8uiNngM8E4elzkdP1UMKwJDh+xrjQlxfIzbQ0KbBKz1QBlsK01KFeECRxmsCNWTKzws4EN0am3Tx/MkXP0W8D7P9zThemKQQHsB45MweeWNFBjY9E+NqW3iw/5UolNfqylCvK4zGRivSaJMGjPRPyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763354; c=relaxed/simple; bh=L3NRX4YCC5wAmVuFoBGeSlDkUFlbjD5+xbxslNXvKy0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OJUkBZLxTH+lo/cDoOv3pgz0wnyWw2ycPO1VqOtY1LiwGwFrkzb0Z9bX9te75zH++AY0RQ4whXlJopHSM8fyy8LtcyqCwUZb+7ZwWIxoEeuac54owHBwQSQxbqXDEV6vJecfNjdcTJyJLMITNS/JjRreDRd5Li9IAogg/ektEMs= 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 0f78f23c5a53093c; Mon, 12 Feb 2024 19:42:29 +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 9385C669CF2; Mon, 12 Feb 2024 19:42:28 +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 v2 8/9] thermal: of: Set THERMAL_TRIP_FLAG_RW_TEMP directly Date: Mon, 12 Feb 2024 19:40:34 +0100 Message-ID: <9235101.CDJkKcVGEf@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719785830797902 X-GMAIL-MSGID: 1790719785830797902 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_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 Reviewed-by: Daniel Lezcano --- v1 -> v2: Rename trip flag (Stanislaw). --- 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_FLAG_RW_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 Mon Feb 12 18:42:14 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: 199993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp103184dyb; Mon, 12 Feb 2024 10:46:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV2pVdRlmvuMPzJjuW5hDpJ2rT5fC7s9FOCPyjRKw957LcVpEdQVVp23pD+jUpu0xlErRu1dt2iuzHV5+pXJN01TCJuyA== X-Google-Smtp-Source: AGHT+IGCCNtvP7Bx6Tvm/TWwiNX6agucudQwP4ky5CsfzExgH8/bZktzO18WMvZ66rJUcgDuv6s8 X-Received: by 2002:a05:6a21:8ccb:b0:19e:be98:fc68 with SMTP id ta11-20020a056a218ccb00b0019ebe98fc68mr11056512pzb.52.1707763588890; Mon, 12 Feb 2024 10:46:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763588; cv=pass; d=google.com; s=arc-20160816; b=fsBkoLF5i0CmN3bB2VOAccKBBHBU4LEPrxQljt0ksz+rR4apkP+pXb+Q00gLPtbTDS AU4Rk/NJ037QdEgkL+Ihjr9DzUmJx82yOuX1V+V//eO/uq0wx9LX/Cxej5XXmAY4Q3HE w60nOD2UDTsaZdtP5ZPATYD8LzqyUgSyLCxUjfvaIt0PQyXyj41I1UscH3eCiSGx+jil s++WQrOKSfPma6+8xSwwTcBrn44roO+XtiW3Ef+B9fmQey5UdobVXnQjxNREMl2ZM/tD MDn4AJm3veyMZq/I2cfIC79cIPNTQ1xLJHxHg0/tuMVom4rcG7qRMOQKbWTa2sXM61V+ thzg== 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=dX5kvg+GB3luoDuan80j6wBw2monrgOfwh0ALbcxPQc=; fh=M97hWNUL5YSTytMAs8CQe2755IcmbZnyGztIsdbeneA=; b=jKRHNxfkbWF+o8R+7Zzcgmmx2V9RpuGaiFAmZZ7pJYH3RHLQ2kBY7BYY/LxehcjbQe QbMRYT13pqOUU8a7QUPM5gAokZy/AXgw1K8ObkV7tKVMfgHCRohdXiGMF/WLmwSmn7/+ AlEcZ66e5AONbd5F+YtjXuQhgsIWmXisa4TU83i3gFwSUZlZdpyZqs4XQjiVYFC0oTXW sfzdxKbPwgbun++M0kkLmI29yySXns30aLkWRAkkqZQOc6c7yS1D29kmccGIZCej9F+1 on5m4e8Q5KC29LsXaC0t9Uevd6TPXEBuVQRrJxqy5TcrL5WLaRqiOKsxVoqqbI6iXW7/ 45QQ==; 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-62210-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62210-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXDp9Z5Itgwq2k5L+kngnWRDcLBec6a00iKqV6pbhl82MHWZ6UFyqoRo0nFKkL34xtRUNJDO7XXb9LWBrXcgRJiM7f9jw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id du17-20020a056a002b5100b006e07f2dfe72si5301780pfb.263.2024.02.12.10.46.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:46:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62210-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-62210-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62210-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 A501028275E for ; Mon, 12 Feb 2024 18:46:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 897974EB36; Mon, 12 Feb 2024 18:42:39 +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 4B7173EA69; Mon, 12 Feb 2024 18:42:30 +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=1707763354; cv=none; b=XAgT33bDxt2F+G2pUDaFpNlV9RYjuGRsGOn4W50DE3z1Hsvj7gqF2Qq5n8v+QrB6zB4vWRys6MMsBMaCn80nbOcfB9zmAAZaMj5ifyxcOr67EMZnNCc1Paf7Azky2fqeHzti5e1Db/tQ2ReWyqN+dWt12Ykdjv/pJFNcVndhAJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763354; c=relaxed/simple; bh=LBXPV0kk/xKvcPAc8EQBc6kk4J5lns1cln/E+8e/rD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Gy29tfV9PbMDsHNMnO9B/v3NoseV2DnDMJezVXftS0NpyaNRItD/UVH1wIdlECBxhgudbIwIdU0IwlRwzl1zSCrG2VgViGEjug8IM0Z1dxdIgfcD9siHmF9TZqH9GdZhrsKkbfjxHEG2zR7bzrVn1pYL6TENf7BQtsDJ/An5pNA= 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 7615cb272cbf5413; Mon, 12 Feb 2024 19:42:28 +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 D22CA669CF2; Mon, 12 Feb 2024 19:42:27 +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 v2 9/9] thermal: core: Eliminate writable trip points masks Date: Mon, 12 Feb 2024 19:42:14 +0100 Message-ID: <5913164.MhkbZ0Pkbq@kreacher> In-Reply-To: <6017196.lOV4Wx5bFT@kreacher> References: <6017196.lOV4Wx5bFT@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: gggruggvucftvghtrhhoucdtuddrgedvledrudefgdduudegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepudeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhukhgrshiirdhluhgsrgesrghrmhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtohepshht rghnihhslhgrfidrghhruhhsiihkrgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehsrhhinhhivhgrshdrphgrnhgurhhuvhgruggrsehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790719913085659065 X-GMAIL-MSGID: 1790719913085659065 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 Reviewed-by: Daniel Lezcano --- v1 -> v2: Rename trip flag (Stanislaw). --- 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 @@ -323,8 +323,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); @@ -383,8 +382,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_FLAG_RW_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 @@ -365,7 +365,7 @@ static struct soc_sensor_entry *alloc_so aux_entry->tzone = thermal_zone_device_register_with_trips("quark_dts", 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");