nvme: make some sysfs diagnostic structures static
PATCH 1/1 nvme: make some sysfs diagnostic structures static
Building with C=1 generates the following warnings:drivers/nvme/host/sysfs.c:397:25: warning: symbol 'dev_attr_io_errors' was not declared. Should it be static? drivers/nvme/host/sysfs.c:444:30: warning: symbol 'nvme_ns_diag_attr_group' was not declared. Should it be static? drivers/nvme/host/sysfs.c:1150:25: warning: symbol 'dev_attr_adm_errors' was not declared. Should it be static?
Make those structures static.
drivers/nvme/host/sysfs.c +3 -3
@@ -394,7 +394,7 @@ static ssize_t nvme_io_errors_store(struct device *dev,return count; } -struct device_attribute dev_attr_io_errors = +static struct device_attribute dev_attr_io_errors =__ATTR (command_error_count,0644 , nvme_io_errors_show, nvme_io_errors_store);
@@ -441,7 +441,7 @@ static umode_t nvme_ns_diag_attrs_are_visible(struct kobject *kobj,return a->mode; } -const struct attribute_group nvme_ns_diag_attr_group = { +static const struct attribute_group nvme_ns_diag_attr_group = { .name ="diag" , .attrs = nvme_ns_diag_attrs, .is_visible = nvme_ns_diag_attrs_are_visible,
@@ -1147,7 +1147,7 @@ static ssize_t nvme_adm_errors_store(struct device *dev,return count; } -struct device_attribute dev_attr_adm_errors = +static struct device_attribute dev_attr_adm_errors =__ATTR (command_error_count,0644 , nvme_adm_errors_show, nvme_adm_errors_store);
Signature · 1 line
2.43.5
Quoted 32 lines · John Garry
Building with C=1 generates the following warnings:
drivers/nvme/host/sysfs.c:397:25: warning: symbol 'dev_attr_io_errors' was not declared. Should it be static?drivers/nvme/host/sysfs.c:444:30: warning: symbol 'nvme_ns_diag_attr_group' was not declared. Should it be static?drivers/nvme/host/sysfs.c:1150:25: warning: symbol 'dev_attr_adm_errors' was not declared. Should it be static?Make those structures static.
Signed-off-by John Garry <[email protected]>drivers/nvme/host/sysfs.c +2
-2@@ -394,7 +394,7 @@ static ssize_t nvme_io_errors_store(struct device *dev,return count; } -struct device_attribute dev_attr_io_errors = +static struct device_attribute dev_attr_io_errors =__ATTR (command_error_count,0644 , nvme_io_errors_show, nvme_io_errors_store);@@ -441,7 +441,7 @@ static umode_t nvme_ns_diag_attrs_are_visible(struct kobject *kobj,return a->mode; } -const struct attribute_group nvme_ns_diag_attr_group = { +static const struct attribute_group nvme_ns_diag_attr_group = { .name ="diag" , .attrs = nvme_ns_diag_attrs, .is_visible = nvme_ns_diag_attrs_are_visible,
drivers/nvme/host/sysfs.c static ssize_t nvme_adm_errors_store(struct device *dev, · line 1153
Quoted 8 lines
drivers/nvme/host/sysfs.c +1
-1@@ -1147,7 +1147,7 @@ static ssize_t nvme_adm_errors_store(struct device *dev,return count; } -struct device_attribute dev_attr_adm_errors = +static struct device_attribute dev_attr_adm_errors =__ATTR (command_error_count,0644 , nvme_adm_errors_show, nvme_adm_errors_store);
BTW, kernel test robot also reported this same issue here:
https://lore.kernel.org/oe-kbuild-all/[email protected]/
So you may want to add closes tag pointing to the above link. Otherwise, this change looks good to me.
Quoted 11 lines
Quoted 6 lines
}
drivers/nvme/host/sysfs.c +1
-1-struct device_attribute dev_attr_adm_errors = +static struct device_attribute dev_attr_adm_errors =
__ATTR(command_error_count, 0644, nvme_adm_errors_show, nvme_adm_errors_store);BTW, kernel test robot also reported this same issue here:
https://urldefense.com/v3/__https://lore.kernel.org/oe-kbuild- all/[email protected]/__;!!ACWV5N9M2RV99hQ! P5UdkxQBbB6XuNloxfIJKNALsPKk8vSXQENG4khm- SufSw1QG_Ndga5ZvcKhtCypHWJDcNkaE1KDvZZ8pO8$ So you may want to add closes tag pointing to the above link. Otherwise,
this change looks good to me.
I would not have noticed that, but here is the necessary tag anyway:
Quoted 1 line
Reviewed-by Nilay Shroff <[email protected]>
Cheers
Looks good:
Quoted 6 lines · John Garry
Building with C=1 generates the following warnings:
drivers/nvme/host/sysfs.c:397:25: warning: symbol 'dev_attr_io_errors' was not declared. Should it be static?drivers/nvme/host/sysfs.c:444:30: warning: symbol 'nvme_ns_diag_attr_group' was not declared. Should it be static?drivers/nvme/host/sysfs.c:1150:25: warning: symbol 'dev_attr_adm_errors' was not declared. Should it be static?Make those structures static.
Thanks, applied to nvme-7.2.