Skip to contentSkip to conversation

platform/x86/dell-wmi-sysman: Make some symbols static

PATCH In review Zou Wei 2 participants 2 messages Oct 31, 2020 – Nov 3, 2020 x86 platform drivers

lore
Share & tools
lore

Zou Wei

author
#0 lore raw

PATCH v3 1/1 platform/x86/dell-wmi-sysman: Make some symbols static

Fix the following sparse warnings:

./passobj-attributes.c:38:23: warning: symbol 'po_is_pass_set' was not declared. Should it be static? ./passobj-attributes.c:70:23: warning: symbol 'po_current_password' was not declared. Should it be static? ./passobj-attributes.c:99:23: warning: symbol 'po_new_password' was not declared. Should it be static? ./passobj-attributes.c:103:23: warning: symbol 'po_min_pass_length' was not declared. Should it be static? ./passobj-attributes.c:107:23: warning: symbol 'po_max_pass_length' was not declared. Should it be static? ./passobj-attributes.c:116:23: warning: symbol 'po_mechanism' was not declared. Should it be static? ./passobj-attributes.c:129:23: warning: symbol 'po_role' was not declared. Should it be static?

---
v2:
- put all of them in a way that each occupies only a single line v3:
- shorten the warning paths
- put the static codes a single line

 .../x86/dell-wmi-sysman/passobj-attributes.c        | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c +7 -14
index e6199fb..3abcd95 100644
@@ -35,8 +35,7 @@ static ssize_t is_enabled_show(struct kobject *kobj, struct kobj_attribute *attr
 	return ret;
 }
 
-struct kobj_attribute po_is_pass_set =
-		__ATTR_RO(is_enabled);
+static struct kobj_attribute po_is_pass_set = __ATTR_RO(is_enabled);
 
 static ssize_t current_password_store(struct kobject *kobj,
 				      struct kobj_attribute *attr,
@@ -67,8 +66,7 @@ static ssize_t current_password_store(struct kobject *kobj,
 	return count;
 }
 
-struct kobj_attribute po_current_password =
-		__ATTR_WO(current_password);
+static struct kobj_attribute po_current_password = __ATTR_WO(current_password);
 
 static ssize_t new_password_store(struct kobject *kobj,
 				  struct kobj_attribute *attr,
@@ -96,16 +94,13 @@ static ssize_t new_password_store(struct kobject *kobj,
 	return ret ? ret : count;
 }
 
-struct kobj_attribute po_new_password =
-		__ATTR_WO(new_password);
+static struct kobj_attribute po_new_password = __ATTR_WO(new_password);
 
 attribute_n_property_show(min_password_length, po);
-struct kobj_attribute po_min_pass_length =
-		__ATTR_RO(min_password_length);
+static struct kobj_attribute po_min_pass_length = __ATTR_RO(min_password_length);
 
 attribute_n_property_show(max_password_length, po);
-struct kobj_attribute po_max_pass_length =
-		__ATTR_RO(max_password_length);
+static struct kobj_attribute po_max_pass_length = __ATTR_RO(max_password_length);
 
 static ssize_t mechanism_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
@@ -113,8 +108,7 @@ static ssize_t mechanism_show(struct kobject *kobj, struct kobj_attribute *attr,
 	return sprintf(buf, "password\n");
 }
 
-struct kobj_attribute po_mechanism =
-	__ATTR_RO(mechanism);
+static struct kobj_attribute po_mechanism = __ATTR_RO(mechanism);
 
 static ssize_t role_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
@@ -126,8 +120,7 @@ static ssize_t role_show(struct kobject *kobj, struct kobj_attribute *attr,
 	return -EIO;
 }
 
-struct kobj_attribute po_role =
-	__ATTR_RO(role);
+static struct kobj_attribute po_role = __ATTR_RO(role);
 
 static struct attribute *po_attrs[] = {
 	&po_is_pass_set.attr,
Signature · 1 line
2.6.2
#1 lore raw

Hi,

Quoted 10 lines · Zou Wei

Fix the following sparse warnings:

./passobj-attributes.c:38:23: warning: symbol 'po_is_pass_set' was not declared. Should it be static? ./passobj-attributes.c:70:23: warning: symbol 'po_current_password' was not declared. Should it be static? ./passobj-attributes.c:99:23: warning: symbol 'po_new_password' was not declared. Should it be static? ./passobj-attributes.c:103:23: warning: symbol 'po_min_pass_length' was not declared. Should it be static? ./passobj-attributes.c:107:23: warning: symbol 'po_max_pass_length' was not declared. Should it be static? ./passobj-attributes.c:116:23: warning: symbol 'po_mechanism' was not declared. Should it be static? ./passobj-attributes.c:129:23: warning: symbol 'po_role' was not declared. Should it be static?

Quoted 2 lines

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 74 lines

---
v2:
- put all of them in a way that each occupies only a single line v3:
- shorten the warning paths
- put the static codes a single line

 .../x86/dell-wmi-sysman/passobj-attributes.c        | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c +7 -14
index e6199fb..3abcd95 100644
@@ -35,8 +35,7 @@ static ssize_t is_enabled_show(struct kobject *kobj, struct kobj_attribute *attr
 	return ret;
 }
 
-struct kobj_attribute po_is_pass_set =
-		__ATTR_RO(is_enabled);
+static struct kobj_attribute po_is_pass_set = __ATTR_RO(is_enabled);
 
 static ssize_t current_password_store(struct kobject *kobj,
 				      struct kobj_attribute *attr,
@@ -67,8 +66,7 @@ static ssize_t current_password_store(struct kobject *kobj,
 	return count;
 }
 
-struct kobj_attribute po_current_password =
-		__ATTR_WO(current_password);
+static struct kobj_attribute po_current_password = __ATTR_WO(current_password);
 
 static ssize_t new_password_store(struct kobject *kobj,
 				  struct kobj_attribute *attr,
@@ -96,16 +94,13 @@ static ssize_t new_password_store(struct kobject *kobj,
 	return ret ? ret : count;
 }
 
-struct kobj_attribute po_new_password =
-		__ATTR_WO(new_password);
+static struct kobj_attribute po_new_password = __ATTR_WO(new_password);
 
 attribute_n_property_show(min_password_length, po);
-struct kobj_attribute po_min_pass_length =
-		__ATTR_RO(min_password_length);
+static struct kobj_attribute po_min_pass_length = __ATTR_RO(min_password_length);
 
 attribute_n_property_show(max_password_length, po);
-struct kobj_attribute po_max_pass_length =
-		__ATTR_RO(max_password_length);
+static struct kobj_attribute po_max_pass_length = __ATTR_RO(max_password_length);
 
 static ssize_t mechanism_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
@@ -113,8 +108,7 @@ static ssize_t mechanism_show(struct kobject *kobj, struct kobj_attribute *attr,
 	return sprintf(buf, "password\n");
 }
 
-struct kobj_attribute po_mechanism =
-	__ATTR_RO(mechanism);
+static struct kobj_attribute po_mechanism = __ATTR_RO(mechanism);
 
 static ssize_t role_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
@@ -126,8 +120,7 @@ static ssize_t role_show(struct kobject *kobj, struct kobj_attribute *attr,
 	return -EIO;
 }
 
-struct kobj_attribute po_role =
-	__ATTR_RO(role);
+static struct kobj_attribute po_role = __ATTR_RO(role);
 
 static struct attribute *po_attrs[] = {
 	&po_is_pass_set.attr,