Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Andy Shevchenko and committed by
Rafael J. Wysocki
ae573387 e73f0f0e

+8 -8
+8 -8
drivers/acpi/acpi_configfs.c
··· 103 103 if (!h) 104 104 return -EINVAL; 105 105 106 - return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature); 106 + return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature); 107 107 } 108 108 109 109 static ssize_t acpi_table_length_show(struct config_item *cfg, char *str) ··· 113 113 if (!h) 114 114 return -EINVAL; 115 115 116 - return sprintf(str, "%d\n", h->length); 116 + return sysfs_emit(str, "%d\n", h->length); 117 117 } 118 118 119 119 static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str) ··· 123 123 if (!h) 124 124 return -EINVAL; 125 125 126 - return sprintf(str, "%d\n", h->revision); 126 + return sysfs_emit(str, "%d\n", h->revision); 127 127 } 128 128 129 129 static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str) ··· 133 133 if (!h) 134 134 return -EINVAL; 135 135 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); 137 137 } 138 138 139 139 static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str) ··· 143 143 if (!h) 144 144 return -EINVAL; 145 145 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); 147 147 } 148 148 149 149 static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str) ··· 153 153 if (!h) 154 154 return -EINVAL; 155 155 156 - return sprintf(str, "%d\n", h->oem_revision); 156 + return sysfs_emit(str, "%d\n", h->oem_revision); 157 157 } 158 158 159 159 static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, ··· 164 164 if (!h) 165 165 return -EINVAL; 166 166 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); 168 168 } 169 169 170 170 static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg, ··· 175 175 if (!h) 176 176 return -EINVAL; 177 177 178 - return sprintf(str, "%d\n", h->asl_compiler_revision); 178 + return sysfs_emit(str, "%d\n", h->asl_compiler_revision); 179 179 } 180 180 181 181 CONFIGFS_ATTR_RO(acpi_table_, signature);