diff mbox

[2/5] thermal: share get_ida()/release_ida() for other thermal ida users

Message ID 1482285855-2974-3-git-send-email-rui.zhang@intel.com (mailing list archive)
State Rejected
Delegated to: Zhang Rui
Headers show

Commit Message

Zhang Rui Dec. 21, 2016, 2:04 a.m. UTC
CC: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/thermal_core.c | 4 ++--
 drivers/thermal/thermal_core.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Matthew Wilcox Dec. 21, 2016, 3:54 p.m. UTC | #1
From: Zhang Rui [mailto:rui.zhang@intel.com]

>   * - thermal zone devices lifecycle: registration, unregistration,

>   *				     binding, and unbinding.

>   */

> -static int get_ida(struct ida *ida, struct mutex *lock, int *id)

> +int get_ida(struct ida *ida, struct mutex *lock, int *id)


I don't like making a function as generically named as "get_ida" non-static.  Unless it's part of the IDA code :-)  In any case, I don't think these drivers need their own mutexes, so I sent a replacement set of patches.
diff mbox

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 1b6fde2..5849727 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -589,7 +589,7 @@  void thermal_zone_device_unbind_exception(struct thermal_zone_device *tz,
  * - thermal zone devices lifecycle: registration, unregistration,
  *				     binding, and unbinding.
  */
-static int get_ida(struct ida *ida, struct mutex *lock, int *id)
+int get_ida(struct ida *ida, struct mutex *lock, int *id)
 {
 	int ret;
 
@@ -605,7 +605,7 @@  static int get_ida(struct ida *ida, struct mutex *lock, int *id)
 	return ret;
 }
 
-static void release_ida(struct ida *ida, struct mutex *lock, int id)
+void release_ida(struct ida *ida, struct mutex *lock, int id)
 {
 	if (!ida || !lock)
 		return;
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 2412b37..e49f9f5 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -68,6 +68,8 @@  void thermal_zone_device_unbind_exception(struct thermal_zone_device *,
 					  const char *, size_t);
 int thermal_zone_device_set_policy(struct thermal_zone_device *, char *);
 int thermal_build_list_of_policies(char *buf);
+int get_ida(struct ida *, struct mutex *, int *);
+void release_ida(struct ida *, struct mutex *, int);
 
 /* sysfs I/F */
 int thermal_zone_create_device_groups(struct thermal_zone_device *, int);