From patchwork Fri Feb 9 14:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 198914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp891922dyd; Fri, 9 Feb 2024 06:31:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXaLwGVmHrk/6Tyav6VW2EBI3Aer6x+4kf/GOuv4PUwMfNulGisUqa6M6ScXc3xePocBNhyCo3ahR3tMHUsTAnNfaElgg== X-Google-Smtp-Source: AGHT+IHj7d/8SHfAA0wnie559HtnlggRxxqTGQwu5KM2yYXGaYQUnN/VIyttUXZ1TnurvserttkG X-Received: by 2002:a17:903:11d1:b0:1d9:dcd:c726 with SMTP id q17-20020a17090311d100b001d90dcdc726mr2089022plh.17.1707489098475; Fri, 09 Feb 2024 06:31:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489098; cv=pass; d=google.com; s=arc-20160816; b=zx+LVjjlONVMeOxmkQwu7gP72CufyuDlvazLd6dJrtwBZ3hjN3zUotAqWAWkivEq36 YqyAQvEW1AQTrDwDEMO4Vi8cpx9cwdYlWw0oNY7ncYbeyczrEmgL+QQvSAOvzeywlP6S s/Lt5fM5cE4IWvmJ/qfZQXomKA0axd3bDx2JDElEzVF/dxgolaXLPpHZdjnF8kaf0KWs 57uX1uJh40JuLr76LlIZge6GrPzYWvri16pO+xFty8bF6wZ6cm+rs5Fc7tqONu6fRNQw sqPoHUMtSqRYV3Obv9kXkBKjvfGvJnY6tFh7CK7CfEO5cPfFaVsSURyFhe5YdxP31CyJ JmIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=m3JGOk+ppSmrXVSSN+/PI5xOeH56cNd38B9gqRpKvYM=; fh=0GYVDx+kAK0z8n310YVfxh7+EXp4BpYvieAgXZVRqlI=; b=j4zQW+3uieRvdyKP5jBVoQ2pN2Ln8Iui+leN55SL2bGvCuAAKAPL+3tTzbjiJ1mVst bAsKSPYKSXHxGJVVrQuG8GcToZk5SALbY8LplRFq9S+bppOOo5untdZ1NtaJeUNKGyhI IKaFSo39GsIc/59hSynIutFI+g5ppMuZlW7/51ldlvFYRk55h9ElqR/omE0XTX9vWwQv EVoqkuaRsjaGu/ONwBgd+NcCDgkTFhfHy+4J/+McUuZzIJ5tbQfwcN7FZESiE44BsVIJ UDlwMQJ5OM11/goicE/LkUTtq8TWumV1N1JSC/+xsEPoD+pNGFTyC1+7rDAbNVf4/a5x csMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXrQM8iizSQifbzOSrxIo3tVE6ootw3WEEFQpjLB9QhwD2eUB9sdwt9ctFtXlmzcaLYmcMr26TiUc7h9Nc8c91bu83qPA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u14-20020a170903124e00b001d92e40f68asi1767614plh.69.2024.02.09.06.31.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:31:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59436-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8760628A341 for ; Fri, 9 Feb 2024 14:19:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C79827AE68; Fri, 9 Feb 2024 14:14:51 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBC9F6F074; Fri, 9 Feb 2024 14:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488089; cv=none; b=UNYANfu8Smrqz1AySm/EHZJ/fpF5rk9q6yeEjPg3u8juAj09wFFJ+BhvcniA1Cb6Zev/VT2DKlT4TgGa8psC3jjkNh/37BlREXSjB49C+PvT3HGzC8wOPF3n8HdEu+osf9TZtlM8lI85UU9rdjgKtjQMUXkMOjl//d6maA3YFdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488089; c=relaxed/simple; bh=8HqmpFd0rysCcXybj+zUxgCCZN4PfgLB3WDz4Z60m3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SyrLjhR3JS2ovBNgA1vu3dMhPBHEDsSboh/qPkFLNCkxNVchMNeSdSkeODnHUva0HBxV5N2jJ7GVYydHGLXVx+DXDTqC4yxg5T6gmpo+QLQzxR6IGSNnmCXSmbJcLFJqhAm9p3m78Dj7Fu2XRtgtzrw/z0Og6g748Ws3YVuCmhw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 251588209d90e162; Fri, 9 Feb 2024 15:14:44 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 3472D669C4D; Fri, 9 Feb 2024 15:14:44 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Lukasz Luba , LKML , Daniel Lezcano , Stanislaw Gruszka , Srinivas Pandruvada , Zhang Rui , netdev@vger.kernel.org, Ido Schimmel , Petr Machata , Miri Korenblit , linux-wireless@vger.kernel.org, Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Manaf Meethalavalappu Pallikunhi Subject: [PATCH v1 5/9] mlxsw: core_thermal: Set THERMAL_TRIP_WRITABLE_TEMP directly Date: Fri, 09 Feb 2024 15:08:43 +0100 Message-ID: <2206820.Mh6RI2rZIc@kreacher> In-Reply-To: <3232442.5fSG56mABF@kreacher> References: <3232442.5fSG56mABF@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrtdeigdeitdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehlihhnuhigqdhpmhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehluhhkrghsiidrlhhusggrsegrrhhmrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepuggrnhhivghlrdhlvgiitggrnhhosehlihhnrghrohdrohhrghdprhgtphhtthhopehsthgr nhhishhlrgifrdhgrhhushiikhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=16 Fuz1=16 Fuz2=16 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432089105298346 X-GMAIL-MSGID: 1790432089105298346 From: Rafael J. Wysocki It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the mlxsw code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki Reviewed-by: Ido Schimmel --- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) Index: linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c =================================================================== --- linux-pm.orig/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ linux-pm/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -44,16 +44,19 @@ static const struct thermal_trip default .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_ASIC_TEMP_NORM, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_ASIC_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_ASIC_TEMP_HOT, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, }; @@ -62,16 +65,19 @@ static const struct thermal_trip default .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_MODULE_TEMP_NORM, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* In range - 40-100% PWM */ .type = THERMAL_TRIP_ACTIVE, .temperature = MLXSW_THERMAL_MODULE_TEMP_HIGH, .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, { /* Warning */ .type = THERMAL_TRIP_HOT, .temperature = MLXSW_THERMAL_MODULE_TEMP_HOT, + .flags = THERMAL_TRIP_WRITABLE_TEMP, }, }; @@ -92,9 +98,6 @@ static const struct mlxsw_cooling_states #define MLXSW_THERMAL_NUM_TRIPS ARRAY_SIZE(default_thermal_trips) -/* Make sure all trips are writable */ -#define MLXSW_THERMAL_TRIP_MASK (BIT(MLXSW_THERMAL_NUM_TRIPS) - 1) - struct mlxsw_thermal; struct mlxsw_thermal_module { @@ -420,7 +423,7 @@ mlxsw_thermal_module_tz_init(struct mlxs module_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, module_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, module_tz, &mlxsw_thermal_module_ops, &mlxsw_thermal_params, @@ -548,7 +551,7 @@ mlxsw_thermal_gearbox_tz_init(struct mlx gearbox_tz->tzdev = thermal_zone_device_register_with_trips(tz_name, gearbox_tz->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, gearbox_tz, &mlxsw_thermal_gearbox_ops, &mlxsw_thermal_params, 0, @@ -773,7 +776,7 @@ int mlxsw_thermal_init(struct mlxsw_core thermal->tzdev = thermal_zone_device_register_with_trips("mlxsw", thermal->trips, MLXSW_THERMAL_NUM_TRIPS, - MLXSW_THERMAL_TRIP_MASK, + 0, thermal, &mlxsw_thermal_ops, &mlxsw_thermal_params, 0,