Skip to contentSkip to conversation

platform/x86: use sysfs_emit() and add the '\n'

PATCH Hans de Goede 1 participant 1 message Sep 27, 2022 1 message not in the archive x86 platform drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

Quoted 6 lines · On 9/23/22 08:32, [email protected] wrote:

From: ye xingchen <[email protected]>

Replace the open-code with sysfs_emit() to simplify the code. And also add '\n' because it need a new line.

Thanks, I have merged this minus the addition of the '\n', this is exposed to userspace and some userspace apps may rely on the current behavior where the '\n' is omitted.

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 26 lines
---
 drivers/platform/x86/dell/dell-smbios-base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/dell/dell-smbios-base.c +2 -2
index fc086b66f70b..e5b61ecdae8c 100644
@@ -441,7 +441,7 @@ static ssize_t location_show(struct device *dev,
 
 	i = match_attribute(dev, attr);
 	if (i > 0)
-		return scnprintf(buf, PAGE_SIZE, "%08x", da_tokens[i].location);
+		return sysfs_emit(buf, "%08x\n", da_tokens[i].location);
 	return 0;
 }
 
@@ -455,7 +455,7 @@ static ssize_t value_show(struct device *dev,
 
 	i = match_attribute(dev, attr);
 	if (i > 0)
-		return scnprintf(buf, PAGE_SIZE, "%08x", da_tokens[i].value);
+		return sysfs_emit(buf, "%08x\n", da_tokens[i].value);
 	return 0;
 }