Commit be014c78 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

thermal: intel: int340x: Assorted minor cleanups

Improve some inconsistent usage of white space in int340x_thermal_zone.c,
fix up one coding style issue in it (missing braces around an else
branch of a conditional) and while at it replace a !ACPI_FAILURE()
check with an equivalent ACPI_SUCCESS() one.

No intentional functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: default avatarZhang Rui <rui.zhang@intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
parent dd3b3d16
...@@ -30,15 +30,16 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone, ...@@ -30,15 +30,16 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
return conv_temp; return conv_temp;
*temp = (unsigned long)conv_temp * 10; *temp = (unsigned long)conv_temp * 10;
} else } else {
/* _TMP returns the temperature in tenths of degrees Kelvin */ /* _TMP returns the temperature in tenths of degrees Kelvin */
*temp = deci_kelvin_to_millicelsius(tmp); *temp = deci_kelvin_to_millicelsius(tmp);
}
return 0; return 0;
} }
static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
int trip, int temp) int trip, int temp)
{ {
struct int34x_thermal_zone *d = zone->devdata; struct int34x_thermal_zone *d = zone->devdata;
acpi_status status; acpi_status status;
...@@ -46,7 +47,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone, ...@@ -46,7 +47,7 @@ static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
snprintf(name, sizeof(name), "PAT%d", trip); snprintf(name, sizeof(name), "PAT%d", trip);
status = acpi_execute_simple_method(d->adev->handle, name, status = acpi_execute_simple_method(d->adev->handle, name,
millicelsius_to_deci_kelvin(temp)); millicelsius_to_deci_kelvin(temp));
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -EIO; return -EIO;
...@@ -92,7 +93,6 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev, ...@@ -92,7 +93,6 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev,
} }
for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) { for (i = 0; i < INT340X_THERMAL_MAX_ACT_TRIP_COUNT; i++) {
ret = thermal_acpi_active_trip_temp(zone_adev, i, ret = thermal_acpi_active_trip_temp(zone_adev, i,
&zone_trips[trip_cnt].temperature); &zone_trips[trip_cnt].temperature);
if (ret) if (ret)
...@@ -121,8 +121,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, ...@@ -121,8 +121,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
acpi_status status; acpi_status status;
int i, ret; int i, ret;
int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), GFP_KERNEL);
GFP_KERNEL);
if (!int34x_thermal_zone) if (!int34x_thermal_zone)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -139,7 +138,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, ...@@ -139,7 +138,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
int34x_thermal_zone->ops->get_temp = get_temp; int34x_thermal_zone->ops->get_temp = get_temp;
status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt); status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
int34x_thermal_zone->aux_trip_nr = trip_cnt; int34x_thermal_zone->aux_trip_nr = trip_cnt;
trip_mask = BIT(trip_cnt) - 1; trip_mask = BIT(trip_cnt) - 1;
} }
...@@ -169,8 +168,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, ...@@ -169,8 +168,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
int34x_thermal_zone->trips = zone_trips; int34x_thermal_zone->trips = zone_trips;
int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table( int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle);
adev->handle);
int34x_thermal_zone->zone = thermal_zone_device_register_with_trips( int34x_thermal_zone->zone = thermal_zone_device_register_with_trips(
acpi_device_bid(adev), acpi_device_bid(adev),
......
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