@@ -198,14 +198,6 @@ static struct think_lmi tlmi_priv;
198
198
static struct class * fw_attr_class ;
199
199
static DEFINE_MUTEX (tlmi_mutex );
200
200
201
- /* ------ Utility functions ------------*/
202
- /* Strip out CR if one is present */
203
- static void strip_cr (char * str )
204
- {
205
- char * p = strchrnul (str , '\n' );
206
- * p = '\0' ;
207
- }
208
-
209
201
/* Convert BIOS WMI error string to suitable error code */
210
202
static int tlmi_errstr_to_err (const char * errstr )
211
203
{
@@ -411,7 +403,7 @@ static ssize_t current_password_store(struct kobject *kobj,
411
403
412
404
strscpy (setting -> password , buf , setting -> maxlen );
413
405
/* Strip out CR if one is present, setting password won't work if it is present */
414
- strip_cr (setting -> password );
406
+ strreplace (setting -> password , '\n' , '\0' );
415
407
return count ;
416
408
}
417
409
@@ -921,7 +913,7 @@ static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *at
921
913
static ssize_t current_value_show (struct kobject * kobj , struct kobj_attribute * attr , char * buf )
922
914
{
923
915
struct tlmi_attr_setting * setting = to_tlmi_attr_setting (kobj );
924
- char * item , * value , * p ;
916
+ char * item , * value ;
925
917
int ret ;
926
918
927
919
ret = tlmi_setting (setting -> index , & item , LENOVO_BIOS_SETTING_GUID );
@@ -934,8 +926,7 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
934
926
ret = - EINVAL ;
935
927
else {
936
928
/* On Workstations remove the Options part after the value */
937
- p = strchrnul (value , ';' );
938
- * p = '\0' ;
929
+ strreplace (value , ';' , '\0' );
939
930
ret = sysfs_emit (buf , "%s\n" , value + 1 );
940
931
}
941
932
kfree (item );
@@ -1540,7 +1531,6 @@ static int tlmi_analyze(void)
1540
1531
for (i = 0 ; i < TLMI_SETTINGS_COUNT ; ++ i ) {
1541
1532
struct tlmi_attr_setting * setting ;
1542
1533
char * item = NULL ;
1543
- char * p ;
1544
1534
1545
1535
tlmi_priv .setting [i ] = NULL ;
1546
1536
ret = tlmi_setting (i , & item , LENOVO_BIOS_SETTING_GUID );
@@ -1557,8 +1547,7 @@ static int tlmi_analyze(void)
1557
1547
strreplace (item , '/' , '\\' );
1558
1548
1559
1549
/* Remove the value part */
1560
- p = strchrnul (item , ',' );
1561
- * p = '\0' ;
1550
+ strreplace (item , ',' , '\0' );
1562
1551
1563
1552
/* Create a setting entry */
1564
1553
setting = kzalloc (sizeof (* setting ), GFP_KERNEL );
0 commit comments