From: Zhang Rui <rui.zhang@intel.com>
To: linux-pm@vger.kernel.org, rafael.j.wysocki@intel.com,
daniel.lezcano@linaro.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] thermal/core: Avoid unbind for thermal zones without .unbind()
Date: Fri, 24 Mar 2023 15:08:07 +0800 [thread overview]
Message-ID: <20230324070807.6342-5-rui.zhang@intel.com> (raw)
In-Reply-To: <20230324070807.6342-1-rui.zhang@intel.com>
The ops->bind()/unbind() callback is the only way to bind/unbind a
cooling device to/from a thermal zone.
Optimize the code to avoid trying unbind when .unbind() callback doesn't
exist.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/thermal/thermal_core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9c447f22cb39..1af36450f13e 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1411,6 +1411,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
}
list_del(&tz->node);
+ if (!tz->ops->unbind)
+ goto unbind_done;
+
/* Unbind all cdevs associated with 'this' thermal zone */
list_for_each_entry(cdev, &thermal_cdev_list, node) {
struct thermal_instance *ti;
@@ -1428,8 +1431,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
continue;
unbind:
- if (tz->ops->unbind)
- tz->ops->unbind(tz, cdev);
+ tz->ops->unbind(tz, cdev);
/*
* The thermal instances for current thermal zone has been
@@ -1441,6 +1443,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
mutex_unlock(&cdev->lock);
}
+unbind_done:
mutex_unlock(&thermal_list_lock);
cancel_delayed_work_sync(&tz->poll_queue);
--
2.25.1
prev parent reply other threads:[~2023-03-24 7:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 7:08 [PATCH v2 1/5] thermal/core: Update cooling device during thermal zone unregistration Zhang Rui
2023-03-24 7:08 ` [PATCH 2/5] thermal/core: Reset cooling state during cooling device unregistration Zhang Rui
2023-03-24 13:19 ` Rafael J. Wysocki
2023-03-27 14:50 ` Zhang, Rui
2023-03-27 15:13 ` Rafael J. Wysocki
2023-03-28 2:46 ` Zhang, Rui
2023-03-28 17:54 ` Rafael J. Wysocki
2023-03-29 6:28 ` Zhang, Rui
2023-03-24 7:08 ` [PATCH 3/5] thermal/core: Remove thermal_bind_params structure Zhang Rui
2023-03-29 18:39 ` Rafael J. Wysocki
2023-03-30 1:11 ` Zhang, Rui
2023-03-24 7:08 ` [PATCH 4/5] thermal/core: Enforce paired .bind/.unbind callbacks Zhang Rui
2023-03-24 13:24 ` Rafael J. Wysocki
2023-03-24 13:25 ` Rafael J. Wysocki
2023-03-27 15:03 ` Zhang, Rui
2023-03-24 7:08 ` Zhang Rui [this message]
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=20230324070807.6342-5-rui.zhang@intel.com \
--to=rui.zhang@intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.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
all inboxes | Powered by JetHome®