mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ernst, Justin" <justin.ernst@hpe.com>
To: "ye.xingchen@zte.com.cn" <ye.xingchen@zte.com.cn>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>
Cc: "markgross@kernel.org" <markgross@kernel.org>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] platform/x86: use sysfs_emit() to instead of scnprintf()
Date: Fri, 2 Dec 2022 17:48:38 +0000	[thread overview]
Message-ID: <PH7PR84MB1813085F3E95CC084D5E605B87179@PH7PR84MB1813.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <202212021705128095546@zte.com.cn>

> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.
> 
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>

Thank you for the patch and for keeping me informed.

Reviewed-by: Justin Ernst <justin.ernst@hpe.com>

> ---
>  drivers/platform/x86/uv_sysfs.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
> index 625b0b79d185..73fc38ee7430 100644
> --- a/drivers/platform/x86/uv_sysfs.c
> +++ b/drivers/platform/x86/uv_sysfs.c
> @@ -119,12 +119,12 @@ struct uv_hub {
> 
>  static ssize_t hub_name_show(struct uv_bios_hub_info *hub_info, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", hub_info->name);
> +	return sysfs_emit(buf, "%s\n", hub_info->name);
>  }
> 
>  static ssize_t hub_location_show(struct uv_bios_hub_info *hub_info, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", hub_info->location);
> +	return sysfs_emit(buf, "%s\n", hub_info->location);
>  }
> 
>  static ssize_t hub_partition_show(struct uv_bios_hub_info *hub_info, char *buf)
> @@ -460,12 +460,12 @@ struct uv_pci_top_obj {
> 
>  static ssize_t uv_pci_type_show(struct uv_pci_top_obj *top_obj, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->type);
> +	return sysfs_emit(buf, "%s\n", top_obj->type);
>  }
> 
>  static ssize_t uv_pci_location_show(struct uv_pci_top_obj *top_obj, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->location);
> +	return sysfs_emit(buf, "%s\n", top_obj->location);
>  }
> 
>  static ssize_t uv_pci_iio_stack_show(struct uv_pci_top_obj *top_obj, char *buf)
> @@ -475,7 +475,7 @@ static ssize_t uv_pci_iio_stack_show(struct uv_pci_top_obj *top_obj, char *buf)
> 
>  static ssize_t uv_pci_ppb_addr_show(struct uv_pci_top_obj *top_obj, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", top_obj->ppb_addr);
> +	return sysfs_emit(buf, "%s\n", top_obj->ppb_addr);
>  }
> 
>  static ssize_t uv_pci_slot_show(struct uv_pci_top_obj *top_obj, char *buf)
> @@ -737,7 +737,7 @@ static ssize_t coherence_id_show(struct kobject *kobj,
>  static ssize_t uv_type_show(struct kobject *kobj,
>  			struct kobj_attribute *attr, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "%s\n", uv_type_string());
> +	return sysfs_emit(buf, "%s\n", uv_type_string());
>  }
> 
>  static ssize_t uv_archtype_show(struct kobject *kobj,
> @@ -749,13 +749,13 @@ static ssize_t uv_archtype_show(struct kobject *kobj,
>  static ssize_t uv_hub_type_show(struct kobject *kobj,
>  			struct kobj_attribute *attr, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
> +	return sysfs_emit(buf, "0x%x\n", uv_hub_type());
>  }
> 
>  static ssize_t uv_hubless_show(struct kobject *kobj,
>  			struct kobj_attribute *attr, char *buf)
>  {
> -	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_get_hubless_system());
> +	return sysfs_emit(buf, "0x%x\n", uv_get_hubless_system());
>  }
> 
>  static struct kobj_attribute partition_id_attr =
> --
> 2.25.1

  reply	other threads:[~2022-12-02 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  9:05 ye.xingchen
2022-12-02 17:48 ` Ernst, Justin [this message]
2022-12-08 15:54 ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH7PR84MB1813085F3E95CC084D5E605B87179@PH7PR84MB1813.NAMPRD84.PROD.OUTLOOK.COM \
    --to=justin.ernst@hpe.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ye.xingchen@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®