Skip to content

Commit ae57338

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: configfs: Use sysfs_emit() in "show" functions
The sysfs_emit() function was introduced to make it less ambiguous which function is preferred when writing to the output buffer in a "show" callback [1]. Convert the GPIO library sysfs interface from sprintf() to sysfs_emit() accordingly, as the latter is aware of the PAGE_SIZE buffer and correctly returns the number of bytes written into the buffer. No functional change intended. [1] Documentation/filesystems/sysfs.rst Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent e73f0f0 commit ae57338

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/acpi/acpi_configfs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
103103
if (!h)
104104
return -EINVAL;
105105

106-
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature);
106+
return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature);
107107
}
108108

109109
static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
@@ -113,7 +113,7 @@ static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
113113
if (!h)
114114
return -EINVAL;
115115

116-
return sprintf(str, "%d\n", h->length);
116+
return sysfs_emit(str, "%d\n", h->length);
117117
}
118118

119119
static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
@@ -123,7 +123,7 @@ static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
123123
if (!h)
124124
return -EINVAL;
125125

126-
return sprintf(str, "%d\n", h->revision);
126+
return sysfs_emit(str, "%d\n", h->revision);
127127
}
128128

129129
static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
@@ -133,7 +133,7 @@ static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
133133
if (!h)
134134
return -EINVAL;
135135

136-
return sprintf(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
136+
return sysfs_emit(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
137137
}
138138

139139
static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
@@ -143,7 +143,7 @@ static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
143143
if (!h)
144144
return -EINVAL;
145145

146-
return sprintf(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
146+
return sysfs_emit(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
147147
}
148148

149149
static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
@@ -153,7 +153,7 @@ static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
153153
if (!h)
154154
return -EINVAL;
155155

156-
return sprintf(str, "%d\n", h->oem_revision);
156+
return sysfs_emit(str, "%d\n", h->oem_revision);
157157
}
158158

159159
static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
@@ -164,7 +164,7 @@ static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
164164
if (!h)
165165
return -EINVAL;
166166

167-
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id);
167+
return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id);
168168
}
169169

170170
static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
@@ -175,7 +175,7 @@ static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
175175
if (!h)
176176
return -EINVAL;
177177

178-
return sprintf(str, "%d\n", h->asl_compiler_revision);
178+
return sysfs_emit(str, "%d\n", h->asl_compiler_revision);
179179
}
180180

181181
CONFIGFS_ATTR_RO(acpi_table_, signature);

0 commit comments

Comments
 (0)