summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Valentin <edubezval@gmail.com>2016-11-07 21:09:06 -0800
committerZhang Rui <rui.zhang@intel.com>2016-11-23 10:06:12 +0800
commitc30176fc6f483163affeb0f629c0e27b23c084a1 (patch)
tree966f8f52dd1a7cb93865fe300f9433bfe77219b2
parent1b4f48494eb2886d42b034b57f0c4005add296b0 (diff)
downloadblackbird-op-linux-c30176fc6f483163affeb0f629c0e27b23c084a1.tar.gz
blackbird-op-linux-c30176fc6f483163affeb0f629c0e27b23c084a1.zip
thermal: core: move idr handling to device management section
Given that idr is only used to get id for thermal devices (zones and cooling), makes sense to move the code closer. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/thermal/thermal_core.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index e36a6a6e58db..f6e24ef1d904 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -286,30 +286,6 @@ static void thermal_unregister_governors(void)
thermal_gov_power_allocator_unregister();
}
-static int get_idr(struct idr *idr, struct mutex *lock, int *id)
-{
- int ret;
-
- if (lock)
- mutex_lock(lock);
- ret = idr_alloc(idr, NULL, 0, 0, GFP_KERNEL);
- if (lock)
- mutex_unlock(lock);
- if (unlikely(ret < 0))
- return ret;
- *id = ret;
- return 0;
-}
-
-static void release_idr(struct idr *idr, struct mutex *lock, int id)
-{
- if (lock)
- mutex_lock(lock);
- idr_remove(idr, id);
- if (lock)
- mutex_unlock(lock);
-}
-
static void print_bind_err_msg(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev, int ret)
{
@@ -699,6 +675,30 @@ void thermal_zone_device_unbind_exception(struct thermal_zone_device *tz,
/* Device management */
+static int get_idr(struct idr *idr, struct mutex *lock, int *id)
+{
+ int ret;
+
+ if (lock)
+ mutex_lock(lock);
+ ret = idr_alloc(idr, NULL, 0, 0, GFP_KERNEL);
+ if (lock)
+ mutex_unlock(lock);
+ if (unlikely(ret < 0))
+ return ret;
+ *id = ret;
+ return 0;
+}
+
+static void release_idr(struct idr *idr, struct mutex *lock, int id)
+{
+ if (lock)
+ mutex_lock(lock);
+ idr_remove(idr, id);
+ if (lock)
+ mutex_unlock(lock);
+}
+
/**
* thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
* @tz: pointer to struct thermal_zone_device
OpenPOWER on IntegriCloud