Re: [PATCH linux-next] platform/x86: use sysfs_emit() and add the '\n'
From: Hans de Goede
Date: Tue Sep 27 2022 - 09:05:03 EST
Hi,
On 9/23/22 08:32, cgel.zte@xxxxxxxxx wrote:
> From: ye xingchen <ye.xingchen@xxxxxxxxxx>
>
> Replace the open-code with sysfs_emit() to simplify the code.
> And also add '\n' because it need a new line.
>
> Signed-off-by: ye xingchen <ye.xingchen@xxxxxxxxxx>
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
> ---
> drivers/platform/x86/dell/dell-smbios-base.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c
> index fc086b66f70b..e5b61ecdae8c 100644
> --- a/drivers/platform/x86/dell/dell-smbios-base.c
> +++ b/drivers/platform/x86/dell/dell-smbios-base.c
> @@ -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;
> }
>