Commit caca8b80 authored by Joe Perches's avatar Joe Perches Committed by Len Brown

thermal_sys: kernel style cleanups

Just a few tidies to make it more like most kernel sources.

A couple of long lines still remain.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reviewed-by: default avatarJesper Juhl <jj@chaosbits.net>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent ec797685
...@@ -64,7 +64,7 @@ static int get_idr(struct idr *idr, struct mutex *lock, int *id) ...@@ -64,7 +64,7 @@ static int get_idr(struct idr *idr, struct mutex *lock, int *id)
{ {
int err; int err;
again: again:
if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0)) if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
return -ENOMEM; return -ENOMEM;
...@@ -816,15 +816,14 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, ...@@ -816,15 +816,14 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
return 0; return 0;
device_remove_file(&tz->device, &dev->attr); device_remove_file(&tz->device, &dev->attr);
remove_symbol_link: remove_symbol_link:
sysfs_remove_link(&tz->device.kobj, dev->name); sysfs_remove_link(&tz->device.kobj, dev->name);
release_idr: release_idr:
release_idr(&tz->idr, &tz->lock, dev->id); release_idr(&tz->idr, &tz->lock, dev->id);
free_mem: free_mem:
kfree(dev); kfree(dev);
return result; return result;
} }
EXPORT_SYMBOL(thermal_zone_bind_cooling_device); EXPORT_SYMBOL(thermal_zone_bind_cooling_device);
/** /**
...@@ -854,14 +853,13 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, ...@@ -854,14 +853,13 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
return -ENODEV; return -ENODEV;
unbind: unbind:
device_remove_file(&tz->device, &pos->attr); device_remove_file(&tz->device, &pos->attr);
sysfs_remove_link(&tz->device.kobj, pos->name); sysfs_remove_link(&tz->device.kobj, pos->name);
release_idr(&tz->idr, &tz->lock, pos->id); release_idr(&tz->idr, &tz->lock, pos->id);
kfree(pos); kfree(pos);
return 0; return 0;
} }
EXPORT_SYMBOL(thermal_zone_unbind_cooling_device); EXPORT_SYMBOL(thermal_zone_unbind_cooling_device);
static void thermal_release(struct device *dev) static void thermal_release(struct device *dev)
...@@ -869,7 +867,8 @@ static void thermal_release(struct device *dev) ...@@ -869,7 +867,8 @@ static void thermal_release(struct device *dev)
struct thermal_zone_device *tz; struct thermal_zone_device *tz;
struct thermal_cooling_device *cdev; struct thermal_cooling_device *cdev;
if (!strncmp(dev_name(dev), "thermal_zone", sizeof "thermal_zone" - 1)) { if (!strncmp(dev_name(dev), "thermal_zone",
sizeof("thermal_zone") - 1)) {
tz = to_thermal_zone(dev); tz = to_thermal_zone(dev);
kfree(tz); kfree(tz);
} else { } else {
...@@ -889,8 +888,9 @@ static struct class thermal_class = { ...@@ -889,8 +888,9 @@ static struct class thermal_class = {
* @devdata: device private data. * @devdata: device private data.
* @ops: standard thermal cooling devices callbacks. * @ops: standard thermal cooling devices callbacks.
*/ */
struct thermal_cooling_device *thermal_cooling_device_register( struct thermal_cooling_device *
char *type, void *devdata, const struct thermal_cooling_device_ops *ops) thermal_cooling_device_register(char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)
{ {
struct thermal_cooling_device *cdev; struct thermal_cooling_device *cdev;
struct thermal_zone_device *pos; struct thermal_zone_device *pos;
...@@ -955,12 +955,11 @@ struct thermal_cooling_device *thermal_cooling_device_register( ...@@ -955,12 +955,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(
if (!result) if (!result)
return cdev; return cdev;
unregister: unregister:
release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
device_unregister(&cdev->device); device_unregister(&cdev->device);
return ERR_PTR(result); return ERR_PTR(result);
} }
EXPORT_SYMBOL(thermal_cooling_device_register); EXPORT_SYMBOL(thermal_cooling_device_register);
/** /**
...@@ -1005,7 +1004,6 @@ void thermal_cooling_device_unregister(struct ...@@ -1005,7 +1004,6 @@ void thermal_cooling_device_unregister(struct
device_unregister(&cdev->device); device_unregister(&cdev->device);
return; return;
} }
EXPORT_SYMBOL(thermal_cooling_device_unregister); EXPORT_SYMBOL(thermal_cooling_device_unregister);
/** /**
...@@ -1081,7 +1079,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) ...@@ -1081,7 +1079,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
tz->last_temperature = temp; tz->last_temperature = temp;
leave: leave:
if (tz->passive) if (tz->passive)
thermal_zone_device_set_polling(tz, tz->passive_delay); thermal_zone_device_set_polling(tz, tz->passive_delay);
else if (tz->polling_delay) else if (tz->polling_delay)
...@@ -1221,12 +1219,11 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, ...@@ -1221,12 +1219,11 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
if (!result) if (!result)
return tz; return tz;
unregister: unregister:
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
device_unregister(&tz->device); device_unregister(&tz->device);
return ERR_PTR(result); return ERR_PTR(result);
} }
EXPORT_SYMBOL(thermal_zone_device_register); EXPORT_SYMBOL(thermal_zone_device_register);
/** /**
...@@ -1278,7 +1275,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) ...@@ -1278,7 +1275,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
device_unregister(&tz->device); device_unregister(&tz->device);
return; return;
} }
EXPORT_SYMBOL(thermal_zone_device_unregister); EXPORT_SYMBOL(thermal_zone_device_unregister);
#ifdef CONFIG_NET #ifdef CONFIG_NET
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment