Skip to content

Commit

Permalink
thermal/core: Rename thermal_zone_device to thermal_zone
Browse files Browse the repository at this point in the history
A thermal zone is a component to represent a sensor, a given number of
properties, a policy and some associated cooling devices.

The current name is 'thermal_zone_device' but that is confusing
because it implies it is a device while it is a software component.

For the sake of clarity and the process of cleaning up the thermal
framework, simply rename it to 'thermal zone'.

No functional change, just renaming.

Cc: Alexandre Bailon <abailon@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc; Eduardo Valentin <eduval@amazon.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
  • Loading branch information
Daniel Lezcano authored and intel-lab-lkp committed Apr 26, 2022
1 parent a17c2cb commit 72a43d2
Show file tree
Hide file tree
Showing 92 changed files with 691 additions and 691 deletions.
10 changes: 5 additions & 5 deletions Documentation/driver-api/thermal/power_allocator.rst
Expand Up @@ -95,7 +95,7 @@ will suffice::
};

and then pass `tz_params` as the 5th parameter to
`thermal_zone_device_register()`
`thermal_zone_register()`

k_po and k_pu
-------------
Expand Down Expand Up @@ -186,7 +186,7 @@ Cooling devices controlled by this governor must supply the additional
1. ::

int get_requested_power(struct thermal_cooling_device *cdev,
struct thermal_zone_device *tz, u32 *power);
struct thermal_zone *tz, u32 *power);


@cdev:
Expand All @@ -205,7 +205,7 @@ device.
2. ::

int state2power(struct thermal_cooling_device *cdev, struct
thermal_zone_device *tz, unsigned long state,
thermal_zone *tz, unsigned long state,
u32 *power);

@cdev:
Expand Down Expand Up @@ -255,7 +255,7 @@ the same kind of compute, but with different efficiency. For example,
a system with two different types of processors.

If the thermal zone is registered using
`thermal_zone_device_register()` (i.e., platform code), then weights
`thermal_zone_register()` (i.e., platform code), then weights
are passed as part of the thermal zone's `thermal_bind_parameters`.
If the platform is registered using device tree, then they are passed
as the `contribution` property of each map in the `cooling-maps` node.
Expand All @@ -265,7 +265,7 @@ Limitations of the power allocator governor

The power allocator governor's PID controller works best if there is a
periodic tick. If you have a driver that calls
`thermal_zone_device_update()` (or anything that ends up calling the
`thermal_zone_update()` (or anything that ends up calling the
governor's `throttle()` function) repetitively, the governor response
won't be very good. Note that this is not particular to this
governor, step-wise will also misbehave if you call its throttle()
Expand Down
28 changes: 14 additions & 14 deletions Documentation/driver-api/thermal/sysfs-api.rst
Expand Up @@ -38,10 +38,10 @@ temperature) and throttle appropriate devices.

::

struct thermal_zone_device
*thermal_zone_device_register(char *type,
struct thermal_zone
*thermal_zone_register(char *type,
int trips, int mask, void *devdata,
struct thermal_zone_device_ops *ops,
struct thermal_zone_ops *ops,
const struct thermal_zone_params *tzp,
int passive_delay, int polling_delay))
Expand Down Expand Up @@ -99,15 +99,15 @@ temperature) and throttle appropriate devices.

::

void thermal_zone_device_unregister(struct thermal_zone_device *tz)
void thermal_zone_unregister(struct thermal_zone *tz)
This interface function removes the thermal zone device.
It deletes the corresponding entry from /sys/class/thermal folder and
unbinds all the thermal cooling devices it uses.

::

struct thermal_zone_device
struct thermal_zone
*thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
void *data,
const struct thermal_zone_of_device_ops *ops)
Expand Down Expand Up @@ -140,7 +140,7 @@ temperature) and throttle appropriate devices.
set_trips a pointer to a function that sets a
temperature window. When this window is
left the driver must inform the thermal
core via thermal_zone_device_update.
core via thermal_zone_update.
get_trend a pointer to a function that reads the
sensor temperature trend.
set_emul_temp a pointer to a function that sets
Expand All @@ -158,7 +158,7 @@ temperature) and throttle appropriate devices.
::

void thermal_zone_of_sensor_unregister(struct device *dev,
struct thermal_zone_device *tzd)
struct thermal_zone *tzd)

This interface unregisters a sensor from a DT thermal zone which was
successfully added by interface thermal_zone_of_sensor_register().
Expand All @@ -169,7 +169,7 @@ temperature) and throttle appropriate devices.

::

struct thermal_zone_device
struct thermal_zone
*devm_thermal_zone_of_sensor_register(struct device *dev,
int sensor_id,
void *data,
Expand All @@ -189,7 +189,7 @@ temperature) and throttle appropriate devices.
::

void devm_thermal_zone_of_sensor_unregister(struct device *dev,
struct thermal_zone_device *tzd)
struct thermal_zone *tzd)

This interface is resource managed version of
thermal_zone_of_sensor_unregister().
Expand All @@ -200,15 +200,15 @@ temperature) and throttle appropriate devices.

::

int thermal_zone_get_slope(struct thermal_zone_device *tz)
int thermal_zone_get_slope(struct thermal_zone *tz)

This interface is used to read the slope attribute value
for the thermal zone device, which might be useful for platform
drivers for temperature calculations.

::

int thermal_zone_get_offset(struct thermal_zone_device *tz)
int thermal_zone_get_offset(struct thermal_zone *tz)

This interface is used to read the offset attribute value
for the thermal zone device, which might be useful for platform
Expand Down Expand Up @@ -256,7 +256,7 @@ temperature) and throttle appropriate devices.

::

int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
int thermal_zone_bind_cooling_device(struct thermal_zone *tz,
int trip, struct thermal_cooling_device *cdev,
unsigned long upper, unsigned long lower, unsigned int weight);
Expand Down Expand Up @@ -286,7 +286,7 @@ temperature) and throttle appropriate devices.

::

int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
int thermal_zone_unbind_cooling_device(struct thermal_zone *tz,
int trip, struct thermal_cooling_device *cdev);
This interface function unbinds a thermal cooling device from a particular
Expand Down Expand Up @@ -446,7 +446,7 @@ Please read Documentation/hwmon/sysfs-interface.rst for additional information.
ACPI thermal zone may support multiple trip points like critical, hot,
passive, active. If an ACPI thermal zone supports critical, passive,
active[0] and active[1] at the same time, it may register itself as a
thermal_zone_device (thermal_zone1) with 4 trip points in all.
thermal_zone (thermal_zone1) with 4 trip points in all.
It has one processor and one fan, which are both registered as
thermal_cooling_device. Both are considered to have the same
effectiveness in cooling the thermal zone.
Expand Down
42 changes: 21 additions & 21 deletions drivers/acpi/thermal.c
Expand Up @@ -168,7 +168,7 @@ struct acpi_thermal {
struct acpi_thermal_state state;
struct acpi_thermal_trips trips;
struct acpi_handle_list devices;
struct thermal_zone_device *thermal_zone;
struct thermal_zone *thermal_zone;
int kelvin_offset; /* in millidegrees */
struct work_struct thermal_check_work;
struct mutex thermal_check_lock;
Expand Down Expand Up @@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)

/* sys I/F for generic thermal sysfs support */

static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
static int thermal_get_temp(struct thermal_zone *thermal, int *temp)
{
struct acpi_thermal *tz = thermal->devdata;
int result;
Expand All @@ -515,7 +515,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
return 0;
}

static int thermal_get_trip_type(struct thermal_zone_device *thermal,
static int thermal_get_trip_type(struct thermal_zone *thermal,
int trip, enum thermal_trip_type *type)
{
struct acpi_thermal *tz = thermal->devdata;
Expand Down Expand Up @@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
return -EINVAL;
}

static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
static int thermal_get_trip_temp(struct thermal_zone *thermal,
int trip, int *temp)
{
struct acpi_thermal *tz = thermal->devdata;
Expand Down Expand Up @@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
return -EINVAL;
}

static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
static int thermal_get_crit_temp(struct thermal_zone *thermal,
int *temperature)
{
struct acpi_thermal *tz = thermal->devdata;
Expand All @@ -627,7 +627,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
return -EINVAL;
}

static int thermal_get_trend(struct thermal_zone_device *thermal,
static int thermal_get_trend(struct thermal_zone *thermal,
int trip, enum thermal_trend *trend)
{
struct acpi_thermal *tz = thermal->devdata;
Expand Down Expand Up @@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
return 0;
}

static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
static void acpi_thermal_zone_hot(struct thermal_zone *thermal)
{
struct acpi_thermal *tz = thermal->devdata;

Expand All @@ -679,18 +679,18 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
ACPI_THERMAL_NOTIFY_HOT, 1);
}

static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
static void acpi_thermal_zone_critical(struct thermal_zone *thermal)
{
struct acpi_thermal *tz = thermal->devdata;

acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
dev_name(&tz->device->dev),
ACPI_THERMAL_NOTIFY_CRITICAL, 1);

thermal_zone_device_critical(thermal);
thermal_zone_critical(thermal);
}

static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
static int acpi_thermal_cooling_device_cb(struct thermal_zone *thermal,
struct thermal_cooling_device *cdev,
bool bind)
{
Expand Down Expand Up @@ -761,29 +761,29 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
}

static int
acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
acpi_thermal_bind_cooling_device(struct thermal_zone *thermal,
struct thermal_cooling_device *cdev)
{
return acpi_thermal_cooling_device_cb(thermal, cdev, true);
}

static int
acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
acpi_thermal_unbind_cooling_device(struct thermal_zone *thermal,
struct thermal_cooling_device *cdev)
{
return acpi_thermal_cooling_device_cb(thermal, cdev, false);
}

static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
static struct thermal_zone_ops acpi_thermal_zone_ops = {
.bind = acpi_thermal_bind_cooling_device,
.unbind = acpi_thermal_unbind_cooling_device,
.get_temp = thermal_get_temp,
.get_trip_type = thermal_get_trip_type,
.get_trip_temp = thermal_get_trip_temp,
.get_crit_temp = thermal_get_crit_temp,
.get_trend = thermal_get_trend,
.hot = acpi_thermal_zone_device_hot,
.critical = acpi_thermal_zone_device_critical,
.hot = acpi_thermal_zone_hot,
.critical = acpi_thermal_zone_critical,
};

static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
Expand All @@ -807,13 +807,13 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)

if (tz->trips.passive.flags.valid)
tz->thermal_zone =
thermal_zone_device_register("acpitz", trips, 0, tz,
thermal_zone_register("acpitz", trips, 0, tz,
&acpi_thermal_zone_ops, NULL,
tz->trips.passive.tsp*100,
tz->polling_frequency*100);
else
tz->thermal_zone =
thermal_zone_device_register("acpitz", trips, 0, tz,
thermal_zone_register("acpitz", trips, 0, tz,
&acpi_thermal_zone_ops, NULL,
0, tz->polling_frequency*100);
if (IS_ERR(tz->thermal_zone))
Expand All @@ -836,7 +836,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
goto remove_dev_link;
}

result = thermal_zone_device_enable(tz->thermal_zone);
result = thermal_zone_enable(tz->thermal_zone);
if (result)
goto acpi_bus_detach;

Expand All @@ -852,7 +852,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
remove_tz_link:
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
unregister_tzd:
thermal_zone_device_unregister(tz->thermal_zone);
thermal_zone_unregister(tz->thermal_zone);

return result;
}
Expand All @@ -861,7 +861,7 @@ static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
{
sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
thermal_zone_device_unregister(tz->thermal_zone);
thermal_zone_unregister(tz->thermal_zone);
tz->thermal_zone = NULL;
acpi_bus_detach_private_data(tz->device->handle);
}
Expand Down Expand Up @@ -1011,7 +1011,7 @@ static void acpi_thermal_check_fn(struct work_struct *work)

mutex_lock(&tz->thermal_check_lock);

thermal_zone_device_update(tz->thermal_zone, THERMAL_EVENT_UNSPECIFIED);
thermal_zone_update(tz->thermal_zone, THERMAL_EVENT_UNSPECIFIED);

refcount_inc(&tz->thermal_check_count);

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/tiny/repaper.c
Expand Up @@ -73,7 +73,7 @@ struct repaper_epd {
struct gpio_desc *reset;
struct gpio_desc *busy;

struct thermal_zone_device *thermal;
struct thermal_zone *thermal;

unsigned int height;
unsigned int width;
Expand Down
6 changes: 3 additions & 3 deletions drivers/hwmon/hwmon.c
Expand Up @@ -63,7 +63,7 @@ struct hwmon_thermal_data {
struct list_head node; /* hwmon tzdata list entry */
struct device *dev; /* Reference to hwmon device */
int index; /* sensor index */
struct thermal_zone_device *tzd;/* thermal zone device */
struct thermal_zone *tzd;/* thermal zone device */
};

static ssize_t
Expand Down Expand Up @@ -217,7 +217,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index)
{
struct hwmon_device *hwdev = to_hwmon_device(dev);
struct hwmon_thermal_data *tdata;
struct thermal_zone_device *tzd;
struct thermal_zone *tzd;
int err;

tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL);
Expand Down Expand Up @@ -286,7 +286,7 @@ static void hwmon_thermal_notify(struct device *dev, int index)

list_for_each_entry(tzdata, &hwdev->tzdata, node) {
if (tzdata->index == index) {
thermal_zone_device_update(tzdata->tzd,
thermal_zone_update(tzdata->tzd,
THERMAL_EVENT_UNSPECIFIED);
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/scpi-hwmon.c
Expand Up @@ -263,7 +263,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&scpi_sensors->thermal_zones);
for (i = 0; i < nr_sensors; i++) {
struct sensor_data *sensor = &scpi_sensors->data[i];
struct thermal_zone_device *z;
struct thermal_zone *z;
struct scpi_thermal_zone *zone;

if (sensor->info.class != TEMPERATURE)
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/sun4i-gpadc-iio.c
Expand Up @@ -102,7 +102,7 @@ struct sun4i_gpadc_iio {
bool no_irq;
/* prevents concurrent reads of temperature and ADC */
struct mutex mutex;
struct thermal_zone_device *tzd;
struct thermal_zone *tzd;
struct device *sensor_device;
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/sun4i-ts.c
Expand Up @@ -237,7 +237,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct device *hwmon;
struct thermal_zone_device *thermal;
struct thermal_zone *thermal;
int error;
u32 reg;
bool ts_attached;
Expand Down

0 comments on commit 72a43d2

Please sign in to comment.