15
15
#define INT3400_THERMAL_TABLE_CHANGED 0x83
16
16
#define INT3400_ODVP_CHANGED 0x88
17
17
#define INT3400_KEEP_ALIVE 0xA0
18
+ #define INT3400_FAKE_TEMP (20 * 1000) /* faked temp sensor with 20C */
18
19
19
20
enum int3400_thermal_uuid {
20
21
INT3400_THERMAL_ACTIVE = 0 ,
@@ -453,6 +454,7 @@ static void int3400_notify(acpi_handle handle,
453
454
void * data )
454
455
{
455
456
struct int3400_thermal_priv * priv = data ;
457
+ struct device * dev ;
456
458
char * thermal_prop [5 ];
457
459
int therm_event ;
458
460
@@ -475,12 +477,14 @@ static void int3400_notify(acpi_handle handle,
475
477
return ;
476
478
}
477
479
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 );
480
484
thermal_prop [2 ] = kasprintf (GFP_KERNEL , "TRIP=" );
481
485
thermal_prop [3 ] = kasprintf (GFP_KERNEL , "EVENT=%d" , therm_event );
482
486
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 );
484
488
kfree (thermal_prop [0 ]);
485
489
kfree (thermal_prop [1 ]);
486
490
kfree (thermal_prop [2 ]);
@@ -490,7 +494,7 @@ static void int3400_notify(acpi_handle handle,
490
494
static int int3400_thermal_get_temp (struct thermal_zone_device * thermal ,
491
495
int * temp )
492
496
{
493
- * temp = 20 * 1000 ; /* faked temp sensor with 20C */
497
+ * temp = INT3400_FAKE_TEMP ;
494
498
return 0 ;
495
499
}
496
500
@@ -499,32 +503,28 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal,
499
503
{
500
504
struct int3400_thermal_priv * priv = thermal_zone_device_priv (thermal );
501
505
int result = 0 ;
506
+ int enabled ;
502
507
503
508
if (!priv )
504
509
return - EINVAL ;
505
510
506
- if (mode != thermal -> mode ) {
507
- int enabled ;
508
-
509
- enabled = mode == THERMAL_DEVICE_ENABLED ;
511
+ enabled = mode == THERMAL_DEVICE_ENABLED ;
510
512
511
- if (priv -> os_uuid_mask ) {
512
- if (!enabled ) {
513
- priv -> os_uuid_mask = 0 ;
514
- result = set_os_uuid_mask (priv , priv -> os_uuid_mask );
515
- }
516
- goto eval_odvp ;
513
+ if (priv -> os_uuid_mask ) {
514
+ if (!enabled ) {
515
+ priv -> os_uuid_mask = 0 ;
516
+ result = set_os_uuid_mask (priv , priv -> os_uuid_mask );
517
517
}
518
-
519
- if (priv -> current_uuid_index < 0 ||
520
- priv -> current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID )
521
- return - EINVAL ;
522
-
523
- result = int3400_thermal_run_osc (priv -> adev -> handle ,
524
- int3400_thermal_uuids [priv -> current_uuid_index ],
525
- & enabled );
518
+ goto eval_odvp ;
526
519
}
527
520
521
+ if (priv -> current_uuid_index < 0 ||
522
+ priv -> current_uuid_index >= INT3400_THERMAL_MAXIMUM_UUID )
523
+ return - EINVAL ;
524
+
525
+ result = int3400_thermal_run_osc (priv -> adev -> handle ,
526
+ int3400_thermal_uuids [priv -> current_uuid_index ],
527
+ & enabled );
528
528
eval_odvp :
529
529
evaluate_odvp (priv );
530
530
0 commit comments