Skip to contentSkip to conversation

ACPI: bgrt: use static for BGRT_SHOW kobj_attribute defines

PATCH Applied Tom Rix 2 participants 2 messages Apr 21, 2022 – Apr 22, 2022 ACPI

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 ACPI: bgrt: use static for BGRT_SHOW kobj_attribute defines

Smatch reports this repesentative issue
bgrt.c:26:1: warning: symbol 'bgrt_attr_version' was not declared. Should it be static? Similar for *status,type,xoffset,yoffset

These variables are defined with the BGRT_SHOW macro. For the definition of bgrt_attr_##_name,
the storage-class specifier should be static

---
 drivers/acpi/bgrt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/bgrt.c +1 -1
index 02d208732f9a..e4fb9e225ddf 100644
@@ -21,7 +21,7 @@ static struct kobject *bgrt_kobj;
 	{									\
 		return sysfs_emit(buf, "%d\n", bgrt_tab._member);		\
 	}									\
-	struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name)
+	static struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name)
 
 BGRT_SHOW(version, version);
 BGRT_SHOW(status, status);
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 19 lines · Tom Rix

Smatch reports this repesentative issue
bgrt.c:26:1: warning: symbol 'bgrt_attr_version' was not declared. Should it be static? Similar for *status,type,xoffset,yoffset

These variables are defined with the BGRT_SHOW macro. For the definition of bgrt_attr_##_name,
the storage-class specifier should be static

---
 drivers/acpi/bgrt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/bgrt.c +0 -0
index 02d208732f9a..e4fb9e225ddf 100644

drivers/acpi/bgrt.c static struct kobject *bgrt_kobj;

Quoted 9 lines
drivers/acpi/bgrt.c +1 -2
@@ -21,7 +21,7 @@ static struct kobject *bgrt_kobj;
        {                                                                       \
                return sysfs_emit(buf, "%d\n", bgrt_tab._member);               \
        }                                                                       \
-       struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name)
+       static struct kobj_attribute bgrt_attr_##_name = __ATTR_RO(_name)
 
 BGRT_SHOW(version, version);
 BGRT_SHOW(status, status);
--

Applied as 5.19 material, thanks!