Skip to content

Commit e5bfcd3

Browse files
Daniel Lezcanodlezcano
authored andcommitted
thermal/core: Rename 'trips' to 'num_trips'
In order to use thermal trips defined in the thermal structure, rename the 'trips' field to 'num_trips' to have the 'trips' field containing the thermal trip points. Cc: Alexandre Bailon <[email protected]> Cc: Kevin Hilman <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent e5f2cda commit e5bfcd3

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

drivers/thermal/gov_fair_share.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ static int get_trip_level(struct thermal_zone_device *tz)
2525
int trip_temp;
2626
enum thermal_trip_type trip_type;
2727

28-
if (tz->trips == 0 || !tz->ops->get_trip_temp)
28+
if (tz->num_trips == 0 || !tz->ops->get_trip_temp)
2929
return 0;
3030

31-
for (count = 0; count < tz->trips; count++) {
31+
for (count = 0; count < tz->num_trips; count++) {
3232
tz->ops->get_trip_temp(tz, count, &trip_temp);
3333
if (tz->temperature < trip_temp)
3434
break;
@@ -53,7 +53,7 @@ static long get_target_state(struct thermal_zone_device *tz,
5353

5454
cdev->ops->get_max_state(cdev, &max_state);
5555

56-
return (long)(percentage * level * max_state) / (100 * tz->trips);
56+
return (long)(percentage * level * max_state) / (100 * tz->num_trips);
5757
}
5858

5959
/**

drivers/thermal/gov_power_allocator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ static void get_governor_trips(struct thermal_zone_device *tz,
527527
last_active = INVALID_TRIP;
528528
last_passive = INVALID_TRIP;
529529

530-
for (i = 0; i < tz->trips; i++) {
530+
for (i = 0; i < tz->num_trips; i++) {
531531
enum thermal_trip_type type;
532532
int ret;
533533

@@ -668,7 +668,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
668668

669669
get_governor_trips(tz, params);
670670

671-
if (tz->trips > 0) {
671+
if (tz->num_trips > 0) {
672672
ret = tz->ops->get_trip_temp(tz,
673673
params->trip_max_desired_temperature,
674674
&control_temp);

drivers/thermal/tegra/tegra30-tsensor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static void tegra_tsensor_get_hw_channel_trips(struct thermal_zone_device *tzd,
316316
*hot_trip = 85000;
317317
*crit_trip = 90000;
318318

319-
for (i = 0; i < tzd->trips; i++) {
319+
for (i = 0; i < tzd->num_trips; i++) {
320320
enum thermal_trip_type type;
321321
int trip_temp;
322322

drivers/thermal/thermal_core.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
501501

502502
tz->notify_event = event;
503503

504-
for (count = 0; count < tz->trips; count++)
504+
for (count = 0; count < tz->num_trips; count++)
505505
handle_thermal_trip(tz, count);
506506
}
507507
EXPORT_SYMBOL_GPL(thermal_zone_device_update);
@@ -626,7 +626,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
626626
unsigned long max_state;
627627
int result, ret;
628628

629-
if (trip >= tz->trips || trip < 0)
629+
if (trip >= tz->num_trips || trip < 0)
630630
return -EINVAL;
631631

632632
list_for_each_entry(pos1, &thermal_tz_list, node) {
@@ -807,7 +807,7 @@ static void __bind(struct thermal_zone_device *tz, int mask,
807807
{
808808
int i, ret;
809809

810-
for (i = 0; i < tz->trips; i++) {
810+
for (i = 0; i < tz->num_trips; i++) {
811811
if (mask & (1 << i)) {
812812
unsigned long upper, lower;
813813

@@ -1053,7 +1053,7 @@ static void __unbind(struct thermal_zone_device *tz, int mask,
10531053
{
10541054
int i;
10551055

1056-
for (i = 0; i < tz->trips; i++)
1056+
for (i = 0; i < tz->num_trips; i++)
10571057
if (mask & (1 << i))
10581058
thermal_zone_unbind_cooling_device(tz, i, cdev);
10591059
}
@@ -1165,7 +1165,7 @@ static void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms
11651165
/**
11661166
* thermal_zone_device_register() - register a new thermal zone device
11671167
* @type: the thermal zone device type
1168-
* @trips: the number of trip points the thermal zone support
1168+
* @num_trips: the number of trip points the thermal zone support
11691169
* @mask: a bit string indicating the writeablility of trip points
11701170
* @devdata: private device data
11711171
* @ops: standard thermal zone device callbacks
@@ -1187,7 +1187,7 @@ static void thermal_set_delay_jiffies(unsigned long *delay_jiffies, int delay_ms
11871187
* IS_ERR*() helpers.
11881188
*/
11891189
struct thermal_zone_device *
1190-
thermal_zone_device_register(const char *type, int trips, int mask,
1190+
thermal_zone_device_register(const char *type, int num_trips, int mask,
11911191
void *devdata, struct thermal_zone_device_ops *ops,
11921192
struct thermal_zone_params *tzp, int passive_delay,
11931193
int polling_delay)
@@ -1211,7 +1211,7 @@ thermal_zone_device_register(const char *type, int trips, int mask,
12111211
return ERR_PTR(-EINVAL);
12121212
}
12131213

1214-
if (trips > THERMAL_MAX_TRIPS || trips < 0 || mask >> trips) {
1214+
if (num_trips > THERMAL_MAX_TRIPS || num_trips < 0 || mask >> num_trips) {
12151215
pr_err("Incorrect number of thermal trips\n");
12161216
return ERR_PTR(-EINVAL);
12171217
}
@@ -1221,7 +1221,7 @@ thermal_zone_device_register(const char *type, int trips, int mask,
12211221
return ERR_PTR(-EINVAL);
12221222
}
12231223

1224-
if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp))
1224+
if (num_trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp))
12251225
return ERR_PTR(-EINVAL);
12261226

12271227
tz = kzalloc(sizeof(*tz), GFP_KERNEL);
@@ -1251,7 +1251,7 @@ thermal_zone_device_register(const char *type, int trips, int mask,
12511251
tz->tzp = tzp;
12521252
tz->device.class = &thermal_class;
12531253
tz->devdata = devdata;
1254-
tz->trips = trips;
1254+
tz->num_trips = num_trips;
12551255

12561256
thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay);
12571257
thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay);
@@ -1269,7 +1269,7 @@ thermal_zone_device_register(const char *type, int trips, int mask,
12691269
if (result)
12701270
goto release_device;
12711271

1272-
for (count = 0; count < trips; count++) {
1272+
for (count = 0; count < num_trips; count++) {
12731273
if (tz->ops->get_trip_type(tz, count, &trip_type) ||
12741274
tz->ops->get_trip_temp(tz, count, &trip_temp) ||
12751275
!trip_temp)

drivers/thermal/thermal_helpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
8989
ret = tz->ops->get_temp(tz, temp);
9090

9191
if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
92-
for (count = 0; count < tz->trips; count++) {
92+
for (count = 0; count < tz->num_trips; count++) {
9393
ret = tz->ops->get_trip_type(tz, count, &type);
9494
if (!ret && type == THERMAL_TRIP_CRITICAL) {
9595
ret = tz->ops->get_trip_temp(tz, count,
@@ -137,7 +137,7 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz)
137137
if (!tz->ops->set_trips || !tz->ops->get_trip_hyst)
138138
goto exit;
139139

140-
for (i = 0; i < tz->trips; i++) {
140+
for (i = 0; i < tz->num_trips; i++) {
141141
int trip_low;
142142

143143
tz->ops->get_trip_temp(tz, i, &trip_temp);

drivers/thermal/thermal_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static int thermal_genl_cmd_tz_get_trip(struct param *p)
469469

470470
mutex_lock(&tz->lock);
471471

472-
for (i = 0; i < tz->trips; i++) {
472+
for (i = 0; i < tz->num_trips; i++) {
473473

474474
enum thermal_trip_type type;
475475
int temp, hyst = 0;

drivers/thermal/thermal_sysfs.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,23 +416,23 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
416416
int indx;
417417

418418
/* This function works only for zones with at least one trip */
419-
if (tz->trips <= 0)
419+
if (tz->num_trips <= 0)
420420
return -EINVAL;
421421

422-
tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs),
422+
tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs),
423423
GFP_KERNEL);
424424
if (!tz->trip_type_attrs)
425425
return -ENOMEM;
426426

427-
tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs),
427+
tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs),
428428
GFP_KERNEL);
429429
if (!tz->trip_temp_attrs) {
430430
kfree(tz->trip_type_attrs);
431431
return -ENOMEM;
432432
}
433433

434434
if (tz->ops->get_trip_hyst) {
435-
tz->trip_hyst_attrs = kcalloc(tz->trips,
435+
tz->trip_hyst_attrs = kcalloc(tz->num_trips,
436436
sizeof(*tz->trip_hyst_attrs),
437437
GFP_KERNEL);
438438
if (!tz->trip_hyst_attrs) {
@@ -442,7 +442,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
442442
}
443443
}
444444

445-
attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL);
445+
attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL);
446446
if (!attrs) {
447447
kfree(tz->trip_type_attrs);
448448
kfree(tz->trip_temp_attrs);
@@ -451,7 +451,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
451451
return -ENOMEM;
452452
}
453453

454-
for (indx = 0; indx < tz->trips; indx++) {
454+
for (indx = 0; indx < tz->num_trips; indx++) {
455455
/* create trip type attribute */
456456
snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH,
457457
"trip_point_%d_type", indx);
@@ -478,7 +478,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
478478
tz->trip_temp_attrs[indx].attr.store =
479479
trip_point_temp_store;
480480
}
481-
attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr;
481+
attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr;
482482

483483
/* create Optional trip hyst attribute */
484484
if (!tz->ops->get_trip_hyst)
@@ -496,10 +496,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
496496
tz->trip_hyst_attrs[indx].attr.store =
497497
trip_point_hyst_store;
498498
}
499-
attrs[indx + tz->trips * 2] =
499+
attrs[indx + tz->num_trips * 2] =
500500
&tz->trip_hyst_attrs[indx].attr.attr;
501501
}
502-
attrs[tz->trips * 3] = NULL;
502+
attrs[tz->num_trips * 3] = NULL;
503503

504504
tz->trips_attribute_group.attrs = attrs;
505505

@@ -540,7 +540,7 @@ int thermal_zone_create_device_groups(struct thermal_zone_device *tz,
540540
for (i = 0; i < size - 2; i++)
541541
groups[i] = thermal_zone_attribute_groups[i];
542542

543-
if (tz->trips) {
543+
if (tz->num_trips) {
544544
result = create_trip_attrs(tz, mask);
545545
if (result) {
546546
kfree(groups);
@@ -561,7 +561,7 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
561561
if (!tz)
562562
return;
563563

564-
if (tz->trips)
564+
if (tz->num_trips)
565565
destroy_trip_attrs(tz);
566566

567567
kfree(tz->device.groups);

include/linux/thermal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct thermal_cooling_device {
123123
* @trip_hyst_attrs: attributes for trip points for sysfs: trip hysteresis
124124
* @mode: current mode of this thermal zone
125125
* @devdata: private pointer for device private data
126-
* @trips: number of trip points the thermal zone supports
126+
* @num_trips: number of trip points the thermal zone supports
127127
* @trips_disabled; bitmap for disabled trips
128128
* @passive_delay_jiffies: number of jiffies to wait between polls when
129129
* performing passive cooling.
@@ -163,7 +163,7 @@ struct thermal_zone_device {
163163
struct thermal_attr *trip_hyst_attrs;
164164
enum thermal_device_mode mode;
165165
void *devdata;
166-
int trips;
166+
int num_trips;
167167
unsigned long trips_disabled; /* bitmap for disabled trips */
168168
unsigned long passive_delay_jiffies;
169169
unsigned long polling_delay_jiffies;

0 commit comments

Comments
 (0)