Skip to content

Commit 12ad93a

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/drivers/int3400: Use thermal zone device wrappers
Use the thermal core API to access the thermal zone "type" field instead of directly using the structure field. While here, remove access to the temperature field, as this driver is reporting fake temperature, which can be replaced with INT3400_FAKE_TEMP. Also replace hardcoded 20C with INT3400_FAKE_TEMP Acked-by: srinivas pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 06c2afb commit 12ad93a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define INT3400_THERMAL_TABLE_CHANGED 0x83
1616
#define INT3400_ODVP_CHANGED 0x88
1717
#define INT3400_KEEP_ALIVE 0xA0
18+
#define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */
1819

1920
enum int3400_thermal_uuid {
2021
INT3400_THERMAL_ACTIVE = 0,
@@ -453,6 +454,7 @@ static void int3400_notify(acpi_handle handle,
453454
void *data)
454455
{
455456
struct int3400_thermal_priv *priv = data;
457+
struct device *dev;
456458
char *thermal_prop[5];
457459
int therm_event;
458460

@@ -475,12 +477,14 @@ static void int3400_notify(acpi_handle handle,
475477
return;
476478
}
477479

478-
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", priv->thermal->type);
479-
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", priv->thermal->temperature);
480+
dev = thermal_zone_device(priv->thermal);
481+
482+
thermal_prop[0] = kasprintf(GFP_KERNEL, "NAME=%s", thermal_zone_device_type(priv->thermal));
483+
thermal_prop[1] = kasprintf(GFP_KERNEL, "TEMP=%d", INT3400_FAKE_TEMP);
480484
thermal_prop[2] = kasprintf(GFP_KERNEL, "TRIP=");
481485
thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event);
482486
thermal_prop[4] = NULL;
483-
kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop);
487+
kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, thermal_prop);
484488
kfree(thermal_prop[0]);
485489
kfree(thermal_prop[1]);
486490
kfree(thermal_prop[2]);
@@ -490,7 +494,7 @@ static void int3400_notify(acpi_handle handle,
490494
static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
491495
int *temp)
492496
{
493-
*temp = 20 * 1000; /* faked temp sensor with 20C */
497+
*temp = INT3400_FAKE_TEMP;
494498
return 0;
495499
}
496500

0 commit comments

Comments
 (0)