@@ -915,17 +915,12 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
915
915
}
916
916
static DEVICE_ATTR_WO (kbd_rgb_mode );
917
917
918
- static ssize_t kbd_rgb_mode_index_show (struct device * device ,
919
- struct device_attribute * attr ,
920
- char * buf )
921
- {
922
- return sysfs_emit (buf , "%s\n" , "cmd mode red green blue speed" );
923
- }
924
- static DEVICE_ATTR_RO (kbd_rgb_mode_index );
918
+ static DEVICE_STRING_ATTR_RO (kbd_rgb_mode_index , 0444 ,
919
+ "cmd mode red green blue speed" );
925
920
926
921
static struct attribute * kbd_rgb_mode_attrs [] = {
927
922
& dev_attr_kbd_rgb_mode .attr ,
928
- & dev_attr_kbd_rgb_mode_index .attr ,
923
+ & dev_attr_kbd_rgb_mode_index .attr . attr ,
929
924
NULL ,
930
925
};
931
926
@@ -967,17 +962,12 @@ static ssize_t kbd_rgb_state_store(struct device *dev,
967
962
}
968
963
static DEVICE_ATTR_WO (kbd_rgb_state );
969
964
970
- static ssize_t kbd_rgb_state_index_show (struct device * device ,
971
- struct device_attribute * attr ,
972
- char * buf )
973
- {
974
- return sysfs_emit (buf , "%s\n" , "cmd boot awake sleep keyboard" );
975
- }
976
- static DEVICE_ATTR_RO (kbd_rgb_state_index );
965
+ static DEVICE_STRING_ATTR_RO (kbd_rgb_state_index , 0444 ,
966
+ "cmd boot awake sleep keyboard" );
977
967
978
968
static struct attribute * kbd_rgb_state_attrs [] = {
979
969
& dev_attr_kbd_rgb_state .attr ,
980
- & dev_attr_kbd_rgb_state_index .attr ,
970
+ & dev_attr_kbd_rgb_state_index .attr . attr ,
981
971
NULL ,
982
972
};
983
973
@@ -2493,13 +2483,6 @@ static ssize_t pwm1_enable_store(struct device *dev,
2493
2483
return count ;
2494
2484
}
2495
2485
2496
- static ssize_t fan1_label_show (struct device * dev ,
2497
- struct device_attribute * attr ,
2498
- char * buf )
2499
- {
2500
- return sysfs_emit (buf , "%s\n" , ASUS_FAN_DESC );
2501
- }
2502
-
2503
2486
static ssize_t asus_hwmon_temp1 (struct device * dev ,
2504
2487
struct device_attribute * attr ,
2505
2488
char * buf )
@@ -2534,13 +2517,6 @@ static ssize_t fan2_input_show(struct device *dev,
2534
2517
return sysfs_emit (buf , "%d\n" , value * 100 );
2535
2518
}
2536
2519
2537
- static ssize_t fan2_label_show (struct device * dev ,
2538
- struct device_attribute * attr ,
2539
- char * buf )
2540
- {
2541
- return sysfs_emit (buf , "%s\n" , ASUS_GPU_FAN_DESC );
2542
- }
2543
-
2544
2520
/* Middle/Center fan on modern ROG laptops */
2545
2521
static ssize_t fan3_input_show (struct device * dev ,
2546
2522
struct device_attribute * attr ,
@@ -2559,13 +2535,6 @@ static ssize_t fan3_input_show(struct device *dev,
2559
2535
return sysfs_emit (buf , "%d\n" , value * 100 );
2560
2536
}
2561
2537
2562
- static ssize_t fan3_label_show (struct device * dev ,
2563
- struct device_attribute * attr ,
2564
- char * buf )
2565
- {
2566
- return sysfs_emit (buf , "%s\n" , ASUS_MID_FAN_DESC );
2567
- }
2568
-
2569
2538
static ssize_t pwm2_enable_show (struct device * dev ,
2570
2539
struct device_attribute * attr ,
2571
2540
char * buf )
@@ -2662,15 +2631,16 @@ static ssize_t pwm3_enable_store(struct device *dev,
2662
2631
static DEVICE_ATTR_RW (pwm1 );
2663
2632
static DEVICE_ATTR_RW (pwm1_enable );
2664
2633
static DEVICE_ATTR_RO (fan1_input );
2665
- static DEVICE_ATTR_RO (fan1_label );
2634
+ static DEVICE_STRING_ATTR_RO (fan1_label , 0444 , ASUS_FAN_DESC ) ;
2635
+
2666
2636
/* Fan2 - GPU fan */
2667
2637
static DEVICE_ATTR_RW (pwm2_enable );
2668
2638
static DEVICE_ATTR_RO (fan2_input );
2669
- static DEVICE_ATTR_RO (fan2_label );
2639
+ static DEVICE_STRING_ATTR_RO (fan2_label , 0444 , ASUS_GPU_FAN_DESC ) ;
2670
2640
/* Fan3 - Middle/center fan */
2671
2641
static DEVICE_ATTR_RW (pwm3_enable );
2672
2642
static DEVICE_ATTR_RO (fan3_input );
2673
- static DEVICE_ATTR_RO (fan3_label );
2643
+ static DEVICE_STRING_ATTR_RO (fan3_label , 0444 , ASUS_MID_FAN_DESC ) ;
2674
2644
2675
2645
/* Temperature */
2676
2646
static DEVICE_ATTR (temp1_input , S_IRUGO , asus_hwmon_temp1 , NULL) ;
@@ -2681,11 +2651,11 @@ static struct attribute *hwmon_attributes[] = {
2681
2651
& dev_attr_pwm2_enable .attr ,
2682
2652
& dev_attr_pwm3_enable .attr ,
2683
2653
& dev_attr_fan1_input .attr ,
2684
- & dev_attr_fan1_label .attr ,
2654
+ & dev_attr_fan1_label .attr . attr ,
2685
2655
& dev_attr_fan2_input .attr ,
2686
- & dev_attr_fan2_label .attr ,
2656
+ & dev_attr_fan2_label .attr . attr ,
2687
2657
& dev_attr_fan3_input .attr ,
2688
- & dev_attr_fan3_label .attr ,
2658
+ & dev_attr_fan3_label .attr . attr ,
2689
2659
2690
2660
& dev_attr_temp1_input .attr ,
2691
2661
NULL
@@ -2702,17 +2672,17 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
2702
2672
if (asus -> fan_type != FAN_TYPE_AGFN )
2703
2673
return 0 ;
2704
2674
} else if (attr == & dev_attr_fan1_input .attr
2705
- || attr == & dev_attr_fan1_label .attr
2675
+ || attr == & dev_attr_fan1_label .attr . attr
2706
2676
|| attr == & dev_attr_pwm1_enable .attr ) {
2707
2677
if (asus -> fan_type == FAN_TYPE_NONE )
2708
2678
return 0 ;
2709
2679
} else if (attr == & dev_attr_fan2_input .attr
2710
- || attr == & dev_attr_fan2_label .attr
2680
+ || attr == & dev_attr_fan2_label .attr . attr
2711
2681
|| attr == & dev_attr_pwm2_enable .attr ) {
2712
2682
if (asus -> gpu_fan_type == FAN_TYPE_NONE )
2713
2683
return 0 ;
2714
2684
} else if (attr == & dev_attr_fan3_input .attr
2715
- || attr == & dev_attr_fan3_label .attr
2685
+ || attr == & dev_attr_fan3_label .attr . attr
2716
2686
|| attr == & dev_attr_pwm3_enable .attr ) {
2717
2687
if (asus -> mid_fan_type == FAN_TYPE_NONE )
2718
2688
return 0 ;
0 commit comments