public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Lukasz Luba <lukasz.luba@arm.com>
Subject: [RESEND][PATCH v1 6/8] thermal: helpers: Drop get_thermal_instance()
Date: Mon, 29 Jul 2024 18:06:55 +0200	[thread overview]
Message-ID: <2014591.usQuhbGJ8B@rjwysocki.net> (raw)
In-Reply-To: <2211925.irdbgypaU6@rjwysocki.net>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

There are no more users of get_thermal_instance(), so drop it.

While at it, replace get_instance() returning a pointer to struct
thermal_instance with thermal_instance_present() returning a bool
which is more straightforward.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/thermal/thermal_core.h    |    5 -----
 drivers/thermal/thermal_helpers.c |   30 ++++++------------------------
 2 files changed, 6 insertions(+), 29 deletions(-)

Index: linux-pm/drivers/thermal/thermal_core.h
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.h
+++ linux-pm/drivers/thermal/thermal_core.h
@@ -204,11 +204,6 @@ void __thermal_cdev_update(struct therma
 
 int get_tz_trend(struct thermal_zone_device *tz, const struct thermal_trip *trip);
 
-struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-		     struct thermal_cooling_device *cdev,
-		     int trip);
-
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
Index: linux-pm/drivers/thermal/thermal_helpers.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_helpers.c
+++ linux-pm/drivers/thermal/thermal_helpers.c
@@ -39,18 +39,18 @@ int get_tz_trend(struct thermal_zone_dev
 	return trend;
 }
 
-static struct thermal_instance *get_instance(struct thermal_zone_device *tz,
-					     struct thermal_cooling_device *cdev,
-					     const struct thermal_trip *trip)
+static bool thermal_instance_present(struct thermal_zone_device *tz,
+				     struct thermal_cooling_device *cdev,
+				     const struct thermal_trip *trip)
 {
 	struct thermal_instance *ti;
 
 	list_for_each_entry(ti, &tz->thermal_instances, tz_node) {
 		if (ti->trip == trip && ti->cdev == cdev)
-			return ti;
+			return true;
 	}
 
-	return NULL;
+	return false;
 }
 
 bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz,
@@ -62,7 +62,7 @@ bool thermal_trip_is_bound_to_cdev(struc
 	mutex_lock(&tz->lock);
 	mutex_lock(&cdev->lock);
 
-	ret = !!get_instance(tz, cdev, trip);
+	ret = thermal_instance_present(tz, cdev, trip);
 
 	mutex_unlock(&cdev->lock);
 	mutex_unlock(&tz->lock);
@@ -71,24 +71,6 @@ bool thermal_trip_is_bound_to_cdev(struc
 }
 EXPORT_SYMBOL_GPL(thermal_trip_is_bound_to_cdev);
 
-struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-		     struct thermal_cooling_device *cdev, int trip_index)
-{
-	struct thermal_instance *ti;
-
-	mutex_lock(&tz->lock);
-	mutex_lock(&cdev->lock);
-
-	ti = get_instance(tz, cdev, &tz->trips[trip_index].trip);
-
-	mutex_unlock(&cdev->lock);
-	mutex_unlock(&tz->lock);
-
-	return ti;
-}
-EXPORT_SYMBOL(get_thermal_instance);
-
 /**
  * __thermal_zone_get_temp() - returns the temperature of a thermal zone
  * @tz: a valid pointer to a struct thermal_zone_device




  parent reply	other threads:[~2024-07-29 17:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-29 15:50 [RESEND][PATCH v1 0/8] thermal: Use trip pointers in thermal driver interface Rafael J. Wysocki
2024-07-29 15:53 ` [RESEND][PATCH v1 1/8] thermal: broadcom: Use thermal_zone_get_crit_temp() in bcm2835_thermal_probe() Rafael J. Wysocki
2024-07-29 21:54   ` Florian Fainelli
2024-08-02  9:36   ` Lukasz Luba
2024-07-29 15:56 ` [RESEND][PATCH v1 2/8] thermal: hisi: Use thermal_zone_for_each_trip() in hisi_thermal_register_sensor() Rafael J. Wysocki
2024-08-02  9:35   ` Lukasz Luba
2024-07-29 15:58 ` [RESEND][PATCH v1 3/8] thermal: qcom: Use thermal_zone_get_crit_temp() in qpnp_tm_init() Rafael J. Wysocki
2024-08-02  9:37   ` Lukasz Luba
2024-08-14  5:09   ` Amit Kucheria
2024-07-29 16:02 ` [RESEND][PATCH v1 4/8] thermal: tegra: Introduce struct trip_temps for critical and hot trips Rafael J. Wysocki
2024-08-02  9:40   ` Lukasz Luba
2024-07-29 16:05 ` [RESEND][PATCH v1 5/8] thermal: tegra: Use thermal_zone_for_each_trip() for walking trip points Rafael J. Wysocki
2024-08-02  9:47   ` Lukasz Luba
2024-07-29 16:06 ` Rafael J. Wysocki [this message]
2024-08-02  9:53   ` [RESEND][PATCH v1 6/8] thermal: helpers: Drop get_thermal_instance() Lukasz Luba
2024-07-29 16:11 ` [PATCH v2 7/8] thermal: trip: Get rid of thermal_zone_get_num_trips() Rafael J. Wysocki
2024-07-30 10:37   ` Niklas Söderlund
2024-08-02  9:55   ` Lukasz Luba
2024-07-29 16:12 ` [RESEND][PATCH v1 8/8] thermal: trip: Drop thermal_zone_get_trip() Rafael J. Wysocki
2024-08-02  9:56   ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2014591.usQuhbGJ8B@rjwysocki.net \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox