From patchwork Fri Dec 15 19:53:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9543280dys; Fri, 15 Dec 2023 12:04:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4ZyhQW/GAu4czwhE7oPV1ZvTi7pfcbs8SWhxGUzu33sIp9+OshT0CrLokeKbyU6e9JMBJ X-Received: by 2002:ad4:5ae8:0:b0:67a:5be3:f0f8 with SMTP id c8-20020ad45ae8000000b0067a5be3f0f8mr19140569qvh.19.1702670646944; Fri, 15 Dec 2023 12:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702670646; cv=none; d=google.com; s=arc-20160816; b=OHXeofR24eEWjaVO2BQmmLFqqN5zpvfkqF/kpK8x0EThZsOFnue693K8LlPQ9Mxg9F 0GaDnErqV3X4rJJ13bVKc9hv0RveqfFMZG2Ld3lyIFrGPD/676Y29uLguoLtpJOMh3H0 uetcZIU/3tPCM5Cj/07qQLfQtm5CJhO6Zhzysv0gAoy5qBIDLdBbkYXtXWv9J/Vr43s+ EljSNou/OK/w8e0528QZrGw76Zm9tF/SWbLYRO+2r8jIYBVLXvvrG7rDvLr6dJZWW06c uhabnGjige2pFsHYGDjyUknrRmn2zK7Z5drccxFoJ+IWrDucbiWmZbKxiK5i1jfKzPf9 Jm/g== ARC-Message-Signature: i=1; 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=HS/fwlTIpdFpEXLJG0OVRyw587PsmdQEJjrIlyKctCw=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=gwG3HZHEDhis8UdGSWHoJa0ndj3BM1DnEgX4UXgzRf/RI+XJsg8nXS69qXU23P9GOM IyrxKBO5UNpuCc3xgeEvWCEtnLVc/Ply8dyK0YQnDeU8B6pnrkmfRUxwbzW9m+LgDVcf 57Z7IUt7TZavl0gmFwMGpIDWEeUPPrvHhrZeuV4T+I7WlH8mZWIDMuNzZpIxW9hJQ+4J 0jZ4cBZ5KyDEKm7GAdNt4XcHBpbL/FMMFPgVLeCg5uDSgVAsI6Vcm1dXFqvYwuJ8xDsA 1jxeZepWomhgzAP0SkBVPY/8UaLtVCM3UGYdr0vHx2uUwRXiN2XDhygNFkBO1F4qnrFA 74qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1592-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1592-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j13-20020a0ce00d000000b0067eee0540efsi1748981qvk.160.2023.12.15.12.04.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:04:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1592-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1592-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1592-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 B11B31C213E5 for ; Fri, 15 Dec 2023 20:04:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00D6851C36; Fri, 15 Dec 2023 20:02:26 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 6E56646556; Fri, 15 Dec 2023 20:02:20 +0000 (UTC) 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 755115599322dca2; Fri, 15 Dec 2023 21:02:18 +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 80E59668B59; Fri, 15 Dec 2023 21:02:17 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 1/6] thermal: trip: Constify thermal zone argument of thermal_zone_trip_id() Date: Fri, 15 Dec 2023 20:53:52 +0100 Message-ID: <1896687.tdWV9SEqCh@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785379576583085542 X-GMAIL-MSGID: 1785379576583085542 From: Rafael J. Wysocki Because thermal_zone_trip_id() does not update the thermal zone object passed to it, its pointer argument representing the thermal zone can be const, so adjust its definition accordingly. No functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba Reviewed-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 2 +- drivers/thermal/thermal_trip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.h +++ linux-pm/drivers/thermal/thermal_core.h @@ -120,7 +120,7 @@ void __thermal_zone_device_update(struct for (__trip = __tz->trips; __trip - __tz->trips < __tz->num_trips; __trip++) void __thermal_zone_set_trips(struct thermal_zone_device *tz); -int thermal_zone_trip_id(struct thermal_zone_device *tz, +int thermal_zone_trip_id(const struct thermal_zone_device *tz, const struct thermal_trip *trip); void thermal_zone_trip_updated(struct thermal_zone_device *tz, const struct thermal_trip *trip); Index: linux-pm/drivers/thermal/thermal_trip.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_trip.c +++ linux-pm/drivers/thermal/thermal_trip.c @@ -143,7 +143,7 @@ int thermal_zone_get_trip(struct thermal } EXPORT_SYMBOL_GPL(thermal_zone_get_trip); -int thermal_zone_trip_id(struct thermal_zone_device *tz, +int thermal_zone_trip_id(const struct thermal_zone_device *tz, const struct thermal_trip *trip) { /* From patchwork Fri Dec 15 19:56:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9543078dys; Fri, 15 Dec 2023 12:03:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IFpf12O1nImoZup8e1y4CqF3Px0iHWUSvUneSMeDTM7XO8S/M5EUPL7G1PjByFV3eyB1V4k X-Received: by 2002:a17:902:6848:b0:1d3:75f8:5bbe with SMTP id f8-20020a170902684800b001d375f85bbemr1843482pln.137.1702670633984; Fri, 15 Dec 2023 12:03:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702670633; cv=none; d=google.com; s=arc-20160816; b=sQqv7n5/DtIkR0/N/JK+EyrAepLyJSTDil0PN9xDQZI4s1iiHvT/opFJnGspuAyXxA JoJ7/0pMEGgyjMehF8uoZNnAZc5WVij8rSJnDRXi0tyulJ4Lfk4DiOUzg7LIEDcjwQCA ZPvV/xFazmei9LPwUZkWu6REcY6ZNw8Tmas4vCCVFLNU4HuJiv22nCYAocVS3kSf1uJT 2LTdOwW5oKLVb/2FOyTWmMmO0l7Kel6blmjhcKdi9Zl2n5n01dwH+As26rRZ2axgnmsQ iwDa2YvIHsV60Btqh+gcCJJK2U/+uVemxAPNZRazKc0PEUXVtzR+TI3as/oeLyYXZJwE lYIg== ARC-Message-Signature: i=1; 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=5/8AbBEgfeuZCffGp6NnkfBAJhHkTKzI0CGOgR7SEJ4=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=fuZuIdt3mCtGMTflbxoRYMlwkxmOcV2xn7mz5p9glL0GbcHt8644VypJU27sZfa/8f nViGwPpwkMqENnWefsbXje+Tm7XzGjGzdHUhP4/Ze0mqXIaq/4E4CVyuoIReqc93ACLV oZTOY7IhwTyucS55J/B1aZjd8f80QBAG7MpIeIdfXZB0mqIq7sP8cXAiMtLPFtCynlzz lbKKwTBpKgcnFI/bbJ1TyXpBzhTgMiQ1OrLBObk/Pf1D6l1FFAMrpubY6bKeZ2tmYr/C ynx6ASwsf4ksOwr4KcSEnDHVblLe/7CbIA10GbVKAnQJ1qEmtzt4zzLMrDD/jr4H2UjU 5Q/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1591-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1591-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d5-20020a17090ae28500b0028688bb3d17si5013228pjz.159.2023.12.15.12.03.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:03:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1591-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1591-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1591-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 55F0A2863AD for ; Fri, 15 Dec 2023 20:03:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68A1349F7E; Fri, 15 Dec 2023 20:02:25 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 4DDED46443; Fri, 15 Dec 2023 20:02:18 +0000 (UTC) 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 6f74b9fbd7fd1d90; Fri, 15 Dec 2023 21:02:17 +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 B5E8C668B59; Fri, 15 Dec 2023 21:02:16 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 2/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_change() Date: Fri, 15 Dec 2023 20:56:02 +0100 Message-ID: <2938222.e9J7NaK4W3@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785379562245482179 X-GMAIL-MSGID: 1785379562245482179 From: Rafael J. Wysocki Instead of requiring the caller of thermal_notify_tz_trip_change() to provide specific values needed to populate struct param in it, make it extract those values from objects passed to it by the caller via const pointers. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba Reviewed-by: Daniel Lezcano --- drivers/thermal/thermal_netlink.c | 12 +++++++----- drivers/thermal/thermal_netlink.h | 8 ++++---- drivers/thermal/thermal_trip.c | 8 ++------ 3 files changed, 13 insertions(+), 15 deletions(-) Index: linux-pm/drivers/thermal/thermal_netlink.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.c +++ linux-pm/drivers/thermal/thermal_netlink.c @@ -361,12 +361,14 @@ int thermal_notify_tz_trip_delete(int tz return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p); } -int thermal_notify_tz_trip_change(int tz_id, int trip_id, int trip_type, - int trip_temp, int trip_hyst) +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { - struct param p = { .tz_id = tz_id, .trip_id = trip_id, - .trip_type = trip_type, .trip_temp = trip_temp, - .trip_hyst = trip_hyst }; + struct param p = { .tz_id = tz->id, + .trip_id = thermal_zone_trip_id(tz, trip), + .trip_type = trip->type, + .trip_temp = trip->temperature, + .trip_hyst = trip->hysteresis }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p); } Index: linux-pm/drivers/thermal/thermal_netlink.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.h +++ linux-pm/drivers/thermal/thermal_netlink.h @@ -23,8 +23,8 @@ int thermal_notify_tz_trip_up(int tz_id, int thermal_notify_tz_trip_delete(int tz_id, int id); int thermal_notify_tz_trip_add(int tz_id, int id, int type, int temp, int hyst); -int thermal_notify_tz_trip_change(int tz_id, int id, int type, - int temp, int hyst); +int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, + const struct thermal_trip *trip); int thermal_notify_cdev_state_update(int cdev_id, int state); int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state); int thermal_notify_cdev_delete(int cdev_id); @@ -79,8 +79,8 @@ static inline int thermal_notify_tz_trip return 0; } -static inline int thermal_notify_tz_trip_change(int tz_id, int id, int type, - int temp, int hyst) +static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { return 0; } Index: linux-pm/drivers/thermal/thermal_trip.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_trip.c +++ linux-pm/drivers/thermal/thermal_trip.c @@ -155,9 +155,7 @@ int thermal_zone_trip_id(const struct th void thermal_zone_trip_updated(struct thermal_zone_device *tz, const struct thermal_trip *trip) { - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip), - trip->type, trip->temperature, - trip->hysteresis); + thermal_notify_tz_trip_change(tz, trip); __thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED); } @@ -168,8 +166,6 @@ void thermal_zone_set_trip_temp(struct t return; trip->temperature = temp; - thermal_notify_tz_trip_change(tz->id, thermal_zone_trip_id(tz, trip), - trip->type, trip->temperature, - trip->hysteresis); + thermal_notify_tz_trip_change(tz, trip); } EXPORT_SYMBOL_GPL(thermal_zone_set_trip_temp); From patchwork Fri Dec 15 19:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9543446dys; Fri, 15 Dec 2023 12:04:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIAVkk0xOHowpo8HRdCKAWUBzdHzZ9058TES+O5cM9lh19lVTpy+BiLgtgT5PLXvKe+UEk X-Received: by 2002:a17:902:c406:b0:1d0:8d2e:9ebc with SMTP id k6-20020a170902c40600b001d08d2e9ebcmr13992821plk.59.1702670658699; Fri, 15 Dec 2023 12:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702670658; cv=none; d=google.com; s=arc-20160816; b=Z6p1vATsjvuGwhyMt7JCq6A+tGbpVwcEAbOJ5xUkGo95TGmd3GsS8vuCzwfFhlTRg+ zoYwnDcROx5TrKpn/om2lzwO2CDR3t+h7bOMwrpPlHirs7cEWhlrIOCk8Gb4CyU36vNO icldrKV9sOxAeZTg5ifzl9wcb4QBBUxjeOvmbPG3GZFQdr9P3l7ZmW7nkN8XcQIkOZcZ GBstCFkV4qoqeuYCWKeysdSIVkuPLqwAbNohF6USmSrUEl/VosaxkErFij4GVuAu0ZWQ ct0Ie6TlM9btdX3CVIyZUpAN2Ql7cXsWaX5vxtO4//W1KVwzoh0jk6SAs2F2rdpT9qzl 8cFA== ARC-Message-Signature: i=1; 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=hkhBIJI6DD+R4XNzhTTtsL820IBBlYWyfuz7rPKlE9o=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=kTZMuB0bPsMgqCKBPNo7BkVauXurC9egnAQzxjpZpLWdaIpqAhXnw/1H6fwUc8NLWM r73e846xFr7NHeopHK0mmB60sdBb03NkqUMMRPi5V7jengapE7gIBmTdkTw808tyt4gg 8JlbnXtVsY5FaX35GSBgb1Bp6ipvpswUmkSj7AhUpOXZ6eNmrzhu5oThsdWrVpcdKNjx n5A7ok6P524e3FhGXDKKboA5XttGh6ajeaAFgkkvO8vymGUmhjhSlo79lcYa4bWnbjvy +uracRATJFB78SvZ5PXRSlPIMZgaUNoL6i1jkAqWUbQ06RnGpOSmhWByZdTH17lIoenu t2+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1594-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1594-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a8-20020a170902b58800b001d05cf08ac6si13152741pls.477.2023.12.15.12.04.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1594-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; spf=pass (google.com: domain of linux-kernel+bounces-1594-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1594-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 B0CFDB22A07 for ; Fri, 15 Dec 2023 20:04:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A917A56391; Fri, 15 Dec 2023 20:02:26 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 7118845BF1; Fri, 15 Dec 2023 20:02:18 +0000 (UTC) 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 da677ab86f469e69; Fri, 15 Dec 2023 21:02:16 +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 D7D91668B59; Fri, 15 Dec 2023 21:02:15 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 3/6] thermal: netlink: Pass pointers to thermal_notify_tz_trip_up/down() Date: Fri, 15 Dec 2023 20:57:50 +0100 Message-ID: <3295756.44csPzL39Z@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785379588903102183 X-GMAIL-MSGID: 1785379588903102183 From: Rafael J. Wysocki Instead of requiring the callers of thermal_notify_tz_trip_up/down() to provide specific values needed to populate struct param in them, make them extract those values from objects passed by the callers via const pointers. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba Reviewed-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 8 ++------ drivers/thermal/thermal_netlink.c | 14 ++++++++++---- drivers/thermal/thermal_netlink.h | 12 ++++++++---- 3 files changed, 20 insertions(+), 14 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -361,9 +361,7 @@ static void handle_thermal_trip(struct t * the threshold and the trip temperature will be equal. */ if (tz->temperature >= trip->temperature) { - thermal_notify_tz_trip_up(tz->id, - thermal_zone_trip_id(tz, trip), - tz->temperature); + thermal_notify_tz_trip_up(tz, trip); trip->threshold = trip->temperature - trip->hysteresis; } else { trip->threshold = trip->temperature; @@ -380,9 +378,7 @@ static void handle_thermal_trip(struct t * the trip. */ if (tz->temperature < trip->temperature - trip->hysteresis) { - thermal_notify_tz_trip_down(tz->id, - thermal_zone_trip_id(tz, trip), - tz->temperature); + thermal_notify_tz_trip_down(tz, trip); trip->threshold = trip->temperature; } else { trip->threshold = trip->temperature - trip->hysteresis; Index: linux-pm/drivers/thermal/thermal_netlink.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.c +++ linux-pm/drivers/thermal/thermal_netlink.c @@ -330,16 +330,22 @@ int thermal_notify_tz_disable(int tz_id) return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p); } -int thermal_notify_tz_trip_down(int tz_id, int trip_id, int temp) +int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { - struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp }; + struct param p = { .tz_id = tz->id, + .trip_id = thermal_zone_trip_id(tz, trip), + .temp = tz->temperature }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DOWN, &p); } -int thermal_notify_tz_trip_up(int tz_id, int trip_id, int temp) +int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { - struct param p = { .tz_id = tz_id, .trip_id = trip_id, .temp = temp }; + struct param p = { .tz_id = tz->id, + .trip_id = thermal_zone_trip_id(tz, trip), + .temp = tz->temperature }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p); } Index: linux-pm/drivers/thermal/thermal_netlink.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.h +++ linux-pm/drivers/thermal/thermal_netlink.h @@ -18,8 +18,10 @@ int thermal_notify_tz_create(int tz_id, int thermal_notify_tz_delete(int tz_id); int thermal_notify_tz_enable(int tz_id); int thermal_notify_tz_disable(int tz_id); -int thermal_notify_tz_trip_down(int tz_id, int id, int temp); -int thermal_notify_tz_trip_up(int tz_id, int id, int temp); +int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz, + const struct thermal_trip *trip); +int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz, + const struct thermal_trip *trip); int thermal_notify_tz_trip_delete(int tz_id, int id); int thermal_notify_tz_trip_add(int tz_id, int id, int type, int temp, int hyst); @@ -58,12 +60,14 @@ static inline int thermal_notify_tz_disa return 0; } -static inline int thermal_notify_tz_trip_down(int tz_id, int id, int temp) +static inline int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { return 0; } -static inline int thermal_notify_tz_trip_up(int tz_id, int id, int temp) +static inline int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz, + const struct thermal_trip *trip) { return 0; } From patchwork Fri Dec 15 19:59:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9542759dys; Fri, 15 Dec 2023 12:03:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoIdG1jmB1rzLr3Q3skPrQRtyIQPBg5uQf19QqhOBsRAIAnm7c7ybJz9GSBPflGmV2Bdqq X-Received: by 2002:a37:e203:0:b0:77e:fba3:93a7 with SMTP id g3-20020a37e203000000b0077efba393a7mr12512115qki.137.1702670607372; Fri, 15 Dec 2023 12:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702670607; cv=none; d=google.com; s=arc-20160816; b=pPjZ7QxAW9jMIVcCyNio0/LDVobntXsEy5mFYDkNnC10mu6zA0pMyvw7PmPfaA17Li LavPkQbCoScNEZgqWNQhe0N2UNYvX46Xi3osUac2qMmueUrCm4ELltJ8ZBdXNNxwoPNv 7exOhfW4Qe/hPRTUH6mrZ/Jt89cD6XkFJeMt49BHFkgn0xZcXsf6KHeqNSDp52VSXZm/ rcmPtTyaVQ/pkcJesX9dfFumAn0C4Lg0RwRIJAJ7gXnmxN9pBiaMAFRNxOc8U4bRfplV 7GqOBzCTfO1oSrWzjmWkK8d0lqzdNuNB27NmNDhwcxz/3Pdk8sYIzwLQqQ/28d2+c0aI 4Yjw== ARC-Message-Signature: i=1; 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=e2o0/jjJrIb0rGOkCOGLZHVZ1tskkssn0/5XxzgXrlg=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=gfNKpo1raAIfaMqBYUjEKwJmp8cnu6MMDLzjHO0zueZFqs8hju+DpIOWgAXs/olmta 0FHNYoDxJag0B93zZFVwljrrtvR4LnuGMJ1h29M+2xPTFnQ46ItqMaQ/toRwZDHDhi56 rIM3lahHzRhCXd9T/nJWEVsZR+UB34xOvCboGgToqsg3Q64ELZVXiYXBTFO009g53O0p n6F5ZitGX/hOLjJE0poj3Mw9xwjYXYwbnMamcAzp8fG1Eofmcn62+zFD7Td4lI9fUJRE uIst20AlFOECgHZKomNholbQ1NHo5SDFrWxJaorlOAZIaKeWDN39KQHdWxvPOAGk46Th kmcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1589-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pe35-20020a05620a852300b0077fb0c02536si1725157qkn.460.2023.12.15.12.03.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:03:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1589-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1589-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 1FEA81C213D6 for ; Fri, 15 Dec 2023 20:03:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C90648CCE; Fri, 15 Dec 2023 20:02:24 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 A73FE45BE1; Fri, 15 Dec 2023 20:02:17 +0000 (UTC) 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 31fef6b089930a91; Fri, 15 Dec 2023 21:02:15 +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 1E9A3668B59; Fri, 15 Dec 2023 21:02:15 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 4/6] thermal: netlink: Drop thermal_notify_tz_trip_add/delete() Date: Fri, 15 Dec 2023 20:59:08 +0100 Message-ID: <10409811.nUPlyArG6x@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785379534746556073 X-GMAIL-MSGID: 1785379534746556073 From: Rafael J. Wysocki Because thermal_notify_tz_trip_add/delete() are never used, drop them entirely along with the related code. The addition or removal of trip points is not supported by the thermal core and is unlikely to be supported in the future, so it is also unlikely that these functions will ever be needed. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba Acked-by: Daniel Lezcano --- drivers/thermal/thermal_netlink.c | 33 +-------------------------------- drivers/thermal/thermal_netlink.h | 14 -------------- 2 files changed, 1 insertion(+), 46 deletions(-) Index: linux-pm/drivers/thermal/thermal_netlink.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.c +++ linux-pm/drivers/thermal/thermal_netlink.c @@ -135,7 +135,7 @@ static int thermal_genl_event_tz_trip_up return 0; } -static int thermal_genl_event_tz_trip_add(struct param *p) +static int thermal_genl_event_tz_trip_change(struct param *p) { if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) || nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id) || @@ -147,15 +147,6 @@ static int thermal_genl_event_tz_trip_ad return 0; } -static int thermal_genl_event_tz_trip_delete(struct param *p) -{ - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_ID, p->tz_id) || - nla_put_u32(p->msg, THERMAL_GENL_ATTR_TZ_TRIP_ID, p->trip_id)) - return -EMSGSIZE; - - return 0; -} - static int thermal_genl_event_cdev_add(struct param *p) { if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME, @@ -245,9 +236,6 @@ int thermal_genl_event_tz_disable(struct int thermal_genl_event_tz_trip_down(struct param *p) __attribute__((alias("thermal_genl_event_tz_trip_up"))); -int thermal_genl_event_tz_trip_change(struct param *p) - __attribute__((alias("thermal_genl_event_tz_trip_add"))); - static cb_t event_cb[] = { [THERMAL_GENL_EVENT_TZ_CREATE] = thermal_genl_event_tz_create, [THERMAL_GENL_EVENT_TZ_DELETE] = thermal_genl_event_tz_delete, @@ -256,8 +244,6 @@ static cb_t event_cb[] = { [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up, [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down, [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change, - [THERMAL_GENL_EVENT_TZ_TRIP_ADD] = thermal_genl_event_tz_trip_add, - [THERMAL_GENL_EVENT_TZ_TRIP_DELETE] = thermal_genl_event_tz_trip_delete, [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add, [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete, [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update, @@ -350,23 +336,6 @@ int thermal_notify_tz_trip_up(const stru return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_UP, &p); } -int thermal_notify_tz_trip_add(int tz_id, int trip_id, int trip_type, - int trip_temp, int trip_hyst) -{ - struct param p = { .tz_id = tz_id, .trip_id = trip_id, - .trip_type = trip_type, .trip_temp = trip_temp, - .trip_hyst = trip_hyst }; - - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_ADD, &p); -} - -int thermal_notify_tz_trip_delete(int tz_id, int trip_id) -{ - struct param p = { .tz_id = tz_id, .trip_id = trip_id }; - - return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_DELETE, &p); -} - int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, const struct thermal_trip *trip) { Index: linux-pm/drivers/thermal/thermal_netlink.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.h +++ linux-pm/drivers/thermal/thermal_netlink.h @@ -22,9 +22,6 @@ int thermal_notify_tz_trip_down(const st const struct thermal_trip *trip); int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz, const struct thermal_trip *trip); -int thermal_notify_tz_trip_delete(int tz_id, int id); -int thermal_notify_tz_trip_add(int tz_id, int id, int type, - int temp, int hyst); int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, const struct thermal_trip *trip); int thermal_notify_cdev_state_update(int cdev_id, int state); @@ -71,17 +68,6 @@ static inline int thermal_notify_tz_trip { return 0; } - -static inline int thermal_notify_tz_trip_delete(int tz_id, int id) -{ - return 0; -} - -static inline int thermal_notify_tz_trip_add(int tz_id, int id, int type, - int temp, int hyst) -{ - return 0; -} static inline int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, const struct thermal_trip *trip) From patchwork Fri Dec 15 20:00:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9549412dys; Fri, 15 Dec 2023 12:12:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOMEhKca+f0/TiPrJUdK/D+41YIigqu3M7CJT9talL592ydjKcdYhFaGnFSTQNK4rEDaIB X-Received: by 2002:a50:9f84:0:b0:552:63ac:2cd1 with SMTP id c4-20020a509f84000000b0055263ac2cd1mr2075740edf.16.1702671166248; Fri, 15 Dec 2023 12:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702671166; cv=none; d=google.com; s=arc-20160816; b=UQeKeI+VuY/W0W7NJ9OkBc677qkiy8waFqmPwAe8M3rqneDbrViiU6NpXvvjbxF5AP 06M6FbaOU3qtjGEe8VmdA4NBq8UcRaFa2KujM17yq+gKqbvt6F1NbGDSPlGFG8LFzxeN vjY+D6IMlC/BLShAHLMn0bSzAkF+iv782T/9Kifqka3ad+DZ6Kz7PKWrWWE187QYMdC2 GNJr7+7gAUY/5Ydd8JoeWzdKOi7UBW2HDwb4mQ/yatl6K3vzc85gEkiSfuJPQuZqpSZ4 Cc/vWAvpiTE4hjZ/cvLafilxSLmTgPzlXc+fjH+9R0ONNBPqGZqGqDWM+2WVlok6ED4f wzug== ARC-Message-Signature: i=1; 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=vtq72ma61SmiXrlKR2HAlAhvoZ8kkEWZdYioXByR0E4=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=sXpADI/xVK/AQZn/eTXQuoCd+k2KKRY2lljBAuPHHcsnOBwWdsfKcXJF7EC+R2O8pC 20Mjp3zZLgqzguqlyJpbjU2UzQ02pBYvD2gcEKlhkeiJwt/pnbqbtpCidPNcXOxWqlVG 64K29orfvmpBghgCBUk3KtehjXgKxeqoaUrNHhzkIM/q2ZTb2X9JqanLf0EHEqnrniw0 +tqbqYJ9PMPZS0jbtWP2XzTYo30p9xfTIAm+oZLk6g3/aPHVVjE8NNHz3JsUsmVWw/Ub bjmA1Tuo7lOmdb7R/fw/1h5BGZiN8FCsVNz5sewT1/P7sN/bT4Zaa+hHguHYd/lZoTwd XShg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1590-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1590-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c37-20020a509fa8000000b00552d7908412si677137edf.155.2023.12.15.12.12.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:12:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1590-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; spf=pass (google.com: domain of linux-kernel+bounces-1590-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1590-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 C31051F265A9 for ; Fri, 15 Dec 2023 20:03:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51B95482E4; Fri, 15 Dec 2023 20:02:24 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 3E3EC4597B; Fri, 15 Dec 2023 20:02:16 +0000 (UTC) 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 5a013ed72259bd7c; Fri, 15 Dec 2023 21:02:14 +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 56A03668B59; Fri, 15 Dec 2023 21:02:14 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 5/6] thermal: netlink: Pass thermal zone pointer to notify routines Date: Fri, 15 Dec 2023 21:00:36 +0100 Message-ID: <1975810.PYKUYFuaPT@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudeftdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785380120752065943 X-GMAIL-MSGID: 1785380120752065943 From: Rafael J. Wysocki There are several routines in the thermal netlink API that take a thermal zone ID or a thermal zone type as their arguments, but from their callers perspective it would be more convenient to pass a thermal zone pointer to them and let them extract the necessary data from the given thermal zone object by themselves. Modify the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba Acked-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 10 +++++----- drivers/thermal/thermal_netlink.c | 21 +++++++++++---------- drivers/thermal/thermal_netlink.h | 22 ++++++++++++---------- 3 files changed, 28 insertions(+), 25 deletions(-) Index: linux-pm/drivers/thermal/thermal_core.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_core.c +++ linux-pm/drivers/thermal/thermal_core.c @@ -213,7 +213,7 @@ exit: mutex_unlock(&tz->lock); mutex_unlock(&thermal_governor_lock); - thermal_notify_tz_gov_change(tz->id, policy); + thermal_notify_tz_gov_change(tz, policy); return ret; } @@ -475,9 +475,9 @@ static int thermal_zone_device_set_mode( mutex_unlock(&tz->lock); if (mode == THERMAL_DEVICE_ENABLED) - thermal_notify_tz_enable(tz->id); + thermal_notify_tz_enable(tz); else - thermal_notify_tz_disable(tz->id); + thermal_notify_tz_disable(tz); return ret; } @@ -1386,7 +1386,7 @@ thermal_zone_device_register_with_trips( if (atomic_cmpxchg(&tz->need_update, 1, 0)) thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); - thermal_notify_tz_create(tz->id, tz->type); + thermal_notify_tz_create(tz); return tz; @@ -1490,7 +1490,7 @@ void thermal_zone_device_unregister(stru put_device(&tz->device); - thermal_notify_tz_delete(tz_id); + thermal_notify_tz_delete(tz); wait_for_completion(&tz->removal); kfree(tz); Index: linux-pm/drivers/thermal/thermal_netlink.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.c +++ linux-pm/drivers/thermal/thermal_netlink.c @@ -288,30 +288,30 @@ out_free_msg: return ret; } -int thermal_notify_tz_create(int tz_id, const char *name) +int thermal_notify_tz_create(const struct thermal_zone_device *tz) { - struct param p = { .tz_id = tz_id, .name = name }; + struct param p = { .tz_id = tz->id, .name = tz->type }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_CREATE, &p); } -int thermal_notify_tz_delete(int tz_id) +int thermal_notify_tz_delete(const struct thermal_zone_device *tz) { - struct param p = { .tz_id = tz_id }; + struct param p = { .tz_id = tz->id }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DELETE, &p); } -int thermal_notify_tz_enable(int tz_id) +int thermal_notify_tz_enable(const struct thermal_zone_device *tz) { - struct param p = { .tz_id = tz_id }; + struct param p = { .tz_id = tz->id }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_ENABLE, &p); } -int thermal_notify_tz_disable(int tz_id) +int thermal_notify_tz_disable(const struct thermal_zone_device *tz) { - struct param p = { .tz_id = tz_id }; + struct param p = { .tz_id = tz->id }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_DISABLE, &p); } @@ -370,9 +370,10 @@ int thermal_notify_cdev_delete(int cdev_ return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p); } -int thermal_notify_tz_gov_change(int tz_id, const char *name) +int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz, + const char *name) { - struct param p = { .tz_id = tz_id, .name = name }; + struct param p = { .tz_id = tz->id, .name = name }; return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_GOV_CHANGE, &p); } Index: linux-pm/drivers/thermal/thermal_netlink.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.h +++ linux-pm/drivers/thermal/thermal_netlink.h @@ -14,10 +14,10 @@ struct thermal_genl_cpu_caps { #ifdef CONFIG_THERMAL_NETLINK int __init thermal_netlink_init(void); void __init thermal_netlink_exit(void); -int thermal_notify_tz_create(int tz_id, const char *name); -int thermal_notify_tz_delete(int tz_id); -int thermal_notify_tz_enable(int tz_id); -int thermal_notify_tz_disable(int tz_id); +int thermal_notify_tz_create(const struct thermal_zone_device *tz); +int thermal_notify_tz_delete(const struct thermal_zone_device *tz); +int thermal_notify_tz_enable(const struct thermal_zone_device *tz); +int thermal_notify_tz_disable(const struct thermal_zone_device *tz); int thermal_notify_tz_trip_down(const struct thermal_zone_device *tz, const struct thermal_trip *trip); int thermal_notify_tz_trip_up(const struct thermal_zone_device *tz, @@ -27,7 +27,8 @@ int thermal_notify_tz_trip_change(const int thermal_notify_cdev_state_update(int cdev_id, int state); int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state); int thermal_notify_cdev_delete(int cdev_id); -int thermal_notify_tz_gov_change(int tz_id, const char *name); +int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz, + const char *name); int thermal_genl_sampling_temp(int id, int temp); int thermal_genl_cpu_capability_event(int count, struct thermal_genl_cpu_caps *caps); @@ -37,22 +38,22 @@ static inline int thermal_netlink_init(v return 0; } -static inline int thermal_notify_tz_create(int tz_id, const char *name) +static inline int thermal_notify_tz_create(const struct thermal_zone_device *tz) { return 0; } -static inline int thermal_notify_tz_delete(int tz_id) +static inline int thermal_notify_tz_delete(const struct thermal_zone_device *tz) { return 0; } -static inline int thermal_notify_tz_enable(int tz_id) +static inline int thermal_notify_tz_enable(const struct thermal_zone_device *tz) { return 0; } -static inline int thermal_notify_tz_disable(int tz_id) +static inline int thermal_notify_tz_disable(const struct thermal_zone_device *tz) { return 0; } @@ -91,7 +92,8 @@ static inline int thermal_notify_cdev_de return 0; } -static inline int thermal_notify_tz_gov_change(int tz_id, const char *name) +static inline int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz, + const char *name) { return 0; } From patchwork Fri Dec 15 20:02:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 179522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9542193dys; Fri, 15 Dec 2023 12:02:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHpRkHnYDzFZmUHgvK7b1m0vek98m3lOUw5UdsYgQOx1t4nTpMtXTe6OQ6NWQkAALBVevq X-Received: by 2002:a17:90b:3a8c:b0:28b:11fc:795a with SMTP id om12-20020a17090b3a8c00b0028b11fc795amr3451888pjb.40.1702670562218; Fri, 15 Dec 2023 12:02:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702670562; cv=none; d=google.com; s=arc-20160816; b=gSRgIFnm5nefublJNuaoONEI+fRdp83Y5/gf0tzKkQAJNDE0v0QwDRZk5kQIkZtQoH lR/ug3qJeVGLHKeM/I3DZH1X64WoJremlLYaDpKimbh3Nea4+26yjFAVEZZera7g+JhR To9w083AbfO+Z0JWLmBoYPSKBEwQXE5+wJhlaihkgOT4u2/29WVwMP5FDT3vbPworAF2 bshQRZF/JPItjmE/7YjDDejFpFgeHVBOmg84LXMD01UC/RgLxRJ9aD3/w3F8VUhD9efm GKtdq+SeJiLv2kh6rbpy+GVNFyxDhxzOnwlOfc3LnIr8UWi+W4yrtsVL2MmMIwZvFza/ EEVg== ARC-Message-Signature: i=1; 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=AGDGB0oNnCehWymfa6Ab8jSccFiGZ1b853nw6aOPT5Y=; fh=PrtSuD01Zw+FPDhsRSNqLGqZbVeJkC2wpKMU0Il46xE=; b=iMmrHRz5wpSRAEGGwKltgtP79lU7c1nRYmhSLczCrKB0+Q5xxJ/GxH/XwCHY36h8ep XtKgk/Y8n+sva/hG/AUp01Wc85ku5gWEOl/WNmM+Gu1dqId1PGZTaIazG82vCJnkSCJz hLY6BUmQViN/T9317LfwzHBueNVxDWYG0TYT4Za/OnD3u4L7OO4heWdovTrSSN8IdMSA sDggFwUu+DWqfMHDZfEvSYqxS9A9EdsTXXBU3oRYZ+z90B+FiNz9QCCZUSZtUK9Uj+hO c9Hxmq4s6XeP4+zWoAl1Nm9g3aySvSawM1CxwJd2fWCsh8qdUhYj3GSSR2VN4AEBxvSx C57w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1588-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1588-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d5-20020a17090ae28500b0028688bb3d17si5013228pjz.159.2023.12.15.12.02.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 12:02:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1588-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1588-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1588-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 F39DD282B04 for ; Fri, 15 Dec 2023 20:02:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 816BA4655F; Fri, 15 Dec 2023 20:02:20 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 210CC45974; Fri, 15 Dec 2023 20:02:15 +0000 (UTC) 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 74bf26d935cc733f; Fri, 15 Dec 2023 21:02:14 +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 9014D668B59; Fri, 15 Dec 2023 21:02:13 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM Cc: Srinivas Pandruvada , Daniel Lezcano , Zhang Rui , Linux ACPI , LKML , Lukasz Luba Subject: [PATCH v1 6/6] thermal: netlink: Rework cdev-related notify API Date: Fri, 15 Dec 2023 21:02:04 +0100 Message-ID: <7628882.EvYhyI6sBW@kreacher> In-Reply-To: <4556052.LvFx2qVVIh@kreacher> References: <4556052.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtvddgudefudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeejpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhrihhnihhvrghsrdhprghnughruhhvrggurgeslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopegurghnihgvlhdrlhgviigtrghnoheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhuihdriihhrghnghesihhnthgvlhdrtghomhdprhgt phhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=7 Fuz1=7 Fuz2=7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785379487281791922 X-GMAIL-MSGID: 1785379487281791922 From: Rafael J. Wysocki The only actually used thermal netlink notification routine related to cooling devices is thermal_notify_cdev_state_update(). The other two, thermal_notify_cdev_add() and thermal_notify_cdev_delete(), are never used. So as to get rid of dead code, drop thermal_notify_cdev_add/delete(), which can be added back if they turn out to be ever needed, along with the related code. In analogy with the previous thermal netlink API changes, redefine thermal_notify_cdev_state_update() to take a const cdev pointer as its first argument and let it extract the requisite information from there by itself. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Lukasz Luba --- drivers/thermal/thermal_helpers.c | 2 - drivers/thermal/thermal_netlink.c | 43 ++------------------------------------ drivers/thermal/thermal_netlink.h | 19 +++------------- 3 files changed, 8 insertions(+), 56 deletions(-) Index: linux-pm/drivers/thermal/thermal_netlink.h =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.h +++ linux-pm/drivers/thermal/thermal_netlink.h @@ -24,9 +24,8 @@ int thermal_notify_tz_trip_up(const stru const struct thermal_trip *trip); int thermal_notify_tz_trip_change(const struct thermal_zone_device *tz, const struct thermal_trip *trip); -int thermal_notify_cdev_state_update(int cdev_id, int state); -int thermal_notify_cdev_add(int cdev_id, const char *name, int max_state); -int thermal_notify_cdev_delete(int cdev_id); +int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev, + int state); int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz, const char *name); int thermal_genl_sampling_temp(int id, int temp); @@ -76,18 +75,8 @@ static inline int thermal_notify_tz_trip return 0; } -static inline int thermal_notify_cdev_state_update(int cdev_id, int state) -{ - return 0; -} - -static inline int thermal_notify_cdev_add(int cdev_id, const char *name, - int max_state) -{ - return 0; -} - -static inline int thermal_notify_cdev_delete(int cdev_id) +static inline int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev, + int state) { return 0; } Index: linux-pm/drivers/thermal/thermal_helpers.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_helpers.c +++ linux-pm/drivers/thermal/thermal_helpers.c @@ -152,7 +152,7 @@ static void thermal_cdev_set_cur_state(s if (cdev->ops->set_cur_state(cdev, target)) return; - thermal_notify_cdev_state_update(cdev->id, target); + thermal_notify_cdev_state_update(cdev, target); thermal_cooling_device_stats_update(cdev, target); } Index: linux-pm/drivers/thermal/thermal_netlink.c =================================================================== --- linux-pm.orig/drivers/thermal/thermal_netlink.c +++ linux-pm/drivers/thermal/thermal_netlink.c @@ -147,27 +147,6 @@ static int thermal_genl_event_tz_trip_ch return 0; } -static int thermal_genl_event_cdev_add(struct param *p) -{ - if (nla_put_string(p->msg, THERMAL_GENL_ATTR_CDEV_NAME, - p->name) || - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, - p->cdev_id) || - nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_MAX_STATE, - p->cdev_max_state)) - return -EMSGSIZE; - - return 0; -} - -static int thermal_genl_event_cdev_delete(struct param *p) -{ - if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, p->cdev_id)) - return -EMSGSIZE; - - return 0; -} - static int thermal_genl_event_cdev_state_update(struct param *p) { if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID, @@ -244,8 +223,6 @@ static cb_t event_cb[] = { [THERMAL_GENL_EVENT_TZ_TRIP_UP] = thermal_genl_event_tz_trip_up, [THERMAL_GENL_EVENT_TZ_TRIP_DOWN] = thermal_genl_event_tz_trip_down, [THERMAL_GENL_EVENT_TZ_TRIP_CHANGE] = thermal_genl_event_tz_trip_change, - [THERMAL_GENL_EVENT_CDEV_ADD] = thermal_genl_event_cdev_add, - [THERMAL_GENL_EVENT_CDEV_DELETE] = thermal_genl_event_cdev_delete, [THERMAL_GENL_EVENT_CDEV_STATE_UPDATE] = thermal_genl_event_cdev_state_update, [THERMAL_GENL_EVENT_TZ_GOV_CHANGE] = thermal_genl_event_gov_change, [THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE] = thermal_genl_event_cpu_capability_change, @@ -348,28 +325,14 @@ int thermal_notify_tz_trip_change(const return thermal_genl_send_event(THERMAL_GENL_EVENT_TZ_TRIP_CHANGE, &p); } -int thermal_notify_cdev_state_update(int cdev_id, int cdev_state) +int thermal_notify_cdev_state_update(const struct thermal_cooling_device *cdev, + int state) { - struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state }; + struct param p = { .cdev_id = cdev->id, .cdev_state = state }; return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_STATE_UPDATE, &p); } -int thermal_notify_cdev_add(int cdev_id, const char *name, int cdev_max_state) -{ - struct param p = { .cdev_id = cdev_id, .name = name, - .cdev_max_state = cdev_max_state }; - - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_ADD, &p); -} - -int thermal_notify_cdev_delete(int cdev_id) -{ - struct param p = { .cdev_id = cdev_id }; - - return thermal_genl_send_event(THERMAL_GENL_EVENT_CDEV_DELETE, &p); -} - int thermal_notify_tz_gov_change(const struct thermal_zone_device *tz, const char *name) {