@@ -915,17 +915,12 @@ static ssize_t kbd_rgb_mode_store(struct device *dev,
915915}
916916static DEVICE_ATTR_WO (kbd_rgb_mode );
917917
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" );
925920
926921static struct attribute * kbd_rgb_mode_attrs [] = {
927922 & dev_attr_kbd_rgb_mode .attr ,
928- & dev_attr_kbd_rgb_mode_index .attr ,
923+ & dev_attr_kbd_rgb_mode_index .attr . attr ,
929924 NULL ,
930925};
931926
@@ -967,17 +962,12 @@ static ssize_t kbd_rgb_state_store(struct device *dev,
967962}
968963static DEVICE_ATTR_WO (kbd_rgb_state );
969964
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" );
977967
978968static struct attribute * kbd_rgb_state_attrs [] = {
979969 & dev_attr_kbd_rgb_state .attr ,
980- & dev_attr_kbd_rgb_state_index .attr ,
970+ & dev_attr_kbd_rgb_state_index .attr . attr ,
981971 NULL ,
982972};
983973
@@ -2493,13 +2483,6 @@ static ssize_t pwm1_enable_store(struct device *dev,
24932483 return count ;
24942484}
24952485
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-
25032486static ssize_t asus_hwmon_temp1 (struct device * dev ,
25042487 struct device_attribute * attr ,
25052488 char * buf )
@@ -2534,13 +2517,6 @@ static ssize_t fan2_input_show(struct device *dev,
25342517 return sysfs_emit (buf , "%d\n" , value * 100 );
25352518}
25362519
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-
25442520/* Middle/Center fan on modern ROG laptops */
25452521static ssize_t fan3_input_show (struct device * dev ,
25462522 struct device_attribute * attr ,
@@ -2559,13 +2535,6 @@ static ssize_t fan3_input_show(struct device *dev,
25592535 return sysfs_emit (buf , "%d\n" , value * 100 );
25602536}
25612537
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-
25692538static ssize_t pwm2_enable_show (struct device * dev ,
25702539 struct device_attribute * attr ,
25712540 char * buf )
@@ -2662,15 +2631,16 @@ static ssize_t pwm3_enable_store(struct device *dev,
26622631static DEVICE_ATTR_RW (pwm1 );
26632632static DEVICE_ATTR_RW (pwm1_enable );
26642633static 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+
26662636/* Fan2 - GPU fan */
26672637static DEVICE_ATTR_RW (pwm2_enable );
26682638static 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 ) ;
26702640/* Fan3 - Middle/center fan */
26712641static DEVICE_ATTR_RW (pwm3_enable );
26722642static 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 ) ;
26742644
26752645/* Temperature */
26762646static DEVICE_ATTR (temp1_input , S_IRUGO , asus_hwmon_temp1 , NULL) ;
@@ -2681,11 +2651,11 @@ static struct attribute *hwmon_attributes[] = {
26812651 & dev_attr_pwm2_enable .attr ,
26822652 & dev_attr_pwm3_enable .attr ,
26832653 & dev_attr_fan1_input .attr ,
2684- & dev_attr_fan1_label .attr ,
2654+ & dev_attr_fan1_label .attr . attr ,
26852655 & dev_attr_fan2_input .attr ,
2686- & dev_attr_fan2_label .attr ,
2656+ & dev_attr_fan2_label .attr . attr ,
26872657 & dev_attr_fan3_input .attr ,
2688- & dev_attr_fan3_label .attr ,
2658+ & dev_attr_fan3_label .attr . attr ,
26892659
26902660 & dev_attr_temp1_input .attr ,
26912661 NULL
@@ -2702,17 +2672,17 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
27022672 if (asus -> fan_type != FAN_TYPE_AGFN )
27032673 return 0 ;
27042674 } else if (attr == & dev_attr_fan1_input .attr
2705- || attr == & dev_attr_fan1_label .attr
2675+ || attr == & dev_attr_fan1_label .attr . attr
27062676 || attr == & dev_attr_pwm1_enable .attr ) {
27072677 if (asus -> fan_type == FAN_TYPE_NONE )
27082678 return 0 ;
27092679 } else if (attr == & dev_attr_fan2_input .attr
2710- || attr == & dev_attr_fan2_label .attr
2680+ || attr == & dev_attr_fan2_label .attr . attr
27112681 || attr == & dev_attr_pwm2_enable .attr ) {
27122682 if (asus -> gpu_fan_type == FAN_TYPE_NONE )
27132683 return 0 ;
27142684 } else if (attr == & dev_attr_fan3_input .attr
2715- || attr == & dev_attr_fan3_label .attr
2685+ || attr == & dev_attr_fan3_label .attr . attr
27162686 || attr == & dev_attr_pwm3_enable .attr ) {
27172687 if (asus -> mid_fan_type == FAN_TYPE_NONE )
27182688 return 0 ;
0 commit comments