Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298037
b: refs/heads/master
c: ec79768
h: refs/heads/master
i:
  298035: b14ff4d
v: v3
  • Loading branch information
Joe Perches authored and Len Brown committed Mar 22, 2012
1 parent 5250f0b commit a521e44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 886ee5463530036f6171e1376118e7014cf33f7f
refs/heads/master: ec797685609da142588012d734e85d14cff9c7d2
32 changes: 12 additions & 20 deletions trunk/drivers/thermal/thermal_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,22 +310,6 @@ static struct device_attribute trip_point_attrs[] = {
__ATTR(trip_point_11_temp, 0444, trip_point_temp_show, NULL),
};

#define TRIP_POINT_ATTR_ADD(_dev, _index, result) \
do { \
result = device_create_file(_dev, \
&trip_point_attrs[_index * 2]); \
if (result) \
break; \
result = device_create_file(_dev, \
&trip_point_attrs[_index * 2 + 1]); \
} while (0)

#define TRIP_POINT_ATTR_REMOVE(_dev, _index) \
do { \
device_remove_file(_dev, &trip_point_attrs[_index * 2]); \
device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \
} while (0)

/* sys I/F for cooling device */
#define to_cooling_device(_dev) \
container_of(_dev, struct thermal_cooling_device, device)
Expand Down Expand Up @@ -1196,7 +1180,12 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
}

for (count = 0; count < trips; count++) {
TRIP_POINT_ATTR_ADD(&tz->device, count, result);
result = device_create_file(&tz->device,
&trip_point_attrs[count * 2]);
if (result)
break;
result = device_create_file(&tz->device,
&trip_point_attrs[count * 2 + 1]);
if (result)
goto unregister;
tz->ops->get_trip_type(tz, count, &trip_type);
Expand Down Expand Up @@ -1276,9 +1265,12 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
if (tz->ops->get_mode)
device_remove_file(&tz->device, &dev_attr_mode);

for (count = 0; count < tz->trips; count++)
TRIP_POINT_ATTR_REMOVE(&tz->device, count);

for (count = 0; count < tz->trips; count++) {
device_remove_file(&tz->device,
&trip_point_attrs[count * 2]);
device_remove_file(&tz->device,
&trip_point_attrs[count * 2 + 1]);
}
thermal_remove_hwmon_sysfs(tz);
release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
idr_destroy(&tz->idr);
Expand Down

0 comments on commit a521e44

Please sign in to comment.